From 73f586a3147b956b81e56aa6c6ffdfefa4cff1cc Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 12 九月 2018 11:52:56 +0800
Subject: [PATCH] 3414 【后端】骑宠争夺boss血量成长

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py                  |   10 +++++
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py |    5 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py      |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py    |   19 ++++++---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py          |   31 +++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                           |    4 +
 6 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index 53e77ae..a78c850 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -667,6 +667,11 @@
             #已经是这个状态了
             continue
         
+        if state:
+            # 骑宠争夺活动开始前同步有效人数到地图
+            if dailyActionID == ShareDefine.DailyActionID_FamilyRobBoss:
+                GameWorldBoss.SyncMapServer_HorsePetRobBossPlayerCount()
+                
         #通知Mapserver,设置字典
         GameWorld.SendMapServerMsgEx(dictName, state)
         #更新字典值
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
index 9490f73..9a89e05 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
@@ -1074,6 +1074,37 @@
     GameWorld.Log("骑宠争夺仙盟击杀Boss数统计: %s" % PyGameData.g_familyKillHorsePetRobBossCntDict)
     return
 
+def SyncMapServer_HorsePetRobBossPlayerCount():
+    ## 活动开始前,同步有效活动人数到地图,作为Boss属性成长系数用
+    
+    diffWorldLV = int(IpyGameDataPY.GetFuncCfg("FairyGrabBossID", 3))
+    funcLimitLV = PlayerControl.GetFuncLimitLV(ShareDefine.GameFuncID_HorsePetRobBoss)
+    curWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
+    minLV = max(funcLimitLV, curWorldLV + diffWorldLV)
+    
+    playerCount = 0
+    playerManager = GameWorld.GetPlayerManager()
+    for i in xrange(playerManager.GetActivePlayerCount()):
+        findPlayer = playerManager.GetActivePlayerAt(i)
+        if findPlayer == None or not findPlayer.GetInitOK():
+            continue
+        
+        if PlayerControl.GetIsTJG(findPlayer):
+            continue
+        
+        if not findPlayer.GetFamilyID():
+            continue
+        
+        if findPlayer.GetLV() < minLV:
+            continue
+        
+        playerCount += 1
+        
+    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_HorsePetRobBossPlayerCount, playerCount)
+    GameWorld.Log("同步骑宠争夺有效参与人数: playerCount=%s,minLV=%s,funcLimitLV=%s,curWorldLV=%s,diffWorldLV=%s" 
+                  % (playerCount, minLV, funcLimitLV, curWorldLV, diffWorldLV))
+    return
+
 def OnHorsePetRobBossActionChange(isOpen):
     ## 骑宠争夺活动状态变更
     
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py
index 91bff20..d22603a 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerControl.py
@@ -31,6 +31,7 @@
 import GameWorld
 import IPY_GameServer
 import MergeBroadcast
+import IpyGameDataPY
 import ShareDefine
 import ChConfig
 import types
@@ -315,3 +316,12 @@
     sysMsg = '%s'%([actionid, addCnt])
     curPlayer.MapServer_QueryPlayerResult(0, 0, "AddFamilyActivity", sysMsg, len(sysMsg))
     return
+
+## 获取功能限制等级(等级条件为全局)
+def GetFuncLimitLV(funcID):
+    ipyData = IpyGameDataPY.GetIpyGameData("FuncOpenLV", funcID)
+    if not ipyData:
+        return 0
+    
+    return ipyData.GetLimitLV()
+
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index e3c2a13..f19d7ef 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -189,7 +189,8 @@
 Def_Notify_WorldKey_BossShuntPlayer = 'BossShuntPlayer'   # boss分流玩家信息
 Def_Notify_WorldKey_BossShuntDeadLine = 'BossShuntDeadLine'   # boss分流线路已死亡的线路
 Def_Notify_WorldKey_BossOnlineHeroCnt = 'BossOnlineHeroCnt_%s'  # boss刷新时间用的在线人数, 参数为NPCID
-Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt = 'FamilyKillHorsePetRobBossCnt'   # boss分流线路已死亡的线路
+Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt = 'FamilyKillHorsePetRobBossCnt'   # 仙盟击杀骑宠boss数统计
+Def_Notify_WorldKey_HorsePetRobBossPlayerCount = 'HorsePetRobBossPlayerCount'   # 骑宠争夺活动有效参考人数
 
 Def_Notify_WorldKey_FamilyActivityDayState = "FamilyActivityDayState"  #战盟相关活动今日开启状态, 按位存储代表今日是否开启过
 
@@ -855,6 +856,7 @@
 GameFuncID_DailyQuest = 78      # 日常
 GameFuncID_FreeGoods = 130      # 极品白拿
 GameFuncID_OSSail = 132         # 开服特惠
+GameFuncID_HorsePetRobBoss = 139# 骑宠争夺
 # 以下为暂时无用的
 GameFuncID_GreatMaster = 28     # 大师
 GameFuncID_Truck = 33           # 运镖
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 4154392..3974428 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -72,9 +72,10 @@
 NPCAttr_ParamDict, # 过程参数公式
 NPCAttr_AttrStrengthenList, # 等级成长属性公式
 NPCAttr_PlayerCntCoefficient, # 地图人数对应属性额外成长系数 {mapID:{"属性名":{组队进入人数:系数, ...}, ...}, ...}
+NPCAttr_NPCPlayerCntCoefficient, # NPC特殊成长人数对应属性额外成长系数 {npcID:{"属性名":{人数:系数, ...}, ...}, ...}, 优先级大于地图人数系数
 NPCAttr_DynNPCLVMap, # 动态等级的地图ID列表,默认已刷新出来的NPC等级不会再变更,下次刷出来的怪物等级变更 [地图ID, ...]
 NPCAttr_DynPCCoefficientMap, # 动态人数系数的地图ID {地图ID:是否马上刷新属性, ...}
-) = range(5)
+) = range(6)
 
 #---------------------------------------------------------------------
 ##NPC初始化->出生调用
@@ -140,11 +141,14 @@
     gameFB = GameWorld.GetGameFB()
     
     if strengthenIpyData.GetIsStrengthenByPlayerCount():
-        strengthenPlayerCnt = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenPlayerCnt)
-        if not strengthenPlayerCnt:
-            GameWorld.ErrLog("NPC配置了按玩家人数成长类型,但是无法获取到对应的玩家人数!npcID=%s" % (npcID))
-            return
-                   
+        if FamilyRobBoss.IsHorsePetRobBoss(npcID):
+            strengthenPlayerCnt = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_HorsePetRobBossPlayerCount)
+        else:
+            strengthenPlayerCnt = gameFB.GetGameFBDictByKey(ChConfig.Def_FB_NPCStrengthenPlayerCnt)
+            if not strengthenPlayerCnt:
+                GameWorld.ErrLog("NPC配置了按玩家人数成长类型,但是无法获取到对应的玩家人数!npcID=%s" % (npcID))
+                return
+            
     lvStrengthenType = strengthenIpyData.GetLVStrengthenType()
     # 根据世界等级
     if lvStrengthenType == 3:
@@ -219,6 +223,7 @@
     paramDict = attrStrengthenInfo[NPCAttr_ParamDict] # 过程参数公式字典
     attrStrengthenList = attrStrengthenInfo[NPCAttr_AttrStrengthenList] # 属性成长公式字典
     playerCntCoefficient = attrStrengthenInfo[NPCAttr_PlayerCntCoefficient] # 人数系数
+    npcIDPlayerCntCoefficient = attrStrengthenInfo[NPCAttr_NPCPlayerCntCoefficient] # 特殊NPC人数系数
     baseMaxHP = npcData.GetHPEx() * ShareDefine.Def_PerPointValue + npcData.GetHP()
     
     if strengthenLV:
@@ -296,6 +301,8 @@
         playerCntAttrCoefficient = playerCntCoefficient.get(mapID, {})
         if not playerCntAttrCoefficient and dataMapID in playerCntCoefficient:
             playerCntAttrCoefficient = playerCntCoefficient[dataMapID]
+        if npcID in npcIDPlayerCntCoefficient:
+            playerCntAttrCoefficient = npcIDPlayerCntCoefficient[npcID]
         for attrKey, coefficientDict in playerCntAttrCoefficient.items():
             if attrKey in attrDict:
                 attrValue = attrDict[attrKey]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index e3c2a13..f19d7ef 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -189,7 +189,8 @@
 Def_Notify_WorldKey_BossShuntPlayer = 'BossShuntPlayer'   # boss分流玩家信息
 Def_Notify_WorldKey_BossShuntDeadLine = 'BossShuntDeadLine'   # boss分流线路已死亡的线路
 Def_Notify_WorldKey_BossOnlineHeroCnt = 'BossOnlineHeroCnt_%s'  # boss刷新时间用的在线人数, 参数为NPCID
-Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt = 'FamilyKillHorsePetRobBossCnt'   # boss分流线路已死亡的线路
+Def_Notify_WorldKey_FamilyKillHorsePetRobBossCnt = 'FamilyKillHorsePetRobBossCnt'   # 仙盟击杀骑宠boss数统计
+Def_Notify_WorldKey_HorsePetRobBossPlayerCount = 'HorsePetRobBossPlayerCount'   # 骑宠争夺活动有效参考人数
 
 Def_Notify_WorldKey_FamilyActivityDayState = "FamilyActivityDayState"  #战盟相关活动今日开启状态, 按位存储代表今日是否开启过
 
@@ -855,6 +856,7 @@
 GameFuncID_DailyQuest = 78      # 日常
 GameFuncID_FreeGoods = 130      # 极品白拿
 GameFuncID_OSSail = 132         # 开服特惠
+GameFuncID_HorsePetRobBoss = 139# 骑宠争夺
 # 以下为暂时无用的
 GameFuncID_GreatMaster = 28     # 大师
 GameFuncID_Truck = 33           # 运镖

--
Gitblit v1.8.0