8796 【BT2】【后端】Part1 2、每日在线送符印寻宝20次(原创角7日在线奖励增加支持每日在线奖励);
3个文件已修改
93 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnlinePrize.py 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -10398,6 +10398,7 @@
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("Index", c_ubyte),    # 奖励索引,其他按顺序
                  ("IsDaily", c_ubyte),    # 是否领取每日日常的奖励,是发1,如果领取定制创角天奖励的则默认发0即可
                  ]
    def __init__(self):
@@ -10415,6 +10416,7 @@
        self.Cmd = 0xA5
        self.SubCmd = 0x06
        self.Index = 0
        self.IsDaily = 0
        return
    def GetLength(self):
@@ -10427,12 +10429,14 @@
        DumpString = '''//A5 06 玩家领取在线奖励 //tagCMGetOnlinePrize:
                                Cmd:%s,
                                SubCmd:%s,
                                Index:%d
                                Index:%d,
                                IsDaily:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.Index
                                self.Index,
                                self.IsDaily
                                )
        return DumpString
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -10398,6 +10398,7 @@
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("Index", c_ubyte),    # 奖励索引,其他按顺序
                  ("IsDaily", c_ubyte),    # 是否领取每日日常的奖励,是发1,如果领取定制创角天奖励的则默认发0即可
                  ]
    def __init__(self):
@@ -10415,6 +10416,7 @@
        self.Cmd = 0xA5
        self.SubCmd = 0x06
        self.Index = 0
        self.IsDaily = 0
        return
    def GetLength(self):
@@ -10427,12 +10429,14 @@
        DumpString = '''//A5 06 玩家领取在线奖励 //tagCMGetOnlinePrize:
                                Cmd:%s,
                                SubCmd:%s,
                                Index:%d
                                Index:%d,
                                IsDaily:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.Index
                                self.Index,
                                self.IsDaily
                                )
        return DumpString
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnlinePrize.py
@@ -28,16 +28,32 @@
import time
##领取在线奖励
# @param None
# @return None
#//A5 06 玩家领取在线奖励 #tagCMGetOnlinePrize
#
#struct   tagCMGetOnlinePrize
#
#{
#    tagHead         Head;
#    BYTE        Index;    // 奖励索引,其他按顺序
#    BYTE        IsDaily;    // 是否领取每日日常的奖励,是发1,如果领取定制创角天奖励的则默认发0即可
#};
def GetOnlinePrize(index, clientPack, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)#GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
    dayID = creatRoleDay
    creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)
    prizeIndex = clientPack.Index
    if not __GetOnlineIsOpen(curPlayer):
    isDaily = clientPack.IsDaily
    GameWorld.DebugLog("领取每日在线奖励: isDaily=%s,prizeIndex=%s" % (isDaily, prizeIndex))
    if prizeIndex <= 0:
        GameWorld.DebugLog("prizeIndex需要从1开始,我也不想,保留原逻辑吧!!!")
        return
    if isDaily:
        dayID = 0 # 0代表每日的
        ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', creatRoleDay)
        if ipyData:
            GameWorld.DebugLog("当天有创角天定制在线奖励,不能领取日常在线奖励!creatRoleDay=%s" % creatRoleDay)
            return
    else:
        dayID = creatRoleDay
    ipyData = IpyGameDataPY.GetIpyGameData('OnlineAward', dayID)
    if not ipyData:
        return
@@ -54,6 +70,7 @@
    stageTimeList = ipyData.GetStageTime()
    
    if prizeIndex - 1 >= len(stageTimeList):
        GameWorld.DebugLog("不存在该在线奖励索引!")
        return
    needTime = stageTimeList[prizeIndex - 1]
    if needTime * 60 > onlineTime:
@@ -62,6 +79,7 @@
    
    awardDict = ipyData.GetReward()
    if str(prizeIndex) not in awardDict:
        GameWorld.DebugLog("没有配置该索引对应在线奖励!")
        return
    itemList = awardDict[str(prizeIndex)]
    
@@ -71,15 +89,13 @@
    if needSpace > packSpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnlinePrizeNote % dayID, awardInfo | awardMark)
    
    # 给物品
    for itemID, itemCount in itemList:
        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnlinePrizeNote % dayID, awardInfo | awardMark)
    #发包
    SendOnlinePrizeInfo(curPlayer)
    return
@@ -116,24 +132,20 @@
    SetStartCalcOnlineTick(curPlayer, 0)
    return
def __GetOnlineIsOpen(curPlayer):
    dayCnt = IpyGameDataPY.IPY_Data().GetOnlineAwardCount()
    creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)#GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
    return creatRoleDay <= dayCnt
    
##发送奖励信息包
# @param None
# @return None
def SendOnlinePrizeInfo(curPlayer):
    if not __GetOnlineIsOpen(curPlayer):
    onlineAwardCount = IpyGameDataPY.IPY_Data().GetOnlineAwardCount()
    if not onlineAwardCount:
        return
    sendPack = ChPyNetSendPack.tagMCOnlinePrize()
    sendPack.Clear()
    sendPack.OnlineTime = GetOnlineTime(curPlayer) * 1000#curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayOnlineTime)
    sendPack.OnlineTime = GetOnlineTime(curPlayer) * 1000
    sendPack.PrizeInfo = []
    for i in xrange(IpyGameDataPY.IPY_Data().GetOnlineAwardCount()):
        dayID = i+1
    for i in xrange(onlineAwardCount):
        dayID = i#i+1,增加了每日支持,从0开始,代表每日
        sendPack.PrizeInfo.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlinePrizeNote % dayID))
    sendPack.Len = len(sendPack.PrizeInfo)
    #通知客户端时间
@@ -165,6 +177,7 @@
    __OnlineMailPrize(curPlayer)
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayOnlineTime, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnlinePrizeNote % 0, 0) # 重置每日在线奖励
   
    if PlayerTJG.GetIsTJG(curPlayer):
        return
@@ -172,21 +185,22 @@
    
    SendOnlinePrizeInfo(curPlayer)
    return
def __OnlineMailPrize(curPlayer):
    #邮件补发奖励
    creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)-1#GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
    if not creatRoleDay:
    creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)
    if creatRoleDay <= 1:
        return
    ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', creatRoleDay)
    mailAwardDay = creatRoleDay - 1
    ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', mailAwardDay)
    if not ipyData:
        return
    prizeInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlinePrizeNote % creatRoleDay)
        ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', 0)
        if not ipyData:
            return
        mailAwardDay = 0 # 昨日非定制的,且有配置0常规的,则补发0的
    prizeInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlinePrizeNote % mailAwardDay)
    onlineTime = GetOnlineTime(curPlayer)
    GameWorld.DebugLog('creatRoleDay=%s,onlineTime=%s' % (creatRoleDay, onlineTime))
    needTimeList = ipyData.GetStageTime()
    awardDict = ipyData.GetReward()
    itemList = []
@@ -198,7 +212,8 @@
    
    if not itemList:
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnlinePrizeNote % creatRoleDay, prizeInfo)
    GameWorld.DebugLog('补发昨日在线奖励: mailAwardDay=%s,onlineTime=%s' % (mailAwardDay, onlineTime))
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnlinePrizeNote % mailAwardDay, prizeInfo)
    PlayerControl.SendMailByKey('OnLineAward1', [curPlayer.GetID()], itemList)
    return