From 0d24ae9f78e7a6314fe79e285566e6ad82dd1622 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 04 九月 2024 11:38:23 +0800 Subject: [PATCH] 10258 【越南】【砍树】新增古宝特殊效果(增加法器每X阶+xx属性) --- ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py | 37 ++++++++++++++++++++++++++++++++----- 1 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py index 36fba64..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工具决定 @@ -75,6 +76,33 @@ goldPaper = int(gmCmdDict.get('GoldPaper', '0')) silver = int(gmCmdDict.get('Silver', '0')) sender = gmCmdDict.get('Sender', ChConfig.Def_Mail_SenderSys) + 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 = [] @@ -93,10 +121,9 @@ #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), - gold, goldPaper, silver) + PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime, + mailInfo, PlayerJob, PlayerCompensation.GetMailText(Title, Text, MailType, sender), + gold, goldPaper, silver, detail, serverID) #执行成功 GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, {"GUID":GUID}) -- Gitblit v1.8.0