From 79af0ddc0c8b3e2a09418284677c6a9517854a29 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期五, 21 九月 2018 14:14:57 +0800 Subject: [PATCH] 3740 【后端】大小宝箱刷新逻辑 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py index f7fa69a..81a060c 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py @@ -27,15 +27,16 @@ import ChConfig -#{(标识点):[npcid,单个点数量,刷新间隔秒, 每次刷新只数, 第一次刷新只数]} -#{(101,102,103):[20302001,1,'20', 2, 10]} +#{(标识点):[npcid,单个点数量,刷新间隔秒, 每次刷新只数, 第一次刷新只数, 总个数上限]} +#{(101,102,103):[20302001,1,'20', 2, 10,30]} ( Def_NPCID, Def_MaxCnt, Def_TimeFormula, Def_RefreshCnt, -Def_FirstRefreshCnt -) = range(5) +Def_FirstRefreshCnt, +Def_TotalLimit, +) = range(6) Map_Dogzfb_LastRefreshTime = "Dogzfb_LastRefreshTime%s" # 刷新时间 参数npcid Map_Dogzfb_NextNeedTime = "NextNeedTime%s" # 下次刷新需要时间 参数npcid @@ -191,16 +192,21 @@ gameWorld.SetGameWorldDict(Map_Dogzfb_LastRefreshTime % npcID, curTime) maxCnt = refreshInfo[Def_MaxCnt] markList = [markInfo] if isinstance(markInfo, int) else list(markInfo) - random.shuffle(markList) + curTotalCnt = 0 for rMark in markList: - if refreshCnt <=0: - break - curCnt = npcCntDict.get(rMark, 0) - if curCnt >= maxCnt: - continue - needRefreshCnt = min(refreshCnt, maxCnt - curCnt) - refreshCnt -= needRefreshCnt - NPCCustomRefresh.SetNPCRefresh(rMark, [(npcID, needRefreshCnt)], needRefreshCnt + curCnt, needRefreshCnt) + curTotalCnt += npcCntDict.get(rMark, 0) + refreshCnt = min(refreshCnt, refreshInfo[Def_TotalLimit] - curTotalCnt) + if refreshCnt > 0: + random.shuffle(markList) + for rMark in markList: + if refreshCnt <=0: + break + curCnt = npcCntDict.get(rMark, 0) + if curCnt >= maxCnt: + continue + needRefreshCnt = min(refreshCnt, maxCnt - curCnt) + refreshCnt -= needRefreshCnt + NPCCustomRefresh.SetNPCRefresh(rMark, [(npcID, needRefreshCnt)], needRefreshCnt + curCnt, needRefreshCnt) #计算下次多久刷新 __UpdateBossTime(npcID, refreshInfo[Def_TimeFormula]) -- Gitblit v1.8.0