From 57855272e59c00bc255b296855ef6ef84a8eb617 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 21 八月 2018 22:06:40 +0800
Subject: [PATCH] fix:离线状态机器人上线也是要补偿缺失时间收益

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
index 613f803..d18b3fe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTJG.py
@@ -199,6 +199,9 @@
     if curPlayer.GetIP() != "127.0.0.1":
         return
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, clientData.NPCID)
+    
+    # 先弥补错失的时间
+    LoginFixTJG(curPlayer, True)
     GameWorld.DebugLog("%s---OnTJGNPC:%s"%(curPlayer.GetName(),clientData.NPCID))
     return
 
@@ -805,7 +808,7 @@
 # 1. 非脱机死亡,2.存在脱机时间,3.离线时间超过5分钟;则一次补齐 离线时间-5分钟的收益并减少脱机时间
 # 按当前经验倍率计算,且不会减buff时间
 # 找到对应的NPC,需读取对应挂机表
-def LoginFixTJG(curPlayer):
+def LoginFixTJG(curPlayer, isTJG=False):
     # 外层需判断是真实玩家登录
     tjgTime = GetTJGTime(curPlayer)     # 秒
     if not tjgTime:
@@ -823,14 +826,17 @@
         return
     times = min(seconds, tjgTime)
 
-    npcID = FindTJGNPC(curPlayer)
-    if not npcID:
-        return
+    if not isTJG:
+        # 真实上线
+        npcID = FindTJGNPC(curPlayer)
+        if not npcID:
+            return
+        
+        # 此时由服务端重新找一次挂机NPC
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)
     
-    GameWorld.DebugLog("弥补脱机----npcid  %s-%s"%(npcID, times))
+    GameWorld.DebugLog("弥补脱机----npcid  %s-%s"%(curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_TJGNPC), times))
     
-    # 此时由服务端重新找一次挂机NPC
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_TJGNPC, npcID)
     
     # 设置脱机登录时的等级, 上线通知清空, 没清空说明多次脱机挂登录 使用旧等级
     notifyLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDictType_TJGNotify_LV, 0, ChConfig.Def_PDictType_TJGNotify)

--
Gitblit v1.8.0