From 54b3ca452de08e8cf5723a0715cc0c3853c2df3a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 01 十二月 2018 16:35:48 +0800
Subject: [PATCH] 2549 【BUG】【1.3】玩家登录时过天处理离线期间所获得的助战仙缘币异常

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py
index fcf12f7..7a14d03 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBHelpBattle.py
@@ -34,6 +34,8 @@
 import IPY_GameWorld
 import PlayerActivity
 
+import time
+
 def DoPlayerOnDay(curPlayer):
     checkInInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HelpBattleCheckInCount)
     checkInCount = checkInInfo / 10 # 累计登记
@@ -44,7 +46,19 @@
         SyncCheckInState(curPlayer, 0, False)
     
     # 重置每日已获得仙缘币
-    PlayerControl.SetTodayXianyuanCoin(curPlayer, 0)
+    ondaySetXianyuanCoin = 0
+    ondayLoginSetXianyuanCoin = curPlayer.GetDictByKey(ChConfig.Def_PDict_TodayXianyuanCoinOnLogin)
+    if ondayLoginSetXianyuanCoin:
+        # 这里做时间比较,预防玩家登录后就没有再切换地图,再次在该地图过天会导致设置值错误问题
+        loginAddCoinTime = curPlayer.GetDictByKey(ChConfig.Def_PDict_LoginAddTodayXianyuanCoinTime)
+        if GameWorld.CheckTimeIsSameServerDayEx(loginAddCoinTime):
+            ondaySetXianyuanCoin = ondayLoginSetXianyuanCoin
+            GameWorld.DebugLog("玩家过天时,登录增加仙缘币有值,仍然是同一天,仙缘币重置为登录时增加的仙缘币!ondayLoginSetXianyuanCoin=%s" % ondayLoginSetXianyuanCoin)
+        else:
+            GameWorld.DebugLog("玩家过天时,登录增加仙缘币有值,但是不是同一天了,仙缘币重置为0!")
+    PlayerControl.SetTodayXianyuanCoin(curPlayer, ondaySetXianyuanCoin)
+    GameWorld.DebugLog("玩家过天设置今日已获得仙缘币: ondaySetXianyuanCoin=%s,ondayLoginSetXianyuanCoin=%s" 
+                       % (ondaySetXianyuanCoin, ondayLoginSetXianyuanCoin))
     return
 
 def DoPlayerLogin(curPlayer):
@@ -382,7 +396,7 @@
 
 def __OnHelpBattleRecord(curPlayer, msgList, tick):
     ## 助战记录同步
-    cmd, helpRecordList = msgList
+    cmd, helpRecordList, isLogin = msgList
     playerID = curPlayer.GetPlayerID()
     GameWorld.DebugLog("__OnHelpBattleRecord %s,helpRecordList=%s" % (cmd, helpRecordList), playerID)
     
@@ -420,12 +434,16 @@
     NetPackCommon.SendFakePack(curPlayer, recordPack)
     
     addDataDict = {"HelpList":drList}
-    GameWorld.DebugLog("    addXianyuanCoinTotal=%s,addXianyuanCoinTotalTotay=%s,totalHelpCount=%s" 
-                       % (addXianyuanCoinTotal, addXianyuanCoinTotalTotay, totalHelpCount), playerID)
+    GameWorld.DebugLog("    addXianyuanCoinTotal=%s,addXianyuanCoinTotalTotay=%s,totalHelpCount=%s,isLogin=%s" 
+                       % (addXianyuanCoinTotal, addXianyuanCoinTotalTotay, totalHelpCount, isLogin), playerID)
     PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_XianyuanCoin, addXianyuanCoinTotal, addDataDict=addDataDict, isSysHint=False)
     if addXianyuanCoinTotalTotay:
         PlayerControl.AddTodayXianyuanCoin(curPlayer, addXianyuanCoinTotalTotay)
-    
+        if isLogin:
+            curPlayer.SetDict(ChConfig.Def_PDict_TodayXianyuanCoinOnLogin, addXianyuanCoinTotalTotay)
+            curPlayer.SetDict(ChConfig.Def_PDict_LoginAddTodayXianyuanCoinTime, int(time.time()))
+            GameWorld.Log("    登录时今日助战信息: addXianyuanCoinTotalTotay=%s" % (addXianyuanCoinTotalTotay), playerID)
+            
     # 更新总助战次数,更新排行榜
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HelpBattleTotalCount, totalHelpCount)
     if totalHelpCount >= IpyGameDataPY.GetFuncCfg("HelpBattleRefresh", 4):

--
Gitblit v1.8.0