hxp
2019-03-05 79a23de6692781dfe4b18fdb57bc4b3e69f34014
6250 【后端】【2.0】拍卖行开发单(邮件记录货币来源)
10个文件已修改
160 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChGameToMapPyPack.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/testMail.py 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py 83 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChGameToMapPyPack.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
@@ -719,12 +719,6 @@
# 邮件(补偿)默认发件人, 具体做活动再定
Def_Mail_SenderSys = "SenderSys"    # 默认邮件发送人
# 邮件类型划分,用于每种类型的保存上限
(
Mail_Type_Default,
Mail_Type_Market,
) = range(2)
# 竖杠
Def_Str_Montant = "|"
@@ -795,8 +789,6 @@
VIPPrivilege_XianyuanCoinUpperAdd,    #33 仙缘币上限加成
VIPPrivilege_XianyuanCoinAddPer,    #34 仙缘币获得倍率加成(万分比)
) = range(1, 35)
Def_MailMoneySource = "MoneySource" # 邮件货币来源key
#游戏货币来源类型定义
(
ServerPython/CoreServerGroup/GameServer/Script/ChGameToMapPyPack.py
@@ -484,6 +484,7 @@
    Gold = 0    #(DWORD Gold)//仙玉
    GoldPaper = 0    #(DWORD GoldPaper)//绑定仙玉
    Silver = 0    #(DWORD Silver)//ͭǮ
    MoneySource = 0    #(BYTE MoneySource)//货币来源
    Items = list()    #(vector<tagGMCompensationItem> Items)//补偿物品信息
    data = None
@@ -505,6 +506,7 @@
        self.Gold,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.GoldPaper,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Silver,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.MoneySource,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            temItems = tagGMCompensationItem()
            _pos = temItems.ReadData(_lpData, _pos)
@@ -525,6 +527,7 @@
        self.Gold = 0
        self.GoldPaper = 0
        self.Silver = 0
        self.MoneySource = 0
        self.Items = list()
        return
@@ -540,6 +543,7 @@
        length += 4
        length += 4
        length += 4
        length += 1
        for i in range(self.Count):
            length += self.Items[i].GetLength()
@@ -557,6 +561,7 @@
        data = CommFunc.WriteDWORD(data, self.Gold)
        data = CommFunc.WriteDWORD(data, self.GoldPaper)
        data = CommFunc.WriteDWORD(data, self.Silver)
        data = CommFunc.WriteBYTE(data, self.MoneySource)
        for i in range(self.Count):
            data = CommFunc.WriteString(data, self.Items[i].GetLength(), self.Items[i].GetBuffer())
        return data
@@ -573,6 +578,7 @@
                                Gold:%d,
                                GoldPaper:%d,
                                Silver:%d,
                                MoneySource:%d,
                                Items:%s
                                '''\
                                %(
@@ -586,6 +592,7 @@
                                self.Gold,
                                self.GoldPaper,
                                self.Silver,
                                self.MoneySource,
                                "..."
                                )
        return DumpString
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/testMail.py
@@ -18,6 +18,7 @@
import PlayerCompensation
import GameWorld
import ShareDefine
import ChConfig
## 执行逻辑
#  @param curPlayer 当前玩家
@@ -26,7 +27,7 @@
def OnExec(curPlayer, gmList):
    
    if not gmList:
        GameWorld.DebugAnswer(curPlayer, "testMail 模板编号, 物品数, 仙玉,绑定仙玉,铜钱,可选模板参数1, 参数2, ...")
        GameWorld.DebugAnswer(curPlayer, "testMail 模板编号 物品数 仙玉 绑玉 铜钱 货币来源 可选模板参数1 参数2 ...")
        return
    
    paramCnt = len(gmList)
@@ -37,13 +38,14 @@
    gold = gmList[2] if paramCnt > 2 else 0
    goldPaper = gmList[3] if paramCnt > 3 else 0
    silver = gmList[4] if paramCnt > 4 else 0
    paramList = gmList[5:]
    moneySource = gmList[5] if paramCnt > 5 else ChConfig.Def_GiveMoney_Mail
    paramList = gmList[6:]
    
    itemCfg = [(29,2000000000,1),(912,5,1),(10161,1,1),(10162,1,1),(10163,1,1)]
    addItemList = itemCfg[0:itemCnt]
    content = "<MailTemplate>%s</MailTemplate>%s" % (mailNum, paramList)
    mailGUID = PlayerCompensation.SendPersonalItemMailEx("", content, 1, [curPlayer.GetPlayerID()], addItemList,
                                                         gold, goldPaper, silver)
                                                         gold, goldPaper, silver, moneySource=moneySource)
    GameWorld.DebugAnswer(curPlayer, "SendMail mailGUID=%s" % mailGUID)
    return
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py
@@ -444,20 +444,20 @@
                giveGoldAverage = min(giveMaxGold, int(math.ceil(giveTotalGold * 1.0 / memCount))) # 有收益的人平分
                
                # 仙盟拍品收益邮件
                detail = {"ItemGUID":itemGUID, "ItemID":itemID, "Count":itemCount, "BidderPrice":bidderPrice, "FamilyPlayerIDList":familyPlayerIDList,
                          ChConfig.Def_MailMoneySource:ChConfig.Def_GiveMoney_AuctionGain}
                detail = {"ItemGUID":itemGUID, "ItemID":itemID, "Count":itemCount, "BidderPrice":bidderPrice, "FamilyPlayerIDList":familyPlayerIDList}
                paramList = [itemID, auctionItem.BidderName, bidderPrice, taxRate, giveGoldAverage, personMaxRate]
                PlayerCompensation.SendMailByKey("PaimaiMail6", familyPlayerIDList, [], paramList, gold=giveGoldAverage, detail=detail)
                PlayerCompensation.SendMailByKey("PaimaiMail6", familyPlayerIDList, [], paramList, gold=giveGoldAverage,
                                                 detail=detail, moneySource=ChConfig.Def_GiveMoney_AuctionGain)
                
            elif playerID:
                taxRate = IpyGameDataPY.GetFuncCfg("AuctionTaxrate", 1) # 全服拍品税率百分比
                givePlayerGold = int(math.ceil(bidderPrice * (100 - taxRate) / 100.0))
                
                # 个人拍卖收益邮件
                detail = {"ItemGUID":itemGUID, "ItemID":itemID, "Count":itemCount, "BidderPrice":bidderPrice,
                          ChConfig.Def_MailMoneySource:ChConfig.Def_GiveMoney_AuctionGain}
                detail = {"ItemGUID":itemGUID, "ItemID":itemID, "Count":itemCount, "BidderPrice":bidderPrice}
                paramList = [itemID, auctionItem.BidderName, bidderPrice, taxRate, givePlayerGold]
                PlayerCompensation.SendMailByKey("PaimaiMail5", [playerID], [], paramList, gold=givePlayerGold, detail=detail)
                PlayerCompensation.SendMailByKey("PaimaiMail5", [playerID], [], paramList, gold=givePlayerGold,
                                                 detail=detail, moneySource=ChConfig.Def_GiveMoney_AuctionGain)
                
            AddAuctionRecord(auctionItem, AuctionRecordResult_SellOK)
        else:
@@ -831,15 +831,17 @@
    
    # 邮件返还上个竞价者
    if lastBidderID and lastBidderPrice:
        detail = {"ItemID":itemID, "ItemGUID":itemGUID, "Count":itemCount, ChConfig.Def_MailMoneySource:ChConfig.Def_GiveMoney_AuctionBidReturn}
        detail = {"ItemID":itemID, "ItemGUID":itemGUID, "Count":itemCount}
        if isBuyout:
            # 竞拍失败,仅通知
            paramList = [itemID, lastBidderPrice]
            PlayerCompensation.SendMailByKey("PaimaiMail2", [lastBidderID], [], paramList, gold=lastBidderPrice, detail=detail)
            PlayerCompensation.SendMailByKey("PaimaiMail2", [lastBidderID], [], paramList, gold=lastBidderPrice,
                                             detail=detail, moneySource=ChConfig.Def_GiveMoney_AuctionBidReturn)
        else:
            # 竞拍失败,可继续竞价邮件
            paramList = [itemID, lastBidderPrice, itemGUID]
            PlayerCompensation.SendMailByKey("PaimaiMail1", [lastBidderID], [], paramList, gold=lastBidderPrice, detail=detail)
            PlayerCompensation.SendMailByKey("PaimaiMail1", [lastBidderID], [], paramList, gold=lastBidderPrice,
                                             detail=detail, moneySource=ChConfig.Def_GiveMoney_AuctionBidReturn)
        AddAuctionRecord(auctionItem, AuctionRecordResult_BidFail)
        
        isSyncBiddingItem = False
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCompensation.py
@@ -84,16 +84,15 @@
## 功能发放物品补偿/奖励邮件
#  @param addItemList [(itemID, itemCnt, isBind), {或物品信息字典}, ...]
#  @return GUID
def SendPersonalItemMailEx(title, content, getDays, playerIDList, addItemList,
                           gold = 0, goldPaper = 0, silver = 0, sourceType = ChConfig.Mail_Type_Default, detail=""):
def SendPersonalItemMailEx(title, content, getDays, playerIDList, addItemList, gold = 0, goldPaper = 0, silver = 0,
                           detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    limitTime = str(GameWorld.GetDatetimeByDiffDays(getDays))
    limitTime = limitTime.split(".")[0]
    return SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList,
                                gold, goldPaper, silver, sourceType, detail=detail)
    return SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource)
    
def SendPersonalItemMailBatch(batchMailInfoList):
    ## 批量发送邮件
    mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail = batchMailInfoList
    mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail, moneySource = batchMailInfoList
    
    lenPlayerID = len(batchPlayerIDList)
    lenItem = len(batchAddItemList)
@@ -116,26 +115,27 @@
        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)
        SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold, goldPaper, silver, detail=detail, moneySource=moneySource)
        
    return
def SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList=[], gold=0, goldPaper=0, silver=0, detail=""):
def SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList=[], gold=0, goldPaper=0, silver=0,
                  detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    if not mailTypeKey:
        mailTypeKey = ShareDefine.DefaultLackSpaceMailType
    GameWorld.DebugLog("SendMailByKey %s, playerIDList=%s, addItemList=%s, paramList=%s, gold=%s, goldPaper=%s, silver=%s"
                       % (mailTypeKey, playerIDList, addItemList, paramList, gold, goldPaper, silver))
    GameWorld.DebugLog("SendMailByKey %s, playerIDList=%s, addItemList=%s, paramList=%s, gold=%s, goldPaper=%s, silver=%s, moneySource=%s"
                       % (mailTypeKey, playerIDList, addItemList, paramList, gold, goldPaper, silver, moneySource))
    title = ""
    content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, json.dumps(paramList, ensure_ascii=False))
    return SendPersonalItemMailEx(title, content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail=detail)
    return SendPersonalItemMailEx(title, content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource)
#  此处货币playerIDList发放统一,如根据玩家不同而变,则应需修改
## 功能发放物品补偿/奖励邮件
#  @param addItemList [(itemID, itemCnt, isBind), {或物品信息字典}, ...]
#  @return GUID
#  @remarks addItemList支持append字典
def SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList,
                         gold = 0, goldPaper = 0, silver = 0, sourceType = ChConfig.Mail_Type_Default, detail=""):
def SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold = 0, goldPaper = 0, silver = 0,
                         detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    if not playerIDList:
        return ""
    
@@ -173,19 +173,18 @@
        GUID = str(uuid.uuid1())
        AddPersonalItem(GUID, addItemDictList[startIndex:startIndex + perMailItemCnt], playerIDList, 
                                           limitTime, "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys, title, content),
                                           gold, goldPaper, silver, sourceType, detail)
                                           gold, goldPaper, silver, detail, moneySource)
    return GUID
## 发送纯文字个人补偿
#  @param limitTime 可以传空
#  @param sourceType 查看 Mail_Type_Default 相关定义
#  @return None
def SendPersonalAsTextMail(PlayerID, title, content, limitTime, sourceType = ChConfig.Mail_Type_Default):
def SendPersonalAsTextMail(PlayerID, title, content, limitTime):
    if GameWorld.IsCrossServer():
        return
    GUID = str(uuid.uuid1())
    PyAddPersonalCompensation(GUID, PlayerID, GameWorld.GetCurrentDataTimeStr(), limitTime, 
                              "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys,title, content), sourceType)
                              "%s<$_$>%s<$_$>%s" % (ChConfig.Def_Mail_SenderSys,title, content))
    return
def GetEntireCompensationInfo(checkState, limitLVType, limitLV):
@@ -378,38 +377,33 @@
# 检查邮件是否已达到保存上限,如超过则先删除旧邮件
# @param LimitTime 参数可传空,个人邮件不限制领取期限,只限制保存数量, 
def PyAddPersonalCompensation(GUID, PlayerID, CreateTime, LimitTime, Text, sourceType,
                              gold = 0, goldPaper = 0, silver = 0):
def PyAddPersonalCompensation(GUID, PlayerID, CreateTime, LimitTime, Text, gold = 0, goldPaper = 0, silver = 0, moneySource=ChConfig.Def_GiveMoney_Mail):
    curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(PlayerID)
    cnt = GameWorld.GetCompensationMgr().GetPersonalCompensationCountByType(PlayerID, sourceType)
    totalCount = GameWorld.GetCompensationMgr().GetPersonalCompensationCount(PlayerID)
    #待支持py读表
    tmpDict = {ChConfig.Mail_Type_Default:IpyGameDataPY.GetFuncCfg("MailDefaultCount"),
               ChConfig.Mail_Type_Market:IpyGameDataPY.GetFuncCfg("MailMarketCount")}
    delcnt = cnt - tmpDict[sourceType] + 1
    #GameWorld.DebugLog("PyAddPersonalCompensation typecnt = %s-%s"%(cnt, delcnt))
    if delcnt > 0:
    maxMailCount = IpyGameDataPY.GetFuncCfg("MailDefaultCount")
    delCount = totalCount - maxMailCount + 1
    GameWorld.DebugLog("新增个人邮件: totalCount=%s,maxMailCount=%s" % (totalCount, maxMailCount), PlayerID)
    if delCount > 0:
        GameWorld.Log("个人邮件达到上限,需要删除!delCount=%s" % (delCount), PlayerID)
        #先取得要删除的GUID
        delGUIDs = []
        for i in xrange(delcnt):
            tmpGuid = GameWorld.GetCompensationMgr().AtGUIDInPersonalTypesByType(PlayerID, sourceType, i)
            if not tmpGuid:
                #GameWorld.DebugLog("PyAddPersonalCompensation not GUID = %s"%tmpGuid)
                continue
            delGUIDs.append(tmpGuid)
        for guid in delGUIDs:
        for i in xrange(delCount):
            curIpyPersonalData = GameWorld.GetCompensationMgr().PersonalCompensationAt(PlayerID, i)
            delGUIDs.append(curIpyPersonalData.GUID)
        for guid in delGUIDs:
            ClearPersonalCompensation(PlayerID, guid)
            #GameWorld.DebugLog("PyAddPersonalCompensation DeletePersonalCompensation GUID = %s"%guid)
            GameWorld.Log("    DeletePersonalCompensation GUID = %s" % guid, PlayerID)
            
            if curPlayer:
                NotifyCompensationResult(curPlayer, guid, 1)
            #未补流向
    #GameWorld.DebugLog("PyAddPersonalCompensation CreateTime %s"%CreateTime)
    #此处没有下发通知
    mailType = moneySource - ChConfig.Def_GiveMoney_Unknown # type类型为byte,存值时需要处理下
    GameWorld.GetCompensationMgr().AddPersonalCompensation(GUID, PlayerID, CreateTime,
                                                           LimitTime, Text, sourceType, gold, goldPaper, silver)
                                                           LimitTime, Text, mailType, gold, goldPaper, silver)
    return
@@ -417,8 +411,7 @@
## 添加个人补偿
#  @param addItemDict, PlayerIDList, LimitTime, Text 
#  @return None
def AddPersonalItem(GUID, addItemDictList, PlayerIDList, LimitTime, Text,
                    gold = 0, goldPaper = 0, silver = 0, sourceType = ChConfig.Mail_Type_Default, detail=""):
def AddPersonalItem(GUID, addItemDictList, PlayerIDList, LimitTime, Text, gold = 0, goldPaper = 0, silver = 0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    if GameWorld.IsCrossServer():
        return
    GameWorld.DebugLog("Compensation### AddPersonalItem GUID:%s ItemDict:\n%s "%(GUID, addItemDictList))
@@ -433,8 +426,7 @@
    #批量添加玩家个人补偿领取表
    createTime = GameWorld.GetCurrentDataTimeStr()
    for PlayerID in PlayerIDList:
        PyAddPersonalCompensation(GUID, PlayerID, createTime, LimitTime,
                                  Text, sourceType, gold, goldPaper, silver)
        PyAddPersonalCompensation(GUID, PlayerID, createTime, LimitTime, Text, gold, goldPaper, silver, moneySource)
        # 针对个人补偿,如果是在线玩家,则立即推送给客户端
        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(PlayerID)
        if curPlayer:
@@ -454,7 +446,7 @@
    
    #添加流向
    addDict = {"LimitTime":LimitTime, "Text":Text, "Gold":gold, "GoldPaper":goldPaper, "Silver":silver, 
               "ItemListLen":len(addItemDictList), "Detail":detail}
               "ItemListLen":len(addItemDictList), "Detail":detail, "MoneySource":moneySource}
    DataRecordPack.DR_AddPersonalCompensation(PlayerIDList, GUID, addItemDictList, addDict)
    return
@@ -680,7 +672,7 @@
        curPlayer.SetDict(Def_RequestState, 0)#解锁
        GameWorld.DebugLog("Compensation### OnMGRequestCompensation no found")
        return
    Text, gold, goldPaper, silver = curEntireRequire.Text, curEntireRequire.Gold, curEntireRequire.GoldPaper, curEntireRequire.Silver
    Text, gold, goldPaper, silver, moneySource = curEntireRequire.Text, curEntireRequire.Gold, curEntireRequire.GoldPaper, curEntireRequire.Silver, curEntireRequire.Type
    #校验背包剩余空间是否足够
    #===========================================================================
    # curCUIDItemCount = GameWorld.GetCompensationMgr().FindItemCount(GUID)
@@ -690,7 +682,7 @@
    #    return
    #===========================================================================
    #发送到MapServer给予奖励
    SendGMRequestCompensationResult(routeIndex, mapID, curPlayer, GUID, compensationType, Text, gold, goldPaper, silver)
    SendGMRequestCompensationResult(routeIndex, mapID, curPlayer, GUID, compensationType, Text, gold, goldPaper, silver, moneySource)
    GameWorld.DebugLog("Compensation### OnMGRequestCompensation out")
    
##请求领取物品
@@ -767,7 +759,7 @@
#  @param routeIndex, mapID, curPlayer, curItem
#  @return None
def SendGMRequestCompensationResult(routeIndex, mapID, curPlayer, GUID, compensationType, Text,
                                    gold, goldPaper, silver):
                                    gold, goldPaper, silver, moneySource):
    sendPack = ChGameToMapPyPack.tagGMRequestCompensationResult() 
    sendPack.PlayerID = curPlayer.GetID()
    sendPack.CompensationType = compensationType
@@ -777,6 +769,7 @@
    sendPack.Gold = gold
    sendPack.GoldPaper = goldPaper
    sendPack.Silver = silver
    sendPack.MoneySource = moneySource
    curGUIDItemCount = GameWorld.GetCompensationMgr().FindItemCount(GUID)
    
    for i in xrange(curGUIDItemCount):
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerQuery.py
@@ -485,10 +485,10 @@
    resultName = pack.GetResultName()                       #[queryid, 人气值, 物品ID]
    
    if callName == "SendMail":
        title, content, getDays, playerIDList, addItemList, gold, goldPaper, silver, detail = eval(resultName)
        title, content, getDays, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource = eval(resultName)
        limitTime = str(GameWorld.GetDatetimeByDiffDays(getDays))
        limitTime = limitTime.split(".")[0]
        PlayerCompensation.SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold, goldPaper, silver, detail=detail)
        PlayerCompensation.SendPersonalItemMail(title, content, limitTime, playerIDList, addItemList, gold, goldPaper, silver, detail=detail, moneySource=moneySource)
        return
    
    if callName == "SendMailBatch":
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4765,8 +4765,6 @@
}
## -----------------------------------------------------
Def_MailMoneySource = "MoneySource" # 邮件货币来源key
#游戏货币来源类型定义
(
Def_GiveMoney_Unknown, # δ֪ 0
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChGameToMapPyPack.py
@@ -484,6 +484,7 @@
    Gold = 0    #(DWORD Gold)//仙玉
    GoldPaper = 0    #(DWORD GoldPaper)//绑定仙玉
    Silver = 0    #(DWORD Silver)//ͭǮ
    MoneySource = 0    #(BYTE MoneySource)//货币来源
    Items = list()    #(vector<tagGMCompensationItem> Items)//补偿物品信息
    data = None
@@ -505,6 +506,7 @@
        self.Gold,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.GoldPaper,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.Silver,_pos = CommFunc.ReadDWORD(_lpData, _pos)
        self.MoneySource,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            temItems = tagGMCompensationItem()
            _pos = temItems.ReadData(_lpData, _pos)
@@ -525,6 +527,7 @@
        self.Gold = 0
        self.GoldPaper = 0
        self.Silver = 0
        self.MoneySource = 0
        self.Items = list()
        return
@@ -540,6 +543,7 @@
        length += 4
        length += 4
        length += 4
        length += 1
        for i in range(self.Count):
            length += self.Items[i].GetLength()
@@ -557,6 +561,7 @@
        data = CommFunc.WriteDWORD(data, self.Gold)
        data = CommFunc.WriteDWORD(data, self.GoldPaper)
        data = CommFunc.WriteDWORD(data, self.Silver)
        data = CommFunc.WriteBYTE(data, self.MoneySource)
        for i in range(self.Count):
            data = CommFunc.WriteString(data, self.Items[i].GetLength(), self.Items[i].GetBuffer())
        return data
@@ -573,6 +578,7 @@
                                Gold:%d,
                                GoldPaper:%d,
                                Silver:%d,
                                MoneySource:%d,
                                Items:%s
                                '''\
                                %(
@@ -586,6 +592,7 @@
                                self.Gold,
                                self.GoldPaper,
                                self.Silver,
                                self.MoneySource,
                                "..."
                                )
        return DumpString
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCompensationTube.py
@@ -129,15 +129,15 @@
        #放入玩家背包
        ItemControler.PlayerItemControler(curPlayer).PutInItem(IPY_GameWorld.rptItem, curCreateItem, 
                                                               event=[ChConfig.ItemGive_Mail, False, {"MailGUID":curPackData.GUID}])
    moneySource = curPackData.MoneySource + ChConfig.Def_GiveMoney_Unknown # 存值时为byte类型,使用时需还原回来
    if curPackData.Gold != 0:
        PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, curPackData.Gold, ChConfig.Def_GiveMoney_Mail)
        PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, curPackData.Gold, moneySource)
    
    if curPackData.GoldPaper != 0:
        PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, curPackData.GoldPaper, ChConfig.Def_GiveMoney_Mail)
        PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Paper, curPackData.GoldPaper, moneySource)
    
    if curPackData.Silver != 0:
        PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, curPackData.Silver, ChConfig.Def_GiveMoney_Mail)
        PlayerControl.GiveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, curPackData.Silver, moneySource)
    
    #发送相关数据  回报补偿发放结果
    sendPack = ChMapToGamePyPack.tagMGGiveCompensationResult()
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -325,7 +325,7 @@
    return
#---------------------------------------------------------------------
def SendMailBatch(mailTypeKey, batchPlayerIDList, batchAddItemList=[], batchParamList=[], batchGold=[], batchGoldPaper=[], batchSilver=[], batchDetail=[]):
def SendMailBatch(mailTypeKey, batchPlayerIDList, batchAddItemList=[], batchParamList=[], batchGold=[], batchGoldPaper=[], batchSilver=[], batchDetail=[], moneySource=ChConfig.Def_GiveMoney_Mail):
    '''批量发送邮件, 用于瞬间需要发送多封(大量)邮件的,比如一些公共副本活动等结算时
    @param mailTypeKey: 邮件模板key
    @param batchPlayerIDList: [playerIDList, playerIDList, ...]
@@ -335,14 +335,15 @@
    @param batchGoldPaper: [batchGoldPaper, batchGoldPaper, ...]
    @param batchSilver: [batchSilver, batchSilver, ...]
    @param batchDetail: [记录邮件流向用, ...]
    @param moneySource: 货币来源
    '''
    msgInfo = str([mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail])
    msgInfo = str([mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver, batchDetail, moneySource])
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SendMailBatch", msgInfo, len(msgInfo))
    GameWorld.Log("SendMailBatch %s, batchPlayerIDList=%s, batchAddItemList=%s, batchParamList=%s, batchGold=%s, batchGoldPaper=%s, batchSilver=%s" 
                  % (mailTypeKey, batchPlayerIDList, batchAddItemList, batchParamList, batchGold, batchGoldPaper, batchSilver))
    return
def SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList=[], gold=0, goldPaper=0, silver=0, detail=""):
def SendMailByKey(mailTypeKey, playerIDList, addItemList, paramList=[], gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    '''
    @param detail: 记录邮件流向用
    '''
@@ -350,13 +351,13 @@
        mailTypeKey = ShareDefine.DefaultLackSpaceMailType
    
    content = "<MailTemplate>%s</MailTemplate>%s" % (mailTypeKey, json.dumps(paramList, ensure_ascii=False))
    SendMail("", content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail)
    SendMail("", content, 30, playerIDList, addItemList, gold, goldPaper, silver, detail, moneySource)
    return
## 功能发放物品补偿/奖励邮件
#  @param addItemList [(itemID, itemCnt, isBind), {或物品信息字典}, ...]
#  @return
def SendMail(title, content, getDays, playerIDList, addItemList, gold=0, goldPaper=0, silver=0, detail=""):
def SendMail(title, content, getDays, playerIDList, addItemList, gold=0, goldPaper=0, silver=0, detail="", moneySource=ChConfig.Def_GiveMoney_Mail):
    if not playerIDList:
        return
    
@@ -398,7 +399,7 @@
    for key, itemCnt in itemCountDict.items():
        itemID, isBind = key
        combineItemList.append((itemID, itemCnt, isBind))
    cmdList = [title, content, getDays, playerIDList, combineItemList, gold, goldPaper, silver, detail]
    cmdList = [title, content, getDays, playerIDList, combineItemList, gold, goldPaper, silver, detail, moneySource]
    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "SendMail", '%s' % (cmdList), len(str(cmdList)))
    return True