| | |
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IpyGameDataPY
|
| | | import PlayerMail
|
| | | import DBDataMgr
|
| | |
|
| | | import time
|
| | |
| | |
|
| | | def UpdatePlayerFPTotalBillboard(curPlayer, isForceUpdate=False, isCheckRule=True):
|
| | | ##更新玩家总战斗力
|
| | | # |
| | | # playerFightPower = PlayerControl.GetFightPower(curPlayer)
|
| | | # if not __CheckFightPowerCanUpdate(curPlayer, ChConfig.Def_PDict_FightPower_Total, playerFightPower,
|
| | | # isForceUpdate, isCheckRule, ChConfig.Def_PDict_FightPower_TotalEx):
|
| | | # return
|
| | | # |
| | | # fightPower = playerFightPower % ChConfig.Def_PerPointValue
|
| | | # fightPowerEx = playerFightPower / ChConfig.Def_PerPointValue
|
| | | # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_Total, fightPower,
|
| | | # ChConfig.Def_PDictType_FightPower)
|
| | | # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FightPower_TotalEx, fightPowerEx,
|
| | | # ChConfig.Def_PDictType_FightPower)
|
| | | # |
| | | # GameWorld.DebugLog("更新总战斗力:playerFightPower=%s" % (playerFightPower), curPlayer.GetPlayerID())
|
| | | # |
| | | # UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FightPower, fightPowerEx, fightPower)
|
| | | |
| | | # if bType == ShareDefine.Def_BT_FightPower:
|
| | | # playerID = bID
|
| | | # fightPowerTotal = cmpValue * ChConfig.Def_PerPointValue + cmpValue2
|
| | | # familyID = exInfo[0]
|
| | | # playerJob = bType2
|
| | | # |
| | | # curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | # if curPlayer:
|
| | | # PlayerControl.SetFightPower(curPlayer, fightPowerTotal)
|
| | | # |
| | | # #更新战盟成员战力
|
| | | # PlayerFamily.UpdFamilyMemberFightPower(familyID, playerID, fightPowerTotal)
|
| | | # |
| | | # #职业战力榜
|
| | | # job = playerJob % 10
|
| | | # if job in ShareDefine.JobFightPowerBillboardDict:
|
| | | # jobBType = ShareDefine.JobFightPowerBillboardDict[job]
|
| | | # UpdatePlayerBillboard(bID, bName, bName2, jobBType, bType2, value1, value2, cmpValue, autoSort, cmpValue2, **kwargs)
|
| | | return
|
| | |
|
| | | #def __CheckFightPowerCanUpdate(curPlayer, key, fightPower, isForceUpdate=False, isCheckRule=True, key2=None):
|
| | | # ''' 检查玩家可否更新战斗力
|
| | | # @param curPlayer 玩家实例
|
| | | # @param key 战斗力类型对应key
|
| | | # @param fightPower 当前战斗力
|
| | | # @param isForceUpdate 是否强制更新(若设置强制更新,在某些潜规则下也不一定能强制更新,如GM等)
|
| | | # @param isCheckRule 是否检查战力范围更新差值
|
| | | # @return True-可更新 |
| | | # '''
|
| | | # if fightPower <= 0:
|
| | | # return False
|
| | | # |
| | | # historyFightPower = curPlayer.NomalDictGetProperty(key, 0, ChConfig.Def_PDictType_FightPower)
|
| | | # if key2 != None:
|
| | | # historyFightPower += curPlayer.NomalDictGetProperty(key2, 0, ChConfig.Def_PDictType_FightPower) * ChConfig.Def_PerPointValue
|
| | | # |
| | | # if not __CanPlayerBillboardComm(curPlayer):
|
| | | # return False
|
| | | # |
| | | # if isForceUpdate:
|
| | | # GameWorld.DebugLog("战斗力更新检查:强制更新 key=%s,fightPower=%s,history=%s" |
| | | # % (key, fightPower, historyFightPower), curPlayer.GetPlayerID())
|
| | | # return True
|
| | | # |
| | | # if fightPower == historyFightPower:
|
| | | # GameWorld.DebugLog("战斗力更新检查:与上次相同,默认不更新 key=%s,fightPower=%s,history=%s" |
| | | # % (key, fightPower, historyFightPower), curPlayer.GetPlayerID())
|
| | | # return False
|
| | | # |
| | | # return True
|
| | |
|
| | | def UpdateHorseBillboard(curPlayer, isForceUpdate=False, isUpdateTotal=True):
|
| | | ##更新玩家坐骑排行榜
|
| | | return
|
| | |
|
| | | def UpdatePyPetBillboard(curPlayer, isForceUpdate=False, isUpdateTotal=True):
|
| | |
| | | kwargs["value3"] = curPlayer.GetFace()
|
| | | kwargs["value4"] = curPlayer.GetFacePic()
|
| | | kwargs["value5"] = curPlayer.GetModelMark()
|
| | | kwargs["value6"] = curPlayer.GetEquipShowSwitch()
|
| | |
|
| | | groupValue1 = 0
|
| | | UpdateBillboard(bType, groupValue1, playerID, playerName, playerOpInfo, playerJob, value1, value2,
|
| | |
| | | clientPack.ViewIDDataList.append(viewData)
|
| | | clientPack.ViewIDDataCnt = len(clientPack.ViewIDDataList)
|
| | | return clientPack
|
| | |
|
| | | def DoGiveBillboardAwardByMail(billboardType, funcName, billboardAwardDict, mailKey):
|
| | | ## 结算排行奖励邮件发放
|
| | | GameWorld.Log("=== %s结算排行奖励! === " % (funcName))
|
| | | if not billboardAwardDict:
|
| | | return
|
| | | orderList = [int(orderStr) for orderStr in billboardAwardDict.keys()]
|
| | | orderList.sort()
|
| | | GameWorld.Log(" 奖励名次列表: %s" % orderList)
|
| | | |
| | | billboardMgr = DBDataMgr.GetBillboardMgr()
|
| | | billBoard = billboardMgr.GetBillboard(ShareDefine.Def_BT_Arena)
|
| | | if not billBoard:
|
| | | return
|
| | | billBoard.SortDelayDo()
|
| | | |
| | | awardOrder = orderList[0]
|
| | | orderPlayerIDDict = {}
|
| | | billboardCount, billboardMaxCount = billBoard.GetCount(), billBoard.GetMaxCount()
|
| | | GameWorld.Log(" 榜单数据数: %s/%s" % (billboardCount, billboardMaxCount))
|
| | | for index in xrange(billboardCount):
|
| | | billBoardData = billBoard.At(index)
|
| | | if not billBoardData:
|
| | | continue
|
| | | order = index + 1
|
| | | |
| | | if order > awardOrder:
|
| | | nextOrderIndex = orderList.index(awardOrder) + 1
|
| | | if nextOrderIndex >= len(orderList):
|
| | | break
|
| | | awardOrder = orderList[nextOrderIndex]
|
| | | |
| | | playerID = billBoardData.GetID()
|
| | | if playerID < ShareDefine.RealPlayerIDStart:
|
| | | # 非真人不处理
|
| | | continue
|
| | | |
| | | orderPlayerIDDict[playerID] = [order, awardOrder]
|
| | | |
| | | paramList = [order]
|
| | | awardList = billboardAwardDict[str(awardOrder)]
|
| | | PlayerMail.SendMailByKey(mailKey, playerID, awardList, paramList)
|
| | | |
| | | GameWorld.Log(" 奖励玩家名次信息: %s" % orderPlayerIDDict)
|
| | | GameWorld.Log("===================================================")
|
| | | return
|