From a7d7e5fc4c17ab455ce3a5118fb0c529241454f1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 20 一月 2021 11:07:34 +0800
Subject: [PATCH] 8701 【主干】【后端】活动相关的充值界面显示优化(跨服充值排行活动支持分);
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py | 302 +++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 272 insertions(+), 30 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
index 0b2d18e..fe910da 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_CrossGrassland.py
@@ -14,13 +14,65 @@
#-------------------------------------------------------------------------------
#"""Version = 2019-04-15 16:30"""
#-------------------------------------------------------------------------------
+
import GameWorld
import GameWorldProcess
+import PlayerFairyDomain
import NPCCustomRefresh
+import IpyGameDataPY
import PyGameData
+import NPCCommon
+import PlayerControl
+import ChConfig
+import FBCommon
+import ItemControler
+
+FBDict_SyncFBNPC = 'SyncFBNPC' #是否需要同步副本NPC
+
+def DoResetCrossGrassland(curPlayer, eventType, fdeventID):
+ ## 草园重置
+
+ resetCollectType = 10 + eventType
+ NPCCommon.DoResetCollectNPCTimeByType(curPlayer, [resetCollectType])
+
+ # 宝箱怪次数重置
+ if eventType == PlayerFairyDomain.FDEventType_GrasslandXian:
+ npcID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+ if npcID:
+ NPCCommon.UpdateNPCAttackCount(curPlayer, npcID, 0)
+
+ ResetGrasslandAwardRecord(curPlayer)
+ return
+
+## 是否需要做进入副本通用检查条件逻辑,默认需要检查
+def OnNeedCheckCanEnterFBComm(curPlayer, mapID, lineID):
+ curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+ return curState != PlayerFairyDomain.FDEventState_Visiting
def OnEnterFBEvent(curPlayer, mapID, lineID, tick):
- return True
+ curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+ return curState in [PlayerFairyDomain.FDEventState_CanVisit, PlayerFairyDomain.FDEventState_Visiting]
+
+## 进入跨服副本注册数据前逻辑
+## @return: 是否可以注册前往跨服副本,次函数中可以写一些扣除消耗逻辑等
+def OnRegEnterCrossFB(curPlayer, mapID, lineID):
+ curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+ if curState == PlayerFairyDomain.FDEventState_CanVisit:
+ delResult = FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID)
+ isOK = delResult[0]
+ if not isOK:
+ return False
+ return PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
+
+ if curState == PlayerFairyDomain.FDEventState_Visiting:
+ return True
+
+ return False
+
+## 跨服功能线路数据缓存,下次开启同样功能线路时会用该数据进行还原之前的副本状态
+def OnGetCrossFuncLineDataCache():
+ refreshNPCInfo = NPCCustomRefresh.GetCopyMapRandomRefreshNPCInfo()
+ return refreshNPCInfo
## 开启副本
def OnOpenFB(tick):
@@ -28,49 +80,42 @@
realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
key = (realMapID, copyMapID)
if key in PyGameData.g_crossFuncLineDataCache:
- refreshNPCInfo = PyGameData.g_crossFuncLineDataCache[key]
+ refreshNPCInfo = PyGameData.g_crossFuncLineDataCache.pop(key)
GameWorld.DebugLog("副本开启根据保存的虚拟线路标试点刷怪信息刷怪: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo))
NPCCustomRefresh.OnFBOpenSetRandomRefreshNPCInfo(refreshNPCInfo, tick)
return
-def GetCurFBFuncLineID():
- ## 获取本线路功能线路ID
- return GameWorld.GetGameWorld().GetPropertyID() % 10000 / 10
-
-def GetCurFBLineZoneID():
- ## 获取本线路所属跨服分区
- return GameWorld.GetGameWorld().GetPropertyID() / 10000
-
## 进副本
def DoEnterFB(curPlayer, tick):
playerID = curPlayer.GetPlayerID()
- zoneID = GetCurFBLineZoneID()
- funcLineID = GetCurFBFuncLineID()
- GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s" % (zoneID, funcLineID), playerID)
+ zoneID = FBCommon.GetCrossDynamicLineMapZoneID()
+ funcLineID = FBCommon.GetCrossDynamicLineMapFuncLineID()
+ crossMapID = PlayerControl.GetCrossMapID(curPlayer)
+ GameWorld.Log("DoEnterFB zoneID=%s,funcLineID=%s,crossMapID=%s" % (zoneID, funcLineID, crossMapID), playerID)
+ FBCommon.Sync_FBNPC(curPlayer=curPlayer)
+ if crossMapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
+ boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+ if boxNPCID:
+ NPCCommon.SyncNPCAttackCount(curPlayer, [boxNPCID])
return
## 副本总逻辑计时器
def OnProcess(tick):
- #gameFB = GameWorld.GetGameFB()
- return
-
-## 关闭副本
-def OnCloseFB(tick):
- gameWorld = GameWorld.GetGameWorld()
- refreshNPCInfo = NPCCustomRefresh.GetCopyMapRandomRefreshNPCInfo()
- if refreshNPCInfo:
- realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
- key = (realMapID, copyMapID)
- PyGameData.g_crossFuncLineDataCache[key] = refreshNPCInfo
- GameWorld.DebugLog("缓存虚拟线路标试点刷怪信息: realMapID=%s,copyMapID=%s,refreshNPCInfo=%s" % (realMapID, copyMapID, refreshNPCInfo))
+ gameFB = GameWorld.GetGameFB()
+ if gameFB.GetGameFBDictByKey(FBDict_SyncFBNPC):
+ gameFB.SetGameFBDict(FBDict_SyncFBNPC, 0)
+ FBCommon.Sync_FBNPC()
- GameWorld.GetGameWorld().SetPropertyID(0)
return
-
-## 玩家退出副本
-def DoExitFB(curPlayer, tick):
- return
+#
+### 关闭副本
+#def OnCloseFB(tick):
+# return
+#
+### 玩家退出副本
+#def DoExitFB(curPlayer, tick):
+# return
##玩家主动离开副本.
def DoPlayerLeaveFB(curPlayer, tick):
@@ -82,4 +127,201 @@
return
+## 客户端进入自定义场景
+def OnEnterCustomScene(curPlayer, mapID, lineID):
+ curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+ PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visiting)
+
+ if curState == PlayerFairyDomain.FDEventState_CanVisit:
+ refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
+ npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
+ for npcID, npcCount in npcCountDict.items():
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, npcCount)
+
+ if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
+ FBCommon.DelFBEnterTicket(curPlayer, mapID, lineID)
+ else:
+ DoCheckUpdateGrasslandEnd(curPlayer)
+
+ SyncCustomSceneNPCCount(curPlayer, mapID, lineID)
+ if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
+ boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+ if boxNPCID:
+ NPCCommon.SyncNPCAttackCount(curPlayer, [boxNPCID])
+
+ return
+
+## 自定义场景采集OK,需自带是否允许采集的判断
+def OnCustomSceneCollectOK(curPlayer, mapID, lineID, npcID):
+ curState = PlayerFairyDomain.GetFairyDomainFBEventState(curPlayer, mapID, lineID)
+ if curState != PlayerFairyDomain.FDEventState_Visiting:
+ return False
+ curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
+ if not curCount:
+ return False
+ return True
+
+def DecCustomSceneNPCCount(curPlayer, npcID):
+ ## 减少草园自定义场景NPC,默认减少一个
+ mapID, lineID = GetGrasslandMapID(curPlayer)
+ if not mapID:
+ return
+ curCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
+ updCount = max(0, curCount - 1)
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandNPCCount % npcID, updCount)
+ SyncCustomSceneNPCCount(curPlayer, mapID, lineID)
+ return
+
+def SyncCustomSceneNPCCount(curPlayer, mapID, lineID):
+ ## 通知自定义场景NPC数
+ refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
+ npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
+ npcNowCountDict = {}
+ for npcID in npcCountDict.keys():
+ npcNowCountDict[npcID] = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandNPCCount % npcID)
+ if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian:
+ boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+ if boxNPCID:
+ npcNowCountDict[boxNPCID] = 1
+ NPCCommon.SyncNPCCntInfo(curPlayer, mapID, npcNowCountDict)
+ return
+
+def RecordGrasslandAward(curPlayer, addItemList):
+ ## 记录草园奖励信息
+ mapID = GetGrasslandMapID(curPlayer)[0]
+ if not mapID:
+ return
+
+ for itemInfo in addItemList:
+ if not isinstance(itemInfo, list):
+ continue
+ itemID, itemCount = itemInfo[:2]
+
+ newIndex = None
+ for i in xrange(20):
+ itemCountInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandDropCount % i)
+ if not itemCountInfo:
+ newIndex = i
+ break
+ recItemID = itemCountInfo/100
+ if recItemID == itemID:
+ updRecValue = itemCountInfo + itemCount
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandDropCount % i, updRecValue)
+ break
+ if newIndex != None:
+ newRecValue = itemID*100 + itemCount
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandDropCount % newIndex, newRecValue)
+
+ return
+
+def ResetGrasslandAwardRecord(curPlayer):
+ ## 重置草园奖励信息记录
+ for i in xrange(20):
+ itemCountInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandDropCount % i)
+ if not itemCountInfo:
+ break
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrasslandDropCount % i, 0)
+ return
+
+
+def GetGrasslandMapID(curPlayer):
+ grasslandMapIDList = [ChConfig.Def_FBMapID_CrossGrasslandLing, ChConfig.Def_FBMapID_CrossGrasslandXian]
+ crossMapID = PlayerControl.GetCrossMapID(curPlayer)
+ customMapID = PlayerControl.GetCustomMapID(curPlayer)
+ if crossMapID in grasslandMapIDList:
+ mapID = crossMapID
+ lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine)
+ elif customMapID in grasslandMapIDList:
+ mapID = customMapID
+ lineID = PlayerControl.GetCustomLineID(curPlayer)
+ else:
+ return 0, 0
+ return mapID, lineID
+
+def DoCheckUpdateGrasslandEnd(curPlayer):
+ ## 检查更新草园已拜访完成
+
+ mapID, lineID = GetGrasslandMapID(curPlayer)
+ if not mapID:
+ return
+
+ # 采集次数是否已用完
+ if mapID == PlayerControl.GetCustomMapID(curPlayer):
+ refreshMapNPCDict = IpyGameDataPY.GetFuncEvalCfg("CrossGrasslandCfg", 2)
+ npcCountDict = refreshMapNPCDict.get((mapID, lineID), {})
+ npcIDList = npcCountDict.keys()
+ else:
+ collNPCIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("MapRefreshNPC", mapID)
+ if not collNPCIpyDataList:
+ return
+
+ npcIDList = []
+ for collIpyData in collNPCIpyDataList:
+ npcIDList += collIpyData.GetNPCIDList()
+
+ for npcID in npcIDList:
+ collectNPCIpyData = IpyGameDataPY.GetIpyGameData("CollectNPC", npcID)
+ if not collectNPCIpyData:
+ return
+ limitMaxTime = collectNPCIpyData.GetMaxCollectCount()
+ totalCollTime = NPCCommon.GetTodayCollectCount(curPlayer, npcID)
+ if totalCollTime < limitMaxTime:
+ GameWorld.DebugLog("草园NPC采集次数未用完! npcID=%s,totalCollTime=%s < limitMaxTime=%s" % (npcID, totalCollTime, limitMaxTime))
+ return
+
+ # 宝箱怪攻击次数是否已用完
+ boxNPCID = IpyGameDataPY.GetFuncCfg("CrossGrasslandCfg", 1)
+ if mapID == ChConfig.Def_FBMapID_CrossGrasslandXian and boxNPCID:
+ boxNPCIpyData = IpyGameDataPY.GetIpyGameDataNotLog("TreasureNPC", boxNPCID)
+ if not boxNPCIpyData:
+ return
+ attackCountDropWeightInfo = boxNPCIpyData.GetAttackCountDropWeightInfo()
+ if not attackCountDropWeightInfo:
+ return
+ maxAttackCount = max(attackCountDropWeightInfo)
+ attackCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_NPCAttackCount % boxNPCID)
+ if attackCount < maxAttackCount:
+ GameWorld.DebugLog("草园宝箱怪攻击次数未用完! boxNPCID=%s,attackCount=%s < maxAttackCount=%s" % (boxNPCID, attackCount, maxAttackCount))
+ return
+
+ PlayerFairyDomain.SetFairyDomainFBEventState(curPlayer, mapID, lineID, PlayerFairyDomain.FDEventState_Visited)
+ PlayerControl.SetCustomMap(curPlayer, 0, 0)
+ GameWorld.DebugLog("设置草园已完成!mapID=%s, lineID=%s" % (mapID, lineID))
+
+ # 通知结算
+ awardItemList = []
+ for i in xrange(20):
+ itemCountInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrasslandDropCount % i)
+ if not itemCountInfo:
+ break
+ isAuctionItem = 0
+ itemID, itemCount = itemCountInfo/100, itemCountInfo%100
+ awardItemList.append([itemID, itemCount, isAuctionItem])
+ extraAward = [] #额外物品奖励
+ ipyData = IpyGameDataPY.GetIpyGameDataByCondition("FairyDomain", {"MapID":mapID, "LineID":lineID})
+ if ipyData:
+ fdEventID = ipyData.GetID()
+ extraAward = PlayerFairyDomain.GetFairyAppointAward(curPlayer, fdEventID)
+ if not extraAward:
+ extraAward = FBCommon.GetFBLineReward(mapID, lineID)
+ if extraAward:
+ ItemControler.GivePlayerItemOrMail(curPlayer, extraAward)
+ awardItemList += extraAward
+ overDict = {FBCommon.Over_itemInfo:FBCommon.GetJsonItemList(awardItemList)}
+ FBCommon.NotifyFBOver(curPlayer, mapID, lineID, 1, overDict)
+ ResetGrasslandAwardRecord(curPlayer)
+ return
+
+def DoFB_NPCDead(curNPC):
+ #GameWorld.DebugLog("DoFB_NPCDead 设置需要同步副本NPC!")
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
+ return
+
+def OnNPCRebornInFB(curNPC):
+ #GameWorld.DebugLog("OnNPCRebornInFB 设置需要同步副本NPC!")
+ GameWorld.GetGameFB().SetGameFBDict(FBDict_SyncFBNPC, 1)
+ return
+
+
+
--
Gitblit v1.8.0