def initPlayer(self): PlayerData.loadPlayerGraphics("rena", "nightgown") self.player.currentSkin = "rena_nightgown" self.team.add(CharacterData.CharacterData("Rena")) self.team.roster[0].currentSkin = "rena_nightgown" self.player.setPosition(288, 192) self.player.display()
def start(): global running while running: if player.data['name'] is None: print( 'Type one of the following commands: save, load, create, exit') cmd = str(input()) if cmd == 'load': player.data = PlayerData.load() print(player.data) if cmd == 'create': create_account() if cmd == 'exit': running = False else: if player.data['current_room'] == 'shop': print( 'Type one of the following commands: inspect item_name, heal, battle, shop, save, exit' ) else: print( 'Type one of the following commands: heal, battle, shop, save, exit' ) cmd = str(input()) if cmd == 'save': PlayerData.save(player) if cmd == 'exit': running = False if cmd == 'heal': player.restore_hp(1000) if cmd == 'battle': enemy = Enemy() enemy.data['current_hp'] = enemy.data['max_hp'] enemy.data['name'] = 'Skeleton' print(enemy.data) Battle.render_battle(player, enemy) # del enemy # print('test') if cmd == 'shop': player.data['current_room'] = 'shop' shop.get_items() if 'inspect' in cmd: cmds = cmd.split() item = cmds[1] shop_items = [item.name for item in shop.items] if item in shop_items: print(item) player.clamp_hp() render(player) if player.data['current_xp'] >= player.data['req_xp']: player.level_up() print('You leveled up!')
def initPlayer(self): PlayerData.loadPlayerGraphics("rena", "nightgown") PlayerData.loadPlayerGraphics("miles", "coat") self.team.add(PlayerData.PlayerData("Rena")) self.team.team[0].currentSkin = "rena_nightgown" self.team.add(PlayerData.PlayerData("Miles")) self.team.team[1].currentSkin = "miles_coat" self.player = self.team.team[0] self.player.setPosition(288, 192) self.player.displayOnMap()
def create_account(): player = Player() while player.data['name'] is None: print('Please Enter Your Name: ') name = str(input()) if os.path.exists(f'{name}.txt'): print('This name is already in use. Please choose another name.') else: player.data["name"] = name PlayerData.save(player)
def InitPlayer(self): self.Player = PlayerData.PlayerData() self.SetPlayerScreenPos(self.display.GetScreenWidth()/2, self.display.GetScreenHeight()/2) self.Player.SetInitialGamePosition() self.Player.PC.SetMoney(100) self.Player.PC.potionCount["Healing"] = 3 self.Player.PC.potionCount["Essence"] = 3
def gameStart(self, gameInfo, playerNum, agentNames): self.gameInfo = gameInfo self.__playerNum_ = playerNum self.__agentList_ = agentNames self.__aliveAgentList_ = agentNames self.__agentIndexList_ = self.AgentToIndexList(agentNames) self.__aliveAgentIndexList_ = self.AgentToIndexList(agentNames) self.agentIdx = gameInfo['agent'] self.role = gameInfo['roleMap'][str(self.agentIdx)] #自分の役割 if self.role == 'WEREWOLF': for k, v in gameInfo['roleMap'].items(): if self.agentIdx != int(k): self.werewolves.append(int(k)) self.Whisper = whisp.WhisperData(self.werewolves) for i in range(self.__playerNum_): pd = PlayerData.PlayerData(self.__agentIndexList_[i], self.__agentList_[i]) self.__playerDataMap_.update({self.__agentIndexList_[i]: pd}) self.__talkNumMap_.update({self.__agentIndexList_[i]: 0}) self.__talkAllNumMap_.update({self.__agentIndexList_[i]: 0}) self.__voteMap_.update({self.__agentIndexList_[i]: -1}) self.__voteNum_.update({self.__agentIndexList_[i]: 0})
def CreatePlayer(self, id): # Prevents sql injection if not self.IsSafeStr(id): return False # Serialize playerData = PlayerData.PlayerData() try: byte_data = pickle.dumps(playerData) except MySQLdb.Error, e: print "[DataMgr] CreatePlayer failed." + e.args[1] return False
def InitDisplay(self): self.display.CreateScreen() self.DisplayInitilized = 1 self.TextureManager = ImageData.ImageData() LoadTitleGraphics(self.TextureManager) LoadWallGraphics(self.TextureManager) PlayerData.LoadPlayerGraphics(self.TextureManager) LoadFeaturesGraphics(self.TextureManager) LoadItemsGraphics(self.TextureManager) LoadFloorGraphics(self.TextureManager) LoadMonsterGraphics(self.TextureManager) self.map = MiniDungeon.CreateDungeon()
def __init__(self): self.DisplayInitialized = 0 self.exitGame = 0 self.stage = 0 self.quitFlag = 0 self.timePerFrame = 1.0 / 60.0 self.updatecount = 0 self.display = DisplayInfo.DisplayInfo() self.timer = pygame.time.Clock() self.timer.tick(120) self.Player = PlayerData.PlayerData() self.playerMoveTo = (0,0) self.escapeDebounceFlag = 0 self.SelectedAction = None self.ActiveAI = [] self.TurnType = 0 # 0 = Player turn, 1 = AI turn
def gameStart(self,gameInfo, playerNum, agentNames): self.gameInfo = gameInfo self.__playerNum_ = playerNum self.__agentList_ = agentNames self.__aliveAgentList_ = agentNames self.__agentIdxlist_ = self.AgentToIndexList(agentNames) self.__aliveAgentIndexList_ = self.AgentToIndexList(agentNames) self.agentIdx = gameInfo['agent'] self.role = gameInfo['roleMap'][str(self.agentIdx)] #自分の役割 for i in range(self.__playerNum_): pd = PlayerData.PlayerData(self.__agentIdxlist_[i],self.__agentList_[i]) self.__playerDataMap_.update({self.__agentIdxlist_[i]:pd}) self.__talkNumMap_.update({self.__agentIdxlist_[i]:0}) self.__talkAllNumMap_.update({self.__agentIdxlist_[i]:0}) self.__voteMap_.update({self.__agentIdxlist_[i]:-1}) self.__voteNum_.update({self.__agentIdxlist_[i]:0}) self.pred.initialize(self.__playerNum_)
def __init__(self): self.pieces = [] playerData = PlayerData.getPlayerData() self.id = playerData.id self.color = playerData.color self.startPosition = playerData.startPosition self.endPosition = playerData.endPosition self.piecesFinished = 0 # gamemodes # None : Not configured. Will give an error # RA : Random player. Move will be randomly selected from the available moves. # MA : Manual Player. Moved will come from the user through the MLudoPlayer class # SA : Simple Automated Player. Moves will be determined by the SALudoPlayer Class # NN : Neural Network Player. Moved will be determined by the NNLudoPlayer class self.gamemode = None self.__initializePlayer()
def main(conn, addr): while True: try: data = conn.recv(4096) except: conn.close() data=False if not data: print("Main. Disconnected from " + addr[0] + ":" + str(addr[1])) try: Short.remove([conn,addr]) except: pass try: Med.remove([conn,addr]) except: pass try: Long.remove([conn,addr]) except: pass break data = data.decode()[2:] print ("Main. "+data) if "Queue" in data: if "Queue1" in data: Short.append([conn,addr]) if "Queue2" in data: Med.append([conn,addr]) if "Queue3" in data: Long.append([conn,addr]) elif "Echo" in data: conn.send("Affirm\n".encode()) conn.close() print("Main. Disconnected from " + addr[0] + ":" + str(addr[1])) LoadPlayerID(data) break elif "Stats" in data: conn.send((PlayerData.GetStats(data) + "\n").encode()) conn.close() print("Main. Disconnected from " + addr[0] + ":" + str(addr[1]))
def initializeNewPlayers(self): PlayerData.reset() self.players = [] for i in range(0, self.noPlayers): self.players.append(Player.Player()) self.players[i].gamemode = self.gameModes[i]
async def data(ctx, arg): embedVar = PlayerData.getPlayerData(arg) await ctx.send(embed=embedVar)