From 54d84deb1ca272784a1acc2fe33277ec2b4f5f37 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 09 一月 2020 17:42:46 +0800
Subject: [PATCH] 8346 【恺英】【后端】协助系统(副本协助奖励仅在发起玩家在线时才结算;增加协助玩家协助状态设置; 跨服服务器暂屏蔽发起协助)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py | 2
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py | 134 ++++++++++++++++++++++++++++++++------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 9 +--
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerAssist.py | 20 ++++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_KillDevil.py | 9 --
5 files changed, 116 insertions(+), 58 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerAssist.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerAssist.py
index 1c4a5e3..69d38f5 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerAssist.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerAssist.py
@@ -335,13 +335,6 @@
NetPackCommon.SendFakePack(assistPlayer, assistPack)
return
-def SetPlayerStartAssistTeamFB(curPlayer, queryData):
- ## 开始协助组队副本 - 玩家进入副本后才真正进入协助状态
-
- #mapID, lineID, tagPlayerID = queryData
-
- return
-
def MapServer_PlayerAssistLogic(curPlayer, msgList, tick):
## 地图同步的协助信息逻辑处理
@@ -403,7 +396,18 @@
# 开始协助组队副本
elif queryType == "OnStartAssistTeamFB":
- SetPlayerStartAssistTeamFB(curPlayer, queryData)
+ mapID, lineID, tagPlayerID = queryData
+ GameWorld.DebugLog(" 开始协助副本: mapID=%s,lineID=%s,tagPlayerID=%s" % (mapID, lineID, tagPlayerID), playerID)
+ # 副本协助暂时只处理设置协助目标ID
+ PlayerControl.SetAssistTagPlayerID(curPlayer, tagPlayerID)
+ return
+
+ # 取消协助组队副本
+ elif queryType == "OnCancelAssistTeamFB":
+ mapID, lineID, reason = queryData
+ GameWorld.DebugLog(" 开始协助副本: mapID=%s,lineID=%s,reason=%s" % (mapID, lineID, reason), playerID)
+ # 副本协助暂时只处理设置协助目标ID
+ PlayerControl.SetAssistTagPlayerID(curPlayer, 0)
return
#QueryPlayerResult_PlayerAssist(curPlayer, queryType, queryData, result)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
index 83c72bb..5f2a6cc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -21,6 +21,7 @@
import CrossRealmPlayer
import PlayerSuccess
import ReadChConfig
+import PlayerAssist
import ShareDefine
import PyGameData
import FBCommon
@@ -531,6 +532,7 @@
#成长NPC所需数据初始化
InitFBNPCStrengthenData(curPlayer, gameMap)
+ PlayerAssist.OnPlayerEnterAssistFB(curPlayer, gameMapID, reqFuncLineID)
DoEnterFB(curPlayer, tick)
RecordFirstEnterMap(curPlayer, gameMapID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_KillDevil.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_KillDevil.py
index bf77a59..053fdda 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_KillDevil.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_KillDevil.py
@@ -81,11 +81,6 @@
gameFB = GameWorld.GetGameFB()
lineTimeCfg = FBCommon.GetFBLineStepTime(mapID)
-
- # 进入消耗处理
- if not FBCommon.GetHadDelTicket(curPlayer):
- FBCommon.SetHadDelTicket(curPlayer)
- PlayerAssist.SetFBNoAssistPlayerID(curPlayer)
fbStep = gameFB.GetFBStep()
if fbStep == FB_Step_Open:
@@ -212,7 +207,7 @@
FBCommon.SetFBStep(FB_Step_Over, tick)
mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
- noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict = PlayerAssist.OnFBAssistOver(mapID)
+ noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict = PlayerAssist.OnFBAssistOver(isPass, mapID)
exitTime = FBCommon.GetFBLineStepTime(mapID)[Def_ExitTime] * 1000
rewardInfo = FBCommon.GetFBLineReward(mapID, 0)
noAssistItemList, assistItemList = ([], []) if not rewardInfo else rewardInfo
@@ -226,7 +221,7 @@
playerID = curPlayer.GetPlayerID()
overDict = {FBCommon.Over_dataMapID:mapID, FBCommon.Over_isPass: int(isPass)}
- if isPass:
+ if isPass and noAssistPlayerID:
itemList = []
if playerID == noAssistPlayerID:
itemList = noAssistItemList
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py
index 9a207ab..61815ea 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAssist.py
@@ -42,6 +42,20 @@
Sync_TodayAssistMoneyInfo(curPlayer)
return
+def OnPlayerLeaveMap(curPlayer):
+ ## 玩家离开地图处理
+
+ NPCHurtManager.OnPlayerLeaveMap(curPlayer)
+
+ mapID = curPlayer.GetMapID()
+ if GameWorld.GetMap().GetMapFBTypeByMapID(mapID) == IPY_GameWorld.fbtTeam:
+ mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
+ if str(mapID) in mapAssistGiftDict and PlayerControl.GetAssistTagPlayerID(curPlayer):
+ lineID = PlayerControl.GetFBFuncLineID(curPlayer)
+ OnCancelAssistTeamFB(curPlayer.GetPlayerID(), mapID, lineID, "LeaveMap")
+
+ return
+
#// B0 10 请求协助Boss #tagCMRequestAssistBoss
#
#struct tagCMRequestAssistBoss
@@ -56,6 +70,9 @@
playerID = curPlayer.GetPlayerID()
objID = clientData.ObjID
npcID = clientData.NPCID
+
+ if GameWorld.IsCrossServer():
+ return
if not curPlayer.GetFamilyID():
GameWorld.DebugLog("没有仙盟不能请求协助!", playerID)
@@ -106,6 +123,9 @@
mapID = clientData.MapID
lineID = clientData.LineID
+ if GameWorld.IsCrossServer():
+ return
+
if not curPlayer.GetFamilyID():
GameWorld.DebugLog("没有仙盟不能请求协助!", playerID)
return
@@ -141,6 +161,12 @@
## 开始协助组队副本,协助玩家进入副本调用
queryData = [mapID, lineID, tagPlayerID]
QueryGameServer_PlayerAssist(playerID, "OnStartAssistTeamFB", queryData)
+ return
+
+def OnCancelAssistTeamFB(playerID, mapID, lineID, reason):
+ ## 取消副本协助
+ queryData = [mapID, lineID, reason]
+ QueryGameServer_PlayerAssist(playerID, "OnCancelAssistTeamFB", queryData)
return
def QueryGameServer_PlayerAssist(playerID, queryType, queryData):
@@ -209,35 +235,72 @@
return
-def SetFBNoAssistPlayerID(curPlayer):
- ## 设置副本非协助玩家ID,玩家进入副本时调用
- gameFB = GameWorld.GetGameFB()
- if gameFB.GetGameFBDictByKey("FBNoAssistPlayerID"):
+def OnPlayerEnterAssistFB(curPlayer, mapID, lineID=0):
+ ## 玩家进入协助副本
+
+ if GameWorld.GetMap().GetMapFBTypeByMapID(mapID) != IPY_GameWorld.fbtTeam:
return
- if curPlayer.GetTeamID():
- if curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
- return
- noAssistPlayerID = curPlayer.GetPlayerID()
- gameFB.SetGameFBDict("FBNoAssistPlayerID", noAssistPlayerID)
- GameWorld.DebugLog("设置副本非协助玩家: noAssistPlayerID=%s" % noAssistPlayerID)
- return
-
-def OnFBAssistOver(mapID, lineID=0):
- ## 副本协助结束
- assistPlayerMoneyDict = {}
- assistMoneyType = ShareDefine.TYPE_Price_FamilyActivity
+
+ mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
+ if str(mapID) not in mapAssistGiftDict:
+ return
+
+ playerID = curPlayer.GetPlayerID()
gameFB = GameWorld.GetGameFB()
noAssistPlayerID = gameFB.GetGameFBDictByKey("FBNoAssistPlayerID")
- GameWorld.DebugLog("副本协助结算: mapID=%s,lineID=%s,noAssistPlayerID=%s" % (mapID, lineID, noAssistPlayerID))
+ if noAssistPlayerID:
+ if playerID != noAssistPlayerID:
+ OnStartAssistTeamFB(playerID, mapID, lineID, noAssistPlayerID)
+ return
- if not noAssistPlayerID:
- return noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict
-
- liheItemID, assistMoney = 0, 0
- mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
- if str(mapID) in mapAssistGiftDict:
- liheItemID, assistMoney = mapAssistGiftDict[str(mapID)]
+ if curPlayer.GetTeamID():
+ if curPlayer.GetTeamLV() != IPY_GameWorld.tmlLeader:
+ # 非队长先进入的,暂不处理,等待队长进入后统一处理
+ return
+ noAssistPlayerID = playerID # 队长或无队伍进入则为非协助玩家
+ gameFB.SetGameFBDict("FBNoAssistPlayerID", noAssistPlayerID)
+ GameWorld.DebugLog("设置副本非协助玩家: noAssistPlayerID=%s" % noAssistPlayerID)
+
+ copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
+ for index in xrange(copyPlayerManager.GetPlayerCount()):
+ player = copyPlayerManager.GetPlayerByIndex(index)
+ if not player:
+ continue
+ fbPlayerID = player.GetPlayerID()
+ if fbPlayerID == noAssistPlayerID:
+ continue
+ if PlayerControl.GetAssistTagPlayerID(player) != noAssistPlayerID:
+ OnStartAssistTeamFB(fbPlayerID, mapID, lineID, noAssistPlayerID)
+
+ return
+
+def OnFBAssistOver(isPass, mapID, lineID=0):
+ ''' 副本协助结束
+ @return: noAssistPlayerID, assistMoneyType, assistPlayerMoneyDict
+ 当 noAssistPlayerID 为0时代表没有成功结算协助,副本额外的协助奖励也不能结算,防止被刷协助奖励
+ '''
+ assistPlayerMoneyDict = {}
+ assistMoneyType = ShareDefine.TYPE_Price_FamilyActivity
+ defaultReturn = (0, assistMoneyType, assistPlayerMoneyDict)
+ gameFB = GameWorld.GetGameFB()
+ noAssistPlayerID = gameFB.GetGameFBDictByKey("FBNoAssistPlayerID")
+ GameWorld.DebugLog("副本协助结算: isPass=%s,mapID=%s,lineID=%s,noAssistPlayerID=%s" % (isPass, mapID, lineID, noAssistPlayerID))
+
+ if not isPass or not noAssistPlayerID:
+ return defaultReturn
+
+ copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
+ noAssistPlayer = copyPlayerManager.FindPlayerByID(noAssistPlayerID)
+ if not noAssistPlayer:
+ GameWorld.DebugLog(" 非协助玩家不在,不结算协助奖励!")
+ return defaultReturn
+
+ mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
+ if str(mapID) not in mapAssistGiftDict:
+ return defaultReturn
+ liheItemID, assistMoney = mapAssistGiftDict[str(mapID)]
+
friendList, memFamilyIDDict = [], {}
teamID = GameWorld.GetGameWorld().GetPropertyID()
if teamID in PyGameData.g_teamFBMemRelationDict:
@@ -246,8 +309,6 @@
assistAwardItemID = liheItemID
assistPlayerDict = {}
- copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
- noAssistPlayer = copyPlayerManager.FindPlayerByID(noAssistPlayerID)
for index in xrange(copyPlayerManager.GetPlayerCount()):
curPlayer = copyPlayerManager.GetPlayerByIndex(index)
if not curPlayer:
@@ -267,18 +328,17 @@
GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s,assistMoney=%s,isFriend=%s,addAssistMoney=%s"
% (assistPlayerID, assistMoney, isFriend, addAssistMoney), mapID, lineID)
- if noAssistPlayer:
- todayGiftCount = assistPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GetThanksGiftCount % liheItemID)
- assistPlayerDict[assistPlayerID] = {"PlayerName":assistPlayer.GetPlayerName(), "Job":assistPlayer.GetJob(),
- "LV":assistPlayer.GetLV(), "RealmLV":assistPlayer.GetOfficialRank(),
- "TodayGiftCount":todayGiftCount}
-
- # 暂定支持同队伍不同仙盟间协助
- if assistFamilyID and assistFamilyID == noAssistPlayerFamilyID:
- notifyParam = [assistPlayer.GetPlayerName(), noAssistPlayer.GetPlayerName(), mapID]
- PlayerControl.FamilyNotify(assistFamilyID, "AssistFBFinish", notifyParam)
+ todayGiftCount = assistPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GetThanksGiftCount % liheItemID)
+ assistPlayerDict[assistPlayerID] = {"PlayerName":assistPlayer.GetPlayerName(), "Job":assistPlayer.GetJob(),
+ "LV":assistPlayer.GetLV(), "RealmLV":assistPlayer.GetOfficialRank(),
+ "TodayGiftCount":todayGiftCount}
+
+ # 暂定支持同队伍不同仙盟间协助
+ if assistFamilyID and assistFamilyID == noAssistPlayerFamilyID:
+ notifyParam = [assistPlayer.GetPlayerName(), noAssistPlayer.GetPlayerName(), mapID]
+ PlayerControl.FamilyNotify(assistFamilyID, "AssistFBFinish", notifyParam)
- if noAssistPlayer and assistPlayerDict:
+ if assistPlayerDict:
GameWorld.DebugLog("发布方给感谢礼盒奖励: noAssistPlayerID=%s,assistAwardItemID=%s" % (noAssistPlayerID, assistAwardItemID), mapID, lineID)
ItemControler.GivePlayerItemOrMail(noAssistPlayer, [[assistAwardItemID, 1, 0]])
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index c627167..0e46c87 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -24,7 +24,6 @@
import PlayerTrade
import PlayerTeam
import SkillCommon
-import ChItem
import GameMap
import FBLogic
import GameWorldProcess
@@ -52,7 +51,6 @@
import PlayerPrestigeSys
import OpenServerCampaign
import PlayerGodWeapon
-import PlayerWing
import PlayerExpandPackCfgMgr
import PlayerWorldAverageLv
import PlayerActivity
@@ -81,8 +79,6 @@
import PlayerFamilyTech
import PlayerCostRebate
import GY_Query_CrossRealmReg
-import PlayerFairyCeremony
-import PlayerNewFairyCeremony
import PlayerCrossRealmPK
import FunctionNPCCommon
import CrossRealmPlayer
@@ -90,6 +86,7 @@
import NPCHurtManager
import ChNetSendPack
import PlayerCoat
+import PlayerAssist
import PlayerState
import QuestCommon
import PlayerDogz
@@ -1524,8 +1521,8 @@
GameWorld.DebugLog("进入副本时,最后一次离开的可返回的副本ID更新!mapID=%s,lineID=%s,Pos(%s,%s)" % (mapID, lineID, posX, posY))
# 离开地图
- NPCHurtManager.OnPlayerLeaveMap(curPlayer)
-
+ PlayerAssist.OnPlayerLeaveMap(curPlayer)
+
# 从副本中切图
if GameWorld.GetMap().GetMapFBType() != IPY_GameWorld.fbtNull:
#默认回满血
--
Gitblit v1.8.0