From 875d928db2370eaaa6a43bf01d0761d7939dab5f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 13 十月 2018 17:14:42 +0800
Subject: [PATCH] 4064 【后端】【主干】直接给玩家的货币类物品优化处理; 2094 邮件发放神兽装备,神兽背包空间不足逻辑错误;
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_Dogz.py | 61 ++++++++++++++++++++++--------
1 files changed, 44 insertions(+), 17 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 81a060c..0afc7a7 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
@@ -42,8 +42,8 @@
Map_Dogzfb_NextNeedTime = "NextNeedTime%s" # 下次刷新需要时间 参数npcid
Map_Dogzfb_LastCheckTick = "LastCheckTick" # 上次检查时间
Map_Dogzfb_NPCRemainCnt = 'NPCRemainCnt_%s' # NPC剩余数量
-Map_Dogzfb_CollectLostHPTick = 'CollectLostHPTick' # 采集掉线Tick
-
+Map_Dogzfb_CollectLostHPTick = 'CollectLostHPTick' # 采集掉血Tick
+Map_Dogzfb_CollectLostHPCnt = 'CollectLostHPCnt' # 采集掉血次数
## 是否能够通过活动查询进入
# @param curPlayer 玩家实例
@@ -106,6 +106,18 @@
return
+## 开始采集
+# @param curPlayer 当前玩家
+# @param curNPC 当前NPC
+# @return None or False
+# @remarks 函数详细说明.
+def OnBeginCollect(curPlayer, curNPC):
+ playerID = curPlayer.GetID()
+ tick = GameWorld.GetGameWorld().GetTick()
+ gameFB = GameWorld.GetGameFB()
+ gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPTick, tick)
+ gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPCnt, 0)
+ return
## 收集中
def OnCollecting(curPlayer, tick):
@@ -117,19 +129,23 @@
curNPC = GameWorld.GetNPCManager().GetNPCByIndex(tagObj.GetIndex())
npcID = curNPC.GetNPCID()
+ __DoCollectLostHP(curPlayer, npcID, tick)
+ return
+
+def __DoCollectLostHP(curPlayer, npcID, tick):
+
+
playerID = curPlayer.GetID()
gameFB = GameWorld.GetGameFB()
collectLostHPTick = gameFB.GetPlayerGameFBDictByKey(playerID, Map_Dogzfb_CollectLostHPTick)
-
+ lostHPCnt = gameFB.GetPlayerGameFBDictByKey(playerID, Map_Dogzfb_CollectLostHPCnt)
+
lostCD = IpyGameDataPY.GetFuncEvalCfg('DogzFBCollect', 1, {}).get(npcID, 1)
- lostTime = (tick - collectLostHPTick) / 1000/lostCD # 掉血次数
- if lostTime >3:
- gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPTick, tick)
- return
+ lostTime = (tick - collectLostHPTick) / (1000*lostCD)-lostHPCnt
if not lostTime:
return
- gameFB.SetGameFBDict(Map_Dogzfb_CollectLostHPTick, tick)
+ gameFB.SetPlayerGameFBDict(playerID, Map_Dogzfb_CollectLostHPCnt, lostHPCnt+lostTime)
lostHPPer = IpyGameDataPY.GetFuncEvalCfg('DogzFBCollect', 2, {}).get(npcID, 1)
@@ -137,10 +153,18 @@
lostValue = min(int(GameObj.GetMaxHP(curPlayer) * lostHPPer / 100.0) * lostTime, GameObj.GetHP(curPlayer)-1)
if lostValue <=0:
return
- #GameWorld.DebugLog("OnCollecting npcID=%s, lostHPPer=%s,lostTime=%s,lostValue=%s" % (npcID, lostHPPer, lostTime, lostValue))
+ GameWorld.DebugLog("OnCollecting npcID=%s, lostHPPer=%s,lostTime=%s,lostValue=%s" % (npcID, lostHPPer, lostTime, lostValue))
SkillCommon.SkillLostHP(curPlayer, skillTypeID, buffOwner, lostValue, tick)
return
+##玩家收集成功(塔, 旗)
+# @param curPlayer 玩家实例
+# @param tick 时间戳
+# @return 无意义
+# @remarks
+def OnCollectOK(curPlayer, npcID, tick):
+ __DoCollectLostHP(curPlayer, npcID, tick)
+ return
##---副本总逻辑计时器---
# @param tick:时间戳
@@ -185,7 +209,7 @@
continue
rmark = npcRefresh.GetRefreshMark()
npcCntDict[rmark] = npcCntDict.get(rmark, 0) + npcRefresh.GetCount()
-
+ isNeedSync = False #是否需要通知
for markInfo, refreshInfo in refreshDict.items():
npcID = refreshInfo[Def_NPCID]
refreshCnt = refreshInfo[Def_FirstRefreshCnt] if isFirst else refreshInfo[Def_RefreshCnt]
@@ -210,9 +234,11 @@
#计算下次多久刷新
__UpdateBossTime(npcID, refreshInfo[Def_TimeFormula])
-
+ if npcID in IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 3):
+ isNeedSync = True
#通知时间
- SyncNPCRefreshTime()
+ if isNeedSync:
+ SyncNPCRefreshTime()
return
@@ -247,14 +273,15 @@
nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
return max(0, nextNeedTime - curTime + lastRefreshTime)
-def SyncNPCRefreshTime(playerid=0):
- curTime = int(time.time())
+def SyncNPCRefreshTime():
syncNPCIDList = IpyGameDataPY.GetFuncEvalCfg('DogzFBRefreshCfg', 3)
syncDict = {}
for npcID in syncNPCIDList:
- refreshTime = GetDogzNPCRefreshTime(curTime, npcID)
- syncDict[npcID] = refreshTime
- msgStr = str([playerid, syncDict])
+ gameWorldMgr = GameWorld.GetGameWorld()
+ lastRefreshTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_LastRefreshTime % npcID)
+ nextNeedTime = gameWorldMgr.GetGameWorldDictByKey(Map_Dogzfb_NextNeedTime % npcID)
+ syncDict[npcID] = [lastRefreshTime, nextNeedTime]
+ msgStr = str(syncDict)
GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, 'DogzNPCTime', msgStr, len(msgStr))
return
--
Gitblit v1.8.0