工程参考/GM指令

来自天龙知识库
跳到导航跳到搜索
GM 指令
203 个指令名 · 189 条指令(别名合并后)· 4 级权限

GM 指令是聊天框里用 !! 前缀发出的服务端调试指令。本页列出全部 189 条:指令名、用法、参数槽与所需权限等级。

怎么使用

  • 在聊天框输入 !!指令名 参数=值,例如 !!createitem itemtype=10101001 quality=1 count=1。前缀是两个感叹号,客户端识别后剥掉前缀发往服务端(实现位于 Client/Interface/GMInterface_Script_Talk.cpp 的 SendGMCommand)。
  • 指令名不区分大小写;参数一律 键=值 形式,多个参数之间不用逗号、直接连写(解析端按 = 逐个找键)。
  • 指令正文最多 254 个文字单位(382 字节),超长客户端直接不发。
  • 每条有效指令都会转发到 WorldServer 留审计记录(GUID、角色名、权限等级、指令原文)。

权限模型

服务端入口 CGCommandHandler::Execute(实现位于 Server/GameServer/Server/Packets/CGCommandHandler.cpp)有两道闸:

  1. 全局开关 g_Command_CommandEnable 默认关。开关打开时任何人可用;关闭时查共享内存 GM 表(GUID + Access 等级),共享内存未启用则直接放行(单机调试)。
  2. 权限过滤 Calc_GmRight:GM 表的 Access 列 0–3 映射到四级执行权限——Access 0 = ALL、1 = ADMIN、2 = GMADMIN、3 = GM。指令按类型分四组,等级不够直接拒绝;未列入任何组的类型一律拒绝。

参数图例

参数列写的是指令用到的参数槽:P0–P9 是整型、F0–F3 是浮点、Exp/Combat 是 64 位数值、文本 是字符串缓冲。用法列是源码分支上的注释原文,写 ?? 表示填数值。

GM(Access 3) · 7 条

最低权限,查人、传送、发系统消息。

指令 用法 参数 类型
syschat syschat ???????? 文本 15
searchplayer — P0 P1 文本 176
gotoplayer — P0 P1 文本 177
setautoremovebadpet — P0 180
sethumanattrpoint — P0 P1 Combat 188
setpetattrpoint — P0 P1 P2 Combat 189
sendsystemmessage — P0 文本 190

GMADMIN(Access 2) · 25 条

传送、复活、造怪、邮件、抓人。

指令 用法 参数 类型
teleport、tp teleport obj=?? loc=???,??? scene=?? P0 P1 F0 F1 1
relive relive 无 7
iamgod iamgod 无 12
iamdog iamdog 无 13
goto goto loc=??,?? scene=?? P0 F0 F1 34
fullrecover、full fullrecover(full) 无 35
skillrelive skillrelive 无 43
setscenetype setscenetype scene=?? P0 46
setdamage setdamage obj=?? damage=???? P0 P1 50
killobj killobj obj=?? P0 51
createmonster createmonster type=?? pos=??,?? baseai=?? scriptai=?? script=?? P0 P1 P2 P3 F0 F1 文本 52
deletemonster deletemonster objid=??? P0 53
setaitype setaitype objid=??? aitype=??? P0 P1 54
sendmail sendmail destguid=??? contex=??? 文本 文本2 59
recvmail recvmail 无 60
getobjinfo getobjinfo objid=??? P0 77
who who 无 80
allwho allwho 无 81
catchplayer catchplayer name=???? 或者 P0 P1 文本 82
playerinfo playerinfo name=???? 或者 P0 P1 文本 83
loadmonster loadmonster filename 文本 94
fingerguid — P0 P1 110
fingername fingername opt=OnlineFlag,PreciseFlag,Position name=name P0 P1 P2 文本 111
advancedfinger advancedfinger =pos =menpai =guildid =sex =fromlevel,tolevel P0 P1 P2 P3 F0 F1 112
KillMonstersByClass — P0 139

ADMIN(Access 1) · 50 条

改属性、发物品发宠物、改钱改元宝、任务数据。

指令 用法 参数 类型
modifyxinfa modifyxinfa xinfa=??,grade=?? P0 P1 P2 3
levelupallxinfa levelupallxinxa grade=?? P0 4
createitem createitem itemtype=物品编号 quality=品质 count=数量(count 省略为 1) P0 P1 P2 P6 文本 5
createitembind createitembind itemtype=物品编号 quality=品质 count=数量(绑定版,count 省略为 1) P0 P1 P2 P6 文本 6
enablegod enablegod 无 10
disablegod disablegod 无 11
createpet createpet petid=??? P0 36
deletepet deletepet petid=??? P0 37
capturepet capturepet petid=??? P0 38
calluppet calluppet petindex=??? P0 39
recallpet recallpet 无 40
freepettonature freepettonature =petindex P0 41
returntochild returntochild =petindex P0 42
setpkvalue — P0 47
setmodelid — P0 48
setequipdur — P1 P2 49
modifymoney、addmoney modifymoney gold=??? P0 55
modifyyuanbao、addyuanbao — P0 56
modifyzengdian、addzengdian modifyzengdian value=?? P0 57
levelup levelup =level P0 78
abilityup abilityup =abilityid =level P0 P1 79
setpethappiness — P0 P1 84
setpethp — P0 Combat 85
setpetlife — P0 P1 86
petlevelup — P0 87
setpetskill — P0 P1 P2 88
usepetskill usepetskill skillid=??? objid=??? P0 P1 89
leveldown LevelDown =levelwillbecut P0 90
addexp AddExp =Expwillbeadded Exp 91
sethaircolor — P0 P1 P2 P3 95
sethairmodel — P0 96
createguard createhelper modelid=??? P0 97
SetVigor — P0 105
SetEnergy — P0 106
PetPullulate — P0 107
addskill addskill =skilll_id P0 P1 108
removeskill removeskill =skilll_id P0 109
setabilityexp setabilityexp =abilityid =value P0 P1 113
EnableFatigue — 无 140
DisableFatigue — 无 141
clearyuanbaodaycost clearyuanbaodaycost value=?? P0 153
setmissiondata setmissiondata param0=??,param1=?? P0 P1 158
setmissionparam setmissionparam param0=??,param1=??,param2=?? P0 P1 P2 159
setmissiondone setmissiondone param0=??,param1=?? P0 P1 160
addpettitle addpettitle titleid=?? P0 162
delpettitle delpettitle titleid=?? P0 163
setusermissiondata setusermissiondata param0=??,param1=??,param2=?? P0 P1 P2 164
killsafetime — 无 166
modifyjiaozi、addjiaozi modifyjiaozi value=?? P0 181
modifyhonour、addhonour modifyhonour value=?? P0 187

ALL(Access 0) · 107 条

最高权限,场景管理、帮会队伍管理、重载配置、Lua 热执行。

指令 用法 参数 类型
modifymenpai modifymenpai menpai=?? P0 2
godrelive godrelive 无 8
debug_print debug_print param0=??,param1=?? P0 P1 9
debug_reloadconfig、reloadgmlist debug_reloadconfig 无 14
debug_shutdown debug_shutdown 无 16
team_invite team_invite sguid=????, dguid=???? P0 文本 17
team_retinvite team_retinvite ret=?, guid=???? P0 P1 18
team_leaderretinvite team_leaderretinvite ret=?, sguid=????, dguid=???? P0 P1 P2 19
team_apply team_apply sguid=????, dguid=???? P0 文本 20
team_retapply team_retapply ret=?, sguid=????, dguid=???? P0 P1 P2 21
team_leave team_leave guid=???? P0 22
team_kick team_kick sguid=????, dguid=???? P0 P1 23
team_dismiss team_dismiss guid=???? P0 24
team_appoint team_appoint sguid=????, dguid=???? P0 P1 25
ability_detail、ability ability objid=???? P0 26
use_ability use_ability ability_id=?? prescription_id=???? obj_id=???? P0 P1 P2 27
combound_gem 宝石表号、合成符格号、消耗颗数。 P6 文本 28
use_gem 旧入口只保留权限检查和退役提示,不再生成旧协议请求。 无 29
channel_create channel_create guid=???? P0 30
channel_invite channel_invite sguid=????, dguid=???? P0 P1 31
channel_dismiss channel_dismiss guid=???? P0 32
channel_kick channel_kick sguid=????, dguid=???? P0 P1 33
createscene createscene 无 44
closescene closescene scene=?? P0 45
teamfollow teamfollow 无 58
createguild createguild =guildname 文本 61
joinguild joinguild =guildid P0 62
guildrecruit guildrecruit =guid P0 63
guildexpel guildexpel =guild P0 64
leaveguild — 无 65
dismissguild — 无 66
guildlist guildlist =startindex P0 67
setmovemode setmovemode modeid=??? P0 68
relation relation 无 69
addfriend addfriend =friendguid =friendgroup =friendname P0 P1 文本 70
setfriendpoint、setfp setfp =friendguid =friendpoint P0 P1 71
addblackname、addblack addblack =blackguid =blackname P0 文本 72
delfriend delfriend =friendguid =passwd P0 文本 73
delblack delblack =blackguid P0 74
transition transition =guid =type =group P0 P1 P2 75
save save 无 76
CityCreate 建立城市 =入口场景号 P0 92
CityDelete 建立城市 =入口场景号 P0 P1 93
CreateSpecialObj — P0 98
useitem useitem bagitempos=??,targetitempos=?? P0 P1 99
forgetrecipe — P0 100
SendImpactToUnit — P0 P1 101
ReloadCombatTables — 无 102
UseSkill — P0 P1 F0 F1 F2 文本 103
savepacketinfo — 无 104
setgoodbad — P0 114
reloadmonsterattr — 无 115
reloadbasevalue — 无 116
setguildattr — P0 P1 Combat 117
ResetCooldownList — P0 118
DispelHostileImpacts — P0 119
OutputPacketAuditReport — 无 120
SetMenpaiPoint — P0 121
UnitAttr — P0 122
setmasterlevel — P0 123
showcooldown — P0 124
LogUnitAttr — P0 P1 Combat 125
loadlua — P0 126
exeluafunc — P0 P1 P2 文本 127
SetCampID SetCampID =objid =campid P0 P1 128
SetReputationID — P0 P1 Combat 129
SetReputationByID — P0 P1 P2 Combat 130
ModifyMyFightBackList — P0 P1 Combat 131
ModifyMyDuelList — P0 P1 Combat 132
ModifyMyEnemyList — P0 P1 Combat 133
SetPvpMode — P0 P1 Combat 134
SetPvpAuth — P0 P1 P2 Combat 135
TestFunction — P0 P1 P2 P3 136
SetMonsterFightWithNpcFlag — P0 P1 P2 P3 137
IncreaceSavvyByCompound IncreaceSavvyByCompound param0=??,param1=?? P0 P1 138
reloadaiscript — 无 142
SetZBValue — P0 143
SetZBTitle — P0 144
reloadtab — 文本 145
showiteminfo showiteminfo itemindex=?? P0 146
setft — P0 P1 147
AuditSwitch — P0 148
log_procreate — 无 149
GuildLeaveWord、glw — 文本 150
slot — P0 151
showcharinfo — P0 152
ResetFightBackList — P0 154
modifyweather — P0 P1 Combat 155
ChangeUserName — 文本 156
ChangeGuildName — 文本 157
couplequestion couplequestion question=?? 文本 161
setpetnumextra setpetnumextra value=?? P0 165
createleague — 文本 文本2 167
destroyleague — 无 168
askenterleague — P0 169
answerenterleague — P0 170
quitleague — 无 171
leaguelist — 无 172
leagueinfo — 无 173
leaguememberapplylist — 无 174
leaguechangedesc — 文本 175
enhance — P0 P1 Combat 178
setpetsavvy — P0 P1 179
levelupanqi — P0 184
setanqiattr — P0 P1 Combat 185
adddarkexp — P0 186
deleteitem、delitem deleteitem index=格号 count=数量(count=all 整格删除;道具栏 0–99、材料栏 100–199、任务栏 200–219) P0 P1 P2 P6 文本 191

占位与别名

  • none 是空指令占位,解析后直接返回、不执行任何操作。
  • 同一行的多个指令名是别名(如 teleport 与 tp),效果相同。
  • 指令类型号来自 Common/GameDefine2.h 的 COMMAND_TYPE 枚举,共 193 个枚举值;改指令解析或权限分组时用它定位。