From 0d2578daffd3b32fb0fa05e7dd92e88aa2d92ffa Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 01 三月 2019 16:23:06 +0800
Subject: [PATCH] 3039 【主干】【1.6】合服定制活动期间资源找回异常

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py |   54 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 29 insertions(+), 25 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
index ba38246..f7dbada 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ZhuXianBoss.py
@@ -31,6 +31,7 @@
 import PlayerActivity
 import NetPackCommon
 import ItemControler
+import PlayerActLogin
 import EventReport
 
 FBDict_StartTick = 'FBDict_StartTick%s' #开始时间
@@ -41,6 +42,7 @@
 FBDict_IsReduceing = 'FBDict_IsReduceing%s' #是否掉血中
 FBPlayerDict_Rank = "FBPlayerDict_Rank" # 玩家排名
 FBDict_BossTotalHP = 'FBDict_BossTotalHP%s' #BOSS血量
+FBDict_LastHurtTick = 'FBDict_LastHurtTick'  #上次伤害时间
 
 g_heroHurtDict = {} #{playerID:hurt}
 
@@ -281,7 +283,7 @@
     remainHP = GetBossRemainHP(lineID, tick)
     totalHP = __GetBossTotalHP(lineID)
     hpReduceSpeed = curSpeed * 10000 / totalHP if totalHP else 0
-    remainHPPer = min(100, remainHP * 100 / totalHP) if totalHP else 0
+    remainHPPer = min(1000000, remainHP * 1000000 / totalHP) if totalHP else 0
     myHurt = g_heroHurtDict.get(curPlayer.GetID(), 0)
     fbHelpDict = {FBCommon.Help_lineID:lineID, "hurtInfo":hurtInfo, 'hpReduceSpeed':hpReduceSpeed, 
                   'remainHPPer':remainHPPer, 'isReduceing':isReduceing,'myHurt':myHurt % ChConfig.Def_PerPointValue,
@@ -323,6 +325,7 @@
 #  @return None
 def DoFB_Player_HurtNPC(curPlayer, curNPC, hurtHP):
     UpdateHurtInfo(curPlayer, hurtHP)
+    GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, GameWorld.GetGameWorld().GetTick())
     return
 #
 def UpdateHurtInfo(curPlayer, hurtHP, isAdd=False):
@@ -371,6 +374,11 @@
     startTick = gameWorld.GetGameWorldDictByKey(FBDict_StartTick % lineID)
     if not startTick or overTick:
         return
+    lastHurtTick = gameFB.GetGameFBDictByKey(FBDict_LastHurtTick)
+    if lastHurtTick and tick - lastHurtTick >= 2000:
+        StopReduceHP(lineID, tick)
+        GameWorld.GetGameFB().SetGameFBDict(FBDict_LastHurtTick, 0)
+            
     FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 5000)
     __CheckBossHP(tick)
     
@@ -409,7 +417,7 @@
         gameFB.SetPlayerGameFBDict(firstPlayerID, FBPlayerDict_Rank, 1)
         if not dropPosX or not dropPosY:
             dropPosX, dropPosY = firstPlayer.GetPosX(), firstPlayer.GetPosY()
-        prizeItemList = GiveZhuXianBossAward(firstPlayer, lineID, dropItemMapInfo=[dropPosX, dropPosY, True])
+        prizeItemList = GiveZhuXianBossAward(firstPlayer, lineID, dropItemMapInfo=[dropPosX, dropPosY, True, True])
         if not prizeItemList:
             # 没有掉落时直接通知结算,防止卡副本
             firstPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
@@ -422,11 +430,10 @@
         if leaveServerTick and tick - leaveServerTick < ChConfig.Def_PlayerOfflineProtectTime:
             #离线超过3分钟的不给奖励
             msgStr = str([ShareDefine.Def_UniversalGameRecType_ZhuXianBossRecord, [firstPlayerID, lineID], [], 0, 0])
-            playerManager.GameServer_QueryPlayerResult(0, 0, 0, 'AddUniversalGameRec', msgStr, len(msgStr))
+            GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'AddUniversalGameRec', msgStr, len(msgStr))
             
     helpItemList = FBCommon.GetFBLineReward(mapID, lineID)
     if helpItemList: #同盟协助奖励
-        needSpace = len(helpItemList)
         jsonItemList = FBCommon.GetJsonItemList(helpItemList)
         for index in range(0 , playerManager.GetPlayerCount()):
             curPlayer = playerManager.GetPlayerByIndex(index)
@@ -435,24 +442,18 @@
                 continue
             if curPlayerID == firstPlayerID:
                 continue
-            if curPlayer.GetFamilyID() != firstPlayerFamilyID:
-                continue
-            remainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt)
-            if not remainCnt:
-                continue
-            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhuXianBossHelpCnt, remainCnt-1)
-            NotifyZXHelpCnt(curPlayer)
             curPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, leaveTick, True)
-            overDict = {FBCommon.Over_rank:0, FBCommon.Over_itemInfo:jsonItemList}
-            FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
-            
-            packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
-            if needSpace > packSpace:
-                PlayerControl.SendMailByKey('ZXBossHelperReward', [curPlayerID], helpItemList)
+            remainCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ZhuXianBossHelpCnt)
+            if curPlayer.GetFamilyID() == firstPlayerFamilyID and remainCnt:
+                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ZhuXianBossHelpCnt, remainCnt-1)
+                NotifyZXHelpCnt(curPlayer)
+                ItemControler.GivePlayerItemOrMail(curPlayer, helpItemList, 'ZXBossHelperReward')
+                overDict = {FBCommon.Over_rank:0, FBCommon.Over_itemInfo:jsonItemList}
+                FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, isPass, overDict)
             else:
-                for itemID, itemCount, isBind in helpItemList:
-                    ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem])
-    
+                overDict = {FBCommon.Over_rank:0}
+                FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, lineID, 0, overDict)
+            
     return
 
 def GiveZhuXianBossAward(curPlayer, lineID, isMail=False, dropItemMapInfo=[]):
@@ -483,6 +484,7 @@
     FBCommon.AddEnterFBCount(curPlayer, ChConfig.Def_FBMapID_ZhuXianBoss, addCnt)
     # 每日活动
     PlayerActivity.AddDailyActionFinishCnt(curPlayer, ShareDefine.DailyActionID_ZhuXianBoss, addCnt)
+    PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_ZhuXianBOSS, addCnt)
     return prizeItemList
 
 def OnPickUpItem(curPlayer, curItem, tick):
@@ -616,6 +618,7 @@
     if not startTick:
         gameWorld.SetGameWorldDict(FBDict_RemainHP % lineID, __GetBossTotalHP(lineID))
     gameWorld.SetGameWorldDict(FBDict_StartTick % lineID, tick)
+    FBCommon.NotifyCopyMapPlayerFBHelp(tick, DoFBHelp, 0)
     return
 
 def __GetBossTotalHP(lineID):return GameWorld.GetGameWorld().GetGameWorldDictByKey(FBDict_BossTotalHP%lineID)
@@ -670,11 +673,12 @@
 def CheckCanAttackTagObjInFB(attacker, defender):
     atkObjType = attacker.GetGameObjType()
     defObjType = defender.GetGameObjType()
-    if atkObjType == IPY_GameWorld.gotPlayer and defObjType == IPY_GameWorld.gotNPC:
-        gameWorld = GameWorld.GetGameWorld()
-        lineID = gameWorld.GetPropertyID() - 1
-        if not gameWorld.GetGameWorldDictByKey(FBDict_IsReduceing%lineID):
-            PlayerControl.NotifyCode(attacker, 'TryEnterJadeDynastyBossError_7')
+    gameWorld = GameWorld.GetGameWorld()
+    lineID = gameWorld.GetPropertyID() - 1
+    if defObjType == IPY_GameWorld.gotNPC and defender.GetNPCID() == CurFBLineBOSSID(lineID):
+        if not PyGameData.g_ZhuXianBossPlayerHurtDict.get(lineID, {}):
+            if atkObjType == IPY_GameWorld.gotPlayer:
+                PlayerControl.NotifyCode(attacker, 'TryEnterJadeDynastyBossError_7')
             return False
     return True
 

--
Gitblit v1.8.0