From 2a41f04515a5cc91e285cf00e9330dc035e26765 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期二, 16 四月 2019 16:09:14 +0800 Subject: [PATCH] 3287 【2.0】娲皇遗迹S通关异常自动退出副本 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerWeekParty.py | 105 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 91 insertions(+), 14 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerWeekParty.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerWeekParty.py index e638771..be64102 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerWeekParty.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerWeekParty.py @@ -25,6 +25,10 @@ import PlayerControl import ItemControler import ChPyNetSendPack +import Operate_EquipStone +import PlayerFeastWeekParty +import DataRecordPack +import PlayerGodWeapon import NetPackCommon import ShareDefine import PyGameData @@ -36,8 +40,8 @@ if not isReset: actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {}) # 活动中同步活动信息 + SyncWeekPartyInfo(curPlayer) if actCostRebateInfo.get(ShareDefine.ActKey_State): - SyncWeekPartyInfo(curPlayer) SyncWeekPartyPlayerInfo(curPlayer) return @@ -61,18 +65,22 @@ state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0) cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0) passlv = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV) - isOk = AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Tower, passlv, False) - AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Login, 1) - - playerWeekPartyID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyID, 0, ChConfig.Def_PDictType_WeekParty) # 玩家身上的活动ID - if not isOk and state: + if state: + #每天都要触发 + AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Tower, passlv, False, True, False) + AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Login, 1, False, False) + AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Stone, Operate_EquipStone.GetTotalStoneLV(curPlayer), False, True, False) + AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_GodWeapon, PlayerGodWeapon.GetGodWeaponTotalLV(curPlayer), False, True, False) SyncWeekPartyPlayerInfo(curPlayer) + playerWeekPartyID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekPartyID, 0, ChConfig.Def_PDictType_WeekParty) # 玩家身上的活动ID # 活动ID 相同的话不处理 if cfgID == playerWeekPartyID: #GameWorld.DebugLog("周狂欢活动ID不变,不处理!", curPlayer.GetPlayerID()) return + CheckWeekPartyActionCnt(curPlayer) # 未领取的奖励邮件发放 - __SendWeekPartyMail(curPlayer, playerWeekPartyID) + if playerWeekPartyID: + __SendWeekPartyMail(curPlayer, playerWeekPartyID) if not cfgID: GameWorld.DebugLog(' 周狂欢活动重置!') @@ -123,6 +131,7 @@ itemList = awardDict[point] for itemID, itemCnt, isBind in itemList: totalItemDict[itemID] = totalItemDict.get(itemID, 0) + itemCnt + DataRecordPack.DR_WeekPartyPoint(curPlayer, day, point) if not totalItemDict: return totalItemList = [[itemID, itemCnt, 1] for itemID, itemCnt in totalItemDict.items()] @@ -130,8 +139,9 @@ return -def AddWeekPartyActionCnt(curPlayer, actionID, addCnt=1, isAdd=True): +def AddWeekPartyActionCnt(curPlayer, actionID, addCnt=1, isAdd=True, isCompatible=False, isSync=True): '''增加周狂欢相关活动完成次数''' + PlayerFeastWeekParty.AddFeastWeekPartyActionCnt(curPlayer, actionID, addCnt, isAdd, isCompatible, isSync) #判断活动是否开启 if not addCnt: return @@ -139,8 +149,11 @@ state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0) cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0) - if not state or not cfgID: + if not cfgID: return + if not state and actionID not in ChConfig.AheadFinishWPActList: + return + actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID) if not actBossIpyData: return @@ -148,6 +161,28 @@ dayIndex = actWeekPartyInfo.get(ShareDefine.ActKey_DayIndex, 0) if dayIndex >= len(templateIDList): return + if actionID in ChConfig.AheadFinishWPActList: + isFind = False + for day, dayTidList in enumerate(templateIDList[dayIndex:]): + findTid = 0 + for tid in dayTidList: + if tid / 100 == actionID: + findTid = tid + break + if not findTid: + continue + ipyData = IpyGameDataPY.GetIpyGameData('WeekParty', findTid) + if not ipyData: + continue + totalTimes = ipyData.GetTotalTimes() + if addCnt != totalTimes: + continue + dayIndex = day + dayIndex + isFind = True + break + if not isFind: + return + dayTidList = templateIDList[dayIndex] findTid = 0 for tid in dayTidList: @@ -167,6 +202,8 @@ return updTimes = curTimes + addCnt else: + if not isCompatible and addCnt != totalTimes: + return updTimes = min(addCnt, totalTimes) realAddCnt = updTimes - curTimes if realAddCnt <= 0: @@ -179,9 +216,47 @@ updPoint = curPoint + addPoint PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyPoint % dayIndex, updPoint, ChConfig.Def_PDictType_WeekParty) GameWorld.DebugLog(' 增加周狂欢相关活动完成次数 dayIndex=%s, findTid=%s, realAddCnt=%s,addPoint=%s' % (dayIndex, findTid, realAddCnt, addPoint)) - SyncWeekPartyPlayerInfo(curPlayer, dayIndex, findTid) + if isSync: + SyncWeekPartyPlayerInfo(curPlayer, dayIndex, findTid) return True + +def CheckWeekPartyActionCnt(curPlayer): + ipyDataMgr = IpyGameDataPY.IPY_Data() + for actionType in ChConfig.AheadFinishWPActList: + if actionType == ChConfig.Def_WPAct_Horse: + for i in xrange(ipyDataMgr.GetHorseCount()): + ipyData = ipyDataMgr.GetHorseByIndex(i) + index = ipyData.GetHorseID() + lv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % index, 0, ChConfig.Def_PDictType_Horse) + if lv: + AddWeekPartyActionCnt(curPlayer, actionType, index, False) + elif actionType == ChConfig.Def_WPAct_Pet: + petDataPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptPet) + for petDataIndex in range(petDataPack.GetCount()): + petItem = petDataPack.GetAt(petDataIndex) + if petItem.IsEmpty(): + continue + petNPCID = petItem.GetUserAttr(ShareDefine.Def_IudetPet_NPCID) + AddWeekPartyActionCnt(curPlayer, actionType, petNPCID, False) + elif actionType == ChConfig.Def_WPAct_Dogz: + for i in xrange(ipyDataMgr.GetDogzCount()): + ipyData = ipyDataMgr.GetDogzByIndex(i) + if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_DogzFightState, i): + AddWeekPartyActionCnt(curPlayer, actionType, ipyData.GetDogzID(), False) + elif actionType == ChConfig.Def_WPAct_Rune: + runeHoleCnt = IpyGameDataPY.GetFuncCfg("RuneUnlock", 4) + for holeNum in xrange(1, runeHoleCnt + 1): + runeData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Rune_Data % holeNum, 0) + if not runeData: + continue + runeItemID = ItemControler.GetRuneItemID(runeData) + itemData = GameWorld.GetGameData().GetItemByTypeID(runeItemID) + if not itemData: + continue + itemColor = itemData.GetItemColor() + AddWeekPartyActionCnt(curPlayer, actionType, itemColor, False) + return def GetWeekPartyActionAward(curPlayer, day, templateID): '''领取周狂欢活动奖励''' @@ -209,7 +284,7 @@ #GameWorld.Log(' actionID=%s,curTimes=%s,gotTimes=%s,singleTimes=%s,newGotTimes=%s'%(actionID, curTimes, gotTimes,singleTimes, newGotTimes)) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyGotTimes % (day, templateID), newGotTimes, ChConfig.Def_PDictType_WeekParty) for itemID, itemCnt in awardDict.items(): - ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 1, [IPY_GameWorld.rptItem]) + ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem]) SyncWeekPartyPlayerInfo(curPlayer, day, templateID) return @@ -246,8 +321,9 @@ return PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekPartyAwardRecord % day, awardRecord | pow(2, getIndex), ChConfig.Def_PDictType_WeekParty) for itemID, itemCnt, isBind in itemList: - ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, isBind, [IPY_GameWorld.rptItem]) + ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt, 0, [IPY_GameWorld.rptItem]) SyncWeekPartyPlayerInfo(curPlayer, day) + DataRecordPack.DR_WeekPartyPoint(curPlayer, day, getPoint) return @@ -311,7 +387,7 @@ actWeekPartyInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_WeekParty, {}) state = actWeekPartyInfo.get(ShareDefine.ActKey_State, 0) cfgID = actWeekPartyInfo.get(ShareDefine.ActKey_CfgID, 0) - if not state or not cfgID: + if not cfgID: return actBossIpyData = IpyGameDataPY.GetIpyGameData("ActWeekParty", cfgID) if not actBossIpyData: @@ -325,6 +401,7 @@ actInfo.Clear() actInfo.StartDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetStartDate(), openServerDay) actInfo.EndtDate = GameWorld.GetOperationActionDateStr(actBossIpyData.GetEndDate(), openServerDay) + actInfo.AdvanceMinutes = actBossIpyData.GetAdvanceMinutes() actInfo.IsDayReset = actBossIpyData.GetIsDayReset() actInfo.ResetType = actBossIpyData.GetResetType() actInfo.LimitLV = actBossIpyData.GetLVLimit() @@ -362,7 +439,7 @@ tInfo.SingleTimes = ipyData.GetSingleTimes() tInfo.Point = ipyData.GetPoint() tInfo.ItemInfo = [] - for itemID, itemCnt, isBind in itemList: + for itemID, itemCnt, isBind in ipyData.GetReward(): awardItem = ChPyNetSendPack.tagMCWeekPartyItem() awardItem.ItemID = itemID awardItem.ItemCnt = itemCnt -- Gitblit v1.8.0