From eddda540e947bcc6483b1c89b3e42b81a337f77e Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 23 十月 2020 15:28:52 +0800 Subject: [PATCH] 4834 【主干】【长尾】【BT】GM补偿邮件重复;(当非单服邮件时GUID相同则不允许重复插入;当指定单服邮件批量发送补偿指令时,每个服重新生成GUID插入邮件) --- ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 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..6ba9f71 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py @@ -78,6 +78,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,7 +120,7 @@ #if len(addItemDictList) == 0: # GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr) # return - PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime, + PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime, mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s"%(sender, Title, Text), gold, goldPaper, silver, detail, serverID) -- Gitblit v1.8.0