| | |
| | | import math
|
| | | import json
|
| | | #领取状态 个位数标识 (可领取即已通知过玩家该封邮件,需要在邮件发生时和上线时设置状态
|
| | | #0 未通知,1 不可领取, 2 可领取, 3 已领取
|
| | | #0 未通知,1 不可领取, 2 可领取, 3 已领取,4 已删除
|
| | | (
|
| | | Unknown_State,
|
| | | Disable_State,
|
| | | Enable_State,
|
| | | Yet_State
|
| | | ) = range(4)
|
| | | Yet_State,
|
| | | Del_State
|
| | | ) = range(5)
|
| | |
|
| | | CheckState_OK = 0 # 已审核
|
| | | CheckState_No = 1 # 未审核
|
| | |
| | | # @param curItemDict
|
| | | # @return IpyCompensationItem
|
| | | def MakeCompensationItem(curItemDict):
|
| | | if not __checkMailItemDict(curItemDict):
|
| | | return
|
| | | curItemData = IPY_GameServer.IpyCompensationItem()
|
| | | #curItemData.GUID = curItemDict['GUID']
|
| | | curItemData.ItemID = curItemDict['ItemID']
|
| | |
| | |
|
| | | 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)
|
| | |
| | | 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
|
| | |
|
| | |
| | | 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, 是否拍品), {或物品信息字典}, ...]
|
| | | # @return GUID
|
| | | # @remarks addItemList支持append字典
|
| | | def SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold = 0, goldPaper = 0, silver = 0,
|
| | | detail="", moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False):
|
| | | detail="", moneySource=ChConfig.Def_GiveMoney_Mail, crossMail=False, mailType=0):
|
| | | if not playerIDList:
|
| | | return ""
|
| | |
|
| | |
| | | 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):
|
| | |
| | | startIndex = i*perMailItemCnt
|
| | | GUID = str(uuid.uuid1())
|
| | | AddPersonalItem(GUID, addItemDictList[startIndex:startIndex + perMailItemCnt], playerIDList,
|
| | | limitTime, "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys, title, content),
|
| | | limitTime, GetMailText(title, content, mailType),
|
| | | gold, goldPaper, silver, detail, moneySource, crossMail)
|
| | | return GUID
|
| | |
|
| | | ## 发送纯文字个人补偿
|
| | | # @param limitTime 可以传空
|
| | | # @return None
|
| | | def SendPersonalAsTextMail(PlayerID, title, content, limitTime):
|
| | | def SendPersonalAsTextMail(PlayerID, title, content, limitTime, mailType=0):
|
| | | if GameWorld.IsCrossServer():
|
| | | return
|
| | | GUID = str(uuid.uuid1())
|
| | | PyAddPersonalCompensation(GUID, PlayerID, GameWorld.GetCurrentDataTimeStr(), limitTime,
|
| | | "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys,title, content))
|
| | | GetMailText(title, content, mailType))
|
| | | return
|
| | |
|
| | | def GetMailText(title, content, mailType=0, sender=ChConfig.Def_Mail_SenderSys):
|
| | | ## 获取邮件字段 Text 内容
|
| | | return "%s<$_$>%s<$_$>%s<$_$>%s" % (sender, title, content, mailType)
|
| | |
|
| | | def GetEntireCompensationInfo(checkState, limitLVType, limitLV):
|
| | | return checkState * 1000000 + limitLVType * 100000 + limitLV
|
| | |
| | | compensation = compensationMgr.PersonalCompensationAt(playerID, i)
|
| | |
|
| | | contentList = compensation.Text.split("<$_$>")
|
| | | if len(contentList) != 3:
|
| | | if len(contentList) < 3:
|
| | | continue
|
| | | sender, title, content = contentList
|
| | | sender, title, content = contentList[:3]
|
| | | mailType = GameWorld.ToIntDef(contentList[3]) if len(contentList) > 3 else 0
|
| | |
|
| | | if tempSign in content and tempSignEnd in content:
|
| | | title = content[content.index(tempSign) + len(tempSign):content.index(tempSignEnd)]
|
| | |
| | | recState = compensationMgr.FindPlayerRecState(playerID, GUID)
|
| | |
|
| | | infoDict = {"GUID":GUID, "Gold":compensation.Gold, "GoldPaper":compensation.GoldPaper, "Silver":compensation.Silver,
|
| | | "Sender":sender, "Title":title, "Content":content, "RecState":recState,
|
| | | "Sender":sender, "Title":title, "Content":content, "RecState":recState, "MailType":mailType,
|
| | | "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList}
|
| | |
|
| | | retList.append(infoDict)
|
| | |
| | | return
|
| | |
|
| | | contentList = compensation.Text.split("<$_$>")
|
| | | if len(contentList) != 3:
|
| | | if len(contentList) < 3:
|
| | | return
|
| | | sender, title, content = contentList
|
| | | sender, title, content = contentList[:3]
|
| | | mailType = GameWorld.ToIntDef(contentList[3]) if len(contentList) > 3 else 0
|
| | |
|
| | | if searchTitle and searchTitle not in title:
|
| | | return
|
| | |
| | | continue
|
| | | itemList.append([itemID, curItem.Count, curItem.IsBind, curItem.UserData])
|
| | |
|
| | | compensationDict = {"GUID":GUID, "CheckState":checkState, "LimitLVType":limitLVType, "LimitLV":limitLV,
|
| | | compensationDict = {"GUID":GUID, "CheckState":checkState, "LimitLVType":limitLVType, "LimitLV":limitLV, "MailType":mailType,
|
| | | "Gold":compensation.Gold, "GoldPaper":compensation.GoldPaper, "Silver":compensation.Silver,
|
| | | "PlayerJob":compensation.PlayerJob, "Sender":sender, "Title":title, "Content":content, "OnlyServerID":compensation.ServerID,
|
| | | "CreateTime":compensation.CreateTime, "LimitTime":compensation.LimitTime, "ItemList":itemList}
|
| | |
| | | return successGUIDList
|
| | |
|
| | | def SendEntireMail(mailTypeKey, getDays, limitLV, limitLVType, addItemList=[], paramList=[], \
|
| | | gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, GUID=""):
|
| | | gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail, GUID="", mailType=0):
|
| | | ''' 发送全服邮件
|
| | | @param mailTypeKey: 邮件模板key
|
| | | @param getDays: 有效天数
|
| | |
| | | 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())
|
| | |
|
| | |
| | | PlayerJob = 127 # 默认全职业可领
|
| | | serverID = 0 # 默认所有服务器ID
|
| | |
|
| | | AddEntireItem(GUID, addItemDictList, limitTime, mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s" % (sender, title, content), |
| | | AddEntireItem(GUID, addItemDictList, limitTime, mailInfo, PlayerJob, GetMailText(title, content, mailType, sender), |
| | | gold, goldPaper, silver, detail, serverID)
|
| | | return
|
| | |
|
| | |
| | | #添加补偿包的所有物品
|
| | | 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)
|
| | |
| | |
|
| | | #此处没有下发通知
|
| | | 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:
|
| | |
| | | #添加补偿包的所有物品
|
| | | for addItemDict in addItemDictList:
|
| | | curItemData = MakeCompensationItem(addItemDict)
|
| | | if not curItemData:
|
| | | return
|
| | | GameWorld.GetCompensationMgr().AddCompensationItem(GUID, curItemData)
|
| | |
|
| | | #offlinePlayerIDList = []
|
| | |
| | | def SetPrizeState(curPlayerID, GUID, prizeState, readState):
|
| | | state = readState*10 + prizeState
|
| | | GameWorld.GetCompensationMgr().AddPlayerRec(curPlayerID, GUID, state)
|
| | | return
|
| | |
|
| | | def GetPrizeGetState(curPlayerID, GUID):
|
| | | ## 获取领取状态
|
| | | return GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, GUID) % 10
|
| | |
|
| | | ##查找玩家可领取的补偿列表
|
| | | # @param curPlayer
|
| | |
| | | states = GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, curRequire.GUID)
|
| | | readState = states/10 # 可读
|
| | | curState = states%10 # 领取状态
|
| | | if curState in (Disable_State, Yet_State):
|
| | | if curState in (Disable_State, Del_State):
|
| | | #不可领 或 已领
|
| | | |
| | | #GameWorld.DebugLog("该玩家当前全服邮件状态不下发: curState=%s,GUID=%s" % (curState, curRequire.GUID), curPlayerID)
|
| | | continue
|
| | |
|
| | | limitTime = datetime.datetime.strptime(curRequire.LimitTime, ChConfig.TYPE_Time_Format)
|
| | |
| | | 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:
|
| | |
| | | continue
|
| | |
|
| | | #可以用的奖励
|
| | | if Enable_State != curState:
|
| | | if Enable_State != curState and curState != Yet_State:
|
| | | SetPrizeState(curPlayerID, curRequire.GUID, Enable_State, readState)
|
| | | allList.append((curRequire.GUID, curRequire.Text, curRequire.CreateTime,
|
| | | curRequire.Gold, curRequire.GoldPaper, curRequire.Silver))
|
| | |
| | | subPack.Gold = gold
|
| | | subPack.GoldPaper = goldPaper
|
| | | subPack.Silver = silver
|
| | | subPack.IsRead = GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayer.GetPlayerID(), GUID)/10
|
| | | resState = GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayer.GetPlayerID(), GUID)
|
| | | if resState % 10 == Yet_State:
|
| | | subPack.IsRead = Yet_State # 已领取
|
| | | else:
|
| | | subPack.IsRead = resState / 10 # 是否已读
|
| | | for index in xrange(curGUIDItemCount):
|
| | | curItem = GameWorld.GetCompensationMgr().FindItemAt(GUID, index)
|
| | | subPackItem = ChPyNetSendPack.tagGCCompensationItem()
|
| | |
| | | sendPack.PackList.append(subPack)
|
| | | sendPack.Count = len(sendPack.PackList)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | | def SyncQueryCompensationResultByGUID(curPlayer, notifyGUIDList):
|
| | | curPlayerID = curPlayer.GetPlayerID()
|
| | | notifyList = []
|
| | | compensationMgr = GameWorld.GetCompensationMgr()
|
| | | for GUID in notifyGUIDList:
|
| | | findCompensation = compensationMgr.FindPersonalCompensation(curPlayerID, GUID)
|
| | | if findCompensation.PlayerID != curPlayerID:
|
| | | findCompensation = compensationMgr.FindEntireCompensation(GUID)
|
| | | if findCompensation.GUID != GUID:
|
| | | # 找不到邮件
|
| | | continue
|
| | | notifyList.append((findCompensation.GUID, findCompensation.Text, findCompensation.CreateTime, |
| | | findCompensation.Gold, findCompensation.GoldPaper, findCompensation.Silver))
|
| | | if not notifyList:
|
| | | return
|
| | | SyncQueryCompensationResult(curPlayer, notifyList)
|
| | | return
|
| | |
|
| | | ##03 03 玩家请求领取补偿#tagMGRequestCompensation
|
| | |
| | | GameWorld.DebugLog("Compensation### OnMGRequestCompensation myPlayerID %s GUID %s"%(myPlayerID, GUID))
|
| | |
|
| | | compensationType, curEntireRequire = CheckRequestCompensation(curPlayer, GUID)
|
| | | if compensationType == Unknow_CompensationType:
|
| | | if compensationType == Unknow_CompensationType or not curEntireRequire:
|
| | | #领取失败
|
| | | curPlayer.SetDict(Def_RequestState, 0)#解锁
|
| | | GameWorld.DebugLog("Compensation### OnMGRequestCompensation no found")
|
| | |
| | | def CheckRequestCompensation(curPlayer, GUID, isPersonnal = True):
|
| | | curPlayerID = curPlayer.GetID()
|
| | |
|
| | | states = GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, GUID)
|
| | | readState = states/10 # 可读 |
| | | curState = states%10 # 领取状态
|
| | | |
| | | if curState in (Disable_State, Yet_State, Del_State):
|
| | | #不可领 或 已领
|
| | | #GameWorld.DebugLog("当前邮件不可领取或已领: states=%s,curState=%s,GUID=%s" % (states, curState, GUID), curPlayerID)
|
| | | return Unknow_CompensationType, None
|
| | | |
| | | if isPersonnal:
|
| | | #在个人补偿中
|
| | | curPersonalCompensation = GameWorld.GetCompensationMgr().FindPersonalCompensation(curPlayerID, GUID)
|
| | |
| | |
|
| | | #---------
|
| | | #在全服补偿中
|
| | | states = GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, GUID)
|
| | | readState = states/10 # 可读 |
| | | curState = states%10 # 领取状态
|
| | | |
| | | if curState in (Disable_State, Yet_State):
|
| | | #不可领 或 已领
|
| | | return Unknow_CompensationType, None
|
| | | curEntireRequire = GameWorld.GetCompensationMgr().FindEntireCompensation(GUID)
|
| | | if curEntireRequire.GUID != GUID:
|
| | | #不再全服补偿中,删除记录
|
| | |
| | | ##玩家领取补偿物品发放成功
|
| | | # @param curPlayer, GUID
|
| | | # @return None
|
| | | def GiveCompensationSuccess(curPlayer, GUID, CompensationType):
|
| | | def GiveCompensationSuccess(curPlayer, GUID, CompensationType, isDel=False):
|
| | | curPlayerID = curPlayer.GetID()
|
| | | NotifyCompensationResult(curPlayer, GUID, 1)
|
| | | |
| | | SetPrizeState(curPlayerID, GUID, Yet_State, Read_State_Yes) # 设置为已领取
|
| | | #流向记录
|
| | | DataRecordPack.DR_GiveCompensationSuccess(curPlayerID, GUID)
|
| | | if not isDel:
|
| | | SyncQueryCompensationResultByGUID(curPlayer, [GUID])
|
| | | return
|
| | | |
| | | NotifyCompensationResult(curPlayer, GUID, 1)
|
| | | |
| | | #全服奖励领取记录变更为已领取
|
| | | if CompensationType == Entire_CompensationType:
|
| | | GameWorld.GetCompensationMgr().AddPlayerRec(curPlayerID, GUID, 10 + Yet_State)
|
| | | SetPrizeState(curPlayerID, GUID, Del_State, Read_State_Yes)
|
| | | return
|
| | | #个人奖励领取条目执行删除
|
| | | if CompensationType == Personal_CompensationType:
|
| | |
| | |
|
| | | mailText = curMail.Text
|
| | | # 通知类模板邮件,过天可直接删除
|
| | | if tempSign in mailText and tempSignEnd in mailText and CheckCanDelCompensation(curMail, curMail.GUID):
|
| | | if tempSign in mailText and tempSignEnd in mailText and CheckCanDelCompensation(curMail, curMail.GUID, curMail.PlayerID):
|
| | | tempKey = mailText[mailText.index(tempSign) + len(tempSign):mailText.index(tempSignEnd)]
|
| | | notClearMailKeyList = IpyGameDataPY.GetFuncEvalCfg("MailSet", 1)
|
| | | if tempKey not in notClearMailKeyList:
|
| | |
| | | #在个人补偿中
|
| | | curPersonalCompensation = GameWorld.GetCompensationMgr().FindPersonalCompensation(curPlayerID, GUID)
|
| | | if curPersonalCompensation.PlayerID == curPlayerID:
|
| | | if not CheckCanDelCompensation(curPersonalCompensation, GUID):
|
| | | if not CheckCanDelCompensation(curPersonalCompensation, GUID, curPlayerID):
|
| | | #有附件不可删除
|
| | | GameWorld.DebugLog("该个人邮件不可删除: %s" % GUID, curPlayerID)
|
| | | NotifyCompensationResult(curPlayer, GUID, 0)
|
| | | return
|
| | |
|
| | |
| | | #全服邮件
|
| | | curEntireRequire = GameWorld.GetCompensationMgr().FindEntireCompensation(GUID)
|
| | | if curEntireRequire.GUID == GUID:
|
| | | if not CheckCanDelCompensation(curEntireRequire, GUID):
|
| | | if not CheckCanDelCompensation(curEntireRequire, GUID, curPlayerID):
|
| | | #有附件不可删除
|
| | | GameWorld.DebugLog("该全服邮件不可删除: %s" % GUID, curPlayerID)
|
| | | NotifyCompensationResult(curPlayer, GUID, 0)
|
| | | return
|
| | |
|
| | | SetPrizeState(curPlayerID, GUID, Disable_State, GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, GUID)/10)
|
| | | SetPrizeState(curPlayerID, GUID, Del_State, GameWorld.GetCompensationMgr().FindPlayerRecState(curPlayerID, GUID)/10)
|
| | | NotifyCompensationResult(curPlayer, GUID, 1)
|
| | | #GameWorld.DebugLog("全服邮件OnDelCompensation:%s"%GUID)
|
| | | return
|
| | |
| | | NotifyCompensationResult(curPlayer, GUID, 0)
|
| | |
|
| | | # 有附件的情况玩家不可主动删除邮件,避免误操作;系统可删除不用调用此接口
|
| | | def CheckCanDelCompensation(mailObj, GUID):
|
| | | def CheckCanDelCompensation(mailObj, GUID, playerID=0):
|
| | | if playerID:
|
| | | if GetPrizeGetState(playerID, GUID) == Yet_State:
|
| | | #GameWorld.DebugLog("已领取的邮件可删除: %s" % GUID, playerID)
|
| | | return True
|
| | | |
| | | if mailObj.Gold or mailObj.GoldPaper or mailObj.Silver:
|
| | | # 有附加货币不可删除
|
| | | return False
|