| | |
| | | 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 = 20 # 已过关的诛仙塔层数
|
| | | curTowerLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ZhuXianTowerPassLV) # 已过关的诛仙塔层数
|
| | | return curTowerLV >= needTowerLV
|
| | |
|
| | |
|
| | | def CheckLearnZhuXianSkill(curPlayer, skillID):
|
| | | ## 检查诛仙装备位装备阶数
|
| | |
| | |
|
| | | return True
|
| | |
|
| | |
|
| | | #// A3 30 装备诛仙装备 #tagCMEquipZhuXianItem
|
| | | #
|
| | | #struct tagCMEquipZhuXianItem
|
| | |
| | | reqEquipPlaceIndex = clientData.EquipIndex
|
| | | itemIndex = clientData.ItemIndex
|
| | |
|
| | | GameWorld.DebugLog("诛仙穿戴装备: EquipIndex=%s,ItemIndex=%s" % (reqEquipPlaceIndex, itemIndex), playerID)
|
| | | GameWorld.DebugLog("穿戴诛仙装备: EquipIndex=%s,ItemIndex=%s" % (reqEquipPlaceIndex, itemIndex), playerID)
|
| | |
|
| | | zhuXianItemPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianItem)
|
| | | curEquip = zhuXianItemPack.GetAt(itemIndex)
|
| | |
| | | equipPlace = curEquip.GetEquipPlace()
|
| | | equipPlaceIndex = GetZhuXianEquipIndexByPlace(equipPlace)
|
| | | if reqEquipPlaceIndex != equipPlaceIndex:
|
| | | reqEquipPlace = GetZhuXianEquipPlaceByIndex(reqEquipPlaceIndex)
|
| | | canPlace = False
|
| | | for sharePlaceList in ShareDefine.ShareEquipPlace:
|
| | | if reqEquipPlaceIndex in sharePlaceList and equipPlaceIndex in sharePlaceList:
|
| | | if reqEquipPlace in sharePlaceList and equipPlace in sharePlaceList:
|
| | | canPlace = True
|
| | | break
|
| | | if not canPlace:
|
| | |
| | | RefreshZhuXianAttr(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | #// A3 31 卸下诛仙装备 #tagCMUnEquipZhuXianItem
|
| | | #
|
| | | #struct tagCMUnEquipZhuXianItem
|
| | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | EquipIndex = clientData.EquipIndex
|
| | | |
| | | GameWorld.DebugLog("卸下诛仙装备: EquipIndex=%s" % (EquipIndex), playerID)
|
| | |
|
| | | zhuXianEquipPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptZhuXianEquip)
|
| | | if EquipIndex < 0 or EquipIndex >= zhuXianEquipPack.GetCount():
|
| | |
| | | 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()
|
| | |
| | | else:
|
| | | PlayerControl.CalcAttrDict_Type(legendAttrID, legendAttrValue, allAttrList)
|
| | |
|
| | | GameWorld.DebugLog("诛仙装备属性: allAttrList=%s" % (allAttrList))
|
| | | GameWorld.DebugLog(" zxSkillPlusAttrDict=%s" % (zxSkillPlusAttrDict))
|
| | | # GameWorld.DebugLog("诛仙装备属性: allAttrList=%s" % (allAttrList))
|
| | | # GameWorld.DebugLog(" zxSkillPlusAttrDict=%s" % (zxSkillPlusAttrDict))
|
| | | # GameWorld.DebugLog(" equipPlaceClassLVDict=%s" % (equipPlaceClassLVDict))
|
| | |
|
| | | # 缓存技能增强比例,目前暂写死对指定技能伤害百分比提升
|
| | | for attrID, plusValue in zxSkillPlusAttrDict.items():
|
| | | if attrID not in attrIDSkillPlusDict:
|
| | | continue
|
| | | skillTypeIDList = attrIDSkillPlusDict[attrID]
|
| | | effSkillTypeID = 0
|
| | | for skillTypeID in skillTypeIDList:
|
| | | skillData = curPlayer.GetSkillManager().FindSkillBySkillTypeID(skillTypeID)
|
| | | if not skillData:
|
| | | continue
|
| | | if SkillCommon.CheckSkillJob(curPlayer, skillData):
|
| | | effSkillTypeID = skillTypeID
|
| | | break
|
| | | if not effSkillTypeID:
|
| | | continue
|
| | | |
| | | if attrID in addAttrIDList:
|
| | | skillAddPerDict = PyGameData.g_zhuXianSkillAddPerDict.get(playerID, {})
|
| | | skillAddPerDict[effSkillTypeID] = plusValue
|
| | | PyGameData.g_zhuXianSkillAddPerDict[playerID] = skillAddPerDict
|
| | | elif attrID in reduceAttrIDList:
|
| | | skillReducePerDict = PyGameData.g_zhuXianSkillReducePerDict.get(playerID, {})
|
| | | skillReducePerDict[effSkillTypeID] = plusValue
|
| | | PyGameData.g_zhuXianSkillReducePerDict[playerID] = skillReducePerDict
|
| | | |
| | | if attrID in addAttrIDList:
|
| | | skillAddPerDict = PyGameData.g_zhuXianSkillAddPerDict.get(playerID, {})
|
| | | skillAddPerDict[skillTypeID] = plusValue
|
| | | PyGameData.g_zhuXianSkillAddPerDict[playerID] = skillAddPerDict
|
| | | elif attrID in reduceAttrIDList:
|
| | | skillReducePerDict = PyGameData.g_zhuXianSkillReducePerDict.get(playerID, {})
|
| | | skillReducePerDict[skillTypeID] = plusValue
|
| | | PyGameData.g_zhuXianSkillReducePerDict[playerID] = skillReducePerDict
|
| | | |
| | | # GameWorld.DebugLog(" PyGameData.g_zhuXianSkillAddPerDict=%s" % PyGameData.g_zhuXianSkillAddPerDict)
|
| | | # GameWorld.DebugLog(" PyGameData.g_zhuXianSkillReducePerDict=%s" % PyGameData.g_zhuXianSkillReducePerDict)
|
| | | |
| | | # 计算套装,目前暂写死对诛仙装备部位基础属性提升
|
| | | suitAttrIDPlusPlaceDict = {
|
| | | ShareDefine.Def_Effect_ZXCloakAttrPer:ShareDefine.zxetCloak,
|
| | |
| | | for place in placeGroupList:
|
| | | if place not in equipPlaceClassLVDict:
|
| | | isSuit = False
|
| | | GameWorld.DebugLog(" 未穿戴装备,无法激活诛仙套装! suitType=%s,placeGroupList=%s,place=%s" % (suitType, placeGroupList, place))
|
| | | #GameWorld.DebugLog(" 未穿戴装备,无法激活诛仙套装! suitType=%s,placeGroupList=%s,place=%s" % (suitType, placeGroupList, place))
|
| | | break
|
| | | if not suitLV:
|
| | | suitLV = equipPlaceClassLVDict[place]
|
| | |
| | | if not isSuit or not suitLV:
|
| | | continue
|
| | |
|
| | | GameWorld.DebugLog(" 激活诛仙套装: suitType=%s, suitLV=%s" % (suitType, suitLV))
|
| | | suitAttrIpyData = IpyGameDataPY.GetIpyGameData("ZhuXianSuitAttr", suitType, suitLV)
|
| | | if not suitAttrIpyData:
|
| | | continue
|
| | |
| | | continue
|
| | | for i, suitEffID in enumerate(suitAttrIDList):
|
| | | suitEffValue = suitAttrValueList[i]
|
| | | #GameWorld.DebugLog(" suitEffID=%s,suitEffValue=%s" % (suitEffID, suitEffValue))
|
| | | if suitEffID in suitAttrIDPlusPlaceDict:
|
| | | plusPlace = suitAttrIDPlusPlaceDict[suitEffID]
|
| | | if plusPlace not in equipPlaceBaseAttrDict:
|
| | | continue
|
| | | plusEffDict = equipPlaceBaseAttrDict[plusPlace]
|
| | | #GameWorld.DebugLog(" plusPlace=%s,plusEffDict=%s" % (plusPlace, plusEffDict))
|
| | | for plusEffID, plusEffValue in plusEffDict.items():
|
| | | addValue = int(plusEffValue * (10000 + suitEffValue) / 10000.0)
|
| | | #GameWorld.DebugLog(" plusEffID=%s,plusEffValue=%s,addValue=%s" % (plusEffID, plusEffValue, addValue))
|
| | | PlayerControl.CalcAttrDict_Type(plusEffID, addValue, allAttrListZXSuit)
|
| | | else:
|
| | | PlayerControl.CalcAttrDict_Type(suitEffID, suitEffValue, allAttrListZXSuit)
|
| | |
| | | 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
|