| | |
| | | import PlayerDogz
|
| | | import PlayerPet
|
| | | import ChConfig
|
| | | import ItemControler
|
| | |
|
| | | GubaoEffType_ActivityPlace = 33 # 活跃修炼x次可领取物品 x次
|
| | | GubaoEffType_Arena = 34 # 竞技场挑战x次可领取物品 x次
|
| | | GubaoEffType_KillWorldBoss = 35 # 击杀世界bossx次可领取物品 x次
|
| | | GubaoEffType_KillBossHome = 36 # 击杀boss之家bossx次可领取物品 x次
|
| | | GubaoEffType_KillCrossPenglaiBoss = 37 # 击杀蓬莱仙境bossx次可领取物品 x次
|
| | | GubaoEffType_KillCrossDemonLandBoss = 38 # 击杀魔化之地bossx次可领取物品 x次
|
| | | GubaoEffType_KillSealDemonBoss = 39 # 击杀封魔坛bossx次可领取物品 x次
|
| | | GubaoEffType_CrossRealmPK = 40 # 参与跨服天梯赛x次可领取物品 x次
|
| | |
|
| | | # 古宝领取物品特殊效果列表
|
| | | GubaoEffTtemIypeList = [GubaoEffType_ActivityPlace, GubaoEffType_Arena, GubaoEffType_KillWorldBoss, GubaoEffType_KillBossHome,
|
| | | GubaoEffType_KillCrossPenglaiBoss, GubaoEffType_KillCrossDemonLandBoss, GubaoEffType_KillSealDemonBoss, |
| | | GubaoEffType_CrossRealmPK,
|
| | | ]
|
| | |
|
| | | def GetGubaoLVInfo(curPlayer, gubaoID):
|
| | | lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoLVInfo % gubaoID)
|
| | |
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | Sync_GubaoInfo(curPlayer)
|
| | | Sync_GubaoItemEffInfo(curPlayer)
|
| | | return
|
| | |
|
| | | #// B2 16 古宝激活 #tagCMGubaoActivate
|
| | |
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | return
|
| | |
|
| | | def AddGubaoItemEffValue(curPlayer, effType, addCnt):
|
| | | if effType not in GubaoEffTtemIypeList:
|
| | | return
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetGubaoCount()):
|
| | | ipyData = ipyDataMgr.GetGubaoByIndex(index)
|
| | | gubaoID = ipyData.GetGubaoID()
|
| | | _, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if not star:
|
| | | continue
|
| | | starIpyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star)
|
| | | if not starIpyData:
|
| | | continue
|
| | | starEffIDList = starIpyData.GetStarEffIDList()
|
| | | for effID in starEffIDList:
|
| | | effIpyData = IpyGameDataPY.GetIpyGameData("GubaoEffAttr", effID)
|
| | | if not effIpyData:
|
| | | continue
|
| | | if effType != effIpyData.GetGubaoEffType():
|
| | | continue
|
| | | effValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType))
|
| | | updValue = min(effValue + addCnt, ChConfig.Def_UpperLimit_DWord)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType), updValue)
|
| | | GameWorld.DebugLog("更新古宝物品效果类型进度值: gubaoID=%s,effID=%s,effType=%s,effValue=%s,addCnt=%s,updValue=%s" |
| | | % (gubaoID, effID, effType, effValue, addCnt, updValue), curPlayer.GetPlayerID())
|
| | | Sync_GubaoItemEffInfo(curPlayer, gubaoID, effType, True)
|
| | | return
|
| | |
|
| | | def GetGubaoItemEffAward(curPlayer, gubaoID, effIDStr):
|
| | | _, star = GetGubaoLVInfo(curPlayer, gubaoID)
|
| | | if not star:
|
| | | #GameWorld.DebugLog("古宝物品效果领奖! 没有星级! gubaoID=%s" % (gubaoID), curPlayer.GetPlayerID())
|
| | | return
|
| | | starIpyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star)
|
| | | if not starIpyData:
|
| | | return
|
| | | starEffIDList = starIpyData.GetStarEffIDList()
|
| | | effID = GameWorld.ToIntDef(effIDStr)
|
| | | if not effID or effID not in starEffIDList:
|
| | | GameWorld.DebugLog("古宝物品效果领奖! 该星级不存在该效果ID! gubaoID=%s,star=%s,effID=%s" |
| | | % (gubaoID, star, effID), curPlayer.GetPlayerID())
|
| | | return
|
| | | effIpyData = IpyGameDataPY.GetIpyGameData("GubaoEffAttr", effID)
|
| | | if not effIpyData:
|
| | | return
|
| | | effType = effIpyData.GetGubaoEffType()
|
| | | if effType not in GubaoEffTtemIypeList:
|
| | | GameWorld.DebugLog("古宝物品效果领奖! 非物品效果类型! gubaoID=%s,star=%s,effID=%s,effType=%s" |
| | | % (gubaoID, star, effID, effType), curPlayer.GetPlayerID())
|
| | | return
|
| | | condValue = effIpyData.GetEffCond()
|
| | | awardItemList = effIpyData.GetEffItemAwardList()
|
| | | if not condValue or not awardItemList:
|
| | | return
|
| | | effValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType))
|
| | | getTimes = effValue / condValue
|
| | | if getTimes <= 0:
|
| | | GameWorld.DebugLog("古宝物品效果领奖! 未达到领奖条件! gubaoID=%s,star=%s,effID=%s,effType=%s,effValue=%s,condValue=%s" |
| | | % (gubaoID, star, effID, effType, effValue, condValue), curPlayer.GetPlayerID())
|
| | | return
|
| | | awardItemTotalList = []
|
| | | if getTimes > 1:
|
| | | for itemID, itemCount, isAuctionItem in awardItemList:
|
| | | awardItemTotalList.append([itemID, int(itemCount * getTimes), isAuctionItem])
|
| | | else:
|
| | | awardItemTotalList = awardItemList
|
| | | updValue = effValue % condValue
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType), updValue)
|
| | | Sync_GubaoItemEffInfo(curPlayer, gubaoID, effType, True)
|
| | | GameWorld.DebugLog("古宝物品效果领奖: gubaoID=%s,star=%s,effID=%s,effType=%s,effValue=%s,condValue=%s,getTimes=%s,updValue=%s,awardItemTotalList=%s" |
| | | % (gubaoID, star, effID, effType, effValue, condValue, getTimes, updValue, awardItemTotalList), curPlayer.GetPlayerID())
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, awardItemTotalList, event=["Gubao", False, {}])
|
| | | return
|
| | |
|
| | | def Sync_GubaoInfo(curPlayer, gubaoIDList=None):
|
| | | if gubaoIDList == None:
|
| | | syncIDList = []
|
| | |
| | | clientPack.Count = len(clientPack.GubaoInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def Sync_GubaoItemEffInfo(curPlayer, gubaoID=0, effType=0, force=False):
|
| | | syncIDList = []
|
| | | if not gubaoID:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in range(ipyDataMgr.GetGubaoCount()):
|
| | | ipyData = ipyDataMgr.GetGubaoByIndex(index)
|
| | | syncIDList.append(ipyData.GetGubaoID())
|
| | | else:
|
| | | syncIDList = [gubaoID]
|
| | | |
| | | syncEffTypeList = [effType] if effType else GubaoEffTtemIypeList
|
| | | |
| | | itemEffInfoList = []
|
| | | for gubaoID in syncIDList:
|
| | | for effType in syncEffTypeList:
|
| | | effValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType))
|
| | | if not effValue and not force:
|
| | | # 非强制同步情况下只同步有值的
|
| | | continue
|
| | | eff = ChPyNetSendPack.tagMCGubaoItemEff()
|
| | | eff.GubaoID = gubaoID
|
| | | eff.EffType = effType
|
| | | eff.EffValue = effValue
|
| | | itemEffInfoList.append(eff)
|
| | | |
| | | if not itemEffInfoList:
|
| | | return
|
| | | |
| | | clientPack = ChPyNetSendPack.tagMCGubaoItemEffInfo()
|
| | | clientPack.ItemEffInfoList = itemEffInfoList
|
| | | clientPack.Count = len(clientPack.ItemEffInfoList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|