| | |
| | | import PlayerControl |
| | | import IpyGameDataPY |
| | | import ChPyNetSendPack |
| | | import CrossRealmPlayer |
| | | import PlayerBillboard |
| | | import ItemControler |
| | | import NetPackCommon |
| | |
| | | Sync_BossTrialActionInfo(curPlayer, actNum) |
| | | Sync_BossTrialPlayerInfo(curPlayer, actNum) |
| | | |
| | | if not __CheckPlayerCrossActBossTrial(curPlayer): |
| | | Sync_CrossActBossTrialActionInfo(curPlayer) |
| | | |
| | | return |
| | | |
| | | def PlayerOnDay(curPlayer, onEventType): |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossTrial, {}).values(): |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | continue |
| | | |
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0) |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID) |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActBossTrial", cfgID) |
| | | if not ipyData: |
| | | continue |
| | | submitAwardResetType = ipyData.GetSubmitAwardResetType() |
| | | if not submitAwardResetType: |
| | | continue |
| | | |
| | | if onEventType != submitAwardResetType: |
| | | continue |
| | | |
| | | GameWorld.DebugLog("boss历练活动重置提交奖励: actNum=%s,cfgID=%s,submitAwardResetType=%s" |
| | | % (actNum, cfgID, submitAwardResetType), curPlayer.GetPlayerID()) |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitAwardCount % actNum, 0) |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitAward % actNum, 0) |
| | | Sync_BossTrialPlayerInfo(curPlayer, actNum) |
| | | |
| | | return |
| | | |
| | | def RefreshBossTrialActionInfo(actNum): |
| | |
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialID % actNum, actID) |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitCount % actNum, 0) |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitAwardCount % actNum, 0) |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitAward % actNum, 0) |
| | | |
| | | if state: |
| | |
| | | Sync_BossTrialPlayerInfo(curPlayer, actNum) |
| | | |
| | | return True |
| | | |
| | | def RefreshCrossActBossTrialInfo(): |
| | | ## 收到GameServer同步的活动信息,刷新活动信息 |
| | | playerManager = GameWorld.GetPlayerManager() |
| | | for index in xrange(playerManager.GetPlayerCount()): |
| | | curPlayer = playerManager.GetPlayerByIndex(index) |
| | | if curPlayer.GetID() == 0: |
| | | continue |
| | | __CheckPlayerCrossActBossTrial(curPlayer) |
| | | |
| | | return |
| | | |
| | | def __CheckPlayerCrossActBossTrial(curPlayer): |
| | | |
| | | playerID = curPlayer.GetPlayerID() |
| | | |
| | | actInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_BossTrial) |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0) |
| | | actID = actInfo.get(ShareDefine.ActKey_ID, 0) |
| | | state = actInfo.get(ShareDefine.ActKey_State, 0) |
| | | dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0) |
| | | |
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CA_BossTrialID) # 玩家身上的活动ID |
| | | |
| | | # 活动ID 相同的话不处理 |
| | | if actID == playerActID: |
| | | GameWorld.DebugLog("跨服Boss历练活动ID不变,不处理!cfgID=%s,dayIndex=%s,actID=%s" % (cfgID, dayIndex, actID), playerID) |
| | | return |
| | | GameWorld.DebugLog("跨服Boss历练活动重置! cfgID=%s,actID=%s,playerActID=%s,state=%s" % (cfgID, actID, playerActID, state), playerID) |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CA_BossTrialID, actID) |
| | | |
| | | if not state: |
| | | CrossRealmPlayer.NotifyCrossActEnd(curPlayer, ShareDefine.CrossActName_BossTrial) |
| | | |
| | | Sync_CrossActBossTrialActionInfo(curPlayer) |
| | | return True |
| | | |
| | | |
| | | def SendToGameServer_BossTrial(curPlayer, msgType, dataMsg=""): |
| | | playerID = curPlayer.GetPlayerID() |
| | | msgList = str([msgType, dataMsg]) |
| | | GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(playerID, 0, 0, "BossTrial", msgList, len(msgList)) |
| | | GameWorld.Log("Boss历练发送GameServer: %s, %s" % (msgType, dataMsg), playerID) |
| | | return |
| | | |
| | | #// AA 23 Boss历练提交凭证 #tagCMActBossTrialSubmit |
| | | # |
| | |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | GameWorld.DebugLog("Boss历练非活动中: actNum=%s" % actNum, playerID) |
| | | return |
| | | if not actInfo.get(ShareDefine.ActKey_StateJoin): |
| | | GameWorld.Log("Boss历练非参与活动中: actNum=%s" % actNum, playerID) |
| | | return |
| | | |
| | | itemID = IpyGameDataPY.GetFuncCfg("BossTrial", 1) |
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem) |
| | |
| | | return |
| | | ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "BossTrialSubmit") |
| | | |
| | | submitAwardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitAwardCount % actNum) |
| | | updSubmitAwardCount = submitAwardCount + submitCount |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitAwardCount % actNum, updSubmitAwardCount) |
| | | |
| | | nowSubmitCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitCount % actNum) |
| | | updSubmitCount = nowSubmitCount + submitCount |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_BossTrialSubmitCount % actNum, updSubmitCount) |
| | | GameWorld.DebugLog("Boss历练提交凭证: actNum=%s,itemID=%s,submitCount=%s,updSubmitCount=%s" % (actNum, itemID, submitCount, updSubmitCount), playerID) |
| | | GameWorld.DebugLog("Boss历练提交凭证: actNum=%s,itemID=%s,submitCount=%s,updSubmitCount=%s,updSubmitAwardCount=%s" |
| | | % (actNum, itemID, submitCount, updSubmitCount, updSubmitAwardCount), playerID) |
| | | |
| | | PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_BossTrialSubmit, updSubmitCount, autoSort=True) |
| | | |
| | | Sync_BossTrialPlayerInfo(curPlayer, actNum) |
| | | |
| | | SendToGameServer_BossTrial(curPlayer, "BossTrialSubmit", [submitCount, updSubmitCount]) |
| | | return |
| | | |
| | | #// AA 24 Boss历练领奖 #tagCMActBossTrialGetAward |
| | |
| | | return |
| | | recordIndex, awardItemList = submitItemAwardInfo[submitCount] |
| | | |
| | | nowSubmitCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitCount % actNum) |
| | | nowSubmitCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitAwardCount % actNum) |
| | | if nowSubmitCount < submitCount: |
| | | GameWorld.DebugLog("Boss历练提交凭证个数不足,无法领奖: actNum=%s,nowSubmitCount=%s < %s" % (actNum, nowSubmitCount, submitCount), playerID) |
| | | return |
| | |
| | | dropCountTotal = 0 |
| | | itemID = IpyGameDataPY.GetFuncCfg("BossTrial", 1) |
| | | |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossTrial, {}).values(): |
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0) |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | GameWorld.DebugLog("Boss历练非活动中,不掉落! actNum=%s" % actNum) |
| | | continue |
| | | dropCount = GameWorld.GetResultByRandomList(dropCountRateList) |
| | | if not dropCount: |
| | | continue |
| | | dropCountTotal += dropCount |
| | | |
| | | if not GameWorld.IsCrossServer(): |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_BossTrial, {}).values(): |
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0) |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | GameWorld.DebugLog("Boss历练非活动中,不掉落! actNum=%s" % actNum) |
| | | continue |
| | | dropCount = GameWorld.GetResultByRandomList(dropCountRateList) |
| | | GameWorld.DebugLog("本服Boss历练掉落! bossIndex=%s,actNum=%s,dropCount=%s" % (limitIndex, actNum, dropCount)) |
| | | if not dropCount: |
| | | continue |
| | | dropCountTotal += dropCount |
| | | |
| | | else: |
| | | crossActInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_BossTrial) |
| | | if crossActInfo.get(ShareDefine.ActKey_State): |
| | | dropCount = GameWorld.GetResultByRandomList(dropCountRateList) |
| | | GameWorld.DebugLog("跨服Boss历练掉落! bossIndex=%s,dropCount=%s" % (limitIndex, dropCount)) |
| | | if dropCount: |
| | | dropCountTotal += dropCount |
| | | |
| | | return itemID, dropCountTotal |
| | | |
| | | def Sync_BossTrialPlayerInfo(curPlayer, actNum): |
| | |
| | | clientPack = ChPyNetSendPack.tagMCActBossTrialPlayerInfo() |
| | | clientPack.ActNum = actNum |
| | | clientPack.SubmitCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitCount % actNum) |
| | | clientPack.SubmitCountAward = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitAward % actNum) |
| | | clientPack.SubmitAwardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitAwardCount % actNum) |
| | | clientPack.SubmitAwardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BossTrialSubmitAward % actNum) |
| | | NetPackCommon.SendFakePack(curPlayer, clientPack) |
| | | return |
| | | |
| | | def Sync_BossTrialActionInfo(curPlayer, actNum): |
| | | ## 通知活动信息 |
| | | |
| | | actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_BossTrial, actNum) |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | return |
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActBossTrial", cfgID) |
| | | if not ipyData: |
| | | return |
| | | templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex) |
| | | if not templateID: |
| | | return |
| | | tempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID) |
| | | if not tempIpyDataList: |
| | | return |
| | | |
| | | personalTempIpyDataList = [] |
| | | personalTempID = GameWorld.GetTemplateIDByList(ipyData.GetTemplateIDList(), dayIndex) |
| | | if personalTempID: |
| | | personalTempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", personalTempID) |
| | | |
| | | familyTempIpyDataList = [] |
| | | familyTempID = GameWorld.GetTemplateIDByList(ipyData.GetFamilyTemplateIDList(), dayIndex) |
| | | if familyTempID: |
| | | familyTempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", familyTempID) |
| | | |
| | | startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData) |
| | | startDateSync = actInfo.get(ShareDefine.ActKey_StartDateSync, startDateStr) |
| | | actInfo = ChPyNetSendPack.tagMCActBossTrialInfo() |
| | | actInfo.ActNum = actNum |
| | | actInfo.StartDate = startDateSync |
| | | actInfo.EndtDate = endDateStr |
| | | actInfo.JoinStartTime = ipyData.GetJoinStartTime() |
| | | actInfo.JoinEndTime = ipyData.GetJoinEndTime() |
| | | actInfo.IsDayReset = ipyData.GetIsDayReset() |
| | | actInfo.ResetType = ipyData.GetResetType() |
| | | actInfo.LimitLV = ipyData.GetLVLimit() |
| | | actInfo.SubResetType = ipyData.GetSubmitAwardResetType() |
| | | |
| | | actInfo.SubmitInfoList = [] |
| | | submitItemAwardInfo = ipyData.GetSubmitItemAwardInfo() |
| | |
| | | actInfo.SubmitInfoList.append(subInfo) |
| | | actInfo.SubmitCount = len(actInfo.SubmitInfoList) |
| | | |
| | | actInfo.BillboardInfoList = [] |
| | | for tempIpyData in tempIpyDataList: |
| | | actInfo.PersonalBillboardInfoList = __GetTempRankBillPackList(personalTempIpyDataList) |
| | | actInfo.PersonalBillCount = len(actInfo.PersonalBillboardInfoList) |
| | | |
| | | actInfo.FamilyBillboardInfoList = __GetTempRankBillPackList(familyTempIpyDataList) |
| | | actInfo.FamilyBillCount = len(actInfo.FamilyBillboardInfoList) |
| | | |
| | | NetPackCommon.SendFakePack(curPlayer, actInfo) |
| | | return |
| | | |
| | | def __GetTempRankBillPackList(ipyDataList): |
| | | packBillList = [] |
| | | if not ipyDataList: |
| | | return packBillList |
| | | for tempIpyData in ipyDataList: |
| | | rankInfo = ChPyNetSendPack.tagMCActBossTrialBillard() |
| | | rankInfo.Rank = tempIpyData.GetRank() |
| | | |
| | | rankInfo.AwardItemList = [] |
| | | |
| | | awardItemList = tempIpyData.GetAwardItemList() |
| | | for itemID, itemCount, isAuctionItem in awardItemList: |
| | | item = ChPyNetSendPack.tagMCActBossTrialItem() |
| | |
| | | item.IsBind = isAuctionItem |
| | | rankInfo.AwardItemList.append(item) |
| | | rankInfo.Count = len(rankInfo.AwardItemList) |
| | | actInfo.BillboardInfoList.append(rankInfo) |
| | | actInfo.BillardCount = len(actInfo.BillboardInfoList) |
| | | |
| | | rankInfo.MemAwardItemList = [] |
| | | memAwardItemList = tempIpyData.GetMemAwardItemList() |
| | | for itemID, itemCount, isAuctionItem in memAwardItemList: |
| | | item = ChPyNetSendPack.tagMCActBossTrialItem() |
| | | item.Clear() |
| | | item.ItemID = itemID |
| | | item.ItemCount = itemCount |
| | | item.IsBind = isAuctionItem |
| | | rankInfo.MemAwardItemList.append(item) |
| | | rankInfo.MemCount = len(rankInfo.MemAwardItemList) |
| | | |
| | | packBillList.append(rankInfo) |
| | | return packBillList |
| | | |
| | | def Sync_CrossActBossTrialActionInfo(curPlayer): |
| | | ## 通知活动信息 |
| | | actInfo = CrossRealmPlayer.GetPlayerCrossActInfo(curPlayer, ShareDefine.CrossActName_BossTrial) |
| | | if not actInfo: |
| | | return |
| | | |
| | | NetPackCommon.SendFakePack(curPlayer, actInfo) |
| | | if not actInfo.get(ShareDefine.ActKey_State): |
| | | return |
| | | |
| | | ipyDataDict = actInfo.get(ShareDefine.ActKey_IpyDataInfo, {}) |
| | | if not ipyDataDict: |
| | | return |
| | | |
| | | personalTempIpyDataList = [] |
| | | personalTempID = ipyDataDict.get("PersonalTemplateID", 0) |
| | | if personalTempID: |
| | | personalTempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", personalTempID) |
| | | |
| | | familyTempIpyDataList = [] |
| | | familyTempID = ipyDataDict.get("FamilyTemplateID", 0) |
| | | if familyTempID: |
| | | familyTempIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", familyTempID) |
| | | |
| | | actPack = ChPyNetSendPack.tagMCCrossActBossTrialInfo() |
| | | actPack.ServerIDRangeInfo = str(actInfo.get(ShareDefine.ActKey_ServerIDRangeList, [])) |
| | | actPack.ServerInfoLen = len(actPack.ServerIDRangeInfo) |
| | | actPack.GroupValue1 = ipyDataDict.get("ZoneID", 0) |
| | | actPack.StartDate = ipyDataDict.get("StartDate", "") |
| | | actPack.EndtDate = ipyDataDict.get("EndDate", "") |
| | | actPack.JoinStartTime = ipyDataDict.get("JoinStartTime", "") |
| | | actPack.JoinEndTime = ipyDataDict.get("JoinEndTime", "") |
| | | actPack.IsDayReset = ipyDataDict.get("IsDayReset", 0) |
| | | actPack.ResetType = ipyDataDict.get("ResetType", 0) |
| | | RankLimitList = ipyDataDict.get("RankLimitList", [0, 0]) |
| | | actPack.RankLimitPersonal = RankLimitList[0] |
| | | actPack.RankLimitFamily = RankLimitList[1] |
| | | |
| | | actPack.PersonalBillboardInfoList = __GetTempRankBillPackList(personalTempIpyDataList) |
| | | actPack.PersonalBillCount = len(actPack.PersonalBillboardInfoList) |
| | | |
| | | actPack.FamilyBillboardInfoList = __GetTempRankBillPackList(familyTempIpyDataList) |
| | | actPack.FamilyBillCount = len(actPack.FamilyBillboardInfoList) |
| | | |
| | | NetPackCommon.SendFakePack(curPlayer, actPack) |
| | | return |