From 9bde68657dcf194c484bad999a2f2bb5c6bb95ba Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 30 七月 2021 19:30:17 +0800
Subject: [PATCH] 5135 【BT2】【BT3】【主干】邮件满删除逻辑bug(按创建时间顺序删除;后台增加显示邮件删除原因)
---
ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py | 9 +++++++++
ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py | 1 +
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py | 2 +-
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py | 48 +++++++++++++++++++++++++++++++++++++++++-------
4 files changed, 52 insertions(+), 8 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py b/ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py
index 0a3e162..57cfda4 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/DataRecordPack.py
@@ -555,6 +555,15 @@
SendEventPack("CompensationPersonal", dataDict)
return
+## 删除个人补偿流向
+# @param curPlayerID, GUID, ItemDictList
+# @return: None
+def DR_DelPersonalCompensation(playerID, GUID, eventName):
+ dataDict = {'PlayerID':playerID, 'GUID':GUID, 'eventName':eventName}
+ #发送封包
+ SendEventPack("CompensationPersonalDel", dataDict)
+ return
+
## 添加全服补偿流向
# @param GUID, ItemDictList
# @return: None
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py
index 6faacc2..5fa1540 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_CompensationQueryPersonal.py
@@ -51,7 +51,7 @@
return
curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
for delGUID in delGUIDList:
- PlayerCompensation.ClearPersonalCompensation(playerID, delGUID)
+ PlayerCompensation.ClearPersonalCompensation(playerID, delGUID, "GMT")
if curPlayer:
PlayerCompensation.NotifyCompensationResult(curPlayer, delGUID, 1)
else:
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
index 008819d..97cba28 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
@@ -705,14 +705,19 @@
GameWorld.DebugLog("新增个人邮件: totalCount=%s,maxMailCount=%s" % (totalCount, maxMailCount), PlayerID)
if delCount > 0:
GameWorld.Log("个人邮件达到上限,需要删除!delCount=%s" % (delCount), PlayerID)
+ delGUIDList = GetPlayerDelMailGUIDList(PlayerID)
#先取得要删除的GUID
delGUIDs = []
- for i in xrange(delCount):
- curIpyPersonalData = GameWorld.GetCompensationMgr().PersonalCompensationAt(PlayerID, i)
- delGUIDs.append(curIpyPersonalData.GUID)
+ for _ in xrange(delCount):
+ if not delGUIDList:
+ break
+ delGUID = delGUIDList.pop(0)
+ curIpyPersonalData = GameWorld.GetCompensationMgr().FindPersonalCompensation(PlayerID, delGUID)
+ if curIpyPersonalData.GUID == delGUID:
+ delGUIDs.append(curIpyPersonalData.GUID)
for guid in delGUIDs:
- ClearPersonalCompensation(PlayerID, guid)
+ ClearPersonalCompensation(PlayerID, guid, "MaxCountLimiit")
GameWorld.Log(" DeletePersonalCompensation GUID = %s" % guid, PlayerID)
if curPlayer:
@@ -723,8 +728,29 @@
mailType = moneySource - ChConfig.Def_GiveMoney_Unknown # type类型为byte,存值时需要处理下
GameWorld.GetCompensationMgr().AddPersonalCompensation(GUID, PlayerID, CreateTime,
LimitTime, Text, mailType, gold, goldPaper, silver)
+ if PlayerID in PyGameData.g_playerDelMailGUIDDict:
+ guidList = PyGameData.g_playerDelMailGUIDDict[PlayerID]
+ guidList.append(GUID)
return
+def GetPlayerDelMailGUIDList(playerID):
+ ## 获取待删除的个人邮件GUID列表
+ if playerID not in PyGameData.g_playerDelMailGUIDDict:
+
+ timeGUIDList = []
+ curPersonalCount = GameWorld.GetCompensationMgr().GetPersonalCompensationCount(playerID)
+ for i in xrange(curPersonalCount):
+ curMail = GameWorld.GetCompensationMgr().PersonalCompensationAt(playerID, i)
+ timeGUIDList.append([curMail.CreateTime, curMail.GUID])
+
+ timeGUIDList.sort() # 按创建时间升序排序
+ delGUIDList = []
+ for _, guid in timeGUIDList:
+ if guid not in delGUIDList:
+ delGUIDList.append(guid)
+ PyGameData.g_playerDelMailGUIDDict[playerID] = delGUIDList
+
+ return PyGameData.g_playerDelMailGUIDDict[playerID]
# 此处货币playerIDList发放统一,如根据玩家不同而变,则应需修改
## 添加个人补偿
@@ -858,13 +884,21 @@
return
# 删除个人邮件表 状态表,同一个GUID 可以多人领取,不能同时删除物品
-def ClearPersonalCompensation(curPlayerID, curGUID):
+def ClearPersonalCompensation(curPlayerID, curGUID, eventName=""):
GameWorld.GetCompensationMgr().DeletePersonalCompensation(curPlayerID, curGUID)
GameWorld.GetCompensationMgr().DeletePlayerCompensationRec(curPlayerID, curGUID)
#存在多人邮件的情况,故删除物品需检查是否最后一个领取者才可删除
if GameWorld.GetCompensationMgr().GetPersonalCountByGUID(curGUID) == 0:
GameWorld.GetCompensationMgr().DeleteCompensationItem(curGUID)
+
+ if curPlayerID in PyGameData.g_playerDelMailGUIDDict:
+ guidList = PyGameData.g_playerDelMailGUIDDict[curPlayerID]
+ if curGUID in guidList:
+ guidList.remove(curGUID)
+ if eventName:
+ # 有特殊操作删除的才记录,常规领取删除的默认无eventName,不记录
+ DataRecordPack.DR_DelPersonalCompensation(curPlayerID, curGUID, eventName)
return
# 设置领取状态
@@ -1217,7 +1251,7 @@
#删除过期补偿信息, 没有主动通知在线玩家
for playerID, GUID in needClearGUIDList:
- ClearPersonalCompensation(playerID, GUID)
+ ClearPersonalCompensation(playerID, GUID, "Timeout")
return
## 清理超时补偿, 个人邮件在超过上限后才会自动删除
@@ -1286,7 +1320,7 @@
NotifyCompensationResult(curPlayer, GUID, 0)
return
- ClearPersonalCompensation(curPlayerID, GUID)
+ ClearPersonalCompensation(curPlayerID, GUID, "ClientDel")
NotifyCompensationResult(curPlayer, GUID, 1)
#GameWorld.DebugLog("个人补偿中OnDelCompensation:%s"%GUID)
return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
index 1ec968e..570b37d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -95,6 +95,7 @@
g_crossActInfoDict = None # 跨服运营活动信息 {actName:{actInfoDict}, ...}
+g_playerDelMailGUIDDict = {} # 玩家邮件GUID信息 {playerID:[GUID, ...], ...} 仅触发删除才有数据,且并不一定所有GUID都存在,仅作为删除邮件时用到
g_crossMailPlayerDict = {} # 有跨服邮件的玩家ID信息 {playerID:tick, ...}
g_crossPlayerViewCache = {} # 查看跨服玩家信息 {playerID:[cacheInfo, updTick], ...}
--
Gitblit v1.8.0