From a9415978e2c4b94debfb59787771e1434a1adf19 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 10 四月 2024 13:58:44 +0800
Subject: [PATCH] 10130 【后端】福地争夺资源功能(增加摇人功能)
---
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
index 2124179..64a1421 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
@@ -50,7 +50,7 @@
# @remarks 函数详细说明.
def OnExec(orderId, gmCmdDict):
gmCmdDict = ClearEmptyFromDict(gmCmdDict)
-
+ GameWorld.DebugLog("GMT_AddEntireCompensation gmCmdDict:%s" % gmCmdDict)
LimitTime = gmCmdDict.get('EndTime', '2050-12-13 00:00:00')
curServerTime = GameWorld.GetCurrentDataTimeStr()
# 当前时间已经超过领取时间
@@ -58,6 +58,7 @@
GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_InvalidTime)
return
+ MailType = int(gmCmdDict.get('MailType', '0'))
Title = gmCmdDict.get('Title', '')
Text = gmCmdDict.get('Text', '')
GUID = gmCmdDict.get('GUID', '') # GM工具需要对全服邮件进行多服批量管理,所以这里GUID暂由GM工具决定
@@ -78,6 +79,30 @@
detail = gmCmdDict.get('Detail', "")
serverID = int(gmCmdDict.get('OnlyServerID', "0"))
+ ''' 需要验证guid是否已存在,如果存在
+ 当 serverID 为0时,不允许插入
+ 当 serverID 不为0时,需重新生成GUID,因为补偿物品是根据GUID查找的,如果 serverID 不一样但是GUID一样,就会导致领取多倍补偿物品
+ '''
+ compensationMgr = GameWorld.GetCompensationMgr()
+ entireCnt = compensationMgr.GetEntireCompensationCount()
+ for i in xrange(entireCnt):
+ compensation = compensationMgr.AtEntireCompensation(i)
+ if not compensation:
+ continue
+
+ if compensation.GUID != GUID:
+ continue
+
+ if not serverID:
+ GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NoNeed, "GUID already existed!")
+ return
+
+ # 如果是单服的,GUID已经存在的情况下,重新分配个GUID,防止重复插入相同GUID的邮件,导致领取多倍补偿
+ newGUID = str(uuid.uuid1())
+ gmCmdDict['GUIDNEW'] = newGUID
+ GameWorld.Log("发送单服补偿邮件,原GUID(%s)已存在,生成新GUID(%s), serverID=%s" % (GUID, newGUID, serverID))
+ GUID = newGUID
+ break
#工具发过来的物品下标依据 'index,index,...' 不一定是从0开始并按顺序连续 =_=#
intemIndexStrList = []
@@ -96,8 +121,8 @@
#if len(addItemDictList) == 0:
# GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
# return
- PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime,
- mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s"%(sender, Title, Text),
+ PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime,
+ mailInfo, PlayerJob, PlayerCompensation.GetMailText(Title, Text, MailType, sender),
gold, goldPaper, silver, detail, serverID)
#执行成功
--
Gitblit v1.8.0