From 532ee8a00dac025085c781f6d62f7d12072ea6b0 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 04 三月 2020 20:18:43 +0800
Subject: [PATCH] 8397 【开发】个人boss新增评级
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py | 3 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py | 12 ++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py | 28 +++++++++++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_PersonalBoss.py | 13 +++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py | 2 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 2 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py | 37 ++++++++++++++++++
7 files changed, 90 insertions(+), 7 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index b1119c0..16143ec 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3074,6 +3074,8 @@
Def_Player_RefreshAttrByBuff = "PlayerAttrByBuff" # 玩家属性刷新功能属性缓存,便于buff刷新计算, 间隔刷新
Def_Player_HadRefreshAttr = "HadRefreshAttr" # 玩家在本地图是否刷新过属性
Def_PlayerKey_ClientCustomScene = "ClientCustomScene" # 客户端自定义场景状态
+Def_PlayerKey_ClientCustomSceneStepTick = "ClientCustomSceneStepTick" # 客户端自定义场景tick
+Def_PlayerKey_ClientCustomSceneGrade = "ClientCustomSceneGrade" # 客户端自定义场景评级
Def_PlayerKey_ChangeMapID = "ChangeMapID" # 请求切换的地图ID
Def_PlayerKey_ChangeLineID = "ChangeLineID" # 请求切换的线路ID
Def_PlayerKey_ResetFBLinePosX = "ResetFBLinePosX" # 请求切换副本多合一地图功能线路ID
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 5f2a6cc..22314e3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -935,6 +935,18 @@
callFunc(tick)
return
+def OnCustomSceneProcess(curPlayer, tick):
+ customMapID = PlayerControl.GetCustomMapID(curPlayer)
+ if not customMapID:
+ return
+ customLineID = PlayerControl.GetCustomLineID(curPlayer)
+ do_FBLogic_ID = __GetFBLogic_MapID(customMapID)
+ callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "OnCustomSceneProcess"))
+ if callFunc:
+ callFunc(curPlayer, customMapID, customLineID, tick)
+
+ return
+
## 开始采集
# @param curPlayer 当前玩家
# @param curNPC 当前NPC
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
index 6015f9d..150225a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/FBCommon.py
@@ -566,6 +566,43 @@
curPlayer.Sync_TimeTick(timeType, 0, diffSecond * 1000, True)
return updGrade
+def UpdateCustomFBGrade(curPlayer, tick, gradeTimeList, timeType=IPY_GameWorld.tttFlagTake):
+ '''更新当前副本星级、评级
+ @param gradeTimeList: 评级分段时间列表,单位秒 [最高评级可用时间, 下级可用时间, ..., 最低级可用时间]
+ @param curPlayer: 触发的玩家,一般是DoEnter时调用,会同步更新一次副本评级并将信息通知该玩家
+ @note: 星级:1-1星;2-2星 ... [60, 20, 10]
+ 评级:1-D;2-C;3-B;4-A;5-S; [60, 30, 30, 20, 10]
+ '''
+ lowest = 1
+ curGrade = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneGrade)
+ #最后一个评级了,不再处理
+ if curGrade == lowest:
+ return curGrade
+
+ fbStepTick = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneStepTick)
+ useSecond = int((tick - fbStepTick) / 1000.0) # 战斗阶段已耗总秒数
+ diffSecond = 0
+ updGrade = len(gradeTimeList)
+ gSecondTotal = 0
+ for gSecond in gradeTimeList:
+ gSecondTotal += gSecond
+ diffSecond = gSecondTotal - useSecond
+ # 还在当前评级段
+ if diffSecond > 0:
+ break
+ updGrade -= 1 # 用时超过当前评级段,降级
+ updGrade = max(lowest, updGrade) # 保底最低级
+ if curGrade == updGrade:
+ return curGrade
+ curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneGrade, updGrade)
+
+ GameWorld.DebugLog("UpdateCustomFBGrade useSecond=%s,gradeTimeList=%s,curGrade=%s,updGrade=%s,diffSecond=%s"
+ % (useSecond, gradeTimeList, curGrade, updGrade, diffSecond))
+
+ if updGrade != lowest:
+ curPlayer.Sync_TimeTick(timeType, 0, diffSecond * 1000, True)
+ return updGrade
+
def NotifyFBOver(curPlayer, dataMapID, lineID, isPass, overDict={}):
## 通知玩家副本总结, 该函数统一几个必带参数
overDict.update({Over_dataMapID:dataMapID, Over_lineID:lineID, Over_isPass:int(isPass)})
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_PersonalBoss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_PersonalBoss.py
index 01352b7..0300b15 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_PersonalBoss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_PersonalBoss.py
@@ -45,6 +45,12 @@
FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Fight)
EventReport.WriteEvent_FB(curPlayer, ChConfig.Def_FBMapID_PersonalBoss, 0, ChConfig.CME_Log_Start)
+ tick = GameWorld.GetGameWorld().GetTick()
+ FBCommon.UpdateCustomFBGrade(curPlayer, tick, FBCommon.GetFBLineGrade(mapID, lineID))
+ return
+
+def OnCustomSceneProcess(curPlayer, mapID, lineID, tick):
+ FBCommon.UpdateCustomFBGrade(curPlayer, tick, FBCommon.GetFBLineGrade(mapID, lineID))
return
## 自定义场景副本击杀NPC
@@ -59,6 +65,9 @@
if FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Fight:
return
+ grade = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneGrade)
+ costTime = GameWorld.GetGameWorld().GetTick() - curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ClientCustomSceneStepTick)
+ GameWorld.DebugLog("个人boss过关: grade=%s,costTime=%s" % (grade, costTime))
isFree = False
curfbStar = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_PlayerFBStar_MapId, lineID, False, [mapID])
# 首次过关不扣次数
@@ -78,10 +87,10 @@
npcCountDict = {bossID:1}
dropItemMapInfo = [0, 0]
- jsonItemList = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, dropItemMapInfo=dropItemMapInfo, isVirtualDrop=True)[0]
+ jsonItemList = NPCCommon.GiveKillNPCDropPrize(curPlayer, mapID, npcCountDict, dropItemMapInfo=dropItemMapInfo, curGrade=grade, isVirtualDrop=True)[0]
FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Over)
isPass = 1
- overDict = {FBCommon.Over_itemInfo:jsonItemList}
+ overDict = {FBCommon.Over_itemInfo:jsonItemList, FBCommon.Over_grade:grade, FBCommon.Over_costTime:costTime}
FBCommon.NotifyFBOver(curPlayer, mapID, lineID, isPass, overDict)
return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 3d4f0dd..1efe1c7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -915,6 +915,8 @@
GameWorld.ErrLog("获取NPC掉落配置错误!表不存在该NPCID=%s" % npcID, playerID)
return
+ curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
+
dropIDList = [] # 掉落的ID列表
auctionIDList = []
dropMoneyCnt, moneyValue = 0, 0
@@ -969,7 +971,7 @@
indepRateDoCnt = ipyDrop.GetIndepRateDoCnt()
if indepRateDoCnt:
indepRateDoCnt = __GetNPCDropDoCountChange(indepRateDoCnt, doCountRate + equipDropDoCountPlus, doCountAdd)
- dropEquipInfoList += __GetNPCIndepRateEquipDrop(ipyDrop, indepRateDoCnt, equipDropRatePlus, curGrade)
+ dropEquipInfoList += __GetNPCIndepRateEquipDrop(mapID, ipyDrop, indepRateDoCnt, equipDropRatePlus, curGrade)
#GameWorld.DebugLog("阶,颜色 key,dropEquipInfoList=%s" % (dropEquipInfoList))
# 3. 第x次击杀, 归属者公共附加掉落,所有归属者都增加击杀次数;
@@ -1022,7 +1024,6 @@
fbGradeColorSuitRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 2) # 评级影响颜色套装概率 {npcID:{颜色:[D级影响概率, ..., S级影响概率], ...}, ...}
if npcID in fbGradeColorSuitRateDict:
gradeColorSuitRateDict = fbGradeColorSuitRateDict[npcID]
- curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
colorMaxDropCntDict = ipyDrop.GetEquipColorMaxDropCount() # {颜色:上限数量,...}
@@ -1107,7 +1108,6 @@
fbGradePriItemIDDropDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 3)
if npcID in fbGradePriItemIDDropDict:
gradePriItemIDDropDict = fbGradePriItemIDDropDict[npcID]
- curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
priDropInfoList = gradePriItemIDDropDict.get(curGrade, [])
priDropIDList = []
for priItemID, priItemCount in priDropInfoList:
@@ -1117,6 +1117,15 @@
for priDropID in priDropIDList:
dropIDList.append(priDropID)
#GameWorld.DebugLog("私有物品掉落: priDropID=%s" % priDropID)
+
+ # 6. 地图评级额外掉落
+ fbGradeDropItemExDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate2", 2) # 地图评级额外物品掉落 {"mapID":{"评级":[[物品ID,个数], ...], ...}}
+ if curGrade and str(mapID) in fbGradeDropItemExDict:
+ gradeItemExDict = fbGradeDropItemExDict[str(mapID)]
+ gradeItemExList = gradeItemExDict.get(str(curGrade), [])
+ #GameWorld.DebugLog("评级额外掉落物品: curGrade=%s,gradeItemExList=%s" % (curGrade, gradeItemExList))
+ for gItemExID, gItemExCount in gradeItemExList:
+ dropIDList += [gItemExID] * gItemExCount
# 检查掉落互斥ID组
dropIDList = __RemoveMutexDropID(dropIDList, IpyGameDataPY.GetFuncCfg("MutexDrop", 1))
@@ -1505,7 +1514,7 @@
#GameWorld.DebugLog("饼图装备掉落结果: doCnt=%s, %s" % (doCnt, dropEquipInfoList))
return dropEquipInfoList
-def __GetNPCIndepRateEquipDrop(ipyDrop, doCnt, equipDropPlus, curGrade=0):
+def __GetNPCIndepRateEquipDrop(mapID, ipyDrop, doCnt, equipDropPlus, curGrade=0):
## 获取NPC独立掉率装备掉落信息
npcID = ipyDrop.GetNPCID()
indepRateDict = ipyDrop.GetIndepRateDrop() # 独立概率掉落信息 {(阶,颜色):概率,...}
@@ -1514,7 +1523,12 @@
fbGradeColorRateDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate", 1) #{npcID:{颜色:[D级影响概率, ..., S级影响概率], ...}, ...}
if npcID in fbGradeColorRateDict:
gradeColorRateDict = fbGradeColorRateDict[npcID]
- curGrade = curGrade if curGrade else GameWorld.GetGameFB().GetGameFBDictByKey(ChConfig.Def_FB_Grade)
+
+ orangeEquipPer = 0
+ fbGradeOrangeEquipPerDict = IpyGameDataPY.GetFuncEvalCfg("FBGradeEquipDropRate2", 1) # 地图评级影响橙装概率百分率 {"mapID":[D级影响概率, ..., S级影响概率], ..}
+ if str(mapID) in fbGradeOrangeEquipPerDict and curGrade:
+ orangeEquipPerList = fbGradeOrangeEquipPerDict[str(mapID)]
+ orangeEquipPer = 0 if (curGrade <= 0 or curGrade > len(orangeEquipPerList)) else orangeEquipPerList[curGrade - 1]
#colorDropCntDict = {} # 装备颜色已经掉落数 {颜色:数量, ...}
dropEquipInfoList = []
@@ -1528,6 +1542,10 @@
dropRate = int(dropRate * colorRate / 10000.0)
#GameWorld.DebugLog(" 评级影响颜色概率: curGrade=%s,colorRate=%s,dropRate=%s" % (curGrade, colorRate, dropRate))
+ if color == ChConfig.Def_Quality_Orange and orangeEquipPer:
+ dropRate = int(dropRate * orangeEquipPer / 100.0)
+ #GameWorld.DebugLog("评级橙装掉率加成: orangeEquipPer=%s,dropRate=%s" % (orangeEquipPer, dropRate))
+
dropRate = dropRate if not equipDropPlus else (dropRate + int(dropRate * equipDropPlus / 10000.0))
mustDropCount = dropRate / Def_NPCMaxDropRate
dropRate = dropRate % Def_NPCMaxDropRate # 基础概率
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
index 78d47d1..e1ceb25 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFB.py
@@ -508,6 +508,7 @@
PlayerControl.SetPlayerSightLevel(curPlayer, curPlayer.GetID())
curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 1) # 由于前端不一定有发mapID,所以这里额外记录这个状态,不能直接用mapID判断
+ curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneStepTick, tick)
PlayerControl.SetCustomMap(curPlayer, mapID, lineID)
NPCCommon.ClearPriWoodPile(curPlayer)
GameWorld.Log("玩家开始自定义场景!mapID=%s,lineID=%s" % (mapID, lineID), playerID)
@@ -539,6 +540,8 @@
mapID = PlayerControl.GetCustomMapID(curPlayer)
lineID = PlayerControl.GetCustomLineID(curPlayer)
curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomScene, 0)
+ curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneStepTick, 0)
+ curPlayer.SetDict(ChConfig.Def_PlayerKey_ClientCustomSceneGrade, 0)
PlayerControl.SetCustomMap(curPlayer, 0, 0)
if mapID and FBCommon.GetCustomMapStep(curPlayer, mapID, lineID) != ChConfig.CustomMapStep_Over:
FBCommon.SetCustomMapStep(curPlayer, mapID, lineID, ChConfig.CustomMapStep_Over)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py
index b1a1c7d..73d1289 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerState.py
@@ -1277,6 +1277,8 @@
FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)
#活跃放置
PlayerActivity.ProcessActivityPlace(curPlayer)
+ #自定义场景
+ FBLogic.OnCustomSceneProcess(curPlayer, tick)
#跨服数据同步,放最后
CrossPlayerData.ProcessCrossPlayer(curPlayer, tick)
return
--
Gitblit v1.8.0