From 63009c74cf80c83a15192322267fc9b30b320797 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 25 四月 2024 17:11:40 +0800
Subject: [PATCH] 10033 【后端】仙树升级系统及砍树产出规则(增加指定累计砍树次数可产出定制物品;)
---
/dev/null | 34 -----------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CutTree.py | 47 +++++++++++++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py | 31 +++++++++++++--
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 1
4 files changed, 74 insertions(+), 39 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 8ade00e..a9b7ef5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4431,6 +4431,7 @@
Def_PDict_TreeLVUPState = "TreeLVUPState" # 仙树升级状态;0-未升级;1-升级中
Def_PDict_TreeLVUPRemainTime = "TreeLVUPRemainTime" # 仙树升级剩余时间,秒
Def_PDict_TreeLVUPRefreshTime = "TreeLVUPRefreshTime" # 仙树升级上次刷新时间戳
+Def_PDict_AppointCutTreeCount = "AppointCutTreeCount" # 累计砍树次数 - 定制专用
#任务,每个任务组有且仅有一个进行中的任务
Def_PDict_TaskIDLast = "TaskIDLast_%s" # 上一次完成的任务ID,参数(任务组)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddCutTreeCnt.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddCutTreeCnt.py
deleted file mode 100644
index 62e4ebe..0000000
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddCutTreeCnt.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/python
-# -*- coding: GBK -*-
-#-------------------------------------------------------------------------------
-#
-##@package GM.Commands.AddCutTreeCnt
-#
-# @todo:增加砍树次数
-# @author hxp
-# @date 2024-02-20
-# @version 1.0
-#
-# 详细描述: 增加砍树次数
-#
-#-------------------------------------------------------------------------------
-#"""Version = 2024-02-20 10:30"""
-#-------------------------------------------------------------------------------
-
-import GameWorld
-import PlayerCutTree
-
-#逻辑实现
-## GM命令执行入口
-# @param curPlayer 当前玩家
-# @param msgList 参数列表
-# @return None
-# @remarks 函数详细说明.
-def OnExec(curPlayer, msgList):
- if not msgList:
- GameWorld.DebugAnswer(curPlayer, "增加砍树次数: AddCutTreeCnt 次数")
- GameWorld.DebugAnswer(curPlayer, "注: 仅执行除装备产出外逻辑")
- return
- addCount = msgList[0]
- PlayerCutTree.OnAddCutTreeCnt(curPlayer, addCount)
- return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CutTree.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CutTree.py
new file mode 100644
index 0000000..f105572
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CutTree.py
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#-------------------------------------------------------------------------------
+#
+##@package GM.Commands.CutTree
+#
+# @todo:砍树相关
+# @author hxp
+# @date 2024-04-25
+# @version 1.0
+#
+# 详细描述: 砍树相关
+#
+#-------------------------------------------------------------------------------
+#"""Version = 2024-04-25 17:30"""
+#-------------------------------------------------------------------------------
+
+import GameWorld
+import PlayerCutTree
+import PlayerControl
+import ChConfig
+
+#逻辑实现
+## GM命令执行入口
+# @param curPlayer 当前玩家
+# @param msgList 参数列表
+# @return None
+# @remarks 函数详细说明.
+def OnExec(curPlayer, msgList):
+ if not msgList:
+ GameWorld.DebugAnswer(curPlayer, "设置定制次数: CutTree a 次数")
+ GameWorld.DebugAnswer(curPlayer, "增加砍树次数: CutTree 次数")
+ GameWorld.DebugAnswer(curPlayer, "注: 仅执行除装备产出外逻辑")
+ return
+
+ value = msgList[0]
+ if value == "a":
+ appointCutCount = msgList[1] if len(msgList) > 1 else 0
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AppointCutTreeCount, appointCutCount)
+ GameWorld.DebugAnswer(curPlayer, "设置砍树定制产出次数: %s" % appointCutCount)
+ return
+
+ if value > 0:
+ addCount = value
+ PlayerCutTree.OnAddCutTreeCnt(curPlayer, addCount)
+
+ return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py
index dabf9c8..064e51e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py
@@ -100,6 +100,9 @@
return
GameWorld.DebugLog(" colorRateList=%s,totalRate=%s" % (colorRateList, totalRate), playerID)
+ cutCountAppointEquipDict = IpyGameDataPY.GetFuncEvalCfg("CutTree", 4)
+ appointCutTreeCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AppointCutTreeCount)
+ GameWorld.DebugLog(" appointCutTreeCount=%s" % (appointCutTreeCount), playerID)
classLV, isSuit = 1, None # 默认1阶,不限制是否套装
placeList = ChConfig.EquipPlace_Base + ChConfig.EquipPlace_Special
jobList = [curPlayer.GetJob()]
@@ -111,16 +114,25 @@
equipIDList = NPCCommon.__GetEquipIDList(0, classLV, itemColor, isSuit, placeList, jobList, findType="CutTree")
if not equipIDList:
continue
- randEquipID = random.choice(equipIDList)
- GameWorld.DebugLog(" 随机装备ID: %s, itemColor=%s,%s" % (randEquipID, itemColor, equipIDList), playerID)
- randEquipIDList.append(randEquipID)
+ appointCutTreeCount += 1
+ if appointCutTreeCount in cutCountAppointEquipDict:
+ randEquipID, appointID = cutCountAppointEquipDict[appointCutTreeCount]
+ GameWorld.DebugLog(" 定制装备ID: %s, appointID=%s,appointCutTreeCount=%s" % (randEquipID, appointID, appointCutTreeCount), playerID)
+ else:
+ appointID = 0
+ randEquipID = random.choice(equipIDList)
+ GameWorld.DebugLog(" 随机装备ID: %s, itemColor=%s,%s" % (randEquipID, itemColor, equipIDList), playerID)
+ randEquipIDList.append([randEquipID, appointID])
GameWorld.DebugLog(" 预产出装备: randEquipIDList=%s" % randEquipIDList, playerID)
giveItemListEx = []
giveEquipIDList = []
- for equipItemID in randEquipIDList:
- curItem = ItemControler.GetOutPutItemObj(equipItemID, 1, False, curPlayer=curPlayer)
+ for equipItemID, appointID in randEquipIDList:
+ setAttrDict = {}
+ if appointID:
+ setAttrDict[ShareDefine.Def_CItemKey_AppointID] = appointID
+ curItem = ItemControler.GetOutPutItemObj(equipItemID, 1, False, curPlayer=curPlayer, setAttrDict=setAttrDict)
if curItem == None:
continue
if not ItemControler.DoLogic_PutItemInPack(curPlayer, curItem, packIndexList=[IPY_GameWorld.rptIdentify]):
@@ -153,6 +165,15 @@
PlayerControl.PlayerControl(curPlayer).AddExp(addExp)
#GameWorld.DebugLog("OnAddCutTreeCnt: addCount=%s,addExp=%s" % (addCount, addExp), curPlayer.GetPlayerID())
+
+ cutCountAppointEquipDict = IpyGameDataPY.GetFuncEvalCfg("CutTree", 4)
+ appointCountMax = max(cutCountAppointEquipDict) if cutCountAppointEquipDict else 0
+ appointCutTreeCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_AppointCutTreeCount)
+ updAppointCutTreeCount = min(appointCutTreeCount + addCount, appointCountMax)
+ if updAppointCutTreeCount != appointCutTreeCount:
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_AppointCutTreeCount, updAppointCutTreeCount)
+ GameWorld.DebugLog("更新定制砍树次数: updAppointCutTreeCount=%s" % (updAppointCutTreeCount), curPlayer.GetPlayerID())
+
PlayerPrestigeSys.AddRealmLVUpCutTreeCnt(curPlayer, addCount)
PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_CutTree, addCount)
return
--
Gitblit v1.8.0