hxp
2020-02-11 44b31d0f8b35c890021e4317281e15ba2d45b593
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActivity.py
@@ -89,6 +89,17 @@
        __CalcAwardStage(curPlayer)
        
        SyncDailyActivityInfo(curPlayer)
        # 记录昨日活跃吸纳经验
        todayExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceTodayExp)
        todayExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceTodayExpPoint)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceTodayExp, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceTodayExpPoint, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceYestorDayExp, todayExp)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceYestorDayExpPoint, todayExpPoint)
        #活跃放置
        Sync_ActivityPlaceInfo(curPlayer)
    else:
        SendDayActionMail(curPlayer)
    
@@ -279,7 +290,7 @@
    curTotalPoint = __GetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint)
    __SetPDictValue(curPlayer, ChConfig.Def_PDict_Activity_TotalPoint, curTotalPoint + addValue)
    __AddCanCostActivityPoint(curPlayer, addValue, isLVUp)
    PlayerControl.NotifyCode(curPlayer, "GetActivity", [addValue])
    SyncDailyActivityInfo(curPlayer)
    EventShell.EventRespons_AddActivityValue(curPlayer)
    GameWorld.DebugLog("增加活跃度,addValue=%s,multiple=%s,addExtraPoint=%s,isLVUp=%s" 
@@ -629,6 +640,17 @@
################################## 活跃放置 ##############################################
#// B0 29 活跃放置明细查询 #tagCMActivityPlaceQuery
#
#struct    tagCMActivityPlaceQuery
#{
#    tagHead        Head;
#};
def OnActivityPlaceQuery(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    Sync_ActivityPlaceInfo(curPlayer)
    return
#// B0 27 活跃放置启动 #tagCMActivityPlaceStart
#
#struct    tagCMActivityPlaceStart
@@ -667,6 +689,7 @@
    if not remainCount:
        curTime = int(time.time())
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, curTime)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceExpCount, 0)
        GameWorld.DebugLog("    没有剩余次数,更新启动时间: %s" % curTime)
        
    Sync_ActivityPlaceInfo(curPlayer)
@@ -680,6 +703,8 @@
#    BYTE        FinishCount;    //完成次数
#};
def OnActivityPlaceQuickFinish(index, clientData, tick):
    ## 经验改为实时获取,暂屏蔽快速完成
    return
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    finishCount = clientData.FinishCount
    remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
@@ -721,26 +746,46 @@
    if not startTime:
        startTime = curTime
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, curTime)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceExpCount, 0)
        
    needSeconds = IpyGameDataPY.GetFuncCfg("ActivityPlace", 3) # 单次放置奖励持续时间,秒
    expSeconds = IpyGameDataPY.GetFuncCfg("ActivityPlaceExp", 1) # 活跃放置获得经验多少秒一次
    passTime = curTime - startTime
    expCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceExpCount)
    canGetExpCount = passTime / expSeconds
    maxExpCount = needSeconds / expSeconds
    addExpCount = min(maxExpCount, canGetExpCount - expCount)
    if addExpCount > 0:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceExpCount, expCount + addExpCount)
        lv = curPlayer.GetLV()
        reExp = PlayerControl.GetPlayerReExp(curPlayer)
        addExp = eval(IpyGameDataPY.GetFuncCompileCfg("ActivityPlaceExp", 2)) * addExpCount # 获得经验公式,参数 lv, reExp
        playerControl = PlayerControl.PlayerControl(curPlayer)
        addExp = playerControl.AddExp(addExp, ShareDefine.Def_ViewExpType_Activity)
        todayExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceTodayExp)
        todayExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceTodayExpPoint)
        todayTotalExp = todayExpPoint * ChConfig.Def_PerPointValue + todayExp + addExp
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceTodayExp, todayTotalExp % ChConfig.Def_PerPointValue)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceTodayExpPoint, todayTotalExp / ChConfig.Def_PerPointValue)
        #GameWorld.DebugLog("passTime=%s,canGetExpCount=%s,expCount=%s,addExpCount=%s,addExp=%s,todayTotalExp=%s"
        #                   % (passTime, canGetExpCount, expCount, addExpCount, addExp, todayTotalExp))
    if passTime < needSeconds:
        #GameWorld.DebugLog("探索时间未到,不结算! curTime=%s,startTime=%s,passTime=%s < %s" % (curTime, startTime, passTime, needSeconds))
        return
    endCount = passTime / needSeconds
    nextStartReduceSeconds = passTime % needSeconds
    __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds)
    __DoActivityPlaceRewardEnd(curPlayer, endCount)
    return
def __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds=0, isQuick=False):
def __DoActivityPlaceRewardEnd(curPlayer, endCount, isQuick=False):
    ## 放置活跃奖励结算
    
    remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
    endCount = min(endCount, remainCount)
    if endCount <= 0:
        return
    if PlayerTJG.GetIsTJG(curPlayer):
        return
    
    countDataDict = {}
@@ -809,9 +854,10 @@
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardTotalCount, rewardTotalCount)
    
    if remainCount > 0:
        nextStartTime = int(time.time()) - nextStartReduceSeconds
        nextStartTime = int(time.time())
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, nextStartTime)
        GameWorld.DebugLog("    还有剩余次数,更新启动时间: %s, nextStartReduceSeconds=%s" % (nextStartTime, nextStartReduceSeconds))
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceExpCount, 0)
        GameWorld.DebugLog("    还有剩余次数,更新启动时间: %s" % (nextStartTime))
        
    # 存储奖励
    rewardItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardItem)
@@ -881,6 +927,10 @@
    placeInfo.RewardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardCount)
    placeInfo.RewardInfo = str(rewardItemInfo)
    placeInfo.RewardLen = len(placeInfo.RewardInfo)
    placeInfo.TodayExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceTodayExp)
    placeInfo.TodayExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceTodayExpPoint)
    placeInfo.YestordayExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceYestorDayExp)
    placeInfo.YestordayExpPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceYestorDayExpPoint)
    NetPackCommon.SendFakePack(curPlayer, placeInfo)
    return