10033 【后端】仙树升级系统及砍树产出规则(增加指定累计砍树次数可产出定制物品;)
2个文件已修改
1个文件已删除
1个文件已添加
113 ■■■■■ 已修改文件
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddCutTreeCnt.py 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CutTree.py 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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,参数(任务组)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/AddCutTreeCnt.py
File was deleted
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/CutTree.py
New file
@@ -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
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