示例#1
0
    def initData(self):
        tableName = "player_ranking"
        fields = 'rank_num,playerid'

        data = db_Manager.selectDataFromTable(tableName,fields)
        for aData in data:
            self.rank[aData[0]] = aData[1]

        tableName = "id_info"
        fields = "rank_max_id"
        data = db_Manager.selectDataFromTable(tableName,fields)
        self.rank_max_num = data[0][0]
示例#2
0
    def loadDefenseBuffs(self):
        playerInfo = playerDataManager.getPlayerByPlayerid(self.player_id)
        if playerInfo == None:
            tableName = "player_pvp_buffs"
            fields = "buffstr"
            conditon = "playerid = %s" % self.player_id
            data = db_Manager.selectDataFromTable(tableName,fields,conditon)
            if len(data) == 0:
                self.defenseBuffs = []
            else:
                self.defenseBuffs.clear()
                buffStr = data[0][0]
                buffStrArr = buffStr.split(',')

                self.defenseBuffs = []
                for index in range(24):
                    if index < len(buffStrArr):
                        value = int(buffStrArr[index])
                        buff = EquipmentBuf(index + 1, value)
                        self.defenseBuffs.append(buff)
            self.loadPlayerLevel()
            self.loadEquipments()
        else:
            cacheBuff = playerInfo.pvpBuffs
            self.playerLevel = playerInfo.getSkillInfo(0).skillLevel
            for index in range(40):
                if index < len(cacheBuff):
                    value = cacheBuff[index]
                    buff = EquipmentBuf(index + 1, value)
                    if value > 0:
                        self.defenseBuffs.append(buff)
            self.equipments = playerInfo.equipments
示例#3
0
    def loadEqument(self):
        tableName = "player_equip"
        fields = "pos,equipmentid,equipment_quality,equipment_level,id,game_level,upgrade_cost," \
                 "buftype1,bufvalue1,buftype2,bufvalue2,buftype3,bufvalue3,buftype4,bufvalue4,buftype5,bufvalue5," \
                 "bufbasetype1,bufbasevalue1,bufbasetype2,bufbasevalue2,bufbasetype3,bufbasevalue3,bufbasetype4,bufbasevalue4,bufbasetype5,bufbasevalue5"
        conditon = "player_id = %s" % self.player_id
        data = db_Manager.selectDataFromTable(tableName,fields,conditon)
        posList = []

        for pos in range(12):
        # for pos in range(6):
            posList.append(pos)
        posList
        # posList.append(10)

        for equipmentData in data:
            posList.remove(equipmentData[0])
            if equipmentData[1] == -1:
                continue
            equipment = EquipMent(data = equipmentData)
            equipPos = int(equipmentData[0])
            self.equipments[equipPos] = equipment

        for pos in posList:
            fields = []
            fields.append('player_id')
            fields.append('pos')

            values = []
            values.append(self.player_id)
            values.append(pos)

            db_Manager.insertIntoTable(tableName,fields,values)
示例#4
0
    def loadSceneInfo(self):
        tableName = "player_scene"
        fields = "scene_id,big_luck_num,small_luck_num"
        conditon = "player_id = %s" % self.player_id
        data = db_Manager.selectDataFromTable(tableName,fields,conditon)
        sceneids = []
        for aData in data:
            sceneInfo = PlayerSceneInfo(aData)
            sceneID = sceneInfo.sceneid
            sceneids.append(sceneID)
            self.scenesInfo[sceneID] = sceneInfo

        for index in range(ConstValue.scenesCount):
            if index not in sceneids:
                sceneInfo = sceneLootEquipTable.getSceneConstInfo(index)
                aData = []
                aData.append(index)
                aData.append(sceneInfo.big_luck_num)
                aData.append(sceneInfo.small_luck_num)
                sceneInfoc = PlayerSceneInfo(aData)
                sceneID = sceneInfoc.sceneid
                self.scenesInfo[sceneID] = sceneInfoc

                fields = []
                fields.append("player_id")
                fields.append("scene_id")
                fields.append("big_luck_num")
                fields.append("small_luck_num")

                values = []
                values.append(self.player_id)
                values.append(index)
                values.append(sceneInfo.big_luck_num)
                values.append(sceneInfo.small_luck_num)
                db_Manager.insertIntoTable(tableName,fields,values)
    def addNocachePlayerResource(self,playerid,type,value,rankNum):
        tableName = "player_base_info"
        filedName = "cash"
        if type == 1:
            filedName = "pvp_medal"
        elif type == 2:
            filedName = "gem"
        elif type == 3:
            filedName = "revive"
        elif type == 4:
            filedName = "cash"

        else:
            print("not conifg this resource %s"%type)
            return
        selectField = filedName
        condition = "playerid = %s" %playerid
        data = db_Manager.selectDataFromTable(tableName,selectField,condition)
        oldValue = int(data[0][0])
        newValue = oldValue + value

        insertField = []
        insertField.append(filedName)
        insertField.append('lastTimedRewardDatetime')
        insertField.append('last_timed_reward_ranknum')
        insertValue = []
        insertValue.append(newValue)
        insertValue.append(GameTools.getDateTimeNowString())
        insertValue.append(rankNum)
        db_Manager.updateDataAtTable(tableName,insertField,insertValue,condition)
 def initData(self):
     tableName = 'id_info'
     fileds = 'server_id,player_max_id'
     data = db_Manager.selectDataFromTable(tableName, fileds)
     self.server_id = data[0][0]
     self.player_max_id = data[0][1]
     self.checkOutDateTime = datetime.datetime.now()
 def initData(self):
     self.tableData.clear()
     tableName = "table_random_reward"
     fields = "type,power,`desc`,`value`"
     data = db_Manager.selectDataFromTable(tableName,fields)
     for oneData in data:
         self.tableData[oneData[0]] = int(oneData[3])
 def initData(self):
     self.tableData.clear()
     tableName = "table_level2scene"
     fields = "num,scene0,scene1,scene2,scene3,scene4,scene5,scene6,scene7,scene8,scene9"
     data = db_Manager.selectDataFromTable(tableName,fields)
     for infoData in data:
         info = SceneInfo_Const(infoData)
         self.tableData[info.num] = info
 def initData(self):
     self.tables.clear()
     tableName = "table_hero_skill"
     fields = "skillid,skill_level,unlock_level,upcost,type,cd,duration,trigglerate,applytimes,applytarget,ApplyTargetNum,effecttype0,effectvalue0,buffvalue0,spawnnewid"
     data = db_Manager.selectDataFromTable(tableName,fields)
     for skillData in data:
         heroSkill = HeroSkill(skillData)
         self.tables[(heroSkill.table_hero_skill_id,heroSkill.skill_level)] = heroSkill
    def initTable(self):
        self.tableData.clear()
        tableName = "table_illegal_word"
        fields = "illegal_world"

        data = db_Manager.selectDataFromTable(tableName, fields)
        for oneData in data:
            self.tableData.append(oneData[0])
示例#11
0
 def loadRankTimedRewardInfo(self):
     tableName = "player_base_info"
     fields = "lastTimedRewardDatetime,last_timed_reward_ranknum"
     conditon = "playerid = %s" % self.player_id
     data = db_Manager.selectDataFromTable(tableName,fields,conditon)
     if len(data) > 0:
         self.last_timed_reward_datetime = data[0][0]
         self.last_timed_reward_ranknum = data[0][1]
示例#12
0
 def initData(self):
     self.tableData.clear()
     tableName = "table_level"
     fields = "id,monsterhp,monstercoins,bosshp,bosscoins,ZsBuyGodRate,offlinegold,relivegold,eqm_upgrade_add_cost,draw_equip_cost,recycle"
     data = db_Manager.selectDataFromTable(tableName, fields)
     for oneData in data:
         item = LevelInfo(oneData)
         self.tableData[item.id] = item
示例#13
0
    def initTable(self):
        self.tableData.clear()
        tableName = "table_global_base"
        fields = "id,value"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            self.tableData[oneData[0]] = oneData[1]
 def initData(self):
     self.tables.clear()
     tableName = "table_pvprank_timer_reward"
     fields = "fromRankNum,toRankNum,type,value,type1,value1"
     data = db_Manager.selectDataFromTable(tableName,fields)
     for itemData in data:
         item = PVPRankTimerReward(itemData)
         self.tables.append(item)
示例#15
0
    def initData(self):
        self.tableData.clear()
        tableName = "table_pvp_shop"
        fields = "id,buy_item_id,cost_type,cost_value,jump_ad,jump_time"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = PVPShopItem(oneData)
            self.tableData[item.id] = item
    def initTable(self):
        self.tableData.clear()
        tableName = "table_equipment_levelup"
        fields = "level,costbase,buffadd"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = EquipmentUpgradeConstInfo(oneData)
            self.tableData[item.level] = item
    def initTable(self):
        self.tableData.clear()
        tableName = "table_scene_loot_equiplist"
        fields = "id,lootid,big_luck_num,small_luck_num,big_luck_id,small_luck_id"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            info = SceneCostInfo(oneData)
            self.tableData[info.sceneid] = info
示例#18
0
 def getPlayeridByudid(self,udid):
     tableName = 'player_base_info'
     fields = 'playerid'
     condition = "udid = '%s'"% udid
     data = db_Manager.selectDataFromTable(tableName,fields,condition)
     if len(data) == 0:
         return  -1
     else:
         return  data[0][0]
示例#19
0
    def initTable(self):
        self.tableData.clear()
        tableName = "table_buffs"
        fields = "bufftype,caltype,discount,levelmodifiy,buffbasevalue"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = Buff(oneData)
            self.tableData[item.bufftype] = item
    def initTable(self):
        self.tableData.clear()
        tableName = "table_eqp_quality_upgrade"
        fields = "quality,costtype,costvalue"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            info = EquipQtyUpgradeInfo(oneData)
            self.tableData[info.qty] = info
示例#21
0
    def initTable(self):
        self.tableData.clear()
        tableName = "table_items"
        fields = "id,bodyid,needlevel,quliaty,cansale,saletype,EffType,value"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = Item(oneData)
            self.tableData[item.id] = item
    def initTable(self):
        self.tableData.clear()
        tableName = "table_eqp_deputbuffs"
        fields = "bufftype,rate"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            if oneData[1] > 0:
                self.tableData.append(oneData[0])
示例#23
0
    def initTable(self):
        self.tableData.clear()
        tableName = "table_hero_unlock"
        fields = "orderid,cost,droplibs,modify"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = HeroUnlockInfo(oneData)
            self.tableData[item.order] = item
示例#24
0
 def initData(self):
     self.tables.clear()
     self.weightSum = 0
     tableName = "table_draw_reward"
     fields = "id,itemid,weight,from_num,to_num,super"
     data = db_Manager.selectDataFromTable(tableName,fields)
     for oneData in data:
         item = DrawReward(oneData)
         self.tables.append(item)
         self.weightSum += item.weight
示例#25
0
 def initData(self):
     self.tables.clear()
     tableName = "table_open_server"
     fields = "`id`, `type`, `condition`, `item1`, `name1`, `num1`, `item2`, `name2`, `num2`, `item3`, `name3`, `num3`"
     data = db_Manager.selectDataFromTable(tableName,fields)
     for openserver in data:
         os = OpenServer(openserver)
         if not os.type in self.tables:
             self.tables[os.type] = {}
         self.tables[os.type][os.id] = os
示例#26
0
    def initTable(self):
        self.tableData.clear()
        tableName = "table_hero"
        fields = (
            "id,atkinterval,dps,propmodify,skills,upgrade_cost_modify,"
            "cost_type,cost_value,hp,sub_hp,add_hp,awake_cost"
        )

        data = db_Manager.selectDataFromTable(tableName, fields)
        for oneData in data:
            item = HeroInfo(oneData)
            self.tableData[item.heroID] = item
示例#27
0
    def loadEquipments(self):
        tableName = "player_equip"
        fields = "pos,equipmentid,equipment_quality,equipment_level,id,game_level,upgrade_cost," \
                 "buftype1,bufvalue1,buftype2,bufvalue2,buftype3,bufvalue3,buftype4,bufvalue4,buftype5,bufvalue5," \
                 "bufbasetype1,bufbasevalue1,bufbasetype2,bufbasevalue2,bufbasetype3,bufbasevalue3,bufbasetype4,bufbasevalue4,bufbasetype5,bufbasevalue5"
        conditon = "player_id = %s" % self.player_id
        data = db_Manager.selectDataFromTable(tableName,fields,conditon)

        for equipmentData in data:
            if equipmentData[1] == -1:
                continue
            equipment = EquipMent(data = equipmentData)
            equipPos = int(equipmentData[0])
            self.equipments[equipPos] = equipment
示例#28
0
    def initTable(self):
        self.tableData.clear()
        tableName = "table_set_equipment"
        fields = "id,partcount,equip1,equip2,equip3," \
                 "equip4,equip5,equip6,efftype1,effvalue1," \
                 "efftype2,effvalue2,efftype3,effvalue3," \
                 "efftype4,effvalue4,efftype5,effvalue5,efftype6,effvalue6," \
                 "skill1," \
                 "skill2,bluerate,greenrate,violetrate,goldenrate"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = EquipmentSetInfo(oneData)
            self.tableData[item.id] = item
示例#29
0
    def getPlayerListByRankNums(self,rankNumList):
        playerIDList = []
        notInRankList = []
        for num in rankNumList:
            playerid = self.rank.get(num,None)
            if playerid == None:
                notInRankList.append(num)
                continue
            playerIDList.append(playerid)

        for remNum in notInRankList:
            rankNumList.remove(remNum)
        playerid2player = {}

        tableName = "player_base_info"
        fileds = "playerid,name,game_level,avatorid"
        if len(playerIDList) == 0:
            return  []
        players = []
        offlinePlayersid = []
        for playerid in playerIDList:
            playerInfo = playerDataManager.getPlayerByPlayerid(playerid)
            if playerInfo == None:
                offlinePlayersid.append(playerid)
            else:
                infos = []
                infos.append(playerid)
                infos.append(playerInfo.name)
                infos.append(playerInfo.game_level)
                infos.append(playerInfo.avatorid)
                pvpplayer = PvpPlayerInfoInRanking(infos)
                playerid2player[playerid] = pvpplayer

        if len(offlinePlayersid) > 0:#offline player
            playerIDList = str(offlinePlayersid)
            playerIDList = playerIDList[1:-1]
            condition = "playerid in (%s)" % playerIDList

            data = db_Manager.selectDataFromTable(tableName,fileds,condition)
            for aaData in data:
                player = PvpPlayerInfoInRanking(aaData)
                playerid2player[player.player_id] = player

        for num in rankNumList:
            playerid = self.rank[num]
            player = playerid2player[playerid]
            player.rankNum = num
            players.append(player)
        return  players
    def initData(self):
        self.tableData.clear()
        tableName = "table_hero_upgrade"
        fields = "level,cost,effadd,PVP_hp"

        data = db_Manager.selectDataFromTable(tableName,fields)
        for oneData in data:
            item = UpgradeInfoH(oneData)
            self.tableData[item.level] = item
            if item.level == 1:
                item.effValue = item.effadd
            else:
                lastValue = self.tableData[item.level - 1].effValue
                value = lastValue + item.effadd
                item.effValue = value