| | |
| | | #!/usr/bin/python |
| | | # -*- coding: GBK -*- |
| | | #------------------------------------------------------------------------------- |
| | | # |
| | | ##@package Player.PlayerGubao |
| | | # |
| | | # @todo:å¤å®ç³»ç» |
| | | # @author hxp |
| | | # @date 2023-01-05 |
| | | # @version 1.0 |
| | | # |
| | | # è¯¦ç»æè¿°: å¤å®ç³»ç» |
| | | # |
| | | #------------------------------------------------------------------------------- |
| | | #"""Version = 2023-01-05 15:30""" |
| | | #------------------------------------------------------------------------------- |
| | | |
| | | import GameWorld |
| | | import ItemCommon |
| | | import PlayerControl |
| | | import IpyGameDataPY |
| | | import ChPyNetSendPack |
| | | import NetPackCommon |
| | | import IPY_GameWorld |
| | | import ChConfig |
| | | |
| | | def GetGubaoLVInfo(curPlayer, gubaoID): |
| | | lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoLVInfo % gubaoID) |
| | | lv = lvInfo / 100 |
| | | star = lvInfo % 100 |
| | | return lv, star |
| | | def SetGubaoLVInfo(curPlayer, gubaoID, lv, star): |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoLVInfo % gubaoID, lv * 100 + star) |
| | | return |
| | | |
| | | def OnPlayerLogin(curPlayer): |
| | | Sync_GubaoInfo(curPlayer) |
| | | return |
| | | |
| | | #// B2 16 å¤å®æ¿æ´» #tagCMGubaoActivate |
| | | # |
| | | #struct tagCMGubaoActivate |
| | | #{ |
| | | # tagHead Head; |
| | | # WORD GubaoID; |
| | | #}; |
| | | def OnGubaoActivate(index, curPackData, tick): |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) |
| | | playerID = curPlayer.GetPlayerID() |
| | | gubaoID = curPackData.GubaoID |
| | | ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID) |
| | | if not ipyData: |
| | | return |
| | | needItemID = ipyData.GetUnlockItemID() |
| | | needItemCnt = ipyData.GetUnlockItemCnt() |
| | | if not needItemID or not needItemCnt: |
| | | return |
| | | |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID) |
| | | if lv or star: |
| | | GameWorld.DebugLog("å¤å®å·²ç»æ¿æ´»è¿ï¼ gubaoID=%s" % gubaoID, playerID) |
| | | return |
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) |
| | | hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(needItemID, itemPack, needItemCnt) |
| | | if not hasEnough: |
| | | GameWorld.DebugLog("æ¿æ´»å¤å®éå
·ä¸è¶³! needItemID=%s,needItemCnt=%s" % (needItemID, needItemCnt), playerID) |
| | | return |
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemList, needItemCnt, False, "Gubao") |
| | | |
| | | lv, star = 1, 1 |
| | | SetGubaoLVInfo(curPlayer, gubaoID, lv, star) |
| | | GameWorld.Log("å¤å®æ¿æ´»æåï¼ gubaoID=%s" % gubaoID, playerID) |
| | | |
| | | RefreshGubaoAttr(curPlayer) |
| | | Sync_GubaoInfo(curPlayer, [gubaoID]) |
| | | return |
| | | |
| | | #// B2 17 å¤å®åæ #tagCMGubaoStarUp |
| | | # |
| | | #struct tagCMGubaoStarUp |
| | | #{ |
| | | # tagHead Head; |
| | | # WORD GubaoID; |
| | | #}; |
| | | def OnGubaoStarUp(index, curPackData, tick): |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) |
| | | playerID = curPlayer.GetPlayerID() |
| | | gubaoID = curPackData.GubaoID |
| | | |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID) |
| | | if not star: |
| | | GameWorld.DebugLog("å¤å®æªæ¿æ´»ï¼æ æ³åæï¼ gubaoID=%s" % gubaoID, playerID) |
| | | return |
| | | |
| | | if not IpyGameDataPY.GetIpyGameDataNotLog("GubaoStar", gubaoID, star + 1): |
| | | GameWorld.DebugLog("å¤å®å·²æ»¡æï¼ gubaoID=%s,star=%s" % (gubaoID, star), playerID) |
| | | return |
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star) |
| | | if not ipyData: |
| | | return |
| | | needItemList = ipyData.GetStarUPNeedItemInfo() |
| | | if not needItemList: |
| | | return |
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) |
| | | lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack) |
| | | if lackItemDict: |
| | | GameWorld.DebugLog("å¤å®åææéç©åä¸è¶³ï¼ star=%s,needItemList=%s,lackItemDict=%s" % (star, needItemList, lackItemDict), playerID) |
| | | return |
| | | #æ£æ¶è |
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "Gubao") |
| | | |
| | | updStar = star + 1 |
| | | SetGubaoLVInfo(curPlayer, gubaoID, lv, updStar) |
| | | GameWorld.Log("å¤å®åæ: gubaoID=%s,updStar=%s" % (gubaoID, updStar), playerID) |
| | | RefreshGubaoAttr(curPlayer) |
| | | Sync_GubaoInfo(curPlayer, [gubaoID]) |
| | | return |
| | | |
| | | #// B2 18 å¤å®å级 #tagCMGubaoLVUp |
| | | # |
| | | #struct tagCMGubaoLVUp |
| | | #{ |
| | | # tagHead Head; |
| | | # WORD GubaoID; |
| | | #}; |
| | | def OnGubaoLVUp(index, curPackData, tick): |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) |
| | | playerID = curPlayer.GetPlayerID() |
| | | gubaoID = curPackData.GubaoID |
| | | |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID) |
| | | if not star: |
| | | GameWorld.DebugLog("å¤å®æªæ¿æ´»ï¼æ æ³åçº§ï¼ gubaoID=%s" % gubaoID, playerID) |
| | | return |
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID) |
| | | if not ipyData: |
| | | return |
| | | quality = ipyData.GetGubaoQuality() |
| | | |
| | | if not IpyGameDataPY.GetIpyGameDataNotLog("GubaoLV", quality, lv + 1): |
| | | GameWorld.DebugLog("å¤å®å·²æ»¡çº§ï¼ gubaoID=%s,quality=%s,lv=%s" % (gubaoID, quality, lv), playerID) |
| | | return |
| | | |
| | | lvIpyData = IpyGameDataPY.GetIpyGameData("GubaoLV", quality, lv) |
| | | if not lvIpyData: |
| | | return |
| | | needItemList = lvIpyData.GetLVUPNeedItemInfo() |
| | | if not needItemList: |
| | | return |
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) |
| | | lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack) |
| | | if lackItemDict: |
| | | GameWorld.DebugLog("å¤å®å级æéç©åä¸è¶³ï¼ quality=%s,lv=%s,needItemList=%s,lackItemDict=%s" |
| | | % (quality, lv, needItemList, lackItemDict), playerID) |
| | | return |
| | | #æ£æ¶è |
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "Gubao") |
| | | |
| | | updLV = lv + 1 |
| | | SetGubaoLVInfo(curPlayer, gubaoID, updLV, star) |
| | | GameWorld.Log("å¤å®å级: gubaoID=%s,quality=%s,updLV=%s" % (gubaoID, quality, updLV), playerID) |
| | | RefreshGubaoAttr(curPlayer) |
| | | Sync_GubaoInfo(curPlayer, [gubaoID]) |
| | | return |
| | | |
| | | def RefreshGubaoAttr(curPlayer): |
| | | CalcGubaoAttr(curPlayer) |
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState() |
| | | return |
| | | |
| | | def CalcGubaoAttr(curPlayer): |
| | | |
| | | allAttrList = [{} for _ in range(4)] |
| | | |
| | | ipyDataMgr = IpyGameDataPY.IPY_Data() |
| | | for index in xrange(ipyDataMgr.GetGubaoCount()): |
| | | ipyData = ipyDataMgr.GetGubaoByIndex(index) |
| | | gubaoID = ipyData.GetGubaoID() |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID) |
| | | if not star: |
| | | continue |
| | | |
| | | quality = ipyData.GetGubaoQuality() |
| | | lvIpyData = IpyGameDataPY.GetIpyGameData("GubaoLV", quality, lv) |
| | | if lvIpyData: |
| | | lvAttrTypeList = lvIpyData.GetLVAttrTypeList() |
| | | lvAttrValueList = lvIpyData.GetLVAttrValueList() |
| | | for i, attrID in enumerate(lvAttrTypeList): |
| | | attrValue = lvAttrValueList[i] |
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList) |
| | | |
| | | starIpyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star) |
| | | if starIpyData: |
| | | starAttrTypeList = starIpyData.GetStarAttrTypeList() |
| | | starAttrValueList = starIpyData.GetStarAttrValueList() |
| | | for i, attrID in enumerate(starAttrTypeList): |
| | | attrValue = starAttrValueList[i] |
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList) |
| | | |
| | | # ä¿å计ç®å¼ |
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Gubao, allAttrList) |
| | | return |
| | | |
| | | def Sync_GubaoInfo(curPlayer, gubaoIDList=None): |
| | | if gubaoIDList == None: |
| | | syncIDList = [] |
| | | ipyDataMgr = IpyGameDataPY.IPY_Data() |
| | | for index in range(ipyDataMgr.GetGubaoCount()): |
| | | ipyData = ipyDataMgr.GetGubaoByIndex(index) |
| | | syncIDList.append(ipyData.GetGubaoID()) |
| | | else: |
| | | syncIDList = gubaoIDList |
| | | |
| | | gubaoInfoList = [] |
| | | for gubaoID in syncIDList: |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID) |
| | | if not lv and not star and gubaoIDList == None: |
| | | # 没ææå®æ¶åªåæ¥æ¿æ´»ç |
| | | continue |
| | | gubao = ChPyNetSendPack.tagMCGubao() |
| | | gubao.GubaoID = gubaoID |
| | | gubao.GubaoLV = lv |
| | | gubao.GubaoStar = star |
| | | gubaoInfoList.append(gubao) |
| | | |
| | | if not gubaoInfoList: |
| | | return |
| | | |
| | | clientPack = ChPyNetSendPack.tagMCGubaoInfo() |
| | | clientPack.GubaoInfoList = gubaoInfoList |
| | | clientPack.Count = len(clientPack.GubaoInfoList) |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack) |
| | | return |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.PlayerGubao
|
| | | #
|
| | | # @todo:å¤å®ç³»ç»
|
| | | # @author hxp
|
| | | # @date 2023-01-05
|
| | | # @version 1.0
|
| | | #
|
| | | # è¯¦ç»æè¿°: å¤å®ç³»ç»
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2023-01-05 15:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import ItemCommon
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import ChPyNetSendPack
|
| | | import NetPackCommon
|
| | | import IPY_GameWorld
|
| | | import PlayerHorse
|
| | | import PlayerDogz
|
| | | import PlayerPet
|
| | | import ChConfig
|
| | |
|
| | | def GetGubaoLVInfo(curPlayer, gubaoID):
|
| | | lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoLVInfo % gubaoID)
|
| | | lv = lvInfo / 100
|
| | | star = lvInfo % 100
|
| | | return lv, star
|
| | | def SetGubaoLVInfo(curPlayer, gubaoID, lv, star):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoLVInfo % gubaoID, lv * 100 + star)
|
| | | return
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | Sync_GubaoInfo(curPlayer)
|
| | | return
|
| | |
|
| | | #// B2 16 å¤å®æ¿æ´» #tagCMGubaoActivate
|
| | | #
|
| | | #struct tagCMGubaoActivate
|
| | | #{
|
| | | # tagHead Head;
|
| | | # WORD GubaoID; |
| | | #};
|
| | | def OnGubaoActivate(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gubaoID = curPackData.GubaoID
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID)
|
| | | if not ipyData:
|
| | | return
|
| | | needItemID = ipyData.GetUnlockItemID()
|
| | | needItemCnt = ipyData.GetUnlockItemCnt()
|
| | | if not needItemID or not needItemCnt:
|
| | | return
|
| | | |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if lv or star:
|
| | | GameWorld.DebugLog("å¤å®å·²ç»æ¿æ´»è¿ï¼ gubaoID=%s" % gubaoID, playerID)
|
| | | return
|
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(needItemID, itemPack, needItemCnt)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("æ¿æ´»å¤å®éå
·ä¸è¶³! needItemID=%s,needItemCnt=%s" % (needItemID, needItemCnt), playerID)
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemList, needItemCnt, False, "Gubao")
|
| | | |
| | | lv, star = 1, 1
|
| | | SetGubaoLVInfo(curPlayer, gubaoID, lv, star)
|
| | | GameWorld.Log("å¤å®æ¿æ´»æåï¼ gubaoID=%s" % gubaoID, playerID)
|
| | | |
| | | RefreshGubaoAttr(curPlayer)
|
| | | Sync_GubaoInfo(curPlayer, [gubaoID])
|
| | | return
|
| | |
|
| | | #// B2 17 å¤å®åæ #tagCMGubaoStarUp
|
| | | #
|
| | | #struct tagCMGubaoStarUp
|
| | | #{
|
| | | # tagHead Head;
|
| | | # WORD GubaoID; |
| | | #};
|
| | | def OnGubaoStarUp(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gubaoID = curPackData.GubaoID
|
| | | |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if not star:
|
| | | GameWorld.DebugLog("å¤å®æªæ¿æ´»ï¼æ æ³åæï¼ gubaoID=%s" % gubaoID, playerID)
|
| | | return
|
| | | |
| | | if not IpyGameDataPY.GetIpyGameDataNotLog("GubaoStar", gubaoID, star + 1):
|
| | | GameWorld.DebugLog("å¤å®å·²æ»¡æï¼ gubaoID=%s,star=%s" % (gubaoID, star), playerID)
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star)
|
| | | if not ipyData:
|
| | | return
|
| | | needItemList = ipyData.GetStarUPNeedItemInfo()
|
| | | if not needItemList:
|
| | | return
|
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack)
|
| | | if lackItemDict:
|
| | | GameWorld.DebugLog("å¤å®åææéç©åä¸è¶³ï¼ star=%s,needItemList=%s,lackItemDict=%s" % (star, needItemList, lackItemDict), playerID)
|
| | | return
|
| | | #æ£æ¶è
|
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "Gubao")
|
| | | |
| | | updStar = star + 1
|
| | | SetGubaoLVInfo(curPlayer, gubaoID, lv, updStar)
|
| | | GameWorld.Log("å¤å®åæ: gubaoID=%s,updStar=%s" % (gubaoID, updStar), playerID)
|
| | | RefreshGubaoAttr(curPlayer)
|
| | | Sync_GubaoInfo(curPlayer, [gubaoID])
|
| | | return
|
| | |
|
| | | #// B2 18 å¤å®å级 #tagCMGubaoLVUp
|
| | | #
|
| | | #struct tagCMGubaoLVUp
|
| | | #{
|
| | | # tagHead Head;
|
| | | # WORD GubaoID; |
| | | #};
|
| | | def OnGubaoLVUp(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | gubaoID = curPackData.GubaoID
|
| | | |
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if not star:
|
| | | GameWorld.DebugLog("å¤å®æªæ¿æ´»ï¼æ æ³åçº§ï¼ gubaoID=%s" % gubaoID, playerID)
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID)
|
| | | if not ipyData:
|
| | | return
|
| | | quality = ipyData.GetGubaoQuality()
|
| | | |
| | | if not IpyGameDataPY.GetIpyGameDataNotLog("GubaoLV", quality, lv + 1):
|
| | | GameWorld.DebugLog("å¤å®å·²æ»¡çº§ï¼ gubaoID=%s,quality=%s,lv=%s" % (gubaoID, quality, lv), playerID)
|
| | | return
|
| | | |
| | | lvIpyData = IpyGameDataPY.GetIpyGameData("GubaoLV", quality, lv)
|
| | | if not lvIpyData:
|
| | | return
|
| | | needItemList = lvIpyData.GetLVUPNeedItemInfo()
|
| | | if not needItemList:
|
| | | return
|
| | | |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack)
|
| | | if lackItemDict:
|
| | | GameWorld.DebugLog("å¤å®å级æéç©åä¸è¶³ï¼ quality=%s,lv=%s,needItemList=%s,lackItemDict=%s" |
| | | % (quality, lv, needItemList, lackItemDict), playerID)
|
| | | return
|
| | | #æ£æ¶è
|
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "Gubao")
|
| | | |
| | | updLV = lv + 1
|
| | | SetGubaoLVInfo(curPlayer, gubaoID, updLV, star)
|
| | | GameWorld.Log("å¤å®å级: gubaoID=%s,quality=%s,updLV=%s" % (gubaoID, quality, updLV), playerID)
|
| | | RefreshGubaoAttr(curPlayer)
|
| | | Sync_GubaoInfo(curPlayer, [gubaoID])
|
| | | return
|
| | |
|
| | | def RefreshGubaoAttr(curPlayer):
|
| | | #CalcGubaoAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | | def CalcGubaoAttr(curPlayer):
|
| | | |
| | | allAttrList = [{} for _ in range(4)]
|
| | | |
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetGubaoCount()):
|
| | | ipyData = ipyDataMgr.GetGubaoByIndex(index)
|
| | | gubaoID = ipyData.GetGubaoID()
|
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if not star:
|
| | | continue
|
| | | |
| | | quality = ipyData.GetGubaoQuality()
|
| | | lvIpyData = IpyGameDataPY.GetIpyGameData("GubaoLV", quality, lv)
|
| | | if lvIpyData:
|
| | | lvAttrTypeList = lvIpyData.GetLVAttrTypeList()
|
| | | lvAttrValueList = lvIpyData.GetLVAttrValueList()
|
| | | for i, attrID in enumerate(lvAttrTypeList):
|
| | | attrValue = lvAttrValueList[i]
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
|
| | | |
| | | starIpyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star)
|
| | | if starIpyData:
|
| | | starEffIDList = starIpyData.GetStarEffIDList()
|
| | | effAttrInfo = {}
|
| | | #GameWorld.DebugLog("GubaoStar屿§: gubaoID=%s,star=%s,starEffIDList=%s" % (gubaoID, star, starEffIDList))
|
| | | for effID in starEffIDList:
|
| | | __calcStarEffAttrByID(curPlayer, effID, effAttrInfo)
|
| | | #GameWorld.DebugLog(" effID=%s,effAttrInfo=%s" % (effID, effAttrInfo))
|
| | | for attrID, attrValue in effAttrInfo.items():
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
|
| | | |
| | | # ä¿å计ç®å¼
|
| | | #GameWorld.DebugLog("å¤å®å±æ§: %s" % allAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Gubao, allAttrList)
|
| | | return
|
| | |
|
| | | def __calcStarEffAttrByID(curPlayer, effID, effAttrInfo):
|
| | | ''' 计ç®å¤å®ç¹æ®ææIDå¯¹åºæå屿§
|
| | | '''
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("GubaoEffAttr", effID)
|
| | | if not ipyData:
|
| | | return
|
| | | effType = ipyData.GetGubaoEffType()
|
| | | effCond = ipyData.GetEffCond()
|
| | | attrID = ipyData.GetEffAttrID()
|
| | | effAttrValue = ipyData.GetEffAttrValue()
|
| | | if effAttrValue <= 0:
|
| | | return
|
| | | #ææç±»å ç±»åè¯´æ æ¡ä»¶
|
| | | # 10 xåè´¨çµå® æ»å»å±æ§æåx% xåè´¨
|
| | | if effType == 10:
|
| | | customAttrDictPet = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Pet)[2]
|
| | | petQualityAttrInfo = customAttrDictPet.get("petQualityAttrInfo", {})
|
| | | quality = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,quality=%s,petQualityAttrInfo=%s" % (effID, effType, quality, petQualityAttrInfo))
|
| | | if quality not in petQualityAttrInfo:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, petQualityAttrInfo[quality], effAttrValue)
|
| | | |
| | | # 11 çµå® æ»ç级æ¯x级+xx屿§ x级
|
| | | elif effType == 11:
|
| | | totalPetLV = PlayerPet.GetTotalPetLV(curPlayer)
|
| | | addAttrValue = int(totalPetLV / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,totalPetLV=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, totalPetLV, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | # 12 çµå® æ¯æ¿æ´»xåª+xx屿§ xåª
|
| | | elif effType == 12:
|
| | | totalPetCount = PlayerPet.GetTotalPetCount(curPlayer)
|
| | | addAttrValue = int(totalPetCount / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,totalPetCount=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, totalPetCount, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | # 13 xåè´¨åéªå¹»å屿§æåx% xåè´¨
|
| | | elif effType == 13:
|
| | | customAttrDictSkin = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkin)[2]
|
| | | horseSkinQualityAttrInfo = customAttrDictSkin.get("horseSkinQualityAttrInfo", {})
|
| | | quality = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,quality=%s,horseSkinQualityAttrInfo=%s" % (effID, effType, quality, horseSkinQualityAttrInfo))
|
| | | if quality not in horseSkinQualityAttrInfo:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, horseSkinQualityAttrInfo[quality], effAttrValue)
|
| | | |
| | | # 14 åéªå¹»åæ¿æ´»xåª+xx屿§ xåª
|
| | | elif effType == 14:
|
| | | horseSkinActCount = PlayerHorse.GetHorseSkinActCount(curPlayer)
|
| | | addAttrValue = int(horseSkinActCount / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,horseSkinActCount=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, horseSkinActCount, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | # 15 æ¯å¹å
»åéªx次+xx屿§ x次
|
| | | elif effType == 15:
|
| | | pass
|
| | | |
| | | #16 xé¶è£
å¤å¼ºå屿§æåx% xé¶
|
| | | elif effType == 16:
|
| | | customAttrDictPlus = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Plus)[2]
|
| | | classBaseAttrDictPlus = customAttrDictPlus.get("classBaseAttrDictPlus", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictPlus=%s" % (effID, effType, classLV, classBaseAttrDictPlus))
|
| | | if classLV not in classBaseAttrDictPlus:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictPlus[classLV], effAttrValue)
|
| | | |
| | | #17 xé¶è£
å¤å®ç³å±æ§æåx% xé¶
|
| | | elif effType == 17:
|
| | | customAttrDictStone = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Stone)[2]
|
| | | classBaseAttrDictStone = customAttrDictStone.get("classBaseAttrDictStone", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictStone=%s" % (effID, effType, classLV, classBaseAttrDictStone))
|
| | | if classLV not in classBaseAttrDictStone:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictStone[classLV], effAttrValue)
|
| | | |
| | | #18 xé¶è£
å¤åæå±æ§æåx% xé¶
|
| | | elif effType == 18:
|
| | | customAttrDictStar = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Star)[2]
|
| | | classBaseAttrDictStar = customAttrDictStar.get("classBaseAttrDictStar", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictStar=%s" % (effID, effType, classLV, classBaseAttrDictStar))
|
| | | if classLV not in classBaseAttrDictStar:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictStar[classLV], effAttrValue)
|
| | | |
| | | #19 xé¶è£
夿´ç¼å±æ§æåx% xé¶
|
| | | elif effType == 19:
|
| | | customAttrDictWash = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Wash)[2]
|
| | | classBaseAttrDictWash = customAttrDictWash.get("classBaseAttrDictWash", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictWash=%s" % (effID, effType, classLV, classBaseAttrDictWash))
|
| | | if classLV not in classBaseAttrDictWash:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictWash[classLV], effAttrValue)
|
| | | |
| | | #20 xé¶è£
å¤éé屿§æåx% xé¶
|
| | | elif effType == 20:
|
| | | customAttrDictEnchant = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Enchant)[2]
|
| | | classBaseAttrDictEnchant = customAttrDictEnchant.get("classBaseAttrDictEnchant", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictEnchant=%s" % (effID, effType, classLV, classBaseAttrDictEnchant))
|
| | | if classLV not in classBaseAttrDictEnchant:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictEnchant[classLV], effAttrValue)
|
| | | |
| | | #21 åºæç¥å
½è£
å¤å¼ºåæ¯x级+xx屿§ x级
|
| | | elif effType == 21:
|
| | | fightDogzTotalPlusLv = PlayerDogz.GetFightDogzTotalPlusLv(curPlayer)
|
| | | addAttrValue = int(fightDogzTotalPlusLv / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,fightDogzTotalPlusLv=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, fightDogzTotalPlusLv, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | return
|
| | |
|
| | | def __addStarEffFuncAttr(ipyData, effAttrInfo, funcAttrInfo, effAttrValue):
|
| | | if not funcAttrInfo or effAttrValue <= 0:
|
| | | return
|
| | | isPer = ipyData.GetIsPer()
|
| | | effAttrIDList = ipyData.GetEffFuncAttrIDList() # æåæå®åè½å±æ§IDå表
|
| | | for attrID, attrValue in funcAttrInfo.items():
|
| | | if effAttrIDList and attrID not in effAttrIDList:
|
| | | continue
|
| | | if isPer:
|
| | | addAttrValue = int(attrValue * effAttrValue / 100.0)
|
| | | else:
|
| | | addAttrValue = effAttrValue
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | return
|
| | |
|
| | | def Sync_GubaoInfo(curPlayer, gubaoIDList=None):
|
| | | if gubaoIDList == None:
|
| | | syncIDList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGubaoCount()):
|
| | | ipyData = ipyDataMgr.GetGubaoByIndex(index)
|
| | | syncIDList.append(ipyData.GetGubaoID())
|
| | | else:
|
| | | syncIDList = gubaoIDList
|
| | | |
| | | gubaoInfoList = []
|
| | | for gubaoID in syncIDList:
|
| | | lv, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if not lv and not star and gubaoIDList == None:
|
| | | # 没ææå®æ¶åªåæ¥æ¿æ´»ç
|
| | | continue
|
| | | gubao = ChPyNetSendPack.tagMCGubao()
|
| | | gubao.GubaoID = gubaoID
|
| | | gubao.GubaoLV = lv
|
| | | gubao.GubaoStar = star
|
| | | gubaoInfoList.append(gubao)
|
| | | |
| | | if not gubaoInfoList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCGubaoInfo()
|
| | | clientPack.GubaoInfoList = gubaoInfoList
|
| | | clientPack.Count = len(clientPack.GubaoInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|