| | |
| | | import ChPyNetSendPack
|
| | | import IpyGameDataPY
|
| | | import IPY_GameWorld
|
| | | import PlayerOnline
|
| | | import PlayerPreset
|
| | | import PlayerBeauty
|
| | | import PlayerGubao
|
| | | import ShareDefine
|
| | | import TurnAttack
|
| | | import DBDataMgr
|
| | |
| | | continue
|
| | | equipDict["%s" % equipIndex] = {"ItemID":curEquip.GetItemTypeID(), "UserData":curEquip.GetUserData()}
|
| | |
|
| | | # 阵容
|
| | | lineupDict = {}
|
| | | for lineupID in ShareDefine.LineupList:
|
| | | lineupInfo = TurnAttack.GetPlayerLineupInfo(curPlayer, lineupID)
|
| | | if not lineupInfo:
|
| | | continue
|
| | | lineupDict["%s" % lineupID] = lineupInfo
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | |
|
| | | # 其他
|
| | | # 预设、阵容
|
| | | batPresetDict = {} # 战斗预设方案组合 {"战斗功能预设":{"功能方案预设":功能预设ID, ...}, ...}
|
| | | lineupDict, mgPresetDict = {}, {}
|
| | | for batPresetType in ShareDefine.NeedCacheBatPresetList:
|
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, batPresetType)
|
| | | #武将方案包含在 lineupInfo 里了,所以不用再取武将预设方案
|
| | | #heroPresetID = PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, ShareDefine.FuncPreset_Hero)
|
| | | mgPresetID = PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, ShareDefine.FuncPreset_Mingge)
|
| | | |
| | | # 战斗预设方案组合 {"战斗功能预设":{"功能方案预设":功能预设ID, ...}, ...}
|
| | | batPresetDict["%s" % batPresetType] = {str(ShareDefine.FuncPreset_Battle):batPresetID,
|
| | | str(ShareDefine.FuncPreset_Mingge):mgPresetID,
|
| | | }
|
| | | |
| | | lineupInfo = TurnAttack.GetPlayerLineupInfo(curPlayer, batPresetType)
|
| | | if lineupInfo:
|
| | | batPresetID = lineupInfo.get("BatPresetID", batPresetID)
|
| | | if str(batPresetID) not in lineupDict:
|
| | | lineupDict["%s" % batPresetID] = lineupInfo
|
| | | |
| | | # 命格方案
|
| | | attrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Mingge, mgPresetID)
|
| | | skillLVDict = olPlayer.GetCalcSpecInfo(ChConfig.Def_CalcAttr_Mingge, mgPresetID)
|
| | | mgPresetDict["%s" % mgPresetID] = {"Attr":{str(k):v for k, v in attrDict.items()}, "Skill":skillLVDict}
|
| | | |
| | | # 命格:感悟境界等级、属性、已激活意象效果和层数
|
| | | minggeDict = {"GWLV":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MGGanwuLV), "Preset":mgPresetDict}
|
| | |
|
| | | plusDict = {"Equip":equipDict, "Lineup":lineupDict}
|
| | | # 古宝:数量、属性
|
| | | attrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Gubao)
|
| | | actCnt = PlayerGubao.GetGubaoTotalCnt(curPlayer)
|
| | | gubaoDict = {"Cnt":actCnt, "Attr":{str(k):v for k, v in attrDict.items()}}
|
| | | |
| | | # 红颜
|
| | | attrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Beauty)
|
| | | actCnt = PlayerBeauty.GetBeautyActCnt(curPlayer)
|
| | | beautyDict = {"Cnt":actCnt, "Attr":{str(k):v for k, v in attrDict.items()}}
|
| | | |
| | | # 坐骑
|
| | | attrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Horse)
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseLV)
|
| | | classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseClassLV)
|
| | | horseDict = {"LV":horseLV, "ClassLV":classLV, "Attr":{str(k):v for k, v in attrDict.items()}}
|
| | | |
| | | plusDict = {"Equip":equipDict, "BatPreset":batPresetDict, "Lineup":lineupDict, "Mingge":minggeDict, |
| | | "Beauty":beautyDict, "Horse":horseDict, "Gubao":gubaoDict}
|
| | | curCache.SetPlusDict(plusDict)
|
| | |
|
| | | return curCache
|
| | |
| | | }
|
| | | return robotDict
|
| | |
|
| | | def UpdRobotViewCache(curCache, robotID):
|
| | | def LoadRobot():
|
| | | ## 加载机器人缓存,在服务器启动、重读配置时加载
|
| | | robotFPSortList = []
|
| | | viewCacheMgr = DBDataMgr.GetPlayerViewCacheMgr()
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetRobotCount()):
|
| | | ipyData = ipyDataMgr.GetRobotByIndex(index)
|
| | | robotPlayerID = ipyData.GetID()
|
| | | curCache = viewCacheMgr.GetPlayerViewCache(robotPlayerID)
|
| | | if not curCache:
|
| | | curCache = viewCacheMgr.AddPlayerViewCache(robotPlayerID)
|
| | | if not curCache:
|
| | | continue
|
| | | UpdRobotViewCache(curCache, robotPlayerID, ipyData)
|
| | | robotFPSortList.append([curCache.GetFightPowerTotal(), robotPlayerID])
|
| | | robotFPSortList.sort(reverse=True) # 战力倒序排序
|
| | | IpyGameDataPY.SetConfigEx("robotFPSortList", robotFPSortList)
|
| | | GameWorld.Log("加载机器人战力排序: %s, %s" % (len(robotFPSortList), robotFPSortList))
|
| | | return robotFPSortList
|
| | |
|
| | | def GetRobotFightPowerSortList():
|
| | | ## 机器人战力倒序排序列表
|
| | | # @return: 倒序排序列表 [[战力, 机器人ID], ...],外部使用可随机修改,不会打乱原始排序
|
| | | sortList = []
|
| | | robotFPSortList = IpyGameDataPY.GetConfigEx("robotFPSortList")
|
| | | if not robotFPSortList:
|
| | | robotFPSortList = LoadRobot()
|
| | | if robotFPSortList:
|
| | | sortList += robotFPSortList
|
| | | return sortList
|
| | |
|
| | | def UpdRobotViewCache(curCache, robotID, robotIpyData=None):
|
| | | ## 更新机器人查看缓存
|
| | | robotIpyData = IpyGameDataPY.GetIpyGameData("Robot", robotID)
|
| | | if not robotIpyData:
|
| | | robotIpyData = IpyGameDataPY.GetIpyGameData("Robot", robotID)
|
| | | if not robotIpyData:
|
| | | return
|
| | | try:
|