ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -38,7 +38,6 @@
import PlayerPrestigeSys
import FBCommon
import PassiveBuffEffMng
import EventReport
import PlayerSuccess
import ItemControler
import GameFuncComm
@@ -54,6 +53,7 @@
import PlayerActivity
import ChNetSendPack
import PlayerState
import PlayerBeauty
import PlayerOnline
import PlayerTask
import PlayerMail
@@ -969,6 +969,64 @@
            playerIDList.remove(playerID)
    return
def OnPlayerLogin(curPlayer):
    DoGMForbidenTalkOnLogin(curPlayer)
    curPlayer.SetDict(ChConfig.Def_PDict_DayOnlineCalcTime, int(time.time()))
    return
def PlayerOnDay(curPlayer):
    PayCoinOnDay(curPlayer)
    # 重置今日累计在线时长统计
    NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayOnlineTime, 0)
    curPlayer.SetDict(ChConfig.Def_PDict_DayOnlineCalcTime, int(time.time()))
    return
def OnMinute(serverTime):
    # 定时记录当前在线玩家今日总在线时长
    if [serverTime.hour, serverTime.minute] in [[23, 55], [23, 59]]:
        playerManager = GameWorld.GetPlayerManager()
        for i in xrange(playerManager.GetPlayerCount()):
            curPlayer = playerManager.GetPlayerByIndex(i)
            if not GameWorld.IsNormalPlayer(curPlayer):
                continue
            RecordTodayOnlineTime(curPlayer)
    return
def RecordTodayOnlineTime(curPlayer):
    '''更新记录今日累计在线时长
    【注】不能在onday调用,不然可能导致流向记录是错误的
    比如玩家离线了多天后上线,会触发onday,此时记录的在线时长实际是上一次离线天的在线时长
    【正确调用时机】
    1. 每次离线
    2. 每日的 23:59 分触发一次,理论上可能最多少统计1分钟,暂无视
    '''
    onlineTime = GetOnlineTimeToday(curPlayer)
    DataRecordPack.DR_OnlineTimeToday(curPlayer, onlineTime)
    return
def GetOnlineTimeToday(curPlayer):
    ## 获取今日累计在线时长,即使不离线过天也需要重置重新计算
    curTime = int(time.time())
    onlineTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayOnlineTime)
    calcTime = curPlayer.GetDictByKey(ChConfig.Def_PDict_DayOnlineCalcTime) # 计算用,不用存db
    if not calcTime:
        calcTime = curTime
    curPlayer.SetDict(ChConfig.Def_PDict_DayOnlineCalcTime, curTime)
    passTime = curTime - calcTime
    if passTime > 0:
        onlineTime += passTime
    onlineTime = min(onlineTime, 86400) # 3600*24=86400 # 最大累计1天时长
    GameWorld.DebugLogEx("今日累计在线时长: %s, passTime=%s", onlineTime, passTime, curPlayer.GetPlayerID())
    NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayOnlineTime, onlineTime)
    return onlineTime
##更新保存玩家在线时间
# @param curPlayer 玩家实例
# @param tick 时间tick
@@ -1059,6 +1117,7 @@
    #宠物下线逻辑, 这里要进行排行榜, 优先做, 避免玩家光环等属性影响宠物属性失效
    PetControl.DoLogic_PetInfo_OnLeaveServer(curPlayer, tick)
    
    RecordTodayOnlineTime(curPlayer)
    #清除下线消失的buff, 在更新排行榜之前
    __DisconnectClearBuff(curPlayer, tick)
    
@@ -2737,9 +2796,9 @@
        __PayMoneyAfterBySilverPaper(curPlayer, price)
        
    #转盘活动
    PlayerActTurntable.OnPlayerUseGold(curPlayer, type_Price, price)
    #PlayerActTurntable.OnPlayerUseGold(curPlayer, type_Price, price)
    #轮回殿
    PlayerActLunhuidian.AddLunhuidianValue(curPlayer, PlayerActLunhuidian.AwardType_PayMoney, type_Price, price)
    #PlayerActLunhuidian.AddLunhuidianValue(curPlayer, PlayerActLunhuidian.AwardType_PayMoney, type_Price, price)
    if type_Price == ShareDefine.TYPE_Price_Xiantao:
        # 累加未结算战锤 - 经验
        unXiantaoCntExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntExp)
@@ -2754,6 +2813,7 @@
            for itemID, upperCnt in DailyBootyUpperList:
                if upperCnt <= 0:
                    continue
                upperCnt = GetBootyUpper(curPlayer, itemID, upperCnt)
                if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BootyDropToday % itemID) >= upperCnt:
                    continue
                unXiantaoCntBooty = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnXiantaoCntBooty % itemID)
@@ -2798,6 +2858,20 @@
        
    DataRecordPack.DR_UseMoney(curPlayer, eventName, type_Price, price, infoDict) # 流向
    return
def GetBootyUpper(curPlayer, itemID, baseUpper):
    ## 战利品掉落上限
    dropUpper = baseUpper
    addPer = 0
    addPer += PlayerBeauty.GetBeautyEffInfo(curPlayer, PlayerBeauty.EffType_BootyPer)[0] # 战利品上限提高百分比
    # 其他功能增加上限,可扩展
    if addPer:
        dropUpper = int(baseUpper * (100 + addPer) / 100.0)
        GameWorld.DebugLogEx("提高战利品掉落上限: itemID=%s,baseUpper=%s,addPer=%s,dropUpper=%s", itemID, baseUpper, addPer, dropUpper)
    return dropUpper
## 付款以后后续操作(金子)
#  @param curPlayer 玩家实例
@@ -4211,6 +4285,7 @@
        PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_OSAMainLevel, lvID)
        if OpenServerActivity.GetOSAState(curPlayer, ShareDefine.Def_BT_OSA_MainLevel) == 1:
            PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_OSA_MainLevel, lvID)
        DataRecordPack.DR_MainLevelPass(curPlayer, lvID)
    return value
def GetMainLevelPassInfo(curPlayer):
    ## 获取主线关卡过关进度信息
@@ -4251,6 +4326,10 @@
    wave = value % 100
    return chapterID, levelNum, wave
## 额外记录最后一次接到的主线任务ID,仅接到新任务时更新即可,可方便用于后台统计或其他判断
def GetMainTaskID(curPlayer):return curPlayer.GetExAttr20()
def SetMainTaskID(curPlayer, value): curPlayer.SetExAttr20(value)
## 获取佩戴的称号ID
def GetTitleID(curPlayer): return curPlayer.GetExAttr3()
def SetTitleID(curPlayer, titleID):