Kill 服务器进程

Kill 服务器进程 "D:\Work\trunk\Program\trunk\Server\bin\win debian kill server.bat" 启动服务器进程 "D:\Work\trunk\Program\trunk\Server\bin\win debian start server.bat" ServerLog 热更 7. 编写 Patch 文件 7.1 基本规则 1. 文件放置…


Kill 服务器进程

"D:\Work\trunk\Program\trunk\Server\bin\win_debian_kill_server.bat"

启动服务器进程

"D:\Work\trunk\Program\trunk\Server\bin\win_debian_start_server.bat"

ServerLog

D:\Work\trunk\Program\trunk\log

热更

  1. 编写 Patch 文件 7.1 基本规则
  2. 文件放置:patch 文件放在 server_common/hotfix/patch/{patch_type}/ 目录下
  3. 命名建议:{patch_type}patch{描述}.lua,如 avatar_patch_fixBug.lua
  4. 代码结构:用 do...end 块包裹,避免变量泄漏到全局 do -- 你的 patch 代码 end
  5. 注册配置:在 patch_order_list.json 的 list 中添加对应条目
  6. order 递增:同一 patch_type 内 order 必须严格递增,不可跳过 7.2 Patch 文件编写步骤 Step 1:在对应 patch/{patch_type}/ 目录下创建 lua 文件 Step 2:编写 patch 逻辑(参考第9节示例) Step 3:在 patch_order_list.json 中注册 { "dev_start": 0, "publish_start": 1, "list": { "1": { "patch_type": "avatar", "order": 1, "file": "avatar_patch_fixSkill.lua" } } } Step 4:通过 GM 命令触发,或重启服务器自动加载

  1. ServerPatchHelper 函数热更工具 ServerPatchHelper 是用于运行时替换函数的核心工具,支持自动处理 upvalue(闭包局部变量)的合并。 8.1 PatchFunc — 核心 API ServerPatchHelper:PatchFunc(funcContainer, funcKey, newFunc, upvalueContext) 参数说明: funcContainer string / table / function 函数所在容器(模块路径字符串、模块 table、或包含目标局部函数的父函数) funcKey string 函数名(table 中的 key 或 upvalue 名) newFunc function 替换用的新函数 upvalueContext table (可选) 额外的 upvalue 上下文函数列表,用于跨函数提取 upvalue funcContainer 的三种形式: -- 形式1:模块路径字符串 ServerPatchHelper:PatchFunc("server_entities.avatar.avatarmember.ImpGM", "MethodName", newFunc)

-- 形式2:模块 table local ImpGM = require "server_entities.avatar.avatarmember.ImpGM" ServerPatchHelper:PatchFunc(ImpGM, "MethodName", newFunc)

-- 形式3:函数(用于替换局部函数) ServerPatchHelper:PatchFunc(ImpGM.SomeMethod, "localFuncName", newFunc)