From 1a7c778c292c7aade276eb62d36b78689edbf631 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期二, 04 六月 2019 10:09:49 +0800 Subject: [PATCH] 6478 骑宠BOSS奖励规则修改 --- ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py | 70 +++++++++++++++++++++++++++++++++-- 1 files changed, 66 insertions(+), 4 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py index 704baf5..d67cf3f 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py @@ -77,7 +77,7 @@ curItemData.ItemID = curItemDict['ItemID'] curItemData.Count = curItemDict['Count'] #curItemData.IsBind = curItemDict.get('IsBind',0) - curItemData.IsBind = 1 if not curItemDict.get('IsAuctionItem',0) else 0 + curItemData.IsBind = curItemDict.get('IsAuctionItem',0) curItemData.UserData = curItemDict.get('UserData', '') return curItemData @@ -129,6 +129,15 @@ title = "" content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, json.dumps(paramList, ensure_ascii=False)) return SendPersonalItemMailEx(title, content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource) + +def CrossServerMsg_SendMail(msgData): + ## 收到跨服服务器同步的发送邮件 + mailTypeKey = msgData["MailTypeKey"] + playerIDList = msgData["Player"] + addItemList = msgData.get("Item", []) + paramList = msgData.get("Param", []) + SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList) + return # 此处货币playerIDList发放统一,如根据玩家不同而变,则应需修改 ## 功能发放物品补偿/奖励邮件 @@ -264,7 +273,7 @@ compensationDict = {"GUID":GUID, "CheckState":checkState, "LimitLVType":limitLVType, "LimitLV":limitLV, "Gold":compensation.Gold, "GoldPaper":compensation.GoldPaper, "Silver":compensation.Silver, - "PlayerJob":compensation.PlayerJob, "Sender":sender, "Title":title, "Content":content, + "PlayerJob":compensation.PlayerJob, "Sender":sender, "Title":title, "Content":content, "OnlyServerID":compensation.ServerID, "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList} return compensationDict @@ -608,6 +617,11 @@ SetPrizeState(curPlayerID, curRequire.GUID, Disable_State, readState) continue + if curRequire.ServerID and curRequire.ServerID != GameWorld.GetPlayerServerID(curPlayer): + # 指定服务器邮件 + SetPrizeState(curPlayerID, curRequire.GUID, Disable_State, readState) + continue + #可以用的奖励 if Enable_State != curState: SetPrizeState(curPlayerID, curRequire.GUID, Enable_State, readState) @@ -760,8 +774,11 @@ # @return None def SendGMRequestCompensationResult(routeIndex, mapID, curPlayer, GUID, compensationType, curEntireRequire): - Text, gold, goldPaper, silver, moneySource, createTime = curEntireRequire.Text, curEntireRequire.Gold, \ - curEntireRequire.GoldPaper, curEntireRequire.Silver, curEntireRequire.Type, curEntireRequire.CreateTime + Text, gold, goldPaper, silver, createTime = curEntireRequire.Text, curEntireRequire.Gold, \ + curEntireRequire.GoldPaper, curEntireRequire.Silver, curEntireRequire.CreateTime + # 全服邮件没有 Type 字段 + moneySource = curEntireRequire.Type if compensationType == Personal_CompensationType else 0 + sendPack = ChGameToMapPyPack.tagGMRequestCompensationResult() sendPack.PlayerID = curPlayer.GetID() sendPack.CompensationType = compensationType @@ -853,11 +870,35 @@ return +##清理超时30天的个人邮件, 否则流失玩家在不断合服情况下数据会累积 +# 个人邮件暂无过期时间设定,只有30天清理逻辑,以创建时间为准 +# @param None +# @return None +def ClearUpPersonalCompensation(): + #校验过期补偿 + curTime = datetime.datetime.today() + needClearGUIDList = [] + allCnt = GameWorld.GetCompensationMgr().GetAllPersonalCompensationCount() + for i in xrange(allCnt): + curMail = GameWorld.GetCompensationMgr().AtAllPersonalCompensation(i) + # 超过接收邮件30天则完全删除此邮件 + limitTime = datetime.datetime.strptime(curMail.CreateTime, ChConfig.TYPE_Time_Format) + datetime.timedelta(days = 30) + if limitTime < curTime: + needClearGUIDList.append([curMail.PlayerID, curMail.GUID]) + + GameWorld.Log("ClearUpPersonalCompensation count=%s"%len(needClearGUIDList)) + + #删除过期补偿信息, 没有主动通知在线玩家 + for playerID, GUID in needClearGUIDList: + ClearPersonalCompensation(playerID, GUID) + return + ## 清理超时补偿, 个人邮件在超过上限后才会自动删除 # @param None # @return None def ClearUpTimeOutCompensation(): + ClearUpPersonalCompensation() ClearUpEntireCompensation() return @@ -913,6 +954,11 @@ #在个人补偿中 curPersonalCompensation = GameWorld.GetCompensationMgr().FindPersonalCompensation(curPlayerID, GUID) if curPersonalCompensation.PlayerID == curPlayerID: + if not CheckCanDelCompensation(curPersonalCompensation, GUID): + #有附件不可删除 + NotifyCompensationResult(curPlayer, GUID, 0) + return + ClearPersonalCompensation(curPlayerID, GUID) NotifyCompensationResult(curPlayer, GUID, 1) #GameWorld.DebugLog("个人补偿中OnDelCompensation:%s"%GUID) @@ -928,12 +974,28 @@ #全服邮件 curEntireRequire = GameWorld.GetCompensationMgr().FindEntireCompensation(GUID) if curEntireRequire.GUID == GUID: + if not CheckCanDelCompensation(curEntireRequire, GUID): + #有附件不可删除 + NotifyCompensationResult(curPlayer, GUID, 0) + return + SetPrizeState(curPlayerID, GUID, Disable_State, GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, GUID)/10) NotifyCompensationResult(curPlayer, GUID, 1) #GameWorld.DebugLog("全服邮件OnDelCompensation:%s"%GUID) return NotifyCompensationResult(curPlayer, GUID, 0) + +# 有附件的情况玩家不可主动删除邮件,避免误操作;系统可删除不用调用此接口 +def CheckCanDelCompensation(mailObj, GUID): + if mailObj.Gold or mailObj.GoldPaper or mailObj.Silver: + # 有附加货币不可删除 + return False + + if GameWorld.GetCompensationMgr().FindItemCount(GUID): + # 有附件物品不可删除 + return False + return True # 邮件删除情况 def NotifyCompensationResult(curPlayer, GUID, result): -- Gitblit v1.8.0