From 14ec5b7075fc87facf9b54ddf8e9320b6811099e Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 18 七月 2019 17:53:58 +0800 Subject: [PATCH] 4546 【主干】灵宠获得活跃突破3000后再次获得会变重置成3000点(增加加活跃值GM命令 AddActivity) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py | 120 ++++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 77 insertions(+), 43 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py index 3a704b3..45d0497 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py @@ -24,19 +24,24 @@ import DataRecordPack import ItemControler import IPY_GameWorld +import PlayerWeekParty import ItemCommon import GameWorld import ChConfig +def GetGiftbagTypeList(cfgID, dayIndex, woldLV): + if cfgID == None or dayIndex == None: + return [] + ipyData = IpyGameDataPY.GetIpyGameData("ActFlashGiftbag", cfgID) + if not ipyData: + return [] + giftbagTypeList = GameWorld.GetDictValueByRangeKey(ipyData.GetGiftbagTypeList(), woldLV, []) + todayGiftbag = giftbagTypeList[-1] if dayIndex >= len(giftbagTypeList) else giftbagTypeList[dayIndex] + return todayGiftbag + def OnPlayerLogin(curPlayer): - isReset = __CheckPlayerFlashGiftbagAction(curPlayer) - if not isReset: - actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashGiftbag, {}) - # 活动中同步活动信息 - if actInfo.get(ShareDefine.ActKey_State): - SyncFlashGiftbagBuyCount(curPlayer, giftbagTypeList=actInfo.get(ShareDefine.ActKey_GiftbagTypeList, [])) - Sync_FlashGiftbagActionInfo(curPlayer) + __CheckPlayerFlashGiftbagAction(curPlayer) return def RefreshFlashGiftbagActionInfo(): @@ -57,26 +62,36 @@ actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashGiftbag, {}) actID = actInfo.get(ShareDefine.ActKey_ID, 0) state = actInfo.get(ShareDefine.ActKey_State, 0) - giftbagTypeList = actInfo.get(ShareDefine.ActKey_GiftbagTypeList, []) - #if not state or not giftbagTypeList: - # return + cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0) playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashGiftbagID) # 玩家身上的活动ID - - # 活动ID 相同的话不处理 - if actID == playerActID: + giftbagTypeList = [] if not cfgID else GetGiftbagTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0)) + isReset = False + if actID != playerActID: + isReset = True + __ResetGiftbagItemBuyCount(curPlayer, giftbagTypeList) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashGiftbagID, actID) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashGiftbagMailState, 0) + GameWorld.DebugLog("限时礼包重置! actID=%s,playerActID=%s,state=%s,giftbagTypeList=%s" % (actID, playerActID, state, giftbagTypeList), playerID) + Sync_FlashGiftbagActionInfo(curPlayer) + else: GameWorld.DebugLog("限时礼包活动ID不变,不处理!", curPlayer.GetPlayerID()) - return - - PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashGiftbagID, actID) - ResetGiftbagItemBuyCount(curPlayer, giftbagTypeList) - - GameWorld.DebugLog("限时礼包重置! actID=%s,playerActID=%s,state=%s,giftbagTypeList=%s" % (actID, playerActID, state, giftbagTypeList), playerID) - - Sync_FlashGiftbagActionInfo(curPlayer) - return True + + playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashGiftbagMailState) # 玩家身上的活动提醒邮件状态 + if actID and state and state != playerMailState: + flashGiftbagIpyData = IpyGameDataPY.GetIpyGameData("ActFlashGiftbag", cfgID) + if flashGiftbagIpyData and flashGiftbagIpyData.GetMailKey() and curPlayer.GetLV() >= flashGiftbagIpyData.GetLVLimit(): + PlayerControl.SendMailByKey(flashGiftbagIpyData.GetMailKey(), [playerID], flashGiftbagIpyData.GetMailItemPrize()) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashGiftbagMailState, state) + GameWorld.DebugLog(" 发送新限时礼包邮件提醒! state=%s,playerMailState=%s" % (state, playerMailState), playerID) + + if not isReset and cfgID: + if giftbagTypeList: + SyncFlashGiftbagBuyCount(curPlayer, giftbagTypeList=giftbagTypeList) + Sync_FlashGiftbagActionInfo(curPlayer) + return isReset -def ResetGiftbagItemBuyCount(curPlayer, giftbagTypeList): +def __ResetGiftbagItemBuyCount(curPlayer, giftbagTypeList): ##重置限时礼包限购物品次数 syncIDList = [] ipyDataMgr = IpyGameDataPY.IPY_Data() @@ -108,7 +123,7 @@ DataRecordPack.DR_CTGError(curPlayer, "FlashGiftbag state is 0!", addDRDict) return - giftbagTypeList = actInfo.get(ShareDefine.ActKey_GiftbagTypeList, []) + giftbagTypeList = GetGiftbagTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0)) if not giftbagTypeList: DataRecordPack.DR_CTGError(curPlayer, "FlashGiftbag GiftbagTypeList is null!", addDRDict) return @@ -128,7 +143,7 @@ return giftbagID = giftbagIpyData.GetGiftbagID() - giftItemList = giftbagIpyData.GetGiftItemList() + giftItemList = __GetJobItemList(giftbagIpyData.GetGiftItemList(), curPlayer.GetJob()) addDRDict.update({"giftbagID":giftbagID, "giftItemList":giftItemList}) buyCountLimit = giftbagIpyData.GetBuyCountLimit() buyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashGiftbagBuyCount % giftbagID) @@ -147,17 +162,29 @@ PlayerControl.SendMailByKey("", [curPlayer.GetPlayerID()], giftItemList) else: for itemID, itemCount, isBind in giftItemList: - ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem], + ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem], event=[ChConfig.ItemGive_CTG, True, addDRDict]) - + + # 取玩家APPID,混服使用 + appID = GameWorld.GetPlayerPlatform(curPlayer) notifyKey = giftbagIpyData.GetNotifyKey() if notifyKey: - orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID) + orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID, appID) rmb = 0 if not orderIpyData else int(orderIpyData.GetPayRMBNum()) PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), rmb, giftbagIpyData.GetMainItemID()]) - + SyncFlashGiftbagBuyCount(curPlayer, [giftbagID]) + PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_GiftBag, actGiftbagType, False) return True + +def __GetJobItemList(itemList, job): + jobItemList = [] + for itemID, itemCnt, isBind in itemList: + if type(itemID) == int: + jobItemList.append([itemID, itemCnt, isBind]) + elif job in itemID: + jobItemList.append([itemID[job], itemCnt, isBind]) + return jobItemList def SyncFlashGiftbagBuyCount(curPlayer, syncIDList=[], giftbagTypeList=[]): ## 通知限时礼包玩家活动信息 @@ -196,13 +223,16 @@ if not actInfo: return - if not actInfo.get(ShareDefine.ActKey_State): - return + #需要提前通知,所以去掉此限制 + #if not actInfo.get(ShareDefine.ActKey_State): + # return cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0) - giftbagTypeList = actInfo.get(ShareDefine.ActKey_GiftbagTypeList, 0) + if not cfgID: + return + giftbagTypeList = GetGiftbagTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0)) - if not cfgID or not giftbagTypeList: + if not giftbagTypeList: return flashGiftbagIpyData = IpyGameDataPY.GetIpyGameData("ActFlashGiftbag", cfgID) @@ -215,9 +245,14 @@ GameWorld.ErrLog("限时礼包开关时间时分配置错误!cfgID=%s" % cfgID) return + # 取玩家APPID,混服使用 + appID = GameWorld.GetPlayerPlatform(curPlayer) + + openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1 packInfo = ChPyNetSendPack.tagMCFlashGiftbagInfo() - packInfo.StartDate = flashGiftbagIpyData.GetStartDate() - packInfo.EndtDate = flashGiftbagIpyData.GetEndDate() + packInfo.StartDate = GameWorld.GetOperationActionDateStr(flashGiftbagIpyData.GetStartDate(), openServerDay) + packInfo.EndtDate = GameWorld.GetOperationActionDateStr(flashGiftbagIpyData.GetEndDate(), openServerDay) + packInfo.AdvanceMinutes = flashGiftbagIpyData.GetAdvanceMinutes() packInfo.ActivityTime = [] for i, startTime in enumerate(startTimeList): timeInfo = ChPyNetSendPack.tagMCFlashGiftbagTime() @@ -239,7 +274,7 @@ for giftIpyData in giftbagIpyDataList: giftbagID = giftIpyData.GetGiftbagID() - orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID) + orderIpyData = GetFlashGiftbagIDOrderInfoIpyData(giftbagID, appID) giftBag = ChPyNetSendPack.tagMCFlashGiftbag() giftBag.GiftID = giftbagID giftBag.OrderInfo = "" if not orderIpyData else orderIpyData.GetOrderInfo() @@ -248,7 +283,7 @@ giftBag.RMB = 0 if not orderIpyData else int(orderIpyData.GetPayRMBNum()) giftBag.RMBOriginal = giftIpyData.GetOriginalRMB() giftBag.ItemInfo = [] - for itemID, itemCount, isBind in giftIpyData.GetGiftItemList(): + for itemID, itemCount, isBind in __GetJobItemList(giftIpyData.GetGiftItemList(), curPlayer.GetJob()): item = ChPyNetSendPack.tagMCFlashGiftbagItem() item.ItemID = itemID item.ItemCount = itemCount @@ -265,21 +300,20 @@ NetPackCommon.SendFakePack(curPlayer, packInfo) return -def GetFlashGiftbagIDOrderInfoIpyData(giftbagID): +def GetFlashGiftbagIDOrderInfoIpyData(giftbagID, appID): ## 获取礼包ID对应实际售价 key = "FlashGiftbagIDRMB" FlashGiftbagIDRMBDict = IpyGameDataPY.GetConfigEx(key) if not FlashGiftbagIDRMBDict: FlashGiftbagIDRMBDict = {} - appID = GameWorld.GetPlatform() ipyDataMgr = IpyGameDataPY.IPY_Data() for i in xrange(ipyDataMgr.GetOrderInfoCount()): ipyData = ipyDataMgr.GetOrderInfoByIndex(i) - if ipyData.GetAppID() != appID: - continue + #if ipyData.GetAppID() != appID: + # continue if not ipyData.GetGiftbagID(): continue - FlashGiftbagIDRMBDict[ipyData.GetGiftbagID()] = ipyData + FlashGiftbagIDRMBDict[(ipyData.GetGiftbagID(), ipyData.GetAppID())] = ipyData IpyGameDataPY.SetConfigEx(key, FlashGiftbagIDRMBDict) - return FlashGiftbagIDRMBDict.get(giftbagID) + return FlashGiftbagIDRMBDict.get((giftbagID, appID)) -- Gitblit v1.8.0