| | |
| | | import ShareDefine
|
| | | import PlayerControl
|
| | | import DataRecordPack
|
| | | import IPY_GameWorld
|
| | | import ItemControler
|
| | | import IpyGameDataPY
|
| | | import NetPackCommon
|
| | | import ChPyNetSendPack
|
| | | import SkillCommon
|
| | | import PyGameData
|
| | | import ChConfig
|
| | |
|
| | | import random
|
| | |
|
| | |
|
| | | def GetZhuXianEquipIndexByPlace(equipPlace):
|
| | | ## 获取诛仙装备位对应的索引
|
| | | return equipPlace - 1 - 120
|
| | |
|
| | |
|
| | | def GetZhuXianEquipPlaceByIndex(equipIndex):
|
| | | ## 获取诛仙装备索引对应装备位
|
| | | return equipIndex + 1 + 120
|
| | |
|
| | |
|
| | | def GetZhuXianEquipPlaceIndexIsUnlock(curPlayer, equipPlaceIndex):
|
| | | ## 获取诛仙装备位是否解锁
|
| | | # @param equipPlaceIndex: 注意传入的参数是装备位索引
|
| | | equipPlace = GetZhuXianEquipPlaceByIndex(equipPlaceIndex)
|
| | | placeUnlockDict = IpyGameDataPY.GetFuncEvalCfg("EquipZhuXian", 1, {}) # 诛仙装备位对应解锁所需诛仙塔层数 {"装备位":诛仙塔层数, ...} 没配的默认解锁
|
| | | placeUnlockDict = IpyGameDataPY.GetFuncEvalCfg("EquipZhuXian", 1, {}) # 诛仙装备位对应解锁所需诛仙塔层数 {"装备位":诛仙塔层数, ...} 没配的默认解锁
|
| | | if str(equipPlace) not in placeUnlockDict:
|
| | | return True
|
| | | needTowerLV = placeUnlockDict[str(equipPlace)]
|
| | | curTowerLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ZhuXianTowerPassLV) # 已过关的诛仙塔层数
|
| | | curTowerLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ZhuXianTowerPassLV) # 已过关的诛仙塔层数
|
| | | return curTowerLV >= needTowerLV
|
| | |
|
| | |
|
| | | def CheckLearnZhuXianSkill(curPlayer, skillID):
|
| | | ## 检查诛仙装备位装备阶数
|
| | |
| | | return
|
| | |
|
| | | return True
|
| | |
|
| | |
|
| | | #// A3 30 装备诛仙装备 #tagCMEquipZhuXianItem
|
| | | #
|
| | |
| | | RefreshZhuXianAttr(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | #// A3 31 卸下诛仙装备 #tagCMUnEquipZhuXianItem
|
| | | #
|
| | | #struct tagCMUnEquipZhuXianItem
|
| | |
| | | RefreshZhuXianAttr(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | def RefreshZhuXianAttr(curPlayer):
|
| | | CalcZhuXianAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | |
|
| | | def CalcZhuXianAttr(curPlayer):
|
| | | ## 刷新诛仙属性
|
| | |
| | |
|
| | | allAttrList = [{} for _ in range(4)]
|
| | | allAttrListZXSuit = [{} for _ in range(4)]
|
| | | equipScoreTotal = 0 #为解决装备评分、战力不一致的情况,装备战力改为由评分作为参数计算战力
|
| | | equipPlaceClassLVDict = {} #装备位对应装备阶 {装备位:阶, ...}
|
| | | equipPlaceBaseAttrDict = {} #装备位对应基础属性字典 {装备位:{属性ID:value, ...}, ...}
|
| | | equipScoreTotal = 0 #为解决装备评分、战力不一致的情况,装备战力改为由评分作为参数计算战力
|
| | | equipPlaceClassLVDict = {} #装备位对应装备阶 {装备位:阶, ...}
|
| | | equipPlaceBaseAttrDict = {} #装备位对应基础属性字典 {装备位:{属性ID:value, ...}, ...}
|
| | |
|
| | | attrIDSkillPlusDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 1, {}) # 属性ID对应影响的技能TypeID列表 {属性ID:[技能TypeID列表, ...], ...}
|
| | | attrIDSkillPlusDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 1, {}) # 属性ID对应影响的技能TypeID列表 {属性ID:[技能TypeID列表, ...], ...}
|
| | | addAttrIDList = range(ShareDefine.Def_Effect_SkillAddPer1, ShareDefine.Def_Effect_SkillAddPer7 + 1)
|
| | | reduceAttrIDList = range(ShareDefine.Def_Effect_SkillReducePer1, ShareDefine.Def_Effect_SkillReducePer7 + 1)
|
| | | zxSkillPlusAttrDict = {} # 玩家诛仙装备影响技能TypeID属性字典 {属性ID:值, ...}
|
| | | zxSkillPlusAttrDict = {} # 玩家诛仙装备影响技能TypeID属性字典 {属性ID:值, ...}
|
| | |
|
| | | zhuXianEquipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianEquip)
|
| | | equipPackCount = zhuXianEquipPack.GetCount()
|
| | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_ZhuXian, equipFightPowerEx)
|
| | | return
|
| | |
|
| | |
|
| | | def GetZhuXianEquipSkillAddPer(playerID, skillTypeID):
|
| | | ## 获取诛仙装备伤害百分比提升值
|
| | | if playerID not in PyGameData.g_zhuXianSkillAddPerDict:
|
| | |
| | | if skillTypeID not in skillAddPerDict:
|
| | | return 0
|
| | | return skillAddPerDict[skillTypeID]
|
| | |
|
| | |
|
| | | def GetZhuXianEquipSkillReducePer(playerID, skillTypeID):
|
| | | ## 获取诛仙装备减伤百分比提升值
|
| | |
| | | return 0
|
| | | return skillReducePerDict[skillTypeID]
|
| | |
|
| | |
|
| | | #// A3 32 诛仙装备分解 #tagCMZhuXianEquipDecompose
|
| | | #
|
| | | #struct tagCMZhuXianEquipDecompose
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE Count; //材料所在背包索引的数量
|
| | | # WORD IndexList[Count]; //材料所在背包索引列表
|
| | | # DWORD ItemIDList[Count]; //材料所在背包物品ID列表
|
| | | # BYTE IsAuto; //是否自动分解
|
| | | #};
|
| | | ## 诛仙装备分解 |
| | | # @param playerIndex 玩家索引 |
| | | # @param clientData 客户端封包 |
| | | # @param tick 时间
|
| | | # @return None
|
| | | def OnZhuXianEquipDecompose(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | if not clientData.Count:
|
| | | return
|
| | | playerID = curPlayer.GetID()
|
| | | eatIndexList = clientData.IndexList
|
| | | eatItemIDList = clientData.ItemIDList
|
| | | isAuto = clientData.IsAuto
|
| | | giveItemDict = {} #分解得到物品
|
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianItem)
|
| | | for i, index in enumerate(eatIndexList):
|
| | | eatItem = itemPack.GetAt(index)
|
| | | if not eatItem or eatItem.IsEmpty():
|
| | | continue
|
| | | eatItemID = eatItem.GetItemTypeID()
|
| | | if eatItemID != eatItemIDList[i]:
|
| | | GameWorld.Log('诛仙装备分解 发的物品ID不对应index=%s eatItemID=%s,ItemIDList[i]=%s' % (index, eatItemID, eatItemIDList[i]), playerID)
|
| | | continue
|
| | | if eatItem.GetType() not in ChConfig.Def_ZhuXianEquiipType:
|
| | | GameWorld.Log('诛仙装备分解 发的物品不是诛仙装备 eatItemID=%s' % eatItemID, playerID)
|
| | | continue
|
| | | |
| | | itemClassLV = ItemCommon.GetItemClassLV(eatItem)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('ZhuXianEquipDecompose', itemClassLV)
|
| | | if not ipyData:
|
| | | GameWorld.DebugLog('ZhuXianEquipDecompose 未配置该阶级分解itemClassLV=%s' % itemClassLV, playerID)
|
| | | continue
|
| | | decomposeInfoDict = ipyData.GetDecomposeInfo()
|
| | | getItemDict = {}
|
| | | for itemIDList, rateList in decomposeInfoDict.items():
|
| | | giveitemCnt = GameWorld.GetResultByRandomList(rateList, 0)
|
| | | if not giveitemCnt:
|
| | | continue
|
| | | if isinstance(itemIDList, tuple):
|
| | | itemID = random.choice(itemIDList)
|
| | | else:
|
| | | itemID = itemIDList
|
| | | giveItemDict[itemID] = giveItemDict.get(itemID, 0) + giveitemCnt
|
| | | getItemDict[itemID] = getItemDict.get(itemID, 0) + giveitemCnt
|
| | | saveDataDict = {'getItemDict':getItemDict, 'isAuto':isAuto}
|
| | | ItemCommon.DelItem(curPlayer, eatItem, 1, True, ChConfig.ItemDel_ZhuXianDecompose, saveDataDict)
|
| | | if giveItemDict:
|
| | | needSpace = len(giveItemDict)
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if packSpace < needSpace:
|
| | | prizeItemList = [[giveItemID, itemCnt, 1] for giveItemID, itemCnt in giveItemDict.items()]
|
| | | PlayerControl.SendMailByKey("DefaultLackSpace", [curPlayer.GetPlayerID()], prizeItemList)
|
| | | else:
|
| | | for giveItemID, itemCnt in giveItemDict.items():
|
| | | ItemControler.GivePlayerItem(curPlayer, giveItemID, itemCnt, True, [IPY_GameWorld.rptItem], True)
|
| | | |
| | | #通知结果
|
| | | packData = ChPyNetSendPack.tagMCZhuXianDecomposeResult()
|
| | | packData.Clear()
|
| | | packData.ItemList = []
|
| | | for itemID, itemCnt in giveItemDict.items():
|
| | | itemInfo = ChPyNetSendPack.tagMCZhuXianDecomposeItem()
|
| | | itemInfo.ItemID = itemID
|
| | | itemInfo.ItemCnt = itemCnt
|
| | | itemInfo.IsBind = 1
|
| | | packData.ItemList.append(itemInfo)
|
| | | packData.Cnt = len(packData.ItemList)
|
| | | NetPackCommon.SendFakePack(curPlayer, packData)
|
| | | return
|