From 4180ba5f28c47d15a33d99973e2034f5337ab3fc Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 20 十二月 2022 17:04:17 +0800
Subject: [PATCH] 9731 【越南】【主干】【BT7】【BT8】转职业(转职附加重置灵根属性点)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py | 124 +++++++++++++++++++++++++++++------------
1 files changed, 87 insertions(+), 37 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
index 464f830..d899b51 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
@@ -286,6 +286,8 @@
# @param curItemDict
# @return IpyCompensationItem
def MakeCompensationItem(curItemDict):
+ if not __checkMailItemDict(curItemDict):
+ return
curItemData = IPY_GameServer.IpyCompensationItem()
#curItemData.GUID = curItemDict['GUID']
curItemData.ItemID = curItemDict['ItemID']
@@ -307,7 +309,7 @@
def SendPersonalItemMailBatch(batchMailInfoList):
## 批量发送邮件
- mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail, moneySource = batchMailInfoList
+ mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail, moneySource, crossMail = batchMailInfoList
lenPlayerID = len(batchPlayerIDList)
lenItem = len(batchAddItemList)
@@ -332,7 +334,7 @@
silver = batchSilver[i] if lenSilver == lenPlayerID else 0
detail = batchDetail[i] if lenDetail == lenPlayerID else ""
content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, str(paramList))
- SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold, goldPaper, silver, detail=detail, moneySource=moneySource)
+ SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold, goldPaper, silver, detail=detail, moneySource=moneySource, crossMail=crossMail)
return
@@ -355,6 +357,55 @@
SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList)
return
+def __checkMailItemIDCount(itemID, itemCount, isAuctionItem):
+ ## 检查是否合法的邮件物品ID Count 数据
+ if not (isinstance(itemID, int) or isinstance(itemID, long)):
+ return
+ if not (isinstance(itemCount, int) or isinstance(itemCount, long)):
+ return
+ if not (isinstance(isAuctionItem, int) or isinstance(isAuctionItem, long) or isinstance(isAuctionItem, bool)):
+ return
+ if itemID > ShareDefine.Def_UpperLimit_DWord or itemCount > ShareDefine.Def_UpperLimit_DWord or isAuctionItem > 255:
+ return
+ return True
+
+def __checkMailItemDict(curItemDict):
+ ## 检查是否合法的邮件物品dict信息 {"ItemID":xxx, "Count":xxx, "IsAuctionItem":xxx}
+ if not isinstance(curItemDict, dict):
+ return
+ if "ItemID" not in curItemDict or "Count" not in curItemDict:
+ return
+ itemID = curItemDict["ItemID"]
+ itemCount = curItemDict["Count"]
+ isAuctionItem = curItemDict.get("IsAuctionItem", 0)
+ if not __checkMailItemIDCount(itemID, itemCount, isAuctionItem):
+ return
+ return curItemDict
+
+def __checkMailItemList(addItemList):
+ ## 检查是否合法的邮件物品列表
+ addItemDictList = []
+ for itemInfo in addItemList:
+ if isinstance(itemInfo, dict):
+ if not __checkMailItemDict(itemInfo):
+ return False, []
+ addItemDictList.append(itemInfo)
+ continue
+
+ if (isinstance(itemInfo, list) or isinstance(itemInfo, tuple)) and (len(itemInfo) == 3 or len(itemInfo) == 2):
+ itemID, itemCount = itemInfo[:2]
+ isAuctionItem = itemInfo[2] if len(itemInfo) > 2 else 0
+ if not __checkMailItemIDCount(itemID, itemCount, isAuctionItem):
+ return False, []
+ addItemDict = {}
+ addItemDict['ItemID'] = itemID
+ addItemDict['Count'] = itemCount
+ addItemDict['IsAuctionItem'] = isAuctionItem
+ addItemDictList.append(addItemDict)
+ else:
+ return False, []
+ return True, addItemDictList
+
# 此处货币playerIDList发放统一,如根据玩家不同而变,则应需修改
## 功能发放物品补偿/奖励邮件
# @param addItemList [(itemID, itemCnt, 是否拍品), {或物品信息字典}, ...]
@@ -373,25 +424,16 @@
if not curServerTime or curServerTime >= limitTime:
GameWorld.DebugLog("功能发放物品补偿/奖励邮件,领取时间已超时,默认不添加!LimitTime=%s" % limitTime)
return ""
+ isOK, addItemDictList = __checkMailItemList(addItemList)
+ if not isOK:
+ GameWorld.ErrLog("发送个人邮件错误: title=%s,content=%s,playerIDList=%s,addItemList=%s,gold=%s,goldPaper=%s,silver=%s,detail=%s,moneySource=%s,crossMail=%s"
+ % (title, content, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource, crossMail))
+ return
- addItemDictList = []
- for itemInfo in addItemList:
- if isinstance(itemInfo, dict):
- addItemDictList.append(itemInfo)
- continue
-
-
- if len(itemInfo) == 3:
- itemID, itemCnt, isAuctionItem = itemInfo
- else:
- continue
-
- addItemDict = {}
- addItemDict['ItemID'] = itemID
- addItemDict['Count'] = itemCnt
- addItemDict['IsAuctionItem'] = isAuctionItem
- addItemDictList.append(addItemDict)
-
+ gold = min(gold, ShareDefine.Def_UpperLimit_DWord)
+ goldPaper = min(goldPaper, ShareDefine.Def_UpperLimit_DWord)
+ silver = min(silver, ShareDefine.Def_UpperLimit_DWord)
+
perMailItemCnt = IpyGameDataPY.GetFuncCfg("MailMaxItemCnt")
mailCnt = max(1, int(math.ceil(len(addItemDictList)/float(perMailItemCnt)))) # 一封邮件最多5个物品
for i in xrange(mailCnt):
@@ -608,23 +650,16 @@
if not mailTypeKey or getDays <= 0:
return
- addItemDictList = []
- for itemInfo in addItemList:
- if isinstance(itemInfo, dict):
- addItemDictList.append(itemInfo)
- continue
-
- if len(itemInfo) == 3:
- itemID, itemCnt, isAuctionItem = itemInfo
- else:
- continue
-
- addItemDict = {}
- addItemDict['ItemID'] = itemID
- addItemDict['Count'] = itemCnt
- addItemDict['IsAuctionItem'] = isAuctionItem
- addItemDictList.append(addItemDict)
-
+ isOK, addItemDictList = __checkMailItemList(addItemList)
+ if not isOK:
+ GameWorld.ErrLog("发送全服邮件错误: mailTypeKey=%s,addItemList=%s,paramList=%s,gold=%s,goldPaper=%s,silver=%s,detail=%s,moneySource=%s"
+ % (mailTypeKey, addItemList, paramList, gold, goldPaper, silver, detail, moneySource))
+ return
+
+ gold = min(gold, ShareDefine.Def_UpperLimit_DWord)
+ goldPaper = min(goldPaper, ShareDefine.Def_UpperLimit_DWord)
+ silver = min(silver, ShareDefine.Def_UpperLimit_DWord)
+
if not GUID:
GUID = str(uuid.uuid1())
@@ -659,11 +694,16 @@
#添加补偿包的所有物品
for addItemDict in addItemDictList:
curItemData = MakeCompensationItem(addItemDict)
+ if not curItemData:
+ return
GameWorld.GetCompensationMgr().AddCompensationItem(GUID, curItemData)
createTime = GameWorld.GetCurrentDataTimeStr()
#添加全服领取补偿条件
+ gold = min(gold, ShareDefine.Def_UpperLimit_DWord)
+ goldPaper = min(goldPaper, ShareDefine.Def_UpperLimit_DWord)
+ silver = min(silver, ShareDefine.Def_UpperLimit_DWord)
GameWorld.GetCompensationMgr().AddEntireCompensationItem(GUID, createTime, LimitTime, mailInfo,
PlayerJob, Text, gold, goldPaper, silver, serverID)
checkState, limitLVType, limitLV = ParseEntireCompensationInfo(mailInfo)
@@ -726,6 +766,9 @@
#此处没有下发通知
mailType = moneySource - ChConfig.Def_GiveMoney_Unknown # type类型为byte,存值时需要处理下
+ gold = min(gold, ShareDefine.Def_UpperLimit_DWord)
+ goldPaper = min(goldPaper, ShareDefine.Def_UpperLimit_DWord)
+ silver = min(silver, ShareDefine.Def_UpperLimit_DWord)
GameWorld.GetCompensationMgr().AddPersonalCompensation(GUID, PlayerID, CreateTime,
LimitTime, Text, mailType, gold, goldPaper, silver)
if PlayerID in PyGameData.g_playerDelMailGUIDDict:
@@ -767,6 +810,8 @@
#添加补偿包的所有物品
for addItemDict in addItemDictList:
curItemData = MakeCompensationItem(addItemDict)
+ if not curItemData:
+ return
GameWorld.GetCompensationMgr().AddCompensationItem(GUID, curItemData)
#offlinePlayerIDList = []
@@ -952,6 +997,11 @@
SetPrizeState(curPlayerID, curRequire.GUID, Disable_State, readState)
continue
+ if limitLVType == LimitLVType_Not and curPlayer.GetCreateRoleTime() > curRequire.CreateTime:
+ #GameWorld.DebugLog("升级后不可领取的邮件发送时间后创角的玩家默认不可领取! CreateRoleTime=%s > %s" % (curPlayer.GetCreateRoleTime(), curRequire.CreateTime))
+ SetPrizeState(curPlayerID, curRequire.GUID, Disable_State, readState)
+ continue
+
if limitLV > curLV:
#等级不足
if limitLVType == LimitLVType_Not:
--
Gitblit v1.8.0