From 819ab7e6091bb882e6106a6d713b0ced1848120f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 17:00:17 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(击杀积分王广播寻路参数优化;战场机器人AI修改为21,优化AI21寻路)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py | 347 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 201 insertions(+), 146 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
index 1717fd8..cd6a3b0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
@@ -18,9 +18,11 @@
import ReadChConfig
import GameLogic_SealDemon
import GameLogic_ZhuXianBoss
+import GameLogic_CrossDemonKing
import PlayerControl
import IPY_GameWorld
import IpyGameDataPY
+import PyGameData
import GameWorld
import FBCommon
import FBLogic
@@ -62,7 +64,7 @@
def __ProcessNPCRefresh(pointIndex, npcRefresh, tick):
funcName = "NPCRefresh_%d" % npcRefresh.GetRefreshMark()
- if globals().has_key(funcName):
+ if globals().has_key(funcName) and GameWorld.GetMap().GetMapID() != ChConfig.Def_FBMapID_ClearDevil:
return globals()[funcName](npcRefresh, tick)
else:
#GameWorld.DebugLog("__NPCCommonRefresh mark = %s" % npcRefresh.GetRefreshMark())
@@ -92,72 +94,6 @@
return
##------------------------------------------------------------------------------
-
-## 合服活动BOSS(勇者大陆)
-# @param npcRefresh 刷新的npc对象
-# @param tick 当前时间
-# @return None
-def NPCRefresh_63(npcRefresh, tick): return __RefreshMixBoss(npcRefresh, tick)
-def NPCRefresh_64(npcRefresh, tick): return __RefreshMixBoss(npcRefresh, tick)
-def NPCRefresh_65(npcRefresh, tick): return __RefreshMixBoss(npcRefresh, tick)
-
-## 合服活动BOSS(勇者大陆)
-# @param npcRefresh 刷新的npc对象
-# @param tick 当前时间
-# @return None
-def __RefreshMixBoss(npcRefresh, tick):
- gameWorld = GameWorld.GetGameWorld()
- isMixServer = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_IsMixServer)
- mixDay = gameWorld.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_MixServerDay)
- refreshMark = npcRefresh.GetRefreshMark()
-
- # 配置
- mixBossInfo = ReadChConfig.GetEvalChConfig("MixBossInfo")
- curBossInfo = mixBossInfo.get(refreshMark)
- if not curBossInfo:
- #GameWorld.DebugLog("__RefreshMixBoss() hasn't configuration refreshMark(%s)"%refreshMark)
- return
- npcId, mixTime, refreshTimeList = curBossInfo
-
- # 合服期间
- if not isMixServer or mixDay < mixTime[0] or mixDay > mixTime[1]:
- #GameWorld.DebugLog("__RefreshMixBoss() no mix server")
- return
-
- # 一线刷新
- lineId = GameWorld.GetGameWorld().GetLineID()
- if lineId != 0:
- #GameWorld.DebugLog("__RefreshMixBoss() not in 1 line(%s), now"%lineId)
- return
-
- # 有怪
- if npcRefresh.GetCount() > 0:
- #GameWorld.DebugLog("__RefreshMixBoss() have mix server boss(%s), now"%refreshMark)
- return
-
- # 刷新时间匹配
- curTime = GameWorld.GetCurrentTime()
- if (curTime.hour, curTime.minute) not in refreshTimeList:
- #GameWorld.DebugLog("__RefreshMixBoss() npcId(%s) isn't refresh(%s) time(%s)"
- # % (npcId, str((curTime.hour, curTime.minute)), refreshTimeList))
- return
-
- # 刷新Tick 一分钟内不再刷新
- refreshTickKey = ChConfig.Map_NPC_WorldBossLastReBornTick % npcId
- lastRefreshTick = gameWorld.GetGameWorldDictByKey(refreshTickKey)
- if tick - lastRefreshTick <= 60 * 1000:
- #GameWorld.DebugLog("__RefreshMixBoss() not refresh inside minute, npcID(%s) tick(%s) lastTick(%s)"
- # % (npcId, tick, lastRefreshTick))
- return
- gameWorld.SetGameWorldDict(refreshTickKey, tick)
-
- # 刷新NPC
- npcRefresh.Refresh(npcId, ChConfig.Def_SuperBossAngryCount, 1, False)
- # 初始化NPC
- __InitNewBornNPC(npcRefresh, tick)
-
- GameWorld.DebugLog("__RefreshMixBoss() refresh mix server boss npcId(%s) success!!!" % (npcId))
- return
## 地图M个点随机刷N只怪
# @param npcRefresh 刷新实例
@@ -359,29 +295,26 @@
def NPCRefresh_198(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
def NPCRefresh_199(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
def NPCRefresh_200(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
-
-
-def ResetActivityBossRefreshCount():
- ## 重置活动boss刷怪个数
-
- # gameFb 要取活动线
- activityLineIndex = 0 # 活动线, 默认1线
- mapID = GameWorld.GetMap().GetMapID()
- activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
- if mapID in activityMapLineDict:
- activityLineIndex = max(0, activityMapLineDict[mapID] - 1)
-
- gameWorld = IPY_GameWorld.IPY_GameWorld(activityLineIndex)
- gameFB = gameWorld.GetGameFBByFbIndex(activityLineIndex)
-
- gameNPC = GameWorld.GetNPCManager() # NPC标识点的无所谓,哪条线都可以,因为都一样
- for i in xrange(gameNPC.GetCustomNPCRefreshCount()):
- npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
- refreshMark = npcRefresh.GetRefreshMark()
- if gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark):
- gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, 0)
- GameWorld.DebugLog("重置活动boss刷怪点刷怪个数: activityLineIndex=%s,refreshMark=%s" % (activityLineIndex, refreshMark))
- return
+def NPCRefresh_201(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_202(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_203(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_204(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_205(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_206(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_207(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_208(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_209(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_210(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_211(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_212(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_213(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_214(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_215(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_216(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_217(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_218(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_219(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
+def NPCRefresh_220(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
## 世界boss刷怪
# @param npcRefresh 刷新实例
@@ -394,19 +327,37 @@
if GameWorld.IsCrossServer():
__DoRefreshWorldBossCrossServer(npcRefresh, tick)
return
+ rebornLineID = 0
+ assignLineID = 0
mapID = GameWorld.GetMap().GetMapID()
refreshMark = npcRefresh.GetRefreshMark()
lineID = GameWorld.GetGameWorld().GetLineID()
- relatedType, relatedID = 0, 0
+ relatedType, relatedID = 0, ""
isNeedShunt = 0
if mapID == ChConfig.Def_FBMapID_SealDemon:
bossID = GameLogic_SealDemon.CurFBLineBOSSID()
+ stoneNPCID = 0
+ elif mapID == ChConfig.Def_FBMapID_DemonKing:
+ bossID = GameLogic_CrossDemonKing.GetCurFBLineBOSSID()
stoneNPCID = 0
elif mapID == ChConfig.Def_FBMapID_ZhuXianBoss:
bossID = GameLogic_ZhuXianBoss.CurFBLineBOSSID()
stoneNPCID = 0
else:
- ipyData = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, isLogNone=False)
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, True, isLogNone=False)
+ if not ipyDataList:
+ return
+ if len(ipyDataList) == 1:
+ ipyData = ipyDataList[0]
+ else:
+ # 同地图同标试点有多条数据的则为不同指定分线
+ ipyData = None
+ for ipyD in ipyDataList:
+ refreshLine = ipyD.GetRefreshLine()
+ rebornLineID = refreshLine - 1
+ if rebornLineID == lineID:
+ ipyData = ipyD
+ break
if not ipyData:
return
stoneNPCID = ipyData.GetStoneNPCID()
@@ -414,36 +365,59 @@
relatedType = ipyData.GetRelatedType()
relatedID = ipyData.GetRelatedID()
isNeedShunt = ipyData.GetIsNeedShunt()
+ assignLineID = ipyData.GetRefreshLine() # 指定刷新的线路
+ if assignLineID > 0:
+ rebornLineID = assignLineID - 1
if not bossID and not stoneNPCID:
return
gameFB = GameWorld.GetGameFB()
gameWorldMgr = GameWorld.GetGameWorld()
- isActivityBoss = False # 是否活动boss
+ forceReborn = False # 强制重生
+ actBossRebornSign = 0
+ mapActBossRebornSign = 0
# 关联日常活动
if relatedType == 1:
+ relatedID = int(relatedID)
actionKey = ShareDefine.Def_Notify_WorldKey_DailyActionState % relatedID
rebornBossState = 1 if gameWorldMgr.GetGameWorldDictByKey(actionKey) else 0
- isActivityBoss = True
+
# 关联运营活动,待扩展
elif relatedType == 2:
- pass
+ actNameInfo = relatedID.split("|")
+ actName = actNameInfo[0]
+ if actName in ShareDefine.MultiActNumOperationActNameList:
+ actNum = GameWorld.ToIntDef(actNameInfo[1] if len(actNameInfo) > 1 else "10")
+ actInfo = GameWorld.GetActInfo(actName, actNum)
+ operationActionState = actInfo.get(ShareDefine.ActKey_State, 0)
+ else:
+ operationActionInfo = PyGameData.g_operationActionDict.get(actName, {})
+ operationActionState = operationActionInfo.get(ShareDefine.ActKey_State, 0)
+ rebornBossState = 1 if operationActionState else 0
+
else:
bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID
rebornBossState = gameWorldMgr.GetGameWorldDictByKey(bosskey)
- rebornLineID = 0
activityLineID = 0 # 活动线, 默认1线
activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
if mapID in activityMapLineDict:
activityLineID = max(0, activityMapLineDict[mapID] - 1)
- # 活动boss只在活动线路刷
- if isActivityBoss:
- activityBossRebornCount = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark)
- rebornLineID = activityLineID # 活动boss只刷在活动线
+ # 关联活动boss
+ if relatedType:
+ if assignLineID == 0: # 没有指定刷新线路的,活动boss固定刷在活动线
+ rebornLineID = activityLineID # 活动boss只刷在活动线
+
# 不是活动线
if rebornBossState and lineID != rebornLineID:
rebornBossState = 0
+
+ # 关联活动boss只要复活标记与上次不同,则强制重生
+ actBossRebornSign = gameWorldMgr.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % relatedID)
+ mapActBossRebornSign = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActBossLastRebornSign % refreshMark)
+ rebornBossState = rebornBossState and actBossRebornSign
+ if rebornBossState and actBossRebornSign != mapActBossRebornSign:
+ forceReborn = True
# 非活动boss活动线不刷, 1线除外
else:
@@ -460,7 +434,7 @@
# 复活状态
if rebornBossState:
if curNPC:
- if curNPC.GetNPCID() == bossID:
+ if not forceReborn and curNPC.GetNPCID() == bossID:
return
#去掉非bossNPC
NPCCommon.SetDeadEx(curNPC)
@@ -469,9 +443,9 @@
if lineID != rebornLineID and not isNeedShunt and mapID not in [ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss]:
return
- if isActivityBoss and activityBossRebornCount > 0:
- #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,activityBossRebornCount=%s"
- # % (lineID, rebornLineID, refreshMark, bossID, activityBossRebornCount))
+ if mapActBossRebornSign and actBossRebornSign == mapActBossRebornSign:
+ #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,actBossRebornSign=%s"
+ # % (lineID, rebornLineID, refreshMark, bossID, actBossRebornSign))
return
# 死亡状态
@@ -483,9 +457,12 @@
if curNPC.GetNPCID() == stoneNPCID:
return
# 活动的boss
- if curNPC.GetNPCID() == bossID and isActivityBoss:
+ if curNPC.GetNPCID() == bossID and relatedType:
GameWorld.Log("活动boss,活动结束,系统设置boss死亡!bossID=%s" % bossID)
- PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
+ if relatedID == ShareDefine.DailyActionID_FamilyRobBoss:
+ PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
+ elif relatedID == ShareDefine.OperationActionName_BossReborn:
+ pass
#去掉非墓碑NPC
NPCCommon.SetDeadEx(curNPC)
@@ -512,8 +489,8 @@
__InitNewBornNPC(npcRefresh, tick)
gameFB.SetGameFBDict(key, tick)
- if isActivityBoss and rebornBossState:
- gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, activityBossRebornCount + 1)
+ if actBossRebornSign and rebornBossState:
+ gameFB.SetGameFBDict(ChConfig.Map_NPC_ActBossLastRebornSign % refreshMark, actBossRebornSign)
GameWorld.DebugLog("BossRefresh mapID=%s,rebornLineID=%s,refreshMark=%s,rebornNPCID=%s,isNeedShunt=%s,OK!"
% (mapID, rebornLineID, refreshMark, rebornNPCID, isNeedShunt), lineID)
@@ -547,24 +524,34 @@
refreshMark = npcRefresh.GetRefreshMark()
lineID = GameWorld.GetGameWorld().GetLineID()
- bossIpyData = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, isLogNone=False)
- if not bossIpyData:
- return
-
- stoneNPCID = bossIpyData.GetStoneNPCID()
- bossID = bossIpyData.GetNPCID()
- if not bossID and not stoneNPCID:
- return
-
- if mapID not in ChConfig.Def_CrossZoneTableName:
- return
- tableName = ChConfig.Def_CrossZoneTableName[mapID]
realMapID = GameWorld.GetGameWorld().GetRealMapID()
copyMapID = GameWorld.GetGameWorld().GetCopyMapID()
- zoneIpyData = IpyGameDataPY.GetIpyGameDataNotLog(tableName, realMapID, mapID, copyMapID)
- if not zoneIpyData:
+
+ if mapID == ChConfig.Def_FBMapID_CrossDemonKing:
+ bossID = GameLogic_CrossDemonKing.GetCurFBLineBOSSID()
+ stoneNPCID = 0
+ zoneID = GameLogic_CrossDemonKing.GetCurFBLineZoneID()
+
+ else:
+ bossIpyData = IpyGameDataPY.GetIpyGameDataByCondition('BOSSInfo', {'RefreshMark':refreshMark, 'MapID':mapID}, isLogNone=False)
+ if not bossIpyData:
+ return
+
+ stoneNPCID = bossIpyData.GetStoneNPCID()
+ bossID = bossIpyData.GetNPCID()
+
+ if mapID not in ChConfig.Def_CrossZoneMapTableName:
+ return
+ tableName = ChConfig.Def_CrossZoneMapTableName[mapID]
+ zoneIpyData = IpyGameDataPY.GetIpyGameDataNotLog(tableName, realMapID, mapID, copyMapID)
+ if not zoneIpyData:
+ return
+ zoneID = zoneIpyData.GetZoneID()
+
+ if not zoneID:
return
- zoneID = zoneIpyData.GetZoneID()
+ if not bossID and not stoneNPCID:
+ return
gameFB = GameWorld.GetGameFB()
bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossRebornCross % (zoneID, bossID)
@@ -907,12 +894,13 @@
''' 地图自定义随机刷怪,支持多点随机刷多种怪,标试点不可重复,支持跨服地图
注意:同个虚拟线路中,标试点不可重复!标试点不可重复!标试点不可重复!
'''
- mapID = gameWorld.GetMapID()
- # {mapID:{编号:[[多个NPCID], [多个标试点], 单个点最大数量, 所有点总数量, 刷怪间隔秒, 每整X小时], ...}, ...}
- randRefreshNPCDict = IpyGameDataPY.GetFuncEvalCfg("RandomRefreshNPC", 1, {})
- if mapID not in randRefreshNPCDict:
+ if gameWorld.GetOpenState() != IPY_GameWorld.fbosOpen:
+ #已经关闭了
return
- mapRandRefreshNPCDict = randRefreshNPCDict[mapID]
+ mapID = gameWorld.GetMapID()
+ refreshIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
+ if not refreshIpyDataList:
+ return
#copyMapID = gameWorld.GetCopyMapID()
@@ -924,21 +912,28 @@
serverTime = GameWorld.GetCurrentTime()
curHour, curMinute = serverTime.hour, serverTime.minute
- refreshNumList = []
- for num, refreshInfo in mapRandRefreshNPCDict.items():
- refreshCD = refreshInfo[4]
+ minuteTotal = curHour * 60 + curMinute
+ needRefreshIpyDataList = []
+ for ipyData in refreshIpyDataList:
+ num = ipyData.GetRefreshNum()
numLastTick = gameFB.GetGameFBDictByKey(ChConfig.Def_RMark_RandomRefreshNPCNumTime % num)
- perHours = refreshInfo[5]
- if numLastTick and perHours:
- if curHour % perHours != 0 or curMinute != 0:
+ if numLastTick:
+ perMinutes = ipyData.GetRefreshPerMinutes()
+ if perMinutes:
+ if minuteTotal % perMinutes != 0:
+ continue
+ refreshCD = 60 # 1分钟内不重复刷新
+ else:
+ refreshCD = ipyData.GetRefreshSeconds()
+
+ if not refreshCD:
continue
- refreshCD = 65 # 1分钟内不重复刷新
- if numLastTick and tick - numLastTick < refreshCD * 1000:
- continue
+ if tick - numLastTick < refreshCD * 1000:
+ continue
gameFB.SetGameFBDict(ChConfig.Def_RMark_RandomRefreshNPCNumTime % num, tick)
- refreshNumList.append(num)
+ needRefreshIpyDataList.append(ipyData)
- if not refreshNumList:
+ if not needRefreshIpyDataList:
#GameWorld.DebugLog("没有需要刷怪的", copyMapID)
return
npcCountDict = {} # 标识点对应NPC数量
@@ -953,9 +948,12 @@
npcCountDict[rMark] = npcCountDict.get(rMark, 0) + npcCount
rMarkNPCRefreshDict[rMark] = npcRefresh
- #GameWorld.DebugLog("npcCountDict=%s" % npcCountDict, copyMapID)
- for num in refreshNumList:
- npcIDList, markList, maxCount, totalMaxCount = mapRandRefreshNPCDict[num][:4]
+ #GameWorld.DebugLog("标试点怪物数: minuteTotal=%s,npcCountDict=%s" % (minuteTotal, npcCountDict), copyMapID)
+ for ipyData in needRefreshIpyDataList:
+ npcIDList = ipyData.GetNPCIDList()
+ markList = ipyData.GetRefreshMarkList()
+ maxCount = ipyData.GetPointMaxCount()
+ totalMaxCount = ipyData.GetTotalMaxCount()
curTotalCount = 0
for rMark in markList:
@@ -963,13 +961,16 @@
refreshCount = totalMaxCount - curTotalCount
- #GameWorld.DebugLog(" num=%s,markList=%s,curTotalCount=%s,totalMaxCount=%s,refreshCount=%s"
- # % (num, markList, curTotalCount, totalMaxCount, refreshCount), copyMapID)
+ #GameWorld.DebugLog(" npcIDList=%s,markList=%s,curTotalCount=%s,totalMaxCount=%s,refreshCount=%s"
+ # % (npcIDList, markList, curTotalCount, totalMaxCount, refreshCount), copyMapID)
if refreshCount <= 0:
continue
- random.shuffle(markList) # 随机打乱顺序
- #GameWorld.DebugLog(" markList=%s" % markList, copyMapID)
+ isNeedRandom = len(markList) != totalMaxCount
+ if isNeedRandom:
+ markList = list(markList)
+ random.shuffle(markList) # 随机打乱顺序,如果需要随机的话就用多个不同的标试点
+ #GameWorld.DebugLog(" markList=%s" % str(markList), copyMapID)
for rMark in markList:
if rMark not in rMarkNPCRefreshDict:
#GameWorld.DebugLog(" 标试点不存在: rMark=%s" % rMark, copyMapID)
@@ -992,3 +993,57 @@
return
+def GetCopyMapRandomRefreshNPCInfo():
+ ## 获取当前虚拟线路随机刷怪点NPC信息
+
+ gameWorld = GameWorld.GetGameWorld()
+ mapID = gameWorld.GetMapID()
+ refreshIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
+ if not refreshIpyDataList:
+ return
+
+ lastRefreshTickDict = {}
+ gameFB = GameWorld.GetGameFB()
+ for ipyData in refreshIpyDataList:
+ num = ipyData.GetRefreshNum()
+ lastRefreshTickDict[num] = gameFB.GetGameFBDictByKey(ChConfig.Def_RMark_RandomRefreshNPCNumTime % num)
+
+ markNPCDict = {} # 标识点对应NPC数量
+ gameNPC = GameWorld.GetNPCManager()
+ for i in xrange(gameNPC.GetCustomNPCRefreshCount()):
+ npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
+ npcCount = npcRefresh.GetCount()
+ if not npcCount:
+ continue
+
+ rMark = npcRefresh.GetRefreshMark()
+ npcIDCountDict = {}
+ for j in xrange(npcCount):
+ curNPC = npcRefresh.GetAt(j)
+ npcID = curNPC.GetNPCID()
+ npcIDCountDict[npcID] = npcIDCountDict.get(npcID, 0) + 1
+ markNPCDict[rMark] = npcIDCountDict
+ return lastRefreshTickDict, markNPCDict
+
+def OnFBOpenSetRandomRefreshNPCInfo(refreshNPCInfo, tick):
+ ## 副本虚拟线路启动时,根据保存的标试点刷怪信息设置刷怪
+ lastRefreshTickDict, markNPCDict = refreshNPCInfo
+
+ gameFB = GameWorld.GetGameFB()
+ gameFB.SetGameFBDict(ChConfig.Def_RMark_RandomRefreshNPCTick, tick)
+ for num, setTick in lastRefreshTickDict.items():
+ gameFB.SetGameFBDict(ChConfig.Def_RMark_RandomRefreshNPCNumTime % num, setTick)
+
+ gameNPC = GameWorld.GetNPCManager()
+ for i in xrange(gameNPC.GetCustomNPCRefreshCount()):
+ npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
+ rMark = npcRefresh.GetRefreshMark()
+ if rMark not in markNPCDict:
+ continue
+ npcIDCountDict = markNPCDict[rMark]
+ for npcID, count in npcIDCountDict.items():
+ GameWorld.DebugLog(" 副本启动刷怪: rMark=%s,npcID=%s,count=%s" % (rMark, npcID, count))
+ npcRefresh.Refresh(npcID, ChConfig.Def_NormalNPCAngryCount, count, False)
+ __InitNewBornNPC(npcRefresh , tick)
+
+ return
--
Gitblit v1.8.0