| | |
| | | DWORD FightPower; //技能战斗力
|
| | | };
|
| | |
|
| | | //预设解锁
|
| | | struct PresetUnlock
|
| | | {
|
| | | BYTE _PresetType; //预设类型
|
| | | BYTE UnlockType; // 解锁类型
|
| | | DWORD UnlockValue; // 解锁所需值
|
| | | };
|
| | |
|
| | | //武将表
|
| | | struct Hero
|
| | | {
|
| | |
| | | ;装备rptEquip//一定要与枚举RoleEquipType的最大值匹配
|
| | | PackCnt01=12
|
| | | ;物品rptItem
|
| | | PackCnt02=100
|
| | | PackCnt02=200
|
| | | ;垃圾桶(回收站)rptRecycle
|
| | | PackCnt03=0
|
| | | ;拆解物品栏rptBreakItem
|
| | |
| | | ;武将英雄背包
|
| | | PackCnt35=500
|
| | | ;命格卦玉背包
|
| | | PackCnt36=36
|
| | | PackCnt36=60
|
| | | ;命格推演背包
|
| | | PackCnt37=10 |
| | |
| | | PacketSubCMD_4=0x53
|
| | | PacketCallFunc_4=OnMinggeQiling
|
| | |
|
| | | ;预设
|
| | | [PlayerPreset]
|
| | | ScriptName = Player\PlayerPreset.py
|
| | | Writer = hxp
|
| | | Releaser = hxp
|
| | | RegType = 0
|
| | | RegisterPackCount = 4
|
| | |
|
| | | PacketCMD_1=0xB2
|
| | | PacketSubCMD_1=0x60
|
| | | PacketCallFunc_1=OnFuncPresetUnlock
|
| | |
|
| | | PacketCMD_2=0xB2
|
| | | PacketSubCMD_2=0x61
|
| | | PacketCallFunc_2=OnFuncPresetUpdName
|
| | |
|
| | | PacketCMD_3=0xB2
|
| | | PacketSubCMD_3=0x62
|
| | | PacketCallFunc_3=OnFuncPresetSwitch
|
| | |
|
| | | PacketCMD_4=0xB2
|
| | | PacketSubCMD_4=0x63
|
| | | PacketCallFunc_4=OnBatPresetSwitch
|
| | |
|
| | | ;武将
|
| | | [PlayerHero]
|
| | | ScriptName = Player\PlayerHero.py
|
| | |
| | |
|
| | | PacketCMD_10=0xB4
|
| | | PacketSubCMD_10=0x12
|
| | | PacketCallFunc_10=OnHeroLineupSave
|
| | | PacketCallFunc_10=OnHeroPresetSave
|
| | |
|
| | | PacketCMD_11=0xB2
|
| | | PacketSubCMD_11=0x39
|
| | |
| | | import PlayerSuccess
|
| | | import IpyGameDataPY
|
| | | import PlayerOnline
|
| | | import PlayerPreset
|
| | | import NPCCommon
|
| | | import ShareDefine
|
| | | import PyGameData
|
| | |
| | | % (chapterID, levelNum, nowChapterID, fixNowValue), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | |
|
| | | def GetCacheLineupFightPower(tagViewCache, lineupID):
|
| | | lineupInfo = GetCacheLineupInfo(tagViewCache, lineupID)
|
| | | return lineupInfo.get("FightPower", 0)
|
| | | def GetCacheLineupInfo(tagViewCache, lineupID):
|
| | | def GetCacheLineupFightPower(tagViewCache, batPresetType=ShareDefine.BatPreset_Main):
|
| | | if not tagViewCache:
|
| | | return 0
|
| | | lineupInfo = GetCacheLineupInfo(tagViewCache, batPresetType)
|
| | | return lineupInfo.get("FightPower", tagViewCache.GetFightPowerTotal())
|
| | | def GetCacheLineupInfo(tagViewCache, batPresetType=ShareDefine.BatPreset_Main):
|
| | | ## 根据查看缓存获取阵容信息,一般是 GetPlayerLineupInfo 返回的结果
|
| | | plusDict = tagViewCache.GetPlusDict()
|
| | | batPresetDict = plusDict.get("BatPreset", {})
|
| | | batTypePresetDict = batPresetDict.get("%s" % batPresetType, {})
|
| | | batPresetID = batTypePresetDict.get("%s" % ShareDefine.FuncPreset_Battle, 1)
|
| | | |
| | | lineupDict = plusDict.get("Lineup", {})
|
| | | lineupInfo = lineupDict.get("%s" % lineupID, {})
|
| | | lineupInfo = lineupDict.get("%s" % batPresetID, {})
|
| | | if not lineupInfo:
|
| | | lineupInfo = lineupDict.get("%s" % ShareDefine.Lineup_Main, {})
|
| | | defBatPresetID = 1
|
| | | lineupInfo = lineupDict.get("%s" % defBatPresetID, {})
|
| | | return lineupInfo
|
| | |
|
| | | def GetPlayerLineupFightPower(curPlayer, lineupID=ShareDefine.Lineup_Main):
|
| | | def GetPlayerLineupFightPower(curPlayer, batPresetType=ShareDefine.BatPreset_Main, exclusiveMapID=0):
|
| | | ## 获取玩家阵容战力,一般用于直接获取阵容战力记录用
|
| | | return GetPlayerLineup(curPlayer, lineupID).fightPower
|
| | | def GetPlayerLineup(curPlayer, lineupID=ShareDefine.Lineup_Main, exclusiveMapID=0):
|
| | | return GetPlayerLineupByType(curPlayer, batPresetType, exclusiveMapID).fightPower
|
| | | def GetPlayerLineupByType(curPlayer, batPresetType=ShareDefine.BatPreset_Main, exclusiveMapID=0):
|
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, batPresetType)
|
| | | return GetPlayerLineupByID(curPlayer, batPresetID, exclusiveMapID)
|
| | | def GetPlayerLineupByID(curPlayer, batPresetID=0, exclusiveMapID=0):
|
| | | ## 获取玩家阵容
|
| | | mainBatPresetID = PlayerPreset.GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main)
|
| | | if not batPresetID:
|
| | | batPresetID = mainBatPresetID
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | lineup = olPlayer.GetLineup(lineupID, exclusiveMapID=exclusiveMapID)
|
| | | if lineup.IsEmpty():
|
| | | GameWorld.DebugLogEx("玩家没有目标阵容默认取主阵容! lineupID=%s", lineupID, curPlayer.GetPlayerID())
|
| | | lineup = olPlayer.GetLineup(ShareDefine.Lineup_Main)
|
| | | lineup = olPlayer.GetPresetLineup(batPresetID, exclusiveMapID=exclusiveMapID)
|
| | | if lineup.IsEmpty() and batPresetID != mainBatPresetID:
|
| | | GameWorld.DebugLogEx("玩家没有目标阵容默认取主线阵容! batPresetID=%s,mainBatPresetID=%s", (batPresetID, mainBatPresetID), curPlayer.GetPlayerID())
|
| | | lineup = olPlayer.GetPresetLineup(mainBatPresetID, exclusiveMapID=exclusiveMapID)
|
| | | return lineup
|
| | |
|
| | | def GetPlayerLineupInfo(curPlayer, lineupID, exclusiveMapID=0):
|
| | | def GetPlayerLineupInfo(curPlayer, batPresetType=ShareDefine.BatPreset_Main, exclusiveMapID=0):
|
| | | ## 获取玩家阵容信息,可用于战斗或查看缓存,因为可能取玩家的缓存进行对战,所以统一使用json格式,前端通用
|
| | | # @param lineupID: 阵容ID
|
| | | # @param exclusiveMapID: 专享阵容的地图ID,如定军阁
|
| | | # @return: 阵容全部信息json字典,前端通用格式
|
| | | |
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, batPresetType)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | lineup = GetPlayerLineup(curPlayer, lineupID, exclusiveMapID)
|
| | | lineup = GetPlayerLineupByID(curPlayer, batPresetID, exclusiveMapID)
|
| | | if lineup.IsEmpty():
|
| | | return {}
|
| | |
|
| | |
| | | heroID = hero.heroID
|
| | | itemIndex = hero.itemIndex
|
| | | heroLV = 1
|
| | | star = 0
|
| | | star, breakLV, awakeLV = 0, 0, 0
|
| | | userData = "{}"
|
| | | if itemIndex >= 0 and itemIndex < curPack.GetCount():
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | if heroItem and not heroItem.IsEmpty():
|
| | | heroLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | star = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | #breakLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | #awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
|
| | | breakLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
|
| | | userData = heroItem.GetUserData()
|
| | |
|
| | | skillIDlist = []
|
| | |
| | | "LV":heroLV,
|
| | | "Star":star,
|
| | | "Data":userData,
|
| | | #"BreakLV":breakLV,
|
| | | #"AwakeLV":awakeLV,
|
| | | "BreakLV":breakLV,
|
| | | "AwakeLV":awakeLV,
|
| | | "FightPower":hero.fightPower,
|
| | | "AttrDict":{str(k):v for k, v in hero.heroBatAttrDict.items() if v > 0},
|
| | | "SkillIDList":skillIDlist,
|
| | |
| | | if not heroDict:
|
| | | return {}
|
| | |
|
| | | lineupInfo = {"PlayerID":playerID, "FightPower":lineup.fightPower, "ShapeType":lineup.shapeType, "Hero":heroDict}
|
| | | #shapeType = 0
|
| | | lineupInfo = {"PlayerID":playerID, "FightPower":lineup.fightPower, "BatPresetID":batPresetID, "Hero":heroDict}
|
| | | return lineupInfo
|
| | |
|
| | | def GetNPCLineupInfo(lineupID, strongerLV=0, difficulty=0, isLog=True, viewNPCID=0):
|
| | |
| | | if not tagViewCache:
|
| | | PlayerControl.NotifyCode(curPlayer, "TagNoViewCache")
|
| | | return
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache, ShareDefine.Lineup_Main)
|
| | | lineupDictA = {1:GetPlayerLineupInfo(curPlayer, ShareDefine.Lineup_Main)}
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache)
|
| | | lineupDictA = {1:GetPlayerLineupInfo(curPlayer)}
|
| | | lineupDictB = {1:defLineupInfo}
|
| | | turnFight = DoTurnFightPVP(guid, mapID, funcLineID, lineupDictA, lineupDictB)
|
| | | return turnFight.costTime if turnFight else None
|
| | |
| | | playerServerID = GameWorld.GetPlayerServerID(curPlayer)
|
| | | guid = GameWorld.GetGUID()
|
| | |
|
| | | atkLineupID = ShareDefine.Lineup_Main # 进攻方默认使用主阵容
|
| | | atkLineupInfo = GetPlayerLineupInfo(curPlayer, atkLineupID, mapID)
|
| | | atkBatPresetType = ChConfig.MapAtkBatPresetTypeDict.get(mapID, ShareDefine.BatPreset_Main)
|
| | | atkLineupInfo = GetPlayerLineupInfo(curPlayer, atkBatPresetType, exclusiveMapID=mapID)
|
| | | if not atkLineupInfo:
|
| | | GameWorld.DebugLogEx("玩家没有该阵容数据! atkLineupID=%s,mapID=%s", atkLineupID, mapID, playerID)
|
| | | GameWorld.DebugLogEx("玩家没有主线阵容数据! mapID=%s", mapID, playerID)
|
| | | return
|
| | |
|
| | | # 玩家
|
| | |
| | | PlayerControl.NotifyCode(curPlayer, "TagNoViewCache")
|
| | | return
|
| | |
|
| | | defLineupID = ChConfig.MapLineIDDict.get(mapID, ShareDefine.Lineup_Main)
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache, defLineupID)
|
| | | defBatPresetType = ChConfig.MapDefBatPresetTypeDict.get(mapID, ShareDefine.BatPreset_Main)
|
| | | defLineupInfo = GetCacheLineupInfo(tagViewCache, defBatPresetType)
|
| | | if not defLineupInfo:
|
| | | GameWorld.DebugLogEx("目标玩家没有该阵容数据! tagPlayerID=%s,defLineupID=%s", tagPlayerID, defLineupID, playerID)
|
| | | GameWorld.DebugLogEx("目标玩家没有该阵容预设数据! tagPlayerID=%s,defBatPresetType=%s", tagPlayerID, defBatPresetType, playerID)
|
| | | PlayerControl.NotifyCode(curPlayer, "TagNoLineup")
|
| | | return
|
| | |
|
| | |
| | | return
|
| | | lineupID = lineupIDList[0] # NPC阵容ID
|
| | |
|
| | | lineupMainInfo = GetPlayerLineupInfo(curPlayer, ShareDefine.Lineup_Main)
|
| | | lineupMainInfo = GetPlayerLineupInfo(curPlayer)
|
| | | if not lineupMainInfo:
|
| | | GameWorld.DebugLogEx("没有设置主阵容!", playerID)
|
| | | return
|
| | |
| | | # char GUID[40]; //战报guid
|
| | | #};
|
| | | def OnTurnFightReportView(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | guid = clientData.GUID
|
| | | |
| | | lastBatBufferInfo = PlayerOnline.GetOnlinePlayer(curPlayer).GetLastBatBuffer()
|
| | | if lastBatBufferInfo and len(lastBatBufferInfo) == 2 and guid == lastBatBufferInfo[0]:
|
| | | guid, reprot = lastBatBufferInfo
|
| | | SyncTurnFightReport(curPlayer, guid, reprot)
|
| | | return
|
| | | |
| | | # 其他战报,一般是入库存储的,待扩展
|
| | | |
| | | # 战报已过期
|
| | | PlayerControl.NotifyCode(curPlayer, "FightReportExpired")
|
| | | ## 改为下载文件
|
| | | return
|
| | |
|
| | | #// B4 16 查看NPC属性 #tagCSViewNPCAttr
|
| | |
| | | Def_CalcAttr_Horse, # 坐骑 6
|
| | | Def_CalcAttr_Beauty, # 红颜 7
|
| | | Def_CalcAttr_Dingjunge, # 定军阁 8
|
| | | ) = range(9)
|
| | | Def_CalcAttr_Mingge, # 命格 9
|
| | | ) = range(10)
|
| | |
|
| | | CalcAttrName = {
|
| | | Def_CalcAttr_LV:"主公等级",
|
| | |
| | | Def_CalcAttr_Horse:"坐骑",
|
| | | Def_CalcAttr_Beauty:"红颜",
|
| | | Def_CalcAttr_Dingjunge:"定军阁",
|
| | | Def_CalcAttr_Mingge:"命格",
|
| | | }
|
| | |
|
| | | ##-----------------------------------------------------------------------------------------------
|
| | |
| | | ReportCenterMapIDList = [Def_FBMapID_Zhanchui, Def_FBMapID_Dingjunge]
|
| | | #需要阵容战斗属性单独专用的地图 - 一般是有地图专有属性的,仅该功能战斗有效,用的是专项的主线阵容,战力独立计算,不影响通用主线阵容战力
|
| | | ExclusiveBatAttrMapIDList = [Def_FBMapID_Dingjunge]
|
| | | #地图专用阵容,注:这里只针对非主动进攻时使用的阵容,不一定是防守,如系统PK的双方阵容也可以
|
| | | MapLineIDDict = {Def_FBMapID_ArenaBattle:ShareDefine.Lineup_ArenaDef}
|
| | | #地图功能专用预设方案,如果没有配置的功能则默认使用主线方案
|
| | | MapAtkBatPresetTypeDict = {}
|
| | | MapDefBatPresetTypeDict = {Def_FBMapID_ArenaBattle:ShareDefine.BatPreset_ArenaDef}
|
| | |
|
| | | #注册上传跨服服务器数据后直接进入跨服服务器的地图
|
| | | RegisterEnter_CrossServerMapIDList = []
|
| | |
| | | Def_PDict_MGGanwuExp = "MGGanwuExp" # 当前感悟等级对应的经验
|
| | | Def_PDict_MGLingying = "MGLingying" # 当前灵应值
|
| | |
|
| | | #预设
|
| | | Def_PDict_PresetState = "PresetState_%s" # 预设解锁状态,按二进制位存储是否已解锁,参数(功能预设类型)
|
| | | Def_PDict_PresetBatID = "PresetBatID_%s" # 战斗功能使用的战斗预设方案ID,参数(战斗功能类型)
|
| | | Def_PDict_PresetFuncID = "PresetFuncID_%s_%s" # 某个战斗预设方案下某个功能预设的方案ID,参数(战斗预设ID, 功能类型)
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | #物品效果(ID或指定类型)对应的属性计算信息 {效果(ID/指定类型):[[属性索引, ...], 是否基础属性,(非)线性]}
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B2 63 战斗预设切换 #tagCSBatPresetSwitch
|
| | |
|
| | | class tagCSBatPresetSwitch(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("BatPresetType", c_ubyte), #战斗预设类型:1-主线战斗;2-演武场防守;
|
| | | ("BatPresetID", c_ubyte), #切换至目标战斗预设ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x63
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x63
|
| | | self.BatPresetType = 0
|
| | | self.BatPresetID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCSBatPresetSwitch)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B2 63 战斗预设切换 //tagCSBatPresetSwitch:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | BatPresetType:%d,
|
| | | BatPresetID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.BatPresetType,
|
| | | self.BatPresetID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCSBatPresetSwitch=tagCSBatPresetSwitch()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSBatPresetSwitch.Cmd,m_NAtagCSBatPresetSwitch.SubCmd))] = m_NAtagCSBatPresetSwitch
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B2 19 红颜激活 #tagCSBeautyActivate
|
| | |
|
| | | class tagCSBeautyActivate(Structure):
|
| | |
| | |
|
| | | m_NAtagCSBeautySkinOP=tagCSBeautySkinOP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSBeautySkinOP.Cmd,m_NAtagCSBeautySkinOP.SubCmd))] = m_NAtagCSBeautySkinOP
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B2 62 功能预设切换 #tagCSFuncPresetSwitch
|
| | |
|
| | | class tagCSFuncPresetSwitch(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("BatPresetID", c_ubyte), #所属战斗预设ID
|
| | | ("FuncPresetType", c_ubyte), #预设类型,2-阵容;3-命格;
|
| | | ("PresetID", c_ubyte), #本功能切换至目标预设ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x62
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x62
|
| | | self.BatPresetID = 0
|
| | | self.FuncPresetType = 0
|
| | | self.PresetID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCSFuncPresetSwitch)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B2 62 功能预设切换 //tagCSFuncPresetSwitch:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | BatPresetID:%d,
|
| | | FuncPresetType:%d,
|
| | | PresetID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.BatPresetID,
|
| | | self.FuncPresetType,
|
| | | self.PresetID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCSFuncPresetSwitch=tagCSFuncPresetSwitch()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSFuncPresetSwitch.Cmd,m_NAtagCSFuncPresetSwitch.SubCmd))] = m_NAtagCSFuncPresetSwitch
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B2 60 功能预设解锁 #tagCSFuncPresetUnlock
|
| | |
|
| | | class tagCSFuncPresetUnlock(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("FuncPresetType", c_ubyte), #预设类型,1-全局;2-阵容;3-命格;
|
| | | ("PresetID", c_ubyte), #预设ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x60
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x60
|
| | | self.FuncPresetType = 0
|
| | | self.PresetID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCSFuncPresetUnlock)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B2 60 功能预设解锁 //tagCSFuncPresetUnlock:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | FuncPresetType:%d,
|
| | | PresetID:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.FuncPresetType,
|
| | | self.PresetID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCSFuncPresetUnlock=tagCSFuncPresetUnlock()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSFuncPresetUnlock.Cmd,m_NAtagCSFuncPresetUnlock.SubCmd))] = m_NAtagCSFuncPresetUnlock
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B2 61 功能预设改名 #tagCSFuncPresetUpdName
|
| | |
|
| | | class tagCSFuncPresetUpdName(Structure):
|
| | | Head = tagHead()
|
| | | FuncPresetType = 0 #(BYTE FuncPresetType)//预设类型,1-全局;2-阵容;3-命格;
|
| | | PresetID = 0 #(BYTE PresetID)//预设ID
|
| | | NameLen = 0 #(BYTE NameLen)
|
| | | PresetName = "" #(String PresetName)//预设名称
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB2
|
| | | self.Head.SubCmd = 0x61
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.FuncPresetType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PresetID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PresetName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB2
|
| | | self.Head.SubCmd = 0x61
|
| | | self.FuncPresetType = 0
|
| | | self.PresetID = 0
|
| | | self.NameLen = 0
|
| | | self.PresetName = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.PresetName)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.FuncPresetType)
|
| | | data = CommFunc.WriteBYTE(data, self.PresetID)
|
| | | data = CommFunc.WriteBYTE(data, self.NameLen)
|
| | | data = CommFunc.WriteString(data, self.NameLen, self.PresetName)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | FuncPresetType:%d,
|
| | | PresetID:%d,
|
| | | NameLen:%d,
|
| | | PresetName:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.FuncPresetType,
|
| | | self.PresetID,
|
| | | self.NameLen,
|
| | | self.PresetName
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCSFuncPresetUpdName=tagCSFuncPresetUpdName()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSFuncPresetUpdName.Head.Cmd,m_NAtagCSFuncPresetUpdName.Head.SubCmd))] = m_NAtagCSFuncPresetUpdName
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B4 12 战斗阵容保存 #tagCSHeroLineupSave
|
| | | # B4 12 战斗阵容预设保存 #tagCSHeroPresetSave
|
| | |
|
| | | class tagCSHeroLineupPos(Structure):
|
| | | class tagCSHeroPresetPos(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("ItemIndex", c_ushort), #武将物品所在武将背包位置索引
|
| | |
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCSHeroLineupPos)
|
| | | return sizeof(tagCSHeroPresetPos)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B4 12 战斗阵容保存 //tagCSHeroLineupSave:
|
| | | DumpString = '''// B4 12 战斗阵容预设保存 //tagCSHeroPresetSave:
|
| | | ItemIndex:%d,
|
| | | PosNum:%d
|
| | | '''\
|
| | |
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagCSHeroLineupSave(Structure):
|
| | | class tagCSHeroPresetSave(Structure):
|
| | | Head = tagHead()
|
| | | LineupID = 0 #(BYTE LineupID)//阵容ID:1-主阵容;其他待扩展,如某个防守阵容
|
| | | PresetID = 0 #(BYTE PresetID)//阵容方案预设ID
|
| | | ShapeType = 0 #(BYTE ShapeType)//本阵容阵型,0为默认阵型,可扩展不同的阵型
|
| | | PosCnt = 0 #(BYTE PosCnt)
|
| | | HeroPosList = list() #(vector<tagCSHeroLineupPos> HeroPosList)// 保存的阵容,只发送最终的阵容武将位置即可
|
| | | HeroPosList = list() #(vector<tagCSHeroPresetPos> HeroPosList)// 保存的阵容,只发送最终的阵容武将位置即可
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.LineupID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PresetID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.ShapeType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PosCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.PosCnt):
|
| | | temHeroPosList = tagCSHeroLineupPos()
|
| | | temHeroPosList = tagCSHeroPresetPos()
|
| | | _pos = temHeroPosList.ReadData(_lpData, _pos)
|
| | | self.HeroPosList.append(temHeroPosList)
|
| | | return _pos
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB4
|
| | | self.Head.SubCmd = 0x12
|
| | | self.LineupID = 0
|
| | | self.PresetID = 0
|
| | | self.ShapeType = 0
|
| | | self.PosCnt = 0
|
| | | self.HeroPosList = list()
|
| | |
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.LineupID)
|
| | | data = CommFunc.WriteBYTE(data, self.PresetID)
|
| | | data = CommFunc.WriteBYTE(data, self.ShapeType)
|
| | | data = CommFunc.WriteBYTE(data, self.PosCnt)
|
| | | for i in range(self.PosCnt):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | LineupID:%d,
|
| | | PresetID:%d,
|
| | | ShapeType:%d,
|
| | | PosCnt:%d,
|
| | | HeroPosList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.LineupID,
|
| | | self.PresetID,
|
| | | self.ShapeType,
|
| | | self.PosCnt,
|
| | | "..."
|
| | |
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCSHeroLineupSave=tagCSHeroLineupSave()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSHeroLineupSave.Head.Cmd,m_NAtagCSHeroLineupSave.Head.SubCmd))] = m_NAtagCSHeroLineupSave
|
| | | m_NAtagCSHeroPresetSave=tagCSHeroPresetSave()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSHeroPresetSave.Head.Cmd,m_NAtagCSHeroPresetSave.Head.SubCmd))] = m_NAtagCSHeroPresetSave
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 63 战斗预设切换信息 #tagSCBatPresetSwitchInfo
|
| | |
|
| | | class tagSCBatPresetSwitch(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("BatPresetType", c_ubyte), #战斗预设类型:1-主线战斗;2-演武场防守;
|
| | | ("BatPresetID", c_ubyte), #该战斗功能所使用的战斗预设ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.BatPresetType = 0
|
| | | self.BatPresetID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagSCBatPresetSwitch)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B1 63 战斗预设切换信息 //tagSCBatPresetSwitchInfo:
|
| | | BatPresetType:%d,
|
| | | BatPresetID:%d
|
| | | '''\
|
| | | %(
|
| | | self.BatPresetType,
|
| | | self.BatPresetID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCBatPresetSwitchInfo(Structure):
|
| | | Head = tagHead()
|
| | | BatFuncCnt = 0 #(BYTE BatFuncCnt)
|
| | | BatPresetList = list() #(vector<tagSCBatPresetSwitch> BatPresetList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x63
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.BatFuncCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.BatFuncCnt):
|
| | | temBatPresetList = tagSCBatPresetSwitch()
|
| | | _pos = temBatPresetList.ReadData(_lpData, _pos)
|
| | | self.BatPresetList.append(temBatPresetList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x63
|
| | | self.BatFuncCnt = 0
|
| | | self.BatPresetList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.BatFuncCnt):
|
| | | length += self.BatPresetList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.BatFuncCnt)
|
| | | for i in range(self.BatFuncCnt):
|
| | | data = CommFunc.WriteString(data, self.BatPresetList[i].GetLength(), self.BatPresetList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | BatFuncCnt:%d,
|
| | | BatPresetList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.BatFuncCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCBatPresetSwitchInfo=tagSCBatPresetSwitchInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCBatPresetSwitchInfo.Head.Cmd,m_NAtagSCBatPresetSwitchInfo.Head.SubCmd))] = m_NAtagSCBatPresetSwitchInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 30 红颜信息 #tagSCBeautyInfo
|
| | |
|
| | | class tagSCBeautySkin(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 61 功能预设信息 #tagSCFuncPresetInfoList
|
| | |
|
| | | class tagSCFuncPreset(Structure):
|
| | | PresetID = 0 #(BYTE PresetID)//预设方案ID
|
| | | NameLen = 0 #(BYTE NameLen)
|
| | | PresetName = "" #(String PresetName)//预设名称
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.PresetID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PresetName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.PresetID = 0
|
| | | self.NameLen = 0
|
| | | self.PresetName = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.PresetName)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteBYTE(data, self.PresetID)
|
| | | data = CommFunc.WriteBYTE(data, self.NameLen)
|
| | | data = CommFunc.WriteString(data, self.NameLen, self.PresetName)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | PresetID:%d,
|
| | | NameLen:%d,
|
| | | PresetName:%s
|
| | | '''\
|
| | | %(
|
| | | self.PresetID,
|
| | | self.NameLen,
|
| | | self.PresetName
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCFuncPresetInfo(Structure):
|
| | | FuncPresetType = 0 #(BYTE FuncPresetType)//预设类型,1-全局战斗;2-阵容;3-命格;
|
| | | UnlockState = 0 #(DWORD UnlockState)//该功能预设解锁状态,按预设ID二进制位运算记录是否已解锁
|
| | | PresetCnt = 0 #(BYTE PresetCnt)
|
| | | PresetList = list() #(vector<tagSCFuncPreset> PresetList)//本功能下预设列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.FuncPresetType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.UnlockState,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PresetCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.PresetCnt):
|
| | | temPresetList = tagSCFuncPreset()
|
| | | _pos = temPresetList.ReadData(_lpData, _pos)
|
| | | self.PresetList.append(temPresetList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.FuncPresetType = 0
|
| | | self.UnlockState = 0
|
| | | self.PresetCnt = 0
|
| | | self.PresetList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | for i in range(self.PresetCnt):
|
| | | length += self.PresetList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteBYTE(data, self.FuncPresetType)
|
| | | data = CommFunc.WriteDWORD(data, self.UnlockState)
|
| | | data = CommFunc.WriteBYTE(data, self.PresetCnt)
|
| | | for i in range(self.PresetCnt):
|
| | | data = CommFunc.WriteString(data, self.PresetList[i].GetLength(), self.PresetList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | FuncPresetType:%d,
|
| | | UnlockState:%d,
|
| | | PresetCnt:%d,
|
| | | PresetList:%s
|
| | | '''\
|
| | | %(
|
| | | self.FuncPresetType,
|
| | | self.UnlockState,
|
| | | self.PresetCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCFuncPresetInfoList(Structure):
|
| | | Head = tagHead()
|
| | | FuncCnt = 0 #(BYTE FuncCnt)
|
| | | FuncPresetList = list() #(vector<tagSCFuncPresetInfo> FuncPresetList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x61
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.FuncCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.FuncCnt):
|
| | | temFuncPresetList = tagSCFuncPresetInfo()
|
| | | _pos = temFuncPresetList.ReadData(_lpData, _pos)
|
| | | self.FuncPresetList.append(temFuncPresetList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x61
|
| | | self.FuncCnt = 0
|
| | | self.FuncPresetList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.FuncCnt):
|
| | | length += self.FuncPresetList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.FuncCnt)
|
| | | for i in range(self.FuncCnt):
|
| | | data = CommFunc.WriteString(data, self.FuncPresetList[i].GetLength(), self.FuncPresetList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | FuncCnt:%d,
|
| | | FuncPresetList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.FuncCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCFuncPresetInfoList=tagSCFuncPresetInfoList()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCFuncPresetInfoList.Head.Cmd,m_NAtagSCFuncPresetInfoList.Head.SubCmd))] = m_NAtagSCFuncPresetInfoList
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 62 功能预设切换信息 #tagSCFuncPresetSwitchInfo
|
| | |
|
| | | class tagSCFuncPresetFunc(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("FuncPresetType", c_ubyte), #预设类型,2-阵容;3-命格;
|
| | | ("FuncPresetID", c_ubyte), #该全局战斗预设下本功能使用的预设ID
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.FuncPresetType = 0
|
| | | self.FuncPresetID = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagSCFuncPresetFunc)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B1 62 功能预设切换信息 //tagSCFuncPresetSwitchInfo:
|
| | | FuncPresetType:%d,
|
| | | FuncPresetID:%d
|
| | | '''\
|
| | | %(
|
| | | self.FuncPresetType,
|
| | | self.FuncPresetID
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCFuncPresetBat(Structure):
|
| | | BatPresetID = 0 #(BYTE BatPresetID)//所属全局战斗预设ID
|
| | | FuncCnt = 0 #(BYTE FuncCnt)
|
| | | FuncPresetList = list() #(vector<tagSCFuncPresetFunc> FuncPresetList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.BatPresetID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.FuncCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.FuncCnt):
|
| | | temFuncPresetList = tagSCFuncPresetFunc()
|
| | | _pos = temFuncPresetList.ReadData(_lpData, _pos)
|
| | | self.FuncPresetList.append(temFuncPresetList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.BatPresetID = 0
|
| | | self.FuncCnt = 0
|
| | | self.FuncPresetList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 1
|
| | | length += 1
|
| | | for i in range(self.FuncCnt):
|
| | | length += self.FuncPresetList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteBYTE(data, self.BatPresetID)
|
| | | data = CommFunc.WriteBYTE(data, self.FuncCnt)
|
| | | for i in range(self.FuncCnt):
|
| | | data = CommFunc.WriteString(data, self.FuncPresetList[i].GetLength(), self.FuncPresetList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | BatPresetID:%d,
|
| | | FuncCnt:%d,
|
| | | FuncPresetList:%s
|
| | | '''\
|
| | | %(
|
| | | self.BatPresetID,
|
| | | self.FuncCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCFuncPresetSwitchInfo(Structure):
|
| | | Head = tagHead()
|
| | | BatPresetCnt = 0 #(BYTE BatPresetCnt)
|
| | | BatPresetList = list() #(vector<tagSCFuncPresetBat> BatPresetList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x62
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.BatPresetCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.BatPresetCnt):
|
| | | temBatPresetList = tagSCFuncPresetBat()
|
| | | _pos = temBatPresetList.ReadData(_lpData, _pos)
|
| | | self.BatPresetList.append(temBatPresetList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x62
|
| | | self.BatPresetCnt = 0
|
| | | self.BatPresetList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.BatPresetCnt):
|
| | | length += self.BatPresetList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.BatPresetCnt)
|
| | | for i in range(self.BatPresetCnt):
|
| | | data = CommFunc.WriteString(data, self.BatPresetList[i].GetLength(), self.BatPresetList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | BatPresetCnt:%d,
|
| | | BatPresetList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.BatPresetCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCFuncPresetSwitchInfo=tagSCFuncPresetSwitchInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCFuncPresetSwitchInfo.Head.Cmd,m_NAtagSCFuncPresetSwitchInfo.Head.SubCmd))] = m_NAtagSCFuncPresetSwitchInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 11 功能系统特权信息 #tagMCFuncSysPrivilegeInfoList
|
| | |
|
| | | class tagMCFuncSysPrivilegeInfo(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 24 阵容信息 #tagSCLineupInfo
|
| | | # B1 24 武将预设信息 #tagSCHeroPresetInfo
|
| | |
|
| | | class tagSCLineup(Structure):
|
| | | LineupID = 0 #(BYTE LineupID)// 阵容ID
|
| | | class tagSCHeroPreset(Structure):
|
| | | PresetID = 0 #(BYTE PresetID)//阵容方案预设ID
|
| | | ShapeType = 0 #(BYTE ShapeType)// 阵型
|
| | | HeroCnt = 0 #(BYTE HeroCnt)
|
| | | HeroItemIndexList = list() #(vector<WORD> HeroItemIndexList)// 所在武将背包索引+1列表 [站位1物品索引+1, 站位2, ...],站位无武将时为0
|
| | |
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.LineupID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.PresetID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.ShapeType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.HeroCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.HeroCnt):
|
| | |
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.LineupID = 0
|
| | | self.PresetID = 0
|
| | | self.ShapeType = 0
|
| | | self.HeroCnt = 0
|
| | | self.HeroItemIndexList = list()
|
| | |
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteBYTE(data, self.LineupID)
|
| | | data = CommFunc.WriteBYTE(data, self.PresetID)
|
| | | data = CommFunc.WriteBYTE(data, self.ShapeType)
|
| | | data = CommFunc.WriteBYTE(data, self.HeroCnt)
|
| | | for i in range(self.HeroCnt):
|
| | |
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | LineupID:%d,
|
| | | PresetID:%d,
|
| | | ShapeType:%d,
|
| | | HeroCnt:%d,
|
| | | HeroItemIndexList:%s
|
| | | '''\
|
| | | %(
|
| | | self.LineupID,
|
| | | self.PresetID,
|
| | | self.ShapeType,
|
| | | self.HeroCnt,
|
| | | "..."
|
| | |
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagSCLineupInfo(Structure):
|
| | | class tagSCHeroPresetInfo(Structure):
|
| | | Head = tagHead()
|
| | | LineupCnt = 0 #(BYTE LineupCnt)
|
| | | LineupList = list() #(vector<tagSCLineup> LineupList)
|
| | | PresetCnt = 0 #(BYTE PresetCnt)
|
| | | PresetList = list() #(vector<tagSCHeroPreset> PresetList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.LineupCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.LineupCnt):
|
| | | temLineupList = tagSCLineup()
|
| | | _pos = temLineupList.ReadData(_lpData, _pos)
|
| | | self.LineupList.append(temLineupList)
|
| | | self.PresetCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.PresetCnt):
|
| | | temPresetList = tagSCHeroPreset()
|
| | | _pos = temPresetList.ReadData(_lpData, _pos)
|
| | | self.PresetList.append(temPresetList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x24
|
| | | self.LineupCnt = 0
|
| | | self.LineupList = list()
|
| | | self.PresetCnt = 0
|
| | | self.PresetList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | for i in range(self.LineupCnt):
|
| | | length += self.LineupList[i].GetLength()
|
| | | for i in range(self.PresetCnt):
|
| | | length += self.PresetList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.LineupCnt)
|
| | | for i in range(self.LineupCnt):
|
| | | data = CommFunc.WriteString(data, self.LineupList[i].GetLength(), self.LineupList[i].GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.PresetCnt)
|
| | | for i in range(self.PresetCnt):
|
| | | data = CommFunc.WriteString(data, self.PresetList[i].GetLength(), self.PresetList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | LineupCnt:%d,
|
| | | LineupList:%s
|
| | | PresetCnt:%d,
|
| | | PresetList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.LineupCnt,
|
| | | self.PresetCnt,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagSCLineupInfo=tagSCLineupInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCLineupInfo.Head.Cmd,m_NAtagSCLineupInfo.Head.SubCmd))] = m_NAtagSCLineupInfo
|
| | | m_NAtagSCHeroPresetInfo=tagSCHeroPresetInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCHeroPresetInfo.Head.Cmd,m_NAtagSCHeroPresetInfo.Head.SubCmd))] = m_NAtagSCHeroPresetInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | |
| | | '''
|
| | | dataToJson = True
|
| | | # 默认使用 dataToJson,如果不需要的可根据 RecType 在这里处理
|
| | | if dbData.RecType in []:
|
| | | if dbData.RecType in ShareDefine.UserDataNOJsonRecTypeList:
|
| | | dataToJson = False
|
| | | recData = GameRecData(dbData, dataToJson)
|
| | | self.__dataList.append(recData)
|
| | |
| | | #---------------------------------------------------------------------
|
| | |
|
| | | import ChConfig
|
| | | import TurnAttack
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import ReadChConfig
|
| | |
| | |
|
| | | import datetime
|
| | | import urllib
|
| | | import json
|
| | |
|
| | | ## 初始化事件
|
| | | # @param None
|
| | |
| | | "FamilyName": curPlayer.GetFamilyName(),
|
| | | "ReamlLV":curPlayer.GetOfficialRank(),
|
| | | "TreeLV":curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV),
|
| | | "LineupHero":GetReportMainLineupInfo(curPlayer),
|
| | | }
|
| | | for mapID in ChConfig.ReportCenterMapIDList:
|
| | | playerInfo["FBPass%s" % mapID] = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FBPassLineID % mapID)
|
| | |
| | | # 第五个参数0代表get发送 1代表post
|
| | | GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)
|
| | | return
|
| | |
|
| | | def GetReportMainLineupInfo(curPlayer):
|
| | | lineup = TurnAttack.GetPlayerLineup(curPlayer, ShareDefine.Lineup_Main)
|
| | | if lineup.IsEmpty():
|
| | | return {}
|
| | | |
| | | heroDict = {}
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for posNum in lineup.GetPosNumList():
|
| | | hero = lineup.GetLineupHero(posNum)
|
| | | heroID = hero.heroID
|
| | | itemIndex = hero.itemIndex
|
| | | heroLV = 1
|
| | | star = 0
|
| | | breakLV = 0
|
| | | awakeLV = 0
|
| | | if itemIndex >= 0 and itemIndex < curPack.GetCount():
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | if heroItem and not heroItem.IsEmpty():
|
| | | heroLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | star = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | breakLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | awakeLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroAwakeLV)
|
| | | heroDict[str(posNum)] = {
|
| | | "HeroID":heroID,
|
| | | "SkinID":hero.skinID,
|
| | | "LV":heroLV,
|
| | | "Star":star,
|
| | | "BreakLV":breakLV,
|
| | | "AwakeLV":awakeLV,
|
| | | }
|
| | | return json.dumps(heroDict, ensure_ascii=False).replace(" ", "")
|
| | |
|
| | | ## =================================================================================================
|
| | |
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "武将皮肤: Hero sk 武将ID 皮肤索引 是否解锁")
|
| | | GameWorld.DebugAnswer(curPlayer, "重置宿缘: Hero sy 0")
|
| | | GameWorld.DebugAnswer(curPlayer, "设置宿缘: Hero sy 宿缘ID 等级 [是否激活]")
|
| | | #GameWorld.DebugAnswer(curPlayer, "清空武将: ClearPack 35")
|
| | | GameWorld.DebugAnswer(curPlayer, "新增武将: MakeItemCount 英雄ID [个数]")
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容上阵: Hero f 阵容ID [武将ID ...]")
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容武将: Hero h 阵容ID 武将ID 等级 星级 突破等级 觉醒等级 皮肤")
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容满级: Hero h 阵容ID 1")
|
| | | GameWorld.DebugAnswer(curPlayer, "一键满级: Hero max [指定等级 星级 突破 觉醒]")
|
| | | GameWorld.DebugAnswer(curPlayer, "清空武将: Hero clear [是否包含生效卡]")
|
| | | return
|
| | |
| | | value = msgList[0]
|
| | | value2 = msgList[1] if len(msgList) > 1 else 0
|
| | |
|
| | | # 阵容上阵
|
| | | if value == "f":
|
| | | __oneKeyLineup(curPlayer, msgList)
|
| | | return
|
| | | |
| | | # 一键满级
|
| | | if value == "max":
|
| | | __oneKeyMax(curPlayer, msgList)
|
| | | return
|
| | | |
| | | # 阵容武将
|
| | | if value == "h":
|
| | | __lineupHero(curPlayer, msgList)
|
| | | return
|
| | |
|
| | | # 图鉴
|
| | |
| | | if not curItem or curItem.IsEmpty():
|
| | | continue
|
| | | if not isAll:
|
| | | if curItem.GetUserAttr(ShareDefine.Def_IudetHeroCardEffective):
|
| | | if curItem.GetUserAttrCount(ShareDefine.Def_IudetHeroEffPresetID):
|
| | | continue
|
| | | curItem.Clear()
|
| | |
|
| | | if isAll:
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).SetEffectiveCardDict({}) # 清空生效缓存
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).ReCalcAllAttr()
|
| | | return
|
| | |
|
| | | # 宿缘
|
| | |
| | | if value == 0:
|
| | | PlayerHero.InitHeroItem(heroItem.GetItem())
|
| | | heroItem.Sync_Item()
|
| | | if heroItem.GetUserAttr(ShareDefine.Def_IudetHeroCardEffective):
|
| | | heroItem.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 0)
|
| | | GameWorld.DebugAnswer(curPlayer, "重置武将: itemIndex=%s" % (itemIndex))
|
| | |
|
| | | # 等级
|
| | |
| | | GameWorld.DebugAnswer(curPlayer, "一键OK!")
|
| | | return
|
| | |
|
| | | def __oneKeyLineup(curPlayer, msgList):
|
| | | ## 阵容上阵: Hero f 阵容ID [武将ID ...]
|
| | | lineupID = msgList[1] if len(msgList) > 1 else 0
|
| | | heroIDList = []
|
| | | for heroID in msgList[2:]: # 去重,单阵容武将ID不能重复
|
| | | if heroID not in heroIDList:
|
| | | heroIDList.append(heroID)
|
| | | if lineupID not in ShareDefine.LineupList:
|
| | | GameWorld.DebugAnswer(curPlayer, "不存在该阵容: %s" % lineupID)
|
| | | return
|
| | | |
| | | if not heroIDList:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有指定阵容武将ID列表!")
|
| | | return
|
| | | |
| | | for heroID in heroIDList:
|
| | | if not GameWorld.GetGameData().GetItemByTypeID(heroID):
|
| | | GameWorld.DebugAnswer(curPlayer, "不存在该武将: %s" % heroID)
|
| | | return
|
| | | |
| | | shapeType = 0
|
| | | haveHeroIDList = []
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | # 直接重置旧阵型
|
| | | syncItemDict = {}
|
| | | for index in range(curPack.GetCount()):
|
| | | heroItem = curPack.GetAt(index)
|
| | | if not heroItem or heroItem.IsEmpty():
|
| | | continue
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | if heroID in heroIDList and heroID not in haveHeroIDList:
|
| | | haveHeroIDList.append(heroID)
|
| | | lineupCount = heroItem.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)
|
| | | if not lineupCount:
|
| | | continue
|
| | | item = heroItem.GetItem()
|
| | | for lpIndex in range(lineupCount)[::-1]:
|
| | | lineupValue = item.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | if PlayerHero.GetLineupValue(lineupValue)[0] != lineupID:
|
| | | continue
|
| | | item.DelUserAttr(ShareDefine.Def_IudetHeroLineup, lineupValue)
|
| | | syncItemDict[index] = heroItem
|
| | | |
| | | # 给没有的武将
|
| | | for heroID in heroIDList:
|
| | | if heroID in haveHeroIDList:
|
| | | continue
|
| | | if not ItemControler.GivePlayerItem(curPlayer, heroID, 1, False):
|
| | | break
|
| | | |
| | | # 更新新阵型
|
| | | heroItemDict = {}
|
| | | updHeroIDList = []
|
| | | for index in range(curPack.GetCount()):
|
| | | heroItem = curPack.GetAt(index)
|
| | | if not heroItem or heroItem.IsEmpty():
|
| | | continue
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | if heroID not in heroIDList:
|
| | | continue
|
| | | if heroID in updHeroIDList:
|
| | | # 已经上过该武将了
|
| | | continue
|
| | | updHeroIDList.append(heroID)
|
| | | posNum = heroIDList.index(heroID) + 1
|
| | | item = heroItem.GetItem()
|
| | | lineupValue = PlayerHero.ComLineupValue(lineupID, shapeType, posNum)
|
| | | item.AddUserAttr(ShareDefine.Def_IudetHeroLineup, lineupValue)
|
| | | if index not in syncItemDict:
|
| | | syncItemDict[index] = heroItem
|
| | | heroItemDict[index] = posNum
|
| | | |
| | | for syncItem in syncItemDict.values():
|
| | | syncItem.Sync_Item()
|
| | | |
| | | lineup = PlayerOnline.GetOnlinePlayer(curPlayer).GetLineup(lineupID, False)
|
| | | lineup.UpdLineup(heroItemDict, shapeType)
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容(%s)上阵OK: %s" % (lineupID, heroItemDict))
|
| | | return
|
| | |
|
| | | def __lineupHero(curPlayer, msgList):
|
| | | #阵容武将: Hero h 阵容ID 武将ID 等级 星级 突破等级 觉醒等级 皮肤
|
| | | #阵容满级: Hero h 阵容ID 1
|
| | | lineupID = msgList[1] if len(msgList) > 1 else 0
|
| | | heroID = msgList[2] if len(msgList) > 2 else 0
|
| | | setLV = msgList[3] if len(msgList) > 3 else None
|
| | | setStar = msgList[4] if len(msgList) > 4 else None
|
| | | setBreakLV = msgList[5] if len(msgList) > 5 else None
|
| | | setAwakeLV = msgList[6] if len(msgList) > 6 else None
|
| | | setSkinID = msgList[7] if len(msgList) > 7 else None
|
| | | |
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | lineup = olPlayer.GetLineup(lineupID)
|
| | | if heroID == 1:
|
| | | setIndexList = lineup.heroItemDict.keys()
|
| | | else:
|
| | | lineupHero = lineup.GetLineupHeroByID(heroID)
|
| | | if not lineupHero:
|
| | | GameWorld.DebugAnswer(curPlayer, "该阵容不存在该武将: %s" % heroID)
|
| | | return
|
| | | setIndexList = [lineupHero.itemIndex]
|
| | | |
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for itemIndex in setIndexList:
|
| | | if itemIndex < 0 or itemIndex >= curPack.GetCount():
|
| | | continue
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | if not heroItem or heroItem.IsEmpty():
|
| | | continue
|
| | | __setHeroItem(curPlayer, heroItem, setLV, setStar, setBreakLV, setAwakeLV, setSkinID)
|
| | | |
| | | GameWorld.DebugAnswer(curPlayer, "设置阵容武将OK")
|
| | | return
|
| | | |
| | | def __setHeroItem(curPlayer, heroItem, setLV=None, setStar=None, setBreakLV=None, setAwakeLV=None, setSkinID=None):
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | heroIpyData = IpyGameDataPY.GetIpyGameData("Hero", heroID)
|
| | |
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import PlayerPreset
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import PlayerOnline
|
| | | import ShareDefine
|
| | | import ChConfig
|
| | |
| | | def OnExec(curPlayer, msgList):
|
| | |
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | |
| | | if not msgList:
|
| | | GameWorld.DebugAnswer(curPlayer, "PrintFightPower [阵容ID 专享属性地图ID]")
|
| | | GameWorld.DebugAnswer(curPlayer, "PrintFightPower [预设方案 专享属性地图ID]")
|
| | | GameWorld.DebugAnswer(curPlayer, "主公战力: %s" % PlayerControl.GetFightPower(curPlayer))
|
| | | for lineupID in ShareDefine.LineupList:
|
| | | lineup = olPlayer.GetLineup(lineupID)
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容(%s)总战力: %s" % (lineupID, lineup.fightPower))
|
| | | if lineupID == ShareDefine.Lineup_Main:
|
| | | |
| | | batPresetIDList = []
|
| | | for batPresetType in ShareDefine.BatPresetList:
|
| | | batPresetName = ShareDefine.BatPresetName.get(batPresetType, "")
|
| | | batPresetName = "%s(%s)" % (batPresetName, batPresetType)
|
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, batPresetType)
|
| | | lineup = olPlayer.GetPresetLineup(batPresetID)
|
| | | GameWorld.DebugAnswer(curPlayer, "%s-方案(%s)战力: %s" % (batPresetName, batPresetID, lineup.fightPower))
|
| | | if batPresetType == ShareDefine.BatPreset_Main:
|
| | | for exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | exclusiveLineup = olPlayer.GetLineup(lineupID, exclusiveMapID=exclusiveMapID)
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容(%s-%s)总战力: %s" % (lineupID, exclusiveLineup.exclusiveMapID, exclusiveLineup.fightPower))
|
| | | exclusiveLineup = olPlayer.GetPresetLineup(batPresetID, exclusiveMapID=exclusiveMapID)
|
| | | GameWorld.DebugAnswer(curPlayer, " 地图(%s)战力: %s" % (exclusiveLineup.exclusiveMapID, exclusiveLineup.fightPower))
|
| | | if batPresetID not in batPresetIDList:
|
| | | batPresetIDList.append(batPresetID)
|
| | | |
| | | # 其他
|
| | | for batPresetID in olPlayer.GetBatPresetIDList():
|
| | | if batPresetID in batPresetIDList:
|
| | | continue
|
| | | if not PlayerPreset.GetFuncPresetIDState(curPlayer, batPresetID):
|
| | | continue
|
| | | lineup = olPlayer.GetPresetLineup(batPresetID)
|
| | | GameWorld.DebugAnswer(curPlayer, "其他方案(%s)战力: %s" % (batPresetID, lineup.fightPower))
|
| | | |
| | | return
|
| | |
|
| | | lineupID = msgList[0]
|
| | | batPresetID = msgList[0]
|
| | | exclusiveMapID = msgList[1] if len(msgList) > 1 else 0
|
| | | if lineupID not in ShareDefine.LineupList:
|
| | | GameWorld.DebugAnswer(curPlayer, "阵容(%s)不存在.")
|
| | | batPresetIDList = olPlayer.GetBatPresetIDList()
|
| | | if batPresetID not in batPresetIDList:
|
| | | GameWorld.DebugAnswer(curPlayer, "没有该战斗预设方案属性!%s" % batPresetID)
|
| | | return
|
| | | if exclusiveMapID not in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | exclusiveMapID
|
| | | exclusiveMapID = 0
|
| | | GameWorld.DebugAnswer(curPlayer, "-------------------")
|
| | | lineup = olPlayer.GetLineup(lineupID, exclusiveMapID=exclusiveMapID) |
| | | GameWorld.DebugAnswer(curPlayer, "【阵容 - %s】明细总战力: %s" % (lineupID, lineup.fightPower))
|
| | | lineup = olPlayer.GetPresetLineup(batPresetID, exclusiveMapID=exclusiveMapID) |
| | | GameWorld.DebugAnswer(curPlayer, "【方案 - %s】战力: %s" % (batPresetID, lineup.fightPower))
|
| | | if exclusiveMapID:
|
| | | GameWorld.DebugAnswer(curPlayer, "功能地图专属阵容地图ID:%s" % exclusiveMapID)
|
| | | |
| | | GameWorld.DebugAnswer(curPlayer, "地图专属方案地图ID:%s" % exclusiveMapID)
|
| | | |
| | | for calcIndex in ChConfig.Def_CalcAttrList:
|
| | | calcName = ChConfig.CalcAttrName.get(calcIndex, "%s" % calcIndex)
|
| | | attrDict = olPlayer.GetCalcAttr(calcIndex)
|
| | |
| | | PlayerArena.SetRecLV(recData, tagViewCache.GetLV() if tagViewCache else 1)
|
| | | # 名字、变更积分 +-、战力
|
| | | # 战力统一记录防守阵容
|
| | | fightPower = TurnAttack.GetCacheLineupFightPower(tagViewCache, ShareDefine.Lineup_ArenaDef) if tagViewCache else 0
|
| | | fightPower = TurnAttack.GetCacheLineupFightPower(tagViewCache, ShareDefine.BatPreset_ArenaDef) if tagViewCache else 0
|
| | | tagPlayerName = tagViewCache.GetPlayerName() if tagViewCache else ""
|
| | | recData.SetUserData({"Name":tagPlayerName, "AddScore":atkAddScore, "FightPower":fightPower})
|
| | | # 攻击方仅在积分变更或者初始积分时更新榜单
|
| | |
| | | ("DWORD", "FightPower", 0),
|
| | | ),
|
| | |
|
| | | "PresetUnlock":(
|
| | | ("BYTE", "PresetType", 1),
|
| | | ("BYTE", "UnlockType", 0),
|
| | | ("DWORD", "UnlockValue", 0),
|
| | | ),
|
| | |
|
| | | "Hero":(
|
| | | ("DWORD", "HeroID", 1),
|
| | | ("char", "Name", 0),
|
| | |
| | | def GetDispersedLimit(self): return self.attrTuple[39] # 驱散限制 BYTE
|
| | | def GetBuffRetain(self): return self.attrTuple[40] # Buff保留规则 BYTE
|
| | | def GetFightPower(self): return self.attrTuple[41] # 技能战斗力 DWORD |
| | | |
| | | # 预设解锁 |
| | | class IPY_PresetUnlock(): |
| | | |
| | | def __init__(self): |
| | | self.attrTuple = None |
| | | return |
| | | |
| | | def GetPresetType(self): return self.attrTuple[0] # 预设类型 BYTE
|
| | | def GetUnlockType(self): return self.attrTuple[1] # 解锁类型 BYTE
|
| | | def GetUnlockValue(self): return self.attrTuple[2] # 解锁所需值 DWORD |
| | | |
| | | # 武将表 |
| | | class IPY_Hero(): |
| | |
| | | self.__LoadFileData("NPC", onlyCheck)
|
| | | self.__LoadFileData("NPCStronger", onlyCheck)
|
| | | self.__LoadFileData("Skill", onlyCheck)
|
| | | self.__LoadFileData("PresetUnlock", onlyCheck)
|
| | | self.__LoadFileData("Hero", onlyCheck)
|
| | | self.__LoadFileData("HeroTalent", onlyCheck)
|
| | | self.__LoadFileData("HeroBreak", onlyCheck)
|
| | |
| | | self.CheckLoadData("Skill") |
| | | return self.ipySkillCache[index]
|
| | | |
| | | def GetPresetUnlockCount(self): |
| | | self.CheckLoadData("PresetUnlock") |
| | | return self.ipyPresetUnlockLen
|
| | | def GetPresetUnlockByIndex(self, index): |
| | | self.CheckLoadData("PresetUnlock") |
| | | return self.ipyPresetUnlockCache[index]
|
| | | |
| | | def GetHeroCount(self): |
| | | self.CheckLoadData("Hero") |
| | | return self.ipyHeroLen
|
| | |
| | | return
|
| | |
|
| | | def ResetHeroPack(curPlayer, curPack, beingIndex, endIndex):
|
| | | itemList = []
|
| | | for i in range(beingIndex, endIndex + 1):
|
| | | curRoleItem = curPack.GetAt(i)
|
| | | if curRoleItem.IsEmpty():
|
| | | continue
|
| | | curItem = curRoleItem.GetItem() |
| | | itemList.append(curItem)
|
| | | itemList.sort(__CmpHeroPack)
|
| | | |
| | | curPack.WipePack(beingIndex, endIndex)
|
| | | putPlace = beingIndex
|
| | | for item in itemList:
|
| | | curPack.GetAt(putPlace).AssignItem(item, False)
|
| | | putPlace += 1
|
| | | |
| | | ## 前端自行排序
|
| | | return
|
| | |
|
| | | def __CmpHeroPack(item1, item2):
|
| | | '''排序规则:上阵武将排前,未上阵武将排后,再各自按照以下规则排序
|
| | | 武将等级>突破等级>武将星级>武将品质>武将ID
|
| | | '''
|
| | | |
| | | posNum1, posNum2 = 0, 0
|
| | | for lpIndex in range(item1.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = item1.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID, _, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | continue
|
| | | posNum1 = posNum
|
| | | break
|
| | | |
| | | for lpIndex in range(item2.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = item2.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID, _, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | continue
|
| | | posNum2 = posNum
|
| | | break
|
| | | |
| | | if (posNum1 and posNum2) or (not posNum1 and not posNum2):
|
| | | lv1 = item1.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | lv2 = item2.GetUserAttr(ShareDefine.Def_IudetHeroLV)
|
| | | if lv1 == lv2:
|
| | | bLV1 = item1.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | bLV2 = item2.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
|
| | | if bLV1 == bLV2:
|
| | | star1 = item1.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | star2 = item2.GetUserAttr(ShareDefine.Def_IudetHeroStar)
|
| | | if star1 == star2:
|
| | | heroID1 = item1.GetItemTypeID()
|
| | | heroID2 = item2.GetItemTypeID()
|
| | | ipyData1 = IpyGameDataPY.GetIpyGameData("Hero", heroID1)
|
| | | ipyData2 = IpyGameDataPY.GetIpyGameData("Hero", heroID2)
|
| | | quality1 = ipyData1.GetQuality() if ipyData1 else 0
|
| | | quality2 = ipyData2.GetQuality() if ipyData2 else 0
|
| | | if quality1 == quality2:
|
| | | return cmp(heroID1, heroID2)
|
| | | return -cmp(quality1, quality2)
|
| | | return -cmp(star1, star2)
|
| | | return -cmp(bLV1, bLV2)
|
| | | return -cmp(lv1, lv2)
|
| | | elif posNum1:
|
| | | return -1
|
| | | elif posNum2:
|
| | | return 1
|
| | | else:
|
| | | return cmp(item1.GetItemTypeID(), item2.GetItemTypeID())
|
| | | |
| | | #===============================================================================
|
| | | #Python 版重整物品
|
| | | # def ResetItem(curPlayer, curPackIndex, tick):
|
| | |
| | | import PyMongoMain
|
| | | import PlayerTalk
|
| | | import PlayerHero
|
| | | import PlayerPreset
|
| | | import PlayerOnline
|
| | | import PlayerBeauty
|
| | | import PlayerTravel
|
| | |
| | | PlayerTravel.OnPlayerLogin(curPlayer)
|
| | | PlayerMingge.OnPlayerLogin(curPlayer)
|
| | | OpenServerActivity.OnPlayerLogin(curPlayer)
|
| | | PlayerPreset.OnPlayerLogin(curPlayer)
|
| | |
|
| | | __OnFixVersion(curPlayer) # 修正线上玩家数据用,暂时放最后
|
| | | # 上线查询一次充值订单
|
| | |
| | | import PlayerGoldInvest
|
| | | import PlayerViewCache
|
| | | import NetPackCommon
|
| | | import TurnAttack
|
| | | import PyGameData
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
| | | matchInfo = ChPyNetSendPack.tagSCArenaMatchInfo()
|
| | | matchInfo.PlayerID = matchID
|
| | | if viewCache:
|
| | | fightPower = PlayerViewCache.GetLineupFightPower(viewCache, ShareDefine.Lineup_ArenaDef)
|
| | | fightPower = TurnAttack.GetCacheLineupFightPower(viewCache, ShareDefine.BatPreset_ArenaDef)
|
| | | matchInfo.PlayerName = viewCache.GetPlayerName()
|
| | | matchInfo.RealmLV = viewCache.GetRealmLV()
|
| | | matchInfo.LV = viewCache.GetLV()
|
| | |
| | | import NetPackCommon
|
| | | import PlayerControl
|
| | | import PlayerOnline
|
| | | import PlayerPreset
|
| | | import PlayerTask
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
| | | return
|
| | | GameWorld.DebugLog("初始化新手武将: %s" % defaultHeroInfo, curPlayer.GetPlayerID())
|
| | |
|
| | | lineupID = ShareDefine.Lineup_Main
|
| | | presetID = 1 # 默认预设1
|
| | | shapeType = 0
|
| | | for heroID, posNum in defaultHeroInfo.items():
|
| | | lineupValue = ComLineupValue(lineupID, shapeType, posNum)
|
| | | lineupValue = ComLineupValue(presetID, shapeType, posNum)
|
| | | setAttrDict = {ShareDefine.Def_IudetHeroLineup:[lineupValue]}
|
| | | ItemControler.GivePlayerItem(curPlayer, heroID, 1, False, [ShareDefine.rptHero], setAttrDict=setAttrDict)
|
| | |
|
| | |
| | | return
|
| | | return heroItem
|
| | |
|
| | | def GetHeroLineupPosNum(heroItem, lineupID=ShareDefine.Lineup_Main):
|
| | | ## 获取英雄所在阵型站位
|
| | | # @param lineupID: 阵型ID,默认主阵型
|
| | | # @return: 0-没有在该阵型;>0-在该阵型中的站位编号
|
| | | lineupCount = heroItem.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)
|
| | | if not lineupCount:
|
| | | return 0
|
| | | for lpIndex in range(lineupCount)[::-1]:
|
| | | lineupValue = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lpID, _, posNum = GetLineupValue(lineupValue)
|
| | | if lpID != lineupID:
|
| | | continue
|
| | | return posNum
|
| | | return 0
|
| | |
|
| | | def InMainLineup(heroItem):
|
| | | ## 是否在主阵容中
|
| | | for lpIndex in range(heroItem.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)):
|
| | | lineupValue = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | if GetLineupValue(lineupValue)[0] == ShareDefine.Lineup_Main:
|
| | | return True
|
| | | return False
|
| | | def GetHeroEffPresetIDList(heroItem):
|
| | | ## 获取英雄有生效的预设ID列表
|
| | | dataCount = heroItem.GetUserAttrCount(ShareDefine.Def_IudetHeroEffPresetID)
|
| | | if not dataCount:
|
| | | return []
|
| | | effPresetIDList = []
|
| | | for lpIndex in range(dataCount):
|
| | | presetID = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroEffPresetID, lpIndex)
|
| | | effPresetIDList.append(presetID)
|
| | | return effPresetIDList
|
| | |
|
| | | #// B2 30 武将升级 #tagCSHeroLVUP
|
| | | #
|
| | |
| | | ratio = IpyGameDataPY.GetFuncCfg("HeroRebirth", 5)
|
| | | dismissItemList = []
|
| | | returnItemDict = {}
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for itemIndex in itemIndexList:
|
| | | if itemIndex < 0 or itemIndex >= curPack.GetCount():
|
| | |
| | | GameWorld.DebugLog("上阵中的武将无法遣散! itemIndex=%s,lineupValueList=%s" % (itemIndex, lineupValueList))
|
| | | continue
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | _, effItemIndex, _ = olPlayer.GetHeroEffectiveCard(heroID)
|
| | | if itemIndex == effItemIndex:
|
| | | GameWorld.DebugLog("生效中的卡牌无法遣散! itemIndex=%s,heroID=%s,effItemIndex=%s" % (itemIndex, heroID, effItemIndex))
|
| | | effPresetIDList = GetHeroEffPresetIDList(heroItem)
|
| | | if effPresetIDList:
|
| | | GameWorld.DebugLog("生效中的卡牌无法遣散! itemIndex=%s,heroID=%s,effPresetIDList=%s" % (itemIndex, heroID, effPresetIDList))
|
| | | continue
|
| | | heroIpyData = IpyGameDataPY.GetIpyGameData("Hero", heroID)
|
| | | if not heroIpyData:
|
| | |
| | |
|
| | | return
|
| | |
|
| | | #// B4 12 战斗阵容保存 #tagCSHeroLineupSave
|
| | | #// B4 12 战斗阵容预设保存 #tagCSHeroPresetSave
|
| | | #
|
| | | #struct tagCSHeroLineupPos
|
| | | #struct tagCSHeroPresetPos
|
| | | #{
|
| | | # WORD ItemIndex; //武将物品所在武将背包位置索引
|
| | | # BYTE PosNum; //1~n上阵位置编号
|
| | | #};
|
| | | #
|
| | | #struct tagCSHeroLineupSave
|
| | | #struct tagCSHeroPresetSave
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE LineupID; //阵容ID:1-主阵容;其他待扩展,如某个防守阵容
|
| | | # BYTE PresetID; //阵容方案预设ID
|
| | | # BYTE ShapeType; //本阵容阵型,0为默认阵型,可扩展不同的阵型
|
| | | # BYTE PosCnt;
|
| | | # tagCSHeroLineupPos HeroPosList[PosCnt]; // 保存的阵容,只发送最终的阵容武将位置即可
|
| | | # tagCSHeroPresetPos HeroPosList[PosCnt]; // 保存的阵容,只发送最终的阵容武将位置即可
|
| | | #};
|
| | | def OnHeroLineupSave(index, clientData, tick):
|
| | | def OnHeroPresetSave(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | lineupID = clientData.LineupID
|
| | | presetID = clientData.PresetID
|
| | | shapeType = clientData.ShapeType
|
| | | heroPosList = clientData.HeroPosList
|
| | |
|
| | |
| | | indexList.append(itemIndex)
|
| | | heroPosDict[posNum] = itemIndex
|
| | |
|
| | | if lineupID not in ShareDefine.LineupList:
|
| | | GameWorld.DebugLog("不存在该阵容,无法保存! lineupID=%s" % lineupID)
|
| | | if not PlayerPreset.GetFuncPresetIDState(curPlayer, presetID, ShareDefine.FuncPreset_Hero):
|
| | | GameWorld.DebugLog("该武将阵容预设不可用! presetID=%s" % presetID)
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("保存阵容: lineupID=%s, %s" % (lineupID, heroPosDict), curPlayer.GetPlayerID())
|
| | | GameWorld.DebugLog("保存武将预设阵容: presetID=%s, %s" % (presetID, heroPosDict), curPlayer.GetPlayerID())
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | # 直接重置旧阵型
|
| | | delCount = 0
|
| | |
| | | item = heroItem.GetItem()
|
| | | for lpIndex in range(lineupCount)[::-1]:
|
| | | lineupValue = item.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | if GetLineupValue(lineupValue)[0] != lineupID:
|
| | | if GetLineupValue(lineupValue)[0] != presetID:
|
| | | continue
|
| | | item.DelUserAttr(ShareDefine.Def_IudetHeroLineup, lineupValue)
|
| | | delCount += 1
|
| | |
| | | continue
|
| | | heroIDList.append(itemID)
|
| | | item = heroItem.GetItem()
|
| | | lineupValue = ComLineupValue(lineupID, shapeType, posNum)
|
| | | lineupValue = ComLineupValue(presetID, shapeType, posNum)
|
| | | item.AddUserAttr(ShareDefine.Def_IudetHeroLineup, lineupValue)
|
| | | if itemIndex not in syncItemDict:
|
| | | syncItemDict[itemIndex] = heroItem
|
| | | heroItemDict[itemIndex] = posNum
|
| | |
|
| | | # 主阵容修改时重整背包,约定所有背包由前端自行排序
|
| | | #if lineupID == ShareDefine.Lineup_Main:
|
| | | # ResetHeroPack(curPlayer)
|
| | | #else:
|
| | | # 约定所有背包由前端自行排序
|
| | | for syncItem in syncItemDict.values():
|
| | | syncItem.Sync_Item()
|
| | |
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | lineup = olPlayer.GetLineup(lineupID, False)
|
| | | lineup.UpdLineup(heroItemDict, shapeType)
|
| | | |
| | | # 主阵容调整,重载生效的卡牌
|
| | | if lineupID == ShareDefine.Lineup_Main:
|
| | | for exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | exclusiveLineup = olPlayer.GetLineup(lineupID, False, exclusiveMapID=exclusiveMapID)
|
| | | exclusiveLineup.UpdLineup(heroItemDict, shapeType)
|
| | | PlayerOnline.reloadEffHeroCard(curPlayer, olPlayer)
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).UpdHeroItemPreset(presetID, heroItemDict, shapeType)
|
| | | return
|
| | |
|
| | | def ComLineupValue(lineupID, shapeType, posNum): return lineupID * 10000 + shapeType * 100 + posNum
|
| | |
| | | return
|
| | |
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | _, effItemIndex, _ = olPlayer.GetHeroEffectiveCard(heroID)
|
| | | if itemIndex == effItemIndex:
|
| | | GameWorld.DebugLog(" 生效中的卡牌无法使用! itemIndex=%s,heroID=%s,effItemIndex=%s" % (itemIndex, heroID, effItemIndex))
|
| | | effPresetIDList = GetHeroEffPresetIDList(heroItem)
|
| | | if effPresetIDList:
|
| | | GameWorld.DebugLog(" 生效中的卡牌无法使用! itemIndex=%s,heroID=%s,effPresetIDList=%s" % (itemIndex, heroID, effPresetIDList))
|
| | | return
|
| | |
|
| | | return True
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def Sync_Lineup(curPlayer, lineupID=None):
|
| | | if lineupID:
|
| | | syncIDList = [lineupID]
|
| | | else:
|
| | | syncIDList = ShareDefine.LineupList
|
| | | |
| | | lineupList = []
|
| | | def Sync_HeroPreset(curPlayer, heroPresetID=None):
|
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | for lineupID in syncIDList:
|
| | | lineup = olPlayer.GetLineup(lineupID, False)
|
| | | if not lineup:
|
| | | if heroPresetID:
|
| | | syncIDList = [heroPresetID]
|
| | | else:
|
| | | syncIDList = olPlayer.GetHeroPresetIDList()
|
| | | |
| | | presetList = []
|
| | | for heroPresetID in syncIDList:
|
| | | heroPreset = olPlayer.GetHeroPreset(heroPresetID)
|
| | | if not heroPreset:
|
| | | continue
|
| | |
|
| | | posNumItemIndexDict = {v:k for k, v in lineup.heroItemDict.items()}
|
| | | posNumItemIndexDict = {v:k for k, v in heroPreset.heroItemDict.items()}
|
| | | heroItemIndexList = [] # 所在武将背包索引+1列表 [站位1物品索引+1, 站位2, ...],站位无武将时为0
|
| | | for posNum in range(1, 1 + ShareDefine.LineupObjMax):
|
| | | if posNum in posNumItemIndexDict:
|
| | | heroItemIndexList.append(posNumItemIndexDict[posNum] + 1)
|
| | | else:
|
| | | heroItemIndexList.append(0)
|
| | | packLineup = ChPyNetSendPack.tagSCLineup()
|
| | | packLineup.LineupID = lineup.lineupID
|
| | | packLineup.ShapeType = lineup.shapeType
|
| | | packLineup.HeroItemIndexList = heroItemIndexList
|
| | | packLineup.HeroCnt = len(packLineup.HeroItemIndexList)
|
| | | lineupList.append(packLineup)
|
| | | preset = ChPyNetSendPack.tagSCHeroPreset()
|
| | | preset.PresetID = heroPresetID
|
| | | preset.ShapeType = heroPreset.shapeType
|
| | | preset.HeroItemIndexList = heroItemIndexList
|
| | | preset.HeroCnt = len(preset.HeroItemIndexList)
|
| | | presetList.append(preset)
|
| | |
|
| | | if not lineupList:
|
| | | if not presetList:
|
| | | return
|
| | |
|
| | | clientPack = ChPyNetSendPack.tagSCLineupInfo()
|
| | | clientPack.LineupList = lineupList
|
| | | clientPack.LineupCnt = len(clientPack.LineupList)
|
| | | clientPack = ChPyNetSendPack.tagSCHeroPresetInfo()
|
| | | clientPack.PresetList = presetList
|
| | | clientPack.PresetCnt = len(clientPack.PresetList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | |
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import PlayerPreset
|
| | | import PlayerControl
|
| | | import ItemControler
|
| | | import IpyGameDataPY
|
| | |
| | | isAutoDec = clientData.AutoDec
|
| | | GameWorld.DebugLog("命格装备替换: mgNum=%s,itemIndex=%s,isAutoDec=%s" % (mgNum, itemIndex, isAutoDec), playerID)
|
| | |
|
| | | openNum = IpyGameDataPY.GetFuncCfg("MinggeCfg", 1)
|
| | | if mgNum < 1 or mgNum > openNum:
|
| | | GameWorld.DebugLog("命格套编号不支持! mgNum=%s" % mgNum, playerID)
|
| | | if not PlayerPreset.GetFuncPresetIDState(curPlayer, mgNum, ShareDefine.FuncPreset_Mingge):
|
| | | GameWorld.DebugLog("命格套方案未解锁! mgNum=%s" % mgNum, playerID)
|
| | | return
|
| | |
|
| | | mgTuiyanPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptMGTuiyan)
|
| | |
| | | __doDecomposeMingge(curPlayer, [itemIndex])
|
| | |
|
| | | # 刷属性
|
| | | RefreshMinggeAttr(curPlayer)
|
| | | RefreshMinggeAttr(curPlayer, mgNum)
|
| | | return
|
| | |
|
| | | #// B2 53 命格祈灵#tagCSMinggeQiling
|
| | |
| | | Sync_MinggeInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def RefreshMinggeAttr(curPlayer):
|
| | | #CalcMinggeAttr(curPlayer)
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).RefreshRoleAttr()
|
| | | def RefreshMinggeAttr(curPlayer, mgNum=0):
|
| | | CalcMinggeAttr(curPlayer, mgNum)
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).RefreshByFuncPreset(ShareDefine.FuncPreset_Mingge, mgNum)
|
| | | return
|
| | |
|
| | | def CalcMinggeAttr(curPlayer):
|
| | | def GetMGNumPackIndexList(mgNum):
|
| | | mgCnt = len(ChConfig.Def_MGGuayuType)
|
| | | startIndex = (mgNum - 1) * mgCnt
|
| | | endIndex = startIndex + mgCnt
|
| | | return range(startIndex, endIndex)
|
| | |
|
| | | def CalcMinggeAttr(curPlayer, mgNum=0):
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | funcPresetType = ShareDefine.FuncPreset_Mingge
|
| | | if not mgNum:
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", funcPresetType)
|
| | | mgPresetIDList = range(1, 1 + len(ipyDataList)) if ipyDataList else []
|
| | | else:
|
| | | mgPresetIDList = [mgNum]
|
| | | |
| | | olPlayer = PlayerOnline.GetOnlinePlayer(curPlayer)
|
| | | equipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptMGGuayu)
|
| | | for mgPresetID in mgPresetIDList:
|
| | | |
| | | attrDict, skillLVDict = {}, {}
|
| | | if not PlayerPreset.GetFuncPresetIDState(curPlayer, mgPresetID, funcPresetType):
|
| | | olPlayer.SetCalcAttr(ChConfig.Def_CalcAttr_Mingge, attrDict, skillLVDict, presetID=mgPresetID)
|
| | | continue
|
| | | |
| | | for index in GetMGNumPackIndexList(mgPresetID):
|
| | | if index < 0 or index >= equipPack.GetCount():
|
| | | continue
|
| | | curEquip = equipPack.GetAt(index)
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | continue
|
| | | |
| | | legendAttrIDCnt = curEquip.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrID)
|
| | | legendAttrValueCnt = curEquip.GetUserAttrCount(ShareDefine.Def_IudetLegendAttrValue)
|
| | | for i in xrange(min(legendAttrIDCnt, legendAttrValueCnt)):
|
| | | attrID = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrID, i)
|
| | | attrValue = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetLegendAttrValue, i)
|
| | | attrDict[attrID] = attrDict.get(attrID, 0) + attrValue
|
| | | |
| | | for i in xrange(curEquip.GetUserAttrCount(ShareDefine.Def_IudetAddSkillID)):
|
| | | skillID = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetAddSkillID, i)
|
| | | if skillID:
|
| | | skillLVDict[skillID] = skillLVDict.get(skillID, 0) + 1
|
| | | |
| | | GameWorld.DebugLog("命格属性: %s,skillLVDict=%s,mgPresetID=%s" % (attrDict, skillLVDict, mgPresetID), playerID)
|
| | | olPlayer.SetCalcAttr(ChConfig.Def_CalcAttr_Mingge, attrDict, skillLVDict, presetID=mgPresetID)
|
| | | |
| | | return
|
| | |
|
| | | def Sync_MinggeInfo(curPlayer):
|
| | |
| | | import TurnAttack
|
| | | import PyGameData
|
| | | import ShareDefine
|
| | | import PlayerPreset
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import FormulaControl
|
| | |
| | | self.skillFightPower = 0 # 技能战力
|
| | | return
|
| | |
|
| | | class Lineup():
|
| | | ## 阵容
|
| | | class PresetHero():
|
| | | '''武将阵容预设方案,可用于任何一个全局战斗预设方案
|
| | | 虽然是同个武将物品阵容预设,但是在不同的战斗预设方案中最终的武将属性可能不一样
|
| | | 故该类无关任何武将战力、属性等,只汇总某个武将阵容预设相关公共数据,如武将站位、生效卡牌等
|
| | | '''
|
| | |
|
| | | def __init__(self, playerID, lineupID, exclusiveMapID=0):
|
| | | self.playerID = playerID
|
| | | self.lineupID = lineupID
|
| | | self.exclusiveMapID = exclusiveMapID # 大于0时代表是某个功能地图专用,如定军阁,阵容与主阵容相同,只是属性、战力可能不一样
|
| | | self.olPlayer = None
|
| | | def __init__(self, heroPresetID=1):
|
| | | self.heroPresetID = heroPresetID
|
| | | self.shapeType = 0
|
| | | self.heroItemDict = {} # 阵容武将背包索引信息 {itemIndex:posNum, ...}
|
| | | self.lineupChange = False # 是否已变更阵容标记,在刷新属性后重置标记
|
| | | self.__refreshState = 0 # 刷属性标记, 0-不需要刷新了,1-需要刷新
|
| | | self._effectiveCardDict = {} # 加成属性生效的武将卡牌信息 {heroID:[cardAddPer, itemIndex, inThis], ...}
|
| | | self.isHeroChange = False
|
| | | return
|
| | | |
| | | def SetHeroItemPreset(self, curPlayer, heroItemDict, shapeType=0, isReload=False):
|
| | | self.shapeType = shapeType
|
| | | self.heroItemDict = heroItemDict
|
| | | if not isReload: # 非重读阵容的视为变更
|
| | | self.isHeroChange = True
|
| | | reloadEffHeroCard(curPlayer, self) # 更新武将阵容强制重刷生效卡牌
|
| | | return
|
| | | |
| | | def IsHeroItemIn(self, itemIndex): return itemIndex in self.heroItemDict
|
| | |
|
| | | def GetHeroEffectiveCard(self, heroID): return self._effectiveCardDict.get(heroID, [-1, -1, False])
|
| | | def SetHeroEffectiveCard(self, heroID, cardAddPer, itemIndex, inThis):
|
| | | ## 更新某个武将生效的卡牌信息
|
| | | self._effectiveCardDict[heroID] = [cardAddPer, itemIndex, inThis]
|
| | | return
|
| | | |
| | | def SetEffectiveCardDict(self, effectiveCardDict): self._effectiveCardDict = effectiveCardDict
|
| | | def GetEffCardAddPer(self):
|
| | | effCardAddPer = 0
|
| | | for effInfo in self._effectiveCardDict.values():
|
| | | effCardAddPer += effInfo[0]
|
| | | return effCardAddPer
|
| | | |
| | | class PresetLineup():
|
| | | ## 全局战斗预设方案
|
| | | |
| | | def __init__(self, playerID, batPresetID, exclusiveMapID=0):
|
| | | self.playerID = playerID
|
| | | self.batPresetID = batPresetID
|
| | | self.exclusiveMapID = exclusiveMapID # 大于0时代表是某个功能地图专用,如定军阁,阵容与主阵容相同,只是属性、战力可能不一样
|
| | | self.olPlayer = None
|
| | | self.__refreshState = 1 # 刷属性标记,初始需要刷新, 0-不需要刷新了,1-需要刷新
|
| | | self.fightPower = 0 # 阵容总战力
|
| | |
|
| | | self.__freeLineupHeroObjs = [] # 释放的空闲对象[LineupHero, ...]
|
| | | self.__lineupHeroDict = {} # 刷新阵容后的武将信息 {posNum:LineupHero, ...}
|
| | | self.fightPower = 0 # 阵容总战力
|
| | | return
|
| | |
|
| | | def UpdLineup(self, heroItemDict, shapeType=0, refreshForce=False, isReload=False):
|
| | | '''变更阵容时更新
|
| | | @param heroItemDict: 武将背包索引信息 {itemIndex:posNum, ...}
|
| | | @param shapeType: 阵型
|
| | | @param refreshForce: 是否强制刷属性
|
| | | '''
|
| | | if not isReload: # 非重读阵容的视为变更
|
| | | self.lineupChange = True
|
| | | self.shapeType = shapeType
|
| | | self.heroItemDict = heroItemDict
|
| | | GameWorld.DebugLog("更新阵容: lineupID=%s,exclusiveMapID=%s,%s" % (self.lineupID, self.exclusiveMapID, heroItemDict), self.playerID)
|
| | | self.RefreshLineupAttr(refreshForce)
|
| | | if not isReload and self.olPlayer.curPlayer and not self.exclusiveMapID:
|
| | | PlayerHero.Sync_Lineup(self.olPlayer.curPlayer, self.lineupID)
|
| | | return
|
| | | |
| | | def IsEmpty(self): return (not self.__lineupHeroDict or not self.heroItemDict)
|
| | | def IsEmpty(self): return not self.__lineupHeroDict
|
| | |
|
| | | def GetPosNumList(self): return self.__lineupHeroDict.keys()
|
| | |
|
| | |
| | | return False
|
| | | self.__refreshState = 0
|
| | | doRefreshLineupAttr(self.olPlayer.curPlayer, self.olPlayer, self)
|
| | | self.lineupChange = False
|
| | | return True
|
| | | |
| | | def CheckHeroItemUpdate(self, itemIndex):
|
| | | if itemIndex not in self.heroItemDict:
|
| | | return
|
| | | self.RefreshLineupAttr()
|
| | | return True
|
| | |
|
| | | class OnlinePlayer():
|
| | |
| | | # 属性、阵容
|
| | | self._calcAttrDict = {} # 功能点属性统计 {calcIndex:{attrID:value, ...}, ...}
|
| | | self._calcSpecEffDict = {} # 功能点特殊效果统计 {calcIndex:effInfo, ...}
|
| | | self._lineupDict = {} # 上阵阵容 {lineKey:Lineup, ...} lineKey 为 lineupID 或者 (lineupID, exclusiveMapID)
|
| | | self._effectiveCardDict = {} # 加成属性生效的武将卡牌信息 {heroID:[cardAddPer, itemIndex, inMain], ...}
|
| | | self._heroPresetDict = {} # 武将预设方案公共数据 {heroPresetID:PresetHero, ...}
|
| | | self._presetLineupDict = {} # 战斗预设方案阵容 {lineKey:PresetLineup, ...} lineKey 为 batPresetID 或者 (batPresetID, exclusiveMapID)
|
| | |
|
| | | # 主线战斗
|
| | | self.mainFight = TurnAttack.MainFight(playerID)
|
| | | |
| | | self._lastBatBufferInfo = [] # 最后一场战斗临时回放 ["guid", "buffer"]
|
| | | return
|
| | |
|
| | | def OnClear(self):
|
| | |
| | | ## 是否真的在线
|
| | | return self.curPlayer != None
|
| | |
|
| | | def GetLineup(self, lineupID, checkAttr=True, exclusiveMapID=0):
|
| | | def GetHeroPreset(self, heroPresetID):
|
| | | ## 武将预设方案公共数据
|
| | | if heroPresetID in self._heroPresetDict:
|
| | | heroPreset = self._heroPresetDict[heroPresetID]
|
| | | else:
|
| | | heroPreset = PresetHero(heroPresetID)
|
| | | self._heroPresetDict[heroPresetID] = heroPreset
|
| | | return heroPreset
|
| | | |
| | | def GetPresetLineup(self, batPresetID, checkAttr=True, exclusiveMapID=0):
|
| | | # @param checkAttr: 检查刷新到最新阵容属性
|
| | | lineup = None
|
| | | lineKey = lineupID
|
| | | lineKey = batPresetID
|
| | | if exclusiveMapID:
|
| | | if exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | lineKey = (lineupID, exclusiveMapID)
|
| | | lineKey = (batPresetID, exclusiveMapID)
|
| | | else:
|
| | | exclusiveMapID = 0
|
| | | if lineKey in self._lineupDict:
|
| | | lineup = self._lineupDict[lineKey]
|
| | | if lineKey in self._presetLineupDict:
|
| | | lineup = self._presetLineupDict[lineKey]
|
| | | else:
|
| | | lineup = Lineup(self.playerID, lineupID, exclusiveMapID)
|
| | | self._lineupDict[lineKey] = lineup
|
| | | lineup = PresetLineup(self.playerID, batPresetID, exclusiveMapID)
|
| | | self._presetLineupDict[lineKey] = lineup
|
| | | GameWorld.DebugLog("创建战斗方案: %s" % str(lineKey))
|
| | | |
| | | lineup.olPlayer = self
|
| | | if checkAttr:
|
| | | lineup.CheckRefreshLineupAttr()
|
| | | return lineup
|
| | |
|
| | | def GetHeroEffectiveCard(self, heroID): return self._effectiveCardDict.get(heroID, [-1, -1, False])
|
| | | def SetHeroEffectiveCard(self, heroID, cardAddPer, itemIndex, inMain):
|
| | | ## 更新某个武将生效的卡牌信息
|
| | | self._effectiveCardDict[heroID] = [cardAddPer, itemIndex, inMain]
|
| | | self.RefreshRoleAttr()
|
| | | |
| | | def SetEffectiveCardDict(self, effectiveCardDict): self._effectiveCardDict = effectiveCardDict
|
| | | def GetEffectiveCardDict(self): return self._effectiveCardDict
|
| | | |
| | | def GetCalcSpecInfo(self, calcIndex): return self._calcSpecEffDict.get(calcIndex, {})
|
| | | def GetCalcAttr(self, calcIndex): return self._calcAttrDict.get(calcIndex, {})
|
| | | def SetCalcAttr(self, calcIndex, attrDict, specEffInfo=None):
|
| | | def GetCalcSpecInfo(self, calcIndex, presetID=0):
|
| | | calcKey = (calcIndex, presetID) if presetID else calcIndex
|
| | | return self._calcSpecEffDict.get(calcKey, {})
|
| | | def GetCalcAttr(self, calcIndex, presetID=0):
|
| | | calcKey = (calcIndex, presetID) if presetID else calcIndex
|
| | | return self._calcAttrDict.get(calcKey, {})
|
| | | def SetCalcAttr(self, calcIndex, attrDict, specEffInfo=None, presetID=0):
|
| | | ## 设置某个功能点计算的属性
|
| | | # @param specEffDict: 特殊效果缓存,功能自定义数据结构
|
| | | self._calcAttrDict[calcIndex] = attrDict
|
| | | calcKey = (calcIndex, presetID) if presetID else calcIndex
|
| | | self._calcAttrDict[calcKey] = attrDict
|
| | | if specEffInfo != None:
|
| | | self._calcSpecEffDict[calcIndex] = specEffInfo
|
| | | self._calcSpecEffDict[calcKey] = specEffInfo
|
| | | return
|
| | |
|
| | | def ReCalcAllAttr(self):
|
| | |
| | |
|
| | | self._calcAttrDict = {}
|
| | | self._calcSpecEffDict = {}
|
| | | self._lineupDict = {}
|
| | | self._effectiveCardDict = {}
|
| | | self._heroPresetDict = {}
|
| | | self._presetLineupDict = {}
|
| | |
|
| | | doCalcAllAttr(curPlayer)
|
| | | doReloadLineup(curPlayer, self)
|
| | | reloadEffHeroCard(curPlayer, self)
|
| | |
|
| | | self.RefreshRoleAttr()
|
| | | #至少确保有主线战斗预设刷新,其他的可以用到再处理
|
| | | mainBatPresetID = PlayerPreset.GetBatPresetID(self.curPlayer, ShareDefine.BatPreset_Main)
|
| | | GameWorld.DebugLog("mainBatPresetID=%s" % mainBatPresetID, self.playerID)
|
| | | self.GetPresetLineup(mainBatPresetID)
|
| | | return
|
| | | |
| | | def GetHeroPresetIDList(self): return self._heroPresetDict.keys()
|
| | | def GetBatPresetIDList(self):
|
| | | presetIDList = []
|
| | | for k in self._presetLineupDict.keys():
|
| | | if isinstance(k, int):
|
| | | presetIDList.append(k)
|
| | | return presetIDList
|
| | | def GetPresetLineupDict(self): return self._presetLineupDict
|
| | | |
| | | def RefreshByFuncPreset(self, funcPresetType, funcPresetID):
|
| | | ## 刷新属性,由某个功能预设属性变更引起的刷新,需要同步刷新所有用到该功能预设的
|
| | | curPlayer = self.curPlayer
|
| | | GameWorld.DebugLog("请求刷功能预设属性变更: funcPresetType=%s,funcPresetID=%s" % (funcPresetType, funcPresetID), self.playerID)
|
| | | for presetLineup in self._presetLineupDict.values():
|
| | | batPresetID = presetLineup.batPresetID
|
| | | if funcPresetID and funcPresetID != PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, funcPresetType):
|
| | | continue
|
| | | presetLineup.RefreshLineupAttr()
|
| | | return
|
| | | |
| | | def RefreshBatPreset(self, batPresetID):
|
| | | ## 刷新某个全局战斗预设,一般是预设切换时需要重新刷新一下
|
| | | GameWorld.DebugLog("请求刷全局预设方案属性: batPresetID=%s" % (batPresetID), self.playerID)
|
| | | presetLineup = self.GetPresetLineup(batPresetID, False)
|
| | | presetLineup.RefreshLineupAttr()
|
| | | return
|
| | |
|
| | | def RefreshRoleAttr(self, refreshForce=False, isAllLineup=False, exclusiveMapID=0):
|
| | |
| | | @param refreshForce: 是否强制立马刷新
|
| | | @param isAllLineup: 是否只同步刷所有阵容属性,如果设置False则默认仅刷主阵容属性
|
| | | '''
|
| | | GameWorld.DebugLog("请求刷属性: refreshForce=%s" % (refreshForce), self.playerID)
|
| | | GameWorld.DebugLog("请求刷主公属性: refreshForce=%s,exclusiveMapID=%s" % (refreshForce, exclusiveMapID), self.playerID)
|
| | | |
| | | # 主公属性刷新时,所有阵容都要同步刷新
|
| | | for lineup in self._lineupDict.values():
|
| | | for lineup in self._presetLineupDict.values():
|
| | | if exclusiveMapID and lineup.exclusiveMapID != exclusiveMapID:
|
| | | # 有指定的话只要指定的即可
|
| | | continue
|
| | |
| | | return
|
| | |
|
| | | def DoRefreshRoleAttr(self, isAllLineup=False, exclusiveMapID=0):
|
| | | '''执行刷属性,默认额外刷主阵容,其他阵容可以用到的时候再刷新
|
| | | @param isAllLineup: 是否刷所有阵容,如果设置False则默认仅刷主阵容属性
|
| | | '''执行刷属性,默认只刷当前预设方案阵容,其他阵容可以用到的时候再刷新
|
| | | @param isAllLineup: 是否刷所有阵容,如果设置False则默认仅刷当前预设方案阵容属性
|
| | | @return: 是否有刷属性,0-无;1-有
|
| | | '''
|
| | |
|
| | | curPlayer = self.curPlayer
|
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main)
|
| | | |
| | | isRefresh = False
|
| | | # 同步执行阵容属性刷新
|
| | | for lineup in self._lineupDict.values():
|
| | | for lineup in self._presetLineupDict.values():
|
| | | if not isAllLineup:
|
| | | # 有指定的话只要指定的即可
|
| | | if exclusiveMapID:
|
| | | if lineup.exclusiveMapID != exclusiveMapID:
|
| | | continue
|
| | |
|
| | | # 否则只刷主阵容,指定地图有效的也不需要刷
|
| | | elif lineup.lineupID != ShareDefine.Lineup_Main or lineup.exclusiveMapID != 0:
|
| | | # 否则只刷当前预设方案,指定地图有效的也不需要刷
|
| | | elif lineup.batPresetID != batPresetID or lineup.exclusiveMapID != 0:
|
| | | continue
|
| | | if lineup.CheckRefreshLineupAttr():
|
| | | isRefresh = True
|
| | |
|
| | | return isRefresh
|
| | |
|
| | | def OnHeroItemUpate(self, heroItem):
|
| | | '''武将物品变化时需要处理的逻辑
|
| | | @param heroItem: 变化武将物品
|
| | | @param return: 影响的阵容ID列表
|
| | | def UpdHeroItemPreset(self, heroPresetID, heroItemDict, shapeType=0, isReload=False):
|
| | | '''变更武将预设阵容时更新
|
| | | @param heroPresetID: 武将预设ID
|
| | | @param heroItemDict: 武将背包索引信息 {itemIndex:posNum, ...}
|
| | | @param shapeType: 阵型
|
| | | @param refreshForce: 是否强制刷属性
|
| | | '''
|
| | | effLineupIDList = []
|
| | | curPlayer = self.curPlayer
|
| | | heroPreset = self.GetHeroPreset(heroPresetID)
|
| | | heroPreset.SetHeroItemPreset(curPlayer, heroItemDict, shapeType, isReload)
|
| | | self.RefreshByFuncPreset(ShareDefine.FuncPreset_Hero, heroPresetID)
|
| | |
|
| | | checkUpdEffHeroCard(self, heroItem) # 检查更新生效的卡牌
|
| | | |
| | | itemIndex = heroItem.GetItemPlaceIndex()
|
| | | for lineKey, lineup in self._lineupDict.items():
|
| | | if lineup.CheckHeroItemUpdate(itemIndex):
|
| | | if lineKey not in effLineupIDList:
|
| | | effLineupIDList.append(lineKey)
|
| | | |
| | | GameWorld.DebugLog("武将物品变化: itemIndex=%s, 影响阵容:%s" % (itemIndex, effLineupIDList), self.playerID)
|
| | | if not isReload:
|
| | | PlayerHero.Sync_HeroPreset(curPlayer, heroPresetID)
|
| | | return
|
| | |
|
| | | def GetLastBatBuffer(self): return self._lastBatBufferInfo
|
| | | def SetLastBatBuffer(self, guid, batBuffer):
|
| | | self._lastBatBufferInfo = [guid, batBuffer]
|
| | | def OnHeroItemUpate(self, heroItem):
|
| | | '''某个武将物品变化时需要处理的逻辑
|
| | | @param heroItem: 变化武将物品
|
| | | '''
|
| | | curPlayer = self.curPlayer
|
| | | itemIndex = heroItem.GetItemPlaceIndex()
|
| | | for heroPreset in self._heroPresetDict.values():
|
| | | effCardAddPerBef = heroPreset.GetEffCardAddPer()
|
| | | |
| | | checkUpdEffHeroCard(curPlayer, heroPreset, heroItem)
|
| | | |
| | | effCardAddPerAft = heroPreset.GetEffCardAddPer()
|
| | | |
| | | if effCardAddPerBef == effCardAddPerAft:
|
| | | continue
|
| | | heroPresetID = heroPreset.heroPresetID
|
| | | GameWorld.DebugLog("武将物品变化影响: itemIndex=%s,heroPresetID=%s,effCardAddPerBef=%s,effCardAddPerAft=%s" |
| | | % (itemIndex, heroPresetID, effCardAddPerBef, effCardAddPerAft), self.playerID)
|
| | | self.RefreshByFuncPreset(ShareDefine.FuncPreset_Hero, heroPresetID)
|
| | | |
| | | return
|
| | |
|
| | | class OnlineMgr():
|
| | |
| | | GetOnlinePlayer(curPlayer).SetCalcAttr(ChConfig.Def_CalcAttr_LV, lvAttrDict)
|
| | | return
|
| | |
|
| | | def checkUpdEffHeroCard(olPlayer, heroItem, isNotify=True):
|
| | | def checkUpdEffHeroCard(curPlayer, heroPreset, heroItem, isNotify=True):
|
| | | ## 玩家武将背包卡牌变更时调用
|
| | | # @return: 加成是否变更
|
| | | if not hasattr(heroItem, "GetItemPlaceIndex"):
|
| | | return
|
| | | curPlayer = olPlayer.curPlayer
|
| | | if not curPlayer:
|
| | | return
|
| | | heroPresetID = heroPreset.heroPresetID
|
| | | itemIndex = heroItem.GetItemPlaceIndex()
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | curAddPer = getHeroCardAddPer(heroItem)
|
| | | effAddPer, effItemIndex, inMain = olPlayer.GetHeroEffectiveCard(heroID)
|
| | | effAddPer, effItemIndex, inThis = heroPreset.GetHeroEffectiveCard(heroID)
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | hisEffItem = curPack.GetAt(effItemIndex) if curPack.GetCount() > effItemIndex else None
|
| | | if not hisEffItem or hisEffItem.IsEmpty():
|
| | | GameWorld.DebugLog("历史生效的物品不在了,强制设置空! effAddPer=%s,effItemIndex=%s,inMain=%s" % (effAddPer, effItemIndex, inMain))
|
| | | effAddPer, effItemIndex, inMain = -1, -1, False
|
| | | GameWorld.DebugLog("历史生效的物品不在了,强制设置空! heroPresetID=%s,effAddPer=%s,effItemIndex=%s,inThis=%s" % (heroPresetID, effAddPer, effItemIndex, inThis))
|
| | | effAddPer, effItemIndex, inThis = -1, -1, False
|
| | |
|
| | | if itemIndex == effItemIndex:
|
| | | if curAddPer == effAddPer:
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成也不变,不用处理! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成也不变,不用处理! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | return
|
| | | olPlayer.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inMain)
|
| | | heroPreset.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inThis)
|
| | | if curAddPer > effAddPer:
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成提升了! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成提升了! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | return
|
| | | if inMain:
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,但在主阵容中依旧保持生效! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | if inThis:
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,但在主阵容中依旧保持生效! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | return
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,未在主阵容中重新检索是否有加成更高的! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,未在主阵容中重新检索是否有加成更高的! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for index in range(curPack.GetCount()):
|
| | | if index == itemIndex:
|
| | |
| | | packCardPer = getHeroCardAddPer(packItem)
|
| | | if packCardPer <= curAddPer:
|
| | | continue
|
| | | GameWorld.DebugLog("有更高加成的同名武将! heroID=%s,index=%s,packCardPer=%s > curAddPer=%s" % (heroID, index, packCardPer, curAddPer))
|
| | | checkUpdEffHeroCard(olPlayer, packItem, isNotify)
|
| | | GameWorld.DebugLog("有更高加成的同名武将! heroPresetID=%s,heroID=%s,index=%s,packCardPer=%s > curAddPer=%s" % (heroPresetID, heroID, index, packCardPer, curAddPer))
|
| | | checkUpdEffHeroCard(curPlayer, heroPreset, packItem, isNotify)
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("没有更高加成的同名武将,保留本卡生效! heroID=%s,itemIndex=%s,curAddPer=%s" % (heroID, itemIndex, curAddPer))
|
| | | GameWorld.DebugLog("没有更高加成的同名武将,保留本卡生效! heroPresetID=%s,heroID=%s,itemIndex=%s,curAddPer=%s" % (heroPresetID, heroID, itemIndex, curAddPer))
|
| | | return
|
| | |
|
| | | if inMain:
|
| | | GameWorld.DebugLog("没有在主阵容中且当前生效的卡牌在主阵容中不处理! heroID=%s,effItemIndex=%s,itemIndex=%s" % (heroID, effItemIndex, itemIndex))
|
| | | if inThis:
|
| | | GameWorld.DebugLog("没有在主阵容中且当前生效的卡牌在主阵容中不处理! heroPresetID=%s,heroID=%s,effItemIndex=%s,itemIndex=%s" % (heroPresetID, heroID, effItemIndex, itemIndex))
|
| | | return
|
| | |
|
| | | if curAddPer <= effAddPer:
|
| | | GameWorld.DebugLog("都没有在主阵容中且不高于当前生效卡牌加成不处理! heroID=%s,itemIndex=%s,curAddPer=%s <= %s,effItemIndex=%s" |
| | | % (heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | GameWorld.DebugLog("都没有在主阵容中且不高于当前生效卡牌加成不处理! heroPresetID=%s,heroID=%s,itemIndex=%s,curAddPer=%s <= %s,effItemIndex=%s" |
| | | % (heroPresetID, heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | return
|
| | | GameWorld.DebugLog("都没有在主阵容中且高于当前生效卡牌加成替换生效卡牌! heroID=%s,itemIndex=%s,curAddPer=%s > %s,effItemIndex=%s" |
| | | % (heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | olPlayer.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inMain)
|
| | | GameWorld.DebugLog("都没有在主阵容中且高于当前生效卡牌加成替换生效卡牌! heroPresetID=%s,heroID=%s,itemIndex=%s,curAddPer=%s > %s,effItemIndex=%s" |
| | | % (heroPresetID, heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | heroPreset.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inThis)
|
| | |
|
| | | item = heroItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 1)
|
| | | item.AddUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | isNotify and heroItem.Sync_Item()
|
| | |
|
| | | if effItemIndex >= 0:
|
| | |
| | | hisEffItem = curPack.GetAt(effItemIndex) if curPack.GetCount() > effItemIndex else None
|
| | | if hisEffItem and not hisEffItem.IsEmpty():
|
| | | item = hisEffItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 0)
|
| | | item.DelUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | isNotify and hisEffItem.Sync_Item()
|
| | |
|
| | | return
|
| | |
|
| | | def reloadEffHeroCard(curPlayer, olPlayer):
|
| | | def reloadEffHeroCard(curPlayer, heroPreset):
|
| | | ## 重新检查载入生效的卡牌,一般用于比较复杂的情况,直接重新遍历一遍,如登录时、重新保存主阵容时
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | heroPresetID = heroPreset.heroPresetID
|
| | | hisEffCardIndexList = [] # 历史生效的卡牌 [index, ...]
|
| | | updEffectiveCardDict = {} # 更新生效的卡牌 {heroID:[cardAddPer, itemIndex, inMain], ...}
|
| | | updEffectiveCardDict = {} # 更新生效的卡牌 {heroID:[cardAddPer, itemIndex, inThis], ...}
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | GameWorld.DebugLog("重新检查载入生效的卡牌: heroPresetID=%s" % (heroPresetID), playerID)
|
| | | for index in range(curPack.GetCount()):
|
| | | heroItem = curPack.GetAt(index)
|
| | | if not heroItem or heroItem.IsEmpty():
|
| | | continue
|
| | |
|
| | | inThis = False # 是否在此预设中
|
| | | lineupCount = heroItem.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)
|
| | | for lpIndex in range(lineupCount):
|
| | | lineupValue = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | if PlayerHero.GetLineupValue(lineupValue)[0] == heroPresetID:
|
| | | inThis = True
|
| | | break
|
| | | |
| | | heroID = heroItem.GetItemTypeID()
|
| | | inMain = PlayerHero.InMainLineup(heroItem)
|
| | | cardAddPer = getHeroCardAddPer(heroItem)
|
| | | |
| | | hisEffPresetIDList = PlayerHero.GetHeroEffPresetIDList(heroItem)
|
| | | # 历史生效的
|
| | | if heroItem.GetUserAttr(ShareDefine.Def_IudetHeroCardEffective): # 是否生效的
|
| | | if heroPresetID in hisEffPresetIDList:
|
| | | hisEffCardIndexList.append(index)
|
| | |
|
| | | # 最新生效的: 主阵容中的优先生效,非主阵容中的最高加成的生效
|
| | | if inMain:
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inMain]
|
| | | if inThis:
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inThis]
|
| | | else:
|
| | | effInfo = updEffectiveCardDict.get(heroID, [-1, -1, False])
|
| | | if effInfo[2] == True:
|
| | | pass #GameWorld.Log(" 已经有在阵容中的生效卡了: index=%s" % effInfo[1])
|
| | | elif cardAddPer > effInfo[0]:
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inMain]
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inThis]
|
| | |
|
| | | # 更新生效变更的卡牌
|
| | | syncItemDict = {} # 需要同步的异常物品 {index:heroItem, ...}
|
| | | GameWorld.DebugLog("历史生效的卡牌索引: %s" % hisEffCardIndexList)
|
| | | GameWorld.DebugLog("最新生效的卡牌信息: %s" % updEffectiveCardDict)
|
| | | GameWorld.DebugLog(" 历史生效的卡牌索引: %s,%s" % (len(hisEffCardIndexList), hisEffCardIndexList), playerID)
|
| | | GameWorld.DebugLog(" 最新生效的卡牌信息: %s,%s" % (len(updEffectiveCardDict), updEffectiveCardDict), playerID)
|
| | | cardPerTotal = 0
|
| | | olPlayer.SetEffectiveCardDict(updEffectiveCardDict)
|
| | | heroPreset.SetEffectiveCardDict(updEffectiveCardDict)
|
| | | for heroID, effInfo in updEffectiveCardDict.items():
|
| | | cardAddPer, itemIndex, inMain = effInfo
|
| | | cardAddPer, itemIndex, inThis = effInfo
|
| | | cardPerTotal += cardAddPer
|
| | | if itemIndex in hisEffCardIndexList:
|
| | | hisEffCardIndexList.remove(itemIndex) # 不变的直接移除,剩余未移除的就是失效的
|
| | | #GameWorld.DebugLog("生效的卡牌不变的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
|
| | | #GameWorld.DebugLog(" 生效的卡牌不变的: heroID=%s,itemIndex=%s,inThis=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inThis, cardAddPer, cardPerTotal), playerID)
|
| | | else:
|
| | | GameWorld.DebugLog("生效的卡牌变化的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
|
| | | GameWorld.DebugLog(" 生效的卡牌变化的: heroID=%s,itemIndex=%s,inThis=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inThis, cardAddPer, cardPerTotal), playerID)
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | item = heroItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 1)
|
| | | item.AddUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | syncItemDict[itemIndex] = heroItem
|
| | |
|
| | | # 移除历史失效的卡牌
|
| | | GameWorld.DebugLog("移除失效的卡牌索引: %s" % hisEffCardIndexList)
|
| | | GameWorld.DebugLog(" 移除失效的卡牌索引: %s" % hisEffCardIndexList, playerID)
|
| | | for itemIndex in hisEffCardIndexList:
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | item = heroItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 0)
|
| | | item.DelUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | syncItemDict[itemIndex] = heroItem
|
| | |
|
| | | GameWorld.DebugLog(" 最终生效卡牌加成: %s,heroPresetID=%s" % (cardPerTotal, heroPresetID), playerID)
|
| | | |
| | | # 同步变更的物品
|
| | | for syncItem in syncItemDict.values():
|
| | | syncItem.Sync_Item()
|
| | |
| | | return addPer
|
| | |
|
| | | def doReloadLineup(curPlayer, olPlayer):
|
| | | ## 重新载入阵容 |
| | | loadLineupIDList = ShareDefine.LineupList
|
| | | lineupDict = {} # {阵容ID:{itemIndex:posNum, ...}, ...}
|
| | | lineShapeTypeDict = {} # {阵容ID:阵型, ...}
|
| | | ## 重新载入阵容
|
| | | herpPresetIpyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", ShareDefine.FuncPreset_Hero)
|
| | | if not herpPresetIpyDataList:
|
| | | return
|
| | | presetIDMax = len(herpPresetIpyDataList) # 最大可用的武将阵容方案ID
|
| | | funcPresetType = ShareDefine.FuncPreset_Hero
|
| | | presetDict = {} # {预设ID:{itemIndex:posNum, ...}, ...}
|
| | | shapeTypeDict = {} # {预设ID:阵型, ...}
|
| | | syncItemDict = {} # 需要同步的异常物品 {index:heroItem, ...}
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for index in range(curPack.GetCount()):
|
| | |
| | | delValueList = []
|
| | | for lpIndex in range(lineupCount)[::-1]:
|
| | | lineupValue = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID, shapeType, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID not in loadLineupIDList:
|
| | | heroPresetID, shapeType, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if not heroPresetID or heroPresetID > presetIDMax or not PlayerPreset.GetFuncPresetIDState(curPlayer, heroPresetID, funcPresetType):
|
| | | GameWorld.DebugLog("异常或不可用的武将预设方案ID: index=%s,heroPresetID=%s,lineupValue=%s" % (index, heroPresetID, lineupValue))
|
| | | delValueList.append(lineupValue)
|
| | | continue
|
| | | # 任意取一个武将保存的阵型即可,同阵容的武将理论上保存的阵型是一样的
|
| | | if lineupID not in lineShapeTypeDict:
|
| | | lineShapeTypeDict[lineupID] = shapeType
|
| | | if lineupID not in lineupDict:
|
| | | lineupDict[lineupID] = {}
|
| | | heroItemDict = lineupDict[lineupID]
|
| | | if heroPresetID not in shapeTypeDict:
|
| | | shapeTypeDict[heroPresetID] = shapeType
|
| | | if heroPresetID not in presetDict:
|
| | | presetDict[heroPresetID] = {}
|
| | | heroItemDict = presetDict[heroPresetID]
|
| | |
|
| | | # 超出人数限制或位置异常
|
| | | if len(heroItemDict) >= ShareDefine.LineupObjMax or posNum in heroItemDict.values() or index in heroItemDict:
|
| | |
| | | for syncItem in syncItemDict.values():
|
| | | syncItem.Sync_Item()
|
| | |
|
| | | GameWorld.DebugLog("重载阵容: %s" % lineupDict, curPlayer.GetPlayerID())
|
| | | for lineupID, heroItemDict in lineupDict.items():
|
| | | lineup = olPlayer.GetLineup(lineupID, False)
|
| | | GameWorld.DebugLog("重载武将预设阵容: %s" % presetDict, curPlayer.GetPlayerID())
|
| | | for heroPresetID, heroItemDict in presetDict.items():
|
| | | shapeType = shapeTypeDict.get(heroPresetID, 0)
|
| | | olPlayer.UpdHeroItemPreset(heroPresetID, heroItemDict, shapeType, isReload=True)
|
| | |
|
| | | # 获取其他绑定该阵容的功能,如红颜、灵兽等
|
| | | |
| | | shapeType = lineShapeTypeDict.get(lineupID, 0)
|
| | | lineup.UpdLineup(heroItemDict, shapeType, isReload=True)
|
| | | |
| | | if lineupID == ShareDefine.Lineup_Main:
|
| | | for exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | exclusiveLineup = olPlayer.GetLineup(lineupID, False, exclusiveMapID=exclusiveMapID)
|
| | | exclusiveLineup.UpdLineup(heroItemDict, shapeType, isReload=True)
|
| | | |
| | | PlayerHero.Sync_Lineup(curPlayer)
|
| | | PlayerHero.Sync_HeroPreset(curPlayer)
|
| | | return
|
| | |
|
| | | def doCalcAllAttr(curPlayer):
|
| | |
| | | GameLogic_Dingjunge.CalcDingjungeAttr(curPlayer)
|
| | | return
|
| | |
|
| | | def doRefreshLineupAttr(curPlayer, olPlayer, lineup):
|
| | | def doRefreshLineupAttr(curPlayer, olPlayer, presetLineup):
|
| | | ''' 刷新某个阵容属性
|
| | | 基础属性-面板显示:
|
| | | 1.全体基础固定值=所有穿戴装备【装备基础固定值】+【法宝基础固定值】+【红颜基础固定值】+【其它模块的固定值】
|
| | |
| | | 最终面板战斗属性=【E全体战斗属性值】*【卡牌继承比例】+【卡牌自身培养战斗属性】
|
| | | '''
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | lineupID = lineup.lineupID
|
| | | exclusiveMapID = lineup.exclusiveMapID
|
| | | batPresetID = presetLineup.batPresetID
|
| | | exclusiveMapID = presetLineup.exclusiveMapID
|
| | |
|
| | | GameWorld.DebugLog("刷新阵容属性: lineupID=%s,exclusiveMapID=%s" % (lineupID, exclusiveMapID), playerID)
|
| | | GameWorld.DebugLog(" itemIndex-posNum : %s" % lineup.heroItemDict, playerID)
|
| | | heroPresetID = PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, ShareDefine.FuncPreset_Hero)
|
| | | mgPresetID = PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, ShareDefine.FuncPreset_Mingge)
|
| | |
|
| | | lineup.FreeLineupHero()
|
| | | heroPreset = olPlayer.GetHeroPreset(heroPresetID)
|
| | | heroItemDict = heroPreset.heroItemDict
|
| | | |
| | | GameWorld.DebugLog("刷新战斗预设方案属性: batPresetID=%s,exclusiveMapID=%s" % (batPresetID, exclusiveMapID), playerID)
|
| | | GameWorld.DebugLog(" heroPresetID=%s,itemIndex-posNum : %s" % (heroPresetID, heroItemDict), playerID)
|
| | | |
| | | presetLineup.FreeLineupHero()
|
| | |
|
| | | # 因为同阵容的武将ID不能重复,所以字典key可以用武将ID
|
| | | countryHeroInfo = {} # 国家武将统计 {country:[heroID, ...], ...}
|
| | |
| | | heroAwakeTalentInfo = {} # 武将觉醒天赋属性 {heroID:{attrID:value, ...}, ...}
|
| | |
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for itemIndex, posNum in lineup.heroItemDict.items():
|
| | | for itemIndex, posNum in heroItemDict.items():
|
| | | if itemIndex < 0 or itemIndex >= curPack.GetCount():
|
| | | continue
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | |
| | | elif skinIDList:
|
| | | skinID = skinIDList[0]
|
| | |
|
| | | lineupHero = lineup.GetLineupHero(posNum)
|
| | | lineupHero = presetLineup.GetLineupHero(posNum)
|
| | | #if False:
|
| | | # lineupHero = LineupHero()
|
| | | lineupHero.itemIndex = itemIndex
|
| | |
| | | hjgAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_HJG)
|
| | | horseAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Horse)
|
| | | beautyAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Beauty)
|
| | | minggeAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Mingge, mgPresetID)
|
| | | dingjungeAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Dingjunge) if exclusiveMapID == ChConfig.Def_FBMapID_Dingjunge else {}
|
| | |
|
| | | GameWorld.DebugLog(" 国家武将统计=%s" % countryHeroInfo, playerID)
|
| | |
| | | GameWorld.DebugLog(" 主幻境阁属性=%s" % hjgAttrDict, playerID)
|
| | | GameWorld.DebugLog(" 主公坐骑属性=%s" % horseAttrDict, playerID)
|
| | | GameWorld.DebugLog(" 主公红颜属性=%s" % beautyAttrDict, playerID)
|
| | | GameWorld.DebugLog(" 主公命格属性=%s,mgPresetID=%s" % (minggeAttrDict, mgPresetID), playerID)
|
| | | GameWorld.DebugLog(" 定军专属属性=%s" % dingjungeAttrDict, playerID)
|
| | | |
| | | effCardAddPer = 0
|
| | | for effInfo in olPlayer.GetEffectiveCardDict().values():
|
| | | effCardAddPer += effInfo[0]
|
| | | effCardAddPer = heroPreset.GetEffCardAddPer()
|
| | | effCardAddPer /= 10000.0
|
| | | GameWorld.DebugLog(" 主公卡牌加成=%s" % effCardAddPer, playerID)
|
| | |
|
| | |
| | |
|
| | | lineupFightPower = 0 # 阵容总战力
|
| | | for heroID, selfAttrDict in heroSelfAttrInfo.items():
|
| | | lineupHero = lineup.GetLineupHeroByID(heroID)
|
| | | lineupHero = presetLineup.GetLineupHeroByID(heroID)
|
| | | if not lineupHero:
|
| | | continue
|
| | | lineupHero.heroBatAttrDict = {}
|
| | |
| | | beautyValue = beautyAttrDict.get(attrID, 0)
|
| | | beautyPer = beautyAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
|
| | |
|
| | | minggeValue = minggeAttrDict.get(attrID, 0)
|
| | | minggePer = minggeAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
|
| | | |
| | | dingjungeValue = dingjungeAttrDict.get(attrID, 0)
|
| | | dingjungePer = dingjungeAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
|
| | |
|
| | |
| | |
|
| | | # 计算
|
| | | attrParamDict = {"lvValue":lvValue, "equipValue":equipValue, "realmValue":realmValue, "realmPer":realmPer, "cardPer":cardPer,
|
| | | "gubaoValue":gubaoValue, "gubaoPer":gubaoPer, "hjgValue":hjgValue, "hjgPer":hjgPer, "horseValue":horseValue, "horsePer":horsePer, |
| | | "gubaoValue":gubaoValue, "gubaoPer":gubaoPer, "hjgValue":hjgValue, "hjgPer":hjgPer, "horseValue":horseValue, "horsePer":horsePer,
|
| | | "beautyValue":beautyValue, "beautyPer":beautyPer, "fatesValue":fatesValue, "fatesPer":fatesPer,
|
| | | "dingjungeValue":dingjungeValue, "dingjungePer":dingjungePer,
|
| | | "dingjungeValue":dingjungeValue, "dingjungePer":dingjungePer, "minggeValue":minggeValue, "minggePer":minggePer,
|
| | | "heroSelfValue":heroSelfValue, "heroSelfPer":heroSelfPer, "inheritPer":inheritPer, "heroLVValue":heroLVValue, "heroLVPer":heroLVPer,
|
| | | "lineupHaloValue":lineupHaloValue, "lineupHaloPer":lineupHaloPer, "fetterValue":fetterValue, "fetterPer":fetterPer,
|
| | | "starTalentValue":starTalentValue, "starTalentPer":starTalentPer, "breakLVValue":breakLVValue, "breakLVPer":breakLVPer,
|
| | |
| | | GameWorld.DebugLog(" 武将最终战力: heroID=%s,fightPower=%s(%s+%s),%s,skillIDList=%s"
|
| | | % (heroID, fightPowerTotal, fightPower, skillFightPower, logAttrDict, lineupHero.heroSkillIDList), playerID)
|
| | |
|
| | | lineup.fightPower = lineupFightPower
|
| | | GameWorld.DebugLog(" 阵容最终战力: lineupID=%s,lineupFightPower=%s,exclusiveMapID=%s" % (lineupID, lineupFightPower, exclusiveMapID), playerID)
|
| | | presetLineup.fightPower = lineupFightPower
|
| | | GameWorld.DebugLog(" 阵容最终战力: batPresetID=%s,lineupFightPower=%s,exclusiveMapID=%s" % (batPresetID, lineupFightPower, exclusiveMapID), playerID)
|
| | |
|
| | | # 非主线阵容不处理以下内容
|
| | | if lineupID != ShareDefine.Lineup_Main or exclusiveMapID:
|
| | | # 非主线预设方案不处理以下内容
|
| | | if exclusiveMapID or batPresetID != PlayerPreset.GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main):
|
| | | return
|
| | |
|
| | | PlayerControl.SetFightPower(curPlayer, lineupFightPower)
|
| | |
| | | # 主线战斗如果有在战斗中,实时更新
|
| | | if mainTurnFight and mainTurnFight.isInFight():
|
| | | # 如果是阵容变化的,重新开始战斗
|
| | | if lineup.lineupChange:
|
| | | GameWorld.DebugLog("主阵容变化,重新开始战斗", playerID)
|
| | | if heroPreset.isHeroChange:
|
| | | heroPreset.isHeroChange = False
|
| | | GameWorld.DebugLog("主线阵容变化,重新开始战斗", playerID)
|
| | | if mainTurnFight.mapID == ChConfig.Def_FBMapID_Main:
|
| | | TurnAttack.__doMainLevelWave(curPlayer, True)
|
| | |
|
| | | # 否则只重新设置战斗属性
|
| | | else:
|
| | | GameWorld.DebugLog("主阵容卡牌属性变更,更新战斗武将属性", playerID)
|
| | | GameWorld.DebugLog("主线阵容卡牌属性变更,更新战斗武将属性", playerID)
|
| | | # lineup 为卡牌的阵容,仅有阵容属性相关,没有战斗对象
|
| | | # batLineup 为卡牌阵容体现到具体战斗的战斗阵容,有具体的战斗对象
|
| | | faction, num = ChConfig.Def_FactionA, 1 # 主线战斗玩家自己默认阵营A的第1个战斗阵容
|
| | |
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | lineupHero = lineup.GetLineupHero(posNum)
|
| | | lineupHero = presetLineup.GetLineupHero(posNum)
|
| | | if lineupHero.heroBatAttrDict:
|
| | | batObj.UpdInitBatAttr(lineupHero.heroBatAttrDict, lineupHero.heroSkillIDList)
|
| | | else:
|
| | | GameWorld.DebugLog("主阵容没有在战斗中,不需要处理", playerID)
|
| | | GameWorld.DebugLog("主线阵容没有在战斗中,不需要处理", playerID)
|
| | |
|
| | | PlayerFamily.RefreshFamilyMember(curPlayer) # 更新公会
|
| | | # 更新排行榜
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.PlayerPreset
|
| | | #
|
| | | # @todo:流派预设
|
| | | # @author hxp
|
| | | # @date 2026-01-16
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 流派预设
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2026-01-16 20:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import DBDataMgr
|
| | | import ShareDefine
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import ChPyNetSendPack
|
| | | import IPY_GameWorld
|
| | | import NetPackCommon
|
| | | import PlayerOnline
|
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | PresetKey_Name = "Name" # 预设命名信息 {"funcPresetType":{"presetID":名字, ...}, ...}
|
| | |
|
| | | def GetPresetRecDict(playerID, isAddNew=False):
|
| | | ## 获取预设记录存储的字典
|
| | | gameRecMgr = DBDataMgr.GetGameRecMgr()
|
| | | preSetRecMgr = gameRecMgr.GetRecTypeIDMgr(ShareDefine.Def_GameRecType_BatPreset, playerID) |
| | | recData = preSetRecMgr.GetOneRecData(isAddNew)
|
| | | if not recData:
|
| | | return {}
|
| | | return recData.GetUserDict()
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | # 检查预设默认解锁
|
| | | Sync_FuncPresetInfo(curPlayer)
|
| | | Sync_FuncPresetSwitchInfo(curPlayer)
|
| | | Sync_BatPresetSwitchInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def GetFuncPresetIDState(curPlayer, presetID, funcPresetType=ShareDefine.FuncPreset_Battle):
|
| | | ## 获取功能预设ID是否可用
|
| | | # @param presetID: 预设ID
|
| | | # @param funcPresetType: 预设类型
|
| | | presetState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PresetState % funcPresetType)
|
| | | if presetState & pow(2, presetID):
|
| | | return True
|
| | | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", funcPresetType)
|
| | | if not ipyDataList:
|
| | | return
|
| | | if presetID > len(ipyDataList):
|
| | | return
|
| | | ipyData = ipyDataList[presetID - 1]
|
| | | if ipyData.GetUnlockType():
|
| | | # 非默认解锁的
|
| | | return
|
| | | presetState |= pow(2, presetID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetState % funcPresetType, presetState)
|
| | | return True
|
| | |
|
| | | #// B2 60 功能预设解锁 #tagCSFuncPresetUnlock
|
| | | #
|
| | | #struct tagCSFuncPresetUnlock
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE FuncPresetType; //预设类型,1-全局;2-阵容;3-命格;
|
| | | # BYTE PresetID; //预设ID
|
| | | #};
|
| | | def OnFuncPresetUnlock(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | funcPresetType = clientData.FuncPresetType
|
| | | presetID = clientData.PresetID
|
| | | |
| | | if GetFuncPresetIDState(curPlayer, presetID, funcPresetType):
|
| | | GameWorld.DebugLog("该预设已解锁! funcPresetType=%s,presetID=%s" % (funcPresetType, presetID))
|
| | | return
|
| | | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", funcPresetType)
|
| | | if not ipyDataList:
|
| | | return
|
| | | if presetID > len(ipyDataList):
|
| | | GameWorld.DebugLog("该预设不存在! funcPresetType=%s,presetID=%s" % (funcPresetType, presetID))
|
| | | return
|
| | | ipyData = ipyDataList[presetID - 1]
|
| | | |
| | | unlockType = ipyData.GetUnlockType()
|
| | | unlockValue = ipyData.GetUnlockValue()
|
| | | |
| | | # 元宝解锁
|
| | | if unlockType == 1:
|
| | | needGold = unlockValue
|
| | | infoDict = {"funcPresetType":funcPresetType, "presetID":presetID}
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold, "FuncPresetUnlock", infoDict):
|
| | | return
|
| | | else:
|
| | | return
|
| | | |
| | | presetState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PresetState % funcPresetType)
|
| | | presetState |= pow(2, presetID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetState % funcPresetType, presetState)
|
| | | GameWorld.DebugLog("功能预设解锁: funcPresetType=%s,presetID=%s,presetState=%s" % (funcPresetType, presetID, presetState))
|
| | | Sync_FuncPresetInfo(curPlayer, funcPresetType, presetID)
|
| | | |
| | | # 全局预设新开方案,初始化预设默认,直接使用主线预设拷贝
|
| | | # 子功能的方案解锁暂不处理,由玩家手动编辑
|
| | | if funcPresetType == ShareDefine.FuncPreset_Battle:
|
| | | mainBatPresetID = GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main)
|
| | | GameWorld.DebugLog("新增全局预设直接使用主线预设拷贝子功能预设! mainBatPresetID=%s" % mainBatPresetID)
|
| | | for funcPresetType in ShareDefine.FuncPresetList:
|
| | | if funcPresetType == ShareDefine.FuncPreset_Battle:
|
| | | continue
|
| | | funcPresetID = GetFuncPresetID(curPlayer, mainBatPresetID, funcPresetType)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetFuncID % (presetID, funcPresetType), funcPresetID)
|
| | | GameWorld.DebugLog(" funcPresetType=%s,funcPresetID=%s" % (funcPresetType, funcPresetID))
|
| | | Sync_FuncPresetSwitchInfo(curPlayer, presetID)
|
| | | |
| | | return
|
| | |
|
| | | #// B2 61 功能预设改名 #tagCSFuncPresetUpdName
|
| | | #
|
| | | #struct tagCSFuncPresetUpdName
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE FuncPresetType; //预设类型,1-全局;2-阵容;3-命格;
|
| | | # BYTE PresetID; //预设ID
|
| | | # BYTE NameLen; |
| | | # char PresetName[NameLen]; //预设名称
|
| | | #};
|
| | | def OnFuncPresetUpdName(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | funcPresetType = clientData.FuncPresetType
|
| | | presetID = clientData.PresetID
|
| | | presetName = clientData.PresetName
|
| | | |
| | | if not GetFuncPresetIDState(curPlayer, presetID, funcPresetType):
|
| | | return
|
| | | |
| | | # 更新名称 {"funcPresetType":{"presetID":名字, ...}, ...}
|
| | | userDict = GetPresetRecDict(playerID, True)
|
| | | if PresetKey_Name not in userDict:
|
| | | userDict[PresetKey_Name] = {}
|
| | | presetNameDict = userDict[PresetKey_Name]
|
| | | if str(funcPresetType) not in presetNameDict:
|
| | | presetNameDict[str(funcPresetType)] = {}
|
| | | funcPresetNameDict = presetNameDict[str(funcPresetType)]
|
| | | funcPresetNameDict[str(presetID)] = presetName
|
| | | |
| | | Sync_FuncPresetInfo(curPlayer, funcPresetType, presetID)
|
| | | return
|
| | |
|
| | | #// B2 62 功能预设切换 #tagCSFuncPresetSwitch
|
| | | #
|
| | | #struct tagCSFuncPresetSwitch
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE BatPresetID; //所属战斗预设ID
|
| | | # BYTE FuncPresetType; //预设类型,2-阵容;3-命格;
|
| | | # BYTE PresetID; //本功能切换至目标预设ID
|
| | | #};
|
| | | def OnFuncPresetSwitch(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | batPresetID = clientData.BatPresetID
|
| | | funcPresetType = clientData.FuncPresetType
|
| | | funcPresetID = clientData.PresetID
|
| | | |
| | | if funcPresetType == ShareDefine.FuncPreset_Battle:
|
| | | GameWorld.DebugLog("全局战斗预设不在此修改,请使用B263封包修改全局预设方案! funcPresetType=%s" % (funcPresetType))
|
| | | return
|
| | | |
| | | if not GetFuncPresetIDState(curPlayer, batPresetID):
|
| | | GameWorld.DebugLog("全局预设未解锁! batPresetID=%s" % batPresetID)
|
| | | return
|
| | | |
| | | if not GetFuncPresetIDState(curPlayer, funcPresetID, funcPresetType):
|
| | | GameWorld.DebugLog("功能预设未解锁! funcPresetID=%s,funcPresetType=%s" % (funcPresetID, funcPresetType))
|
| | | return
|
| | | |
| | | if GetFuncPresetID(curPlayer, batPresetID, funcPresetType) == funcPresetID:
|
| | | GameWorld.DebugLog("功能预设不变不处理! batPresetID=%s,funcPresetType=%s,funcPresetID=%s" % (batPresetID, funcPresetType, funcPresetID))
|
| | | return
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetFuncID % (batPresetID, funcPresetType), funcPresetID)
|
| | | GameWorld.DebugLog("功能预设方案切换: batPresetID=%s,funcPresetType=%s,funcPresetID=%s" % (batPresetID, funcPresetType, funcPresetID))
|
| | | |
| | | # 刷属性
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).RefreshBatPreset(batPresetID)
|
| | | |
| | | Sync_FuncPresetSwitchInfo(curPlayer, batPresetID, funcPresetType)
|
| | | return
|
| | |
|
| | | #// B2 63 战斗预设切换 #tagCSBatPresetSwitch
|
| | | #
|
| | | #struct tagCSBatPresetSwitch
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE BatPresetType; //战斗预设类型:1-主线战斗;2-演武场防守;
|
| | | # BYTE BatPresetID; //切换至目标战斗预设ID
|
| | | #};
|
| | | def OnBatPresetSwitch(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | batPresetType = clientData.BatPresetType
|
| | | batPresetID = clientData.BatPresetID
|
| | | |
| | | if batPresetType not in ShareDefine.BatPresetList:
|
| | | return
|
| | | |
| | | if not GetFuncPresetIDState(curPlayer, batPresetID):
|
| | | GameWorld.DebugLog("全局战斗预设未解锁! batPresetID=%s" % batPresetID)
|
| | | return
|
| | | |
| | | if GetBatPresetID(curPlayer, batPresetType) == batPresetID:
|
| | | GameWorld.DebugLog("全局战斗预设不变不处理! batPresetType=%s,batPresetID=%s" % (batPresetType, batPresetID))
|
| | | return
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_PresetBatID % batPresetType, batPresetID)
|
| | | GameWorld.DebugLog("全局战斗预设方案切换: batPresetType=%s,batPresetID=%s" % (batPresetType, batPresetID))
|
| | | |
| | | # 刷属性
|
| | | PlayerOnline.GetOnlinePlayer(curPlayer).RefreshBatPreset(batPresetID)
|
| | | |
| | | Sync_BatPresetSwitchInfo(curPlayer, batPresetType)
|
| | | return
|
| | |
|
| | | def GetBatPresetID(curPlayer, batPresetType):
|
| | | ## 获取战斗功能当前使用中的战斗预设方案,默认1
|
| | | return max(1, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PresetBatID % batPresetType))
|
| | |
|
| | | def GetFuncPresetID(curPlayer, batPresetID, funcPresetType):
|
| | | ## 获取某个战斗预设方案下某个功能使用的预设ID,默认1
|
| | | return max(1, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PresetFuncID % (batPresetID, funcPresetType)))
|
| | |
|
| | | def Sync_FuncPresetInfo(curPlayer, funcPresetType=None, presetID=None):
|
| | | |
| | | if funcPresetType == None:
|
| | | presetTypeList = ShareDefine.FuncPresetList
|
| | | else:
|
| | | presetTypeList = [funcPresetType]
|
| | | |
| | | funcPresetList = []
|
| | | for presetType in presetTypeList:
|
| | | funcPresetInfo = ChPyNetSendPack.tagSCFuncPresetInfo()
|
| | | funcPresetInfo.FuncPresetType = presetType
|
| | | |
| | | presetIDList = []
|
| | | if funcPresetType == None and presetID == None:
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", presetType)
|
| | | presetIDList = range(1, 1 + len(ipyDataList)) if ipyDataList else []
|
| | | elif presetID != None:
|
| | | presetIDList = [presetID]
|
| | | |
| | | presetNameDict = {}
|
| | | if presetIDList:
|
| | | userDict = GetPresetRecDict(curPlayer.GetPlayerID())
|
| | | presetNameDict = userDict.get(PresetKey_Name, {})
|
| | | |
| | | funcPresetInfo.PresetList = []
|
| | | for psID in presetIDList:
|
| | | if presetID == None and not GetFuncPresetIDState(curPlayer, psID, presetType):
|
| | | continue
|
| | | preset = ChPyNetSendPack.tagSCFuncPreset()
|
| | | preset.PresetID = psID
|
| | | preset.PresetName = presetNameDict.get(str(presetType), {}).get(str(psID), "")
|
| | | preset.NameLen = len(preset.PresetName)
|
| | | funcPresetInfo.PresetList.append(preset)
|
| | | |
| | | funcPresetInfo.PresetCnt = len(funcPresetInfo.PresetList)
|
| | | funcPresetInfo.UnlockState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_PresetState % presetType)
|
| | | funcPresetList.append(funcPresetInfo)
|
| | | |
| | | if not funcPresetList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagSCFuncPresetInfoList()
|
| | | clientPack.FuncPresetList = funcPresetList
|
| | | clientPack.FuncCnt = len(clientPack.FuncPresetList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def Sync_FuncPresetSwitchInfo(curPlayer, batPresetID=None, funcPresetType=None):
|
| | | if batPresetID == None:
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", ShareDefine.FuncPreset_Battle)
|
| | | batPresetIDList = range(1, 1 + len(ipyDataList)) if ipyDataList else []
|
| | | else:
|
| | | batPresetIDList = [batPresetID]
|
| | | |
| | | batPresetList = []
|
| | | for batPresetID in batPresetIDList:
|
| | | if not GetFuncPresetIDState(curPlayer, batPresetID):
|
| | | continue
|
| | | batPreset = ChPyNetSendPack.tagSCFuncPresetBat()
|
| | | batPreset.BatPresetID = batPresetID
|
| | | |
| | | batPreset.FuncPresetList = []
|
| | | for funcType in ShareDefine.FuncPresetList:
|
| | | if funcType == ShareDefine.FuncPreset_Battle:
|
| | | continue
|
| | | if funcPresetType and funcPresetType != funcType:
|
| | | continue
|
| | | funcPreset = ChPyNetSendPack.tagSCFuncPresetFunc()
|
| | | funcPreset.FuncPresetType = funcType
|
| | | funcPreset.FuncPresetID = GetFuncPresetID(curPlayer, batPresetID, funcType)
|
| | | batPreset.FuncPresetList.append(funcPreset)
|
| | | batPreset.FuncCnt = len(batPreset.FuncPresetList)
|
| | | batPresetList.append(batPreset)
|
| | | |
| | | if not batPresetList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagSCFuncPresetSwitchInfo()
|
| | | clientPack.BatPresetList = batPresetList
|
| | | clientPack.BatPresetCnt = len(clientPack.BatPresetList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def Sync_BatPresetSwitchInfo(curPlayer, batPresetType=None):
|
| | | |
| | | if not batPresetType:
|
| | | batPresetTypeList = ShareDefine.BatPresetList
|
| | | else:
|
| | | batPresetTypeList = [batPresetType]
|
| | | |
| | | batPresetList = []
|
| | | for batPresetType in batPresetTypeList:
|
| | | batPreset = ChPyNetSendPack.tagSCBatPresetSwitch()
|
| | | batPreset.BatPresetType = batPresetType
|
| | | batPreset.BatPresetID = GetBatPresetID(curPlayer, batPresetType)
|
| | | batPresetList.append(batPreset)
|
| | | |
| | | if not batPresetList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagSCBatPresetSwitchInfo()
|
| | | clientPack.BatPresetList = batPresetList
|
| | | clientPack.BatFuncCnt = len(clientPack.BatPresetList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
| | | import IpyGameDataPY
|
| | | import IPY_GameWorld
|
| | | import PlayerOnline
|
| | | import PlayerPreset
|
| | | import PlayerBeauty
|
| | | import PlayerGubao
|
| | | import ShareDefine
|
| | | import TurnAttack
|
| | | import DBDataMgr
|
| | |
| | | return True
|
| | |
|
| | | return False
|
| | |
|
| | | def GetLineupFightPower(curCache, lineupID):
|
| | | ## 获取查看缓存中某个阵容对应的战力
|
| | | if not curCache:
|
| | | return 0
|
| | | plusDict = curCache.GetPlusDict()
|
| | | if "Lineup" in plusDict:
|
| | | lineupDict = plusDict["Lineup"]
|
| | | if str(lineupID) in lineupDict:
|
| | | lineupInfo = lineupDict[str(lineupID)]
|
| | | if "FightPower" in lineupInfo:
|
| | | return lineupInfo["FightPower"]
|
| | | return curCache.GetFightPowerTotal()
|
| | |
|
| | | def FindBattleViewCache(playerID):
|
| | | ## 获取可战斗的玩家缓存
|
| | |
| | | continue
|
| | | equipDict["%s" % equipIndex] = {"ItemID":curEquip.GetItemTypeID(), "UserData":curEquip.GetUserData()}
|
| | |
|
| | | # 阵容
|
| | | lineupDict = {}
|
| | | for lineupID in ShareDefine.NeedViewCacheLineupIDList:
|
| | | 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}
|
| | | |
| | | # 古宝:数量、属性
|
| | | 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)
|
| | |
| | | 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, "Lineup":lineupDict, "Beauty":beautyDict, "Horse":horseDict}
|
| | | plusDict = {"Equip":equipDict, "BatPreset":batPresetDict, "Lineup":lineupDict, "Mingge":minggeDict, |
| | | "Beauty":beautyDict, "Horse":horseDict, "Gubao":gubaoDict}
|
| | | curCache.SetPlusDict(plusDict)
|
| | |
|
| | | return curCache
|
| | |
| | | Def_GameRecType_TalkCache, # 聊天缓存,频道 306
|
| | | Def_GameRecType_PlayerOfflineUnprocessed, # 离线玩家待处理事件,playerID 307
|
| | | Def_GameRecType_ArenaRecord, # 演武场玩家挑战记录,playerID 308
|
| | | ) = range(300, 1 + 308)
|
| | | Def_GameRecType_BatPreset, # 战斗方案预设额外存储信息,playerID 309
|
| | | ) = range(300, 1 + 309)
|
| | | #通用信息记录新 - 字典key配置,如果有配置,则可额外按对应记录Value值存储字典,方便快速取值,可配置Value编号 1~8,配空默认 Value1
|
| | | Def_GameRecValueKeyDict = {
|
| | | Def_GameRecType_Xiangong:[1],
|
| | | }
|
| | | #仅查看自己的记录
|
| | | Def_ViewGameRecSelfList = [Def_GameRecType_ArenaRecord]
|
| | | Def_ViewGameRecSelfList = [Def_GameRecType_ArenaRecord, Def_GameRecType_BatPreset]
|
| | |
|
| | | #UserData不使用json的记录类型
|
| | | UserDataNOJsonRecTypeList = []
|
| | |
|
| | | #通用信息记录类型
|
| | | Def_UniversalGameRecTypeList = (
|
| | |
| | | Def_IudetHeroTalentWashID = 77 # 英雄天赋洗炼随机ID列表
|
| | | Def_IudetHeroTalentIDAwakeRand = 79 # 英雄觉醒时随机天赋选项ID列表
|
| | | Def_IudetHeroLineup = 81 # 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...]
|
| | | Def_IudetHeroEffPresetID = 83 # 卡牌有生效的预设ID [预设ID, ...]
|
| | |
|
| | | Def_IudetItemColor = 16 # 物品颜色,如果该值没有就取物品
|
| | | #Def_IudetItemCount = 18 # 物品个数,支持20亿,目前仅特殊转化物品会用到
|
| | |
| | | Def_IudetHeroBreakLV = 74 # 英雄突破等级
|
| | | Def_IudetHeroAwakeLV = 76 # 英雄觉醒等级
|
| | | Def_IudetHeroSkin = 78 # 英雄使用的皮肤索引
|
| | | Def_IudetHeroCardEffective = 80 # 卡牌加成是否生效的,每个武将仅有一张卡牌生效
|
| | | Def_IudetHeroCardEffective = 80 # 卡牌在主线预设中生效标识,每个武将在某一阵容预设中仅有一张卡牌生效,废弃,使用 Def_IudetHeroEffPresetID 代替
|
| | |
|
| | | # 200~300 宠物数据用
|
| | | Def_IudetPet_NPCID = 200 # npcID
|
| | |
| | |
|
| | | LineupObjMax = 6 # 阵容最大上阵武将数
|
| | |
|
| | | # 阵容定义,主动进攻阵容只使用主阵容,功能可以有指定的阵容,如防守阵容、系统PK阵容等
|
| | | LineupList = (
|
| | | Lineup_Main, # 主阵容 1
|
| | | Lineup_2, # 废弃
|
| | | Lineup_ArenaDef, # 竞技场防守阵容 3
|
| | | ) = range(1, 1 + 3)
|
| | | # 战斗功能预设定义
|
| | | BatPresetList = (
|
| | | BatPreset_Main, # 主线战斗 1
|
| | | BatPreset_ArenaDef, # 演武场防守 2
|
| | | ) = range(1, 1 + 2)
|
| | |
|
| | | # 需要存储查看缓存的阵容ID列表,一般只存储主阵容及各功能所需的防守阵容
|
| | | NeedViewCacheLineupIDList = [Lineup_Main, Lineup_ArenaDef]
|
| | | # 需要缓存的战斗功能预设,一般只要主线+防守功能预设,主动攻击的PVE功能可以不用,如某个副本的主动攻击预设
|
| | | NeedCacheBatPresetList = [BatPreset_Main, BatPreset_ArenaDef]
|
| | |
|
| | | BatPresetName = {BatPreset_Main:"主线", BatPreset_ArenaDef:"演武场防守"}
|
| | |
|
| | | # 功能预设定义
|
| | | FuncPresetList = (
|
| | | FuncPreset_Battle, # 全局战斗预设 1
|
| | | FuncPreset_Hero, # 武将预设 2
|
| | | FuncPreset_Mingge, # 命格预设 3
|
| | | ) = range(1, 1 + 3)
|
| | |
|
| | | # 宠物物品数据状态
|
| | | Def_PetStateList = (
|