【GM】添加一些GM命令

dev_chengFeng
gaoxin 2021-10-29 12:08:40 +08:00
parent c1f3658da4
commit b181f4bd55
2 changed files with 24 additions and 11 deletions

View File

@ -214,13 +214,15 @@ function this.RequestSendChatMsg(channel, content, func)
end
--
function this.RequestGMCommand(command)
function this.RequestGMCommand(command, func)
-- 世界发言消息特殊处理
local content = string.format("%d|%s", GLOBAL_CHAT_TYPE.COMMON, command)
-- 请求发送
NetManager.RequestSendChatMsg(CHAT_CHANNEL.GLOBAL, content, 0, function(msg)
PopupTipPanel.ShowTip(Language[10358])
if func then
func()
end
end)
end

View File

@ -34,6 +34,7 @@ local GMType = {
local GMSubType = {
Server = 1,
Func = 2,
Chat = 3,
}
local _GMConfig = {}
@ -79,6 +80,7 @@ function GMPanel:InitComponent()
{type = GMType.Player, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "批量生成英雄", inputTip = {"英雄ID#星级|..."}, callBack = this.GetManyHeros},
{type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "9#%s#0", btnTip = "通关关卡", inputTip = {"关卡id"}, callBack = nil},
{type = GMType.Player, subType = GMSubType.Server, inputNum = 1, args = "3#1#%s", btnTip = "发送邮件", inputTip = {"id,num|id,num..."}, callBack = nil},
{type = GMType.Player, subType = GMSubType.Chat, inputNum = 1, args = "//soul <uid> %s", btnTip = "加宝物", inputTip = {"魂宝id#强化等级#精炼等级"}, callBack = nil},
{type = GMType.Player, subType = GMSubType.Server, inputNum = 0, args = "8#1#1", btnTip = "通关所有关卡", inputTip = {}, callBack = nil},
-- {type = GMType.Player, subType = GMSubType.Server, inputNum = 0, args = "6#0#0", btnTip = "一键物品", inputTip = {""}, callBack = nil},
-- {type = GMType.Player, subType = GMSubType.Server, inputNum = 0, args = "22#0#0", btnTip = "一键异妖", inputTip = {""}, callBack = nil},
@ -88,13 +90,19 @@ function GMPanel:InitComponent()
{type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "生成顶级装备", inputTip = {""}, callBack = this.GetEquipe},
{type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "生成很多物品", inputTip = {""}, callBack = this.GetAllItems},
{type = GMType.Player, subType = GMSubType.Func, inputNum = 0, args = "", btnTip = "鑫鹏的gm", inputTip = {""}, callBack = this.SendToXinPeng},
{type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "16#%s#0", btnTip = "跳转", inputTip = {"输入兽潮层数"}, callBack = nil},
{type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "15#%s#0", btnTip = "获取", inputTip = {"孙龙秘宝积分"}, callBack = this.SetSunLongScroe},
{type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "23#0#%s", btnTip = "获取", inputTip = {"天宫秘宝积分"}, callBack = nil},
{type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "24#%s", btnTip = "逍遥游", inputTip = {"类型#mapId#bossId"}, callBack = nil},
{type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "25#%s#1", btnTip = "山河社稷图", inputTip = {"小关卡ID"}, callBack = nil},
{type = GMType.Function, subType = GMSubType.Server, inputNum = 1, args = "14#%s#0", btnTip = "跳转", inputTip = {"试炼副本层数"}, callBack = nil},
{type = GMType.Function, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "添加圣物", inputTip = {"输入圣物ID"}, callBack = this.AddHoly},
{type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//addholy <uid> %s", btnTip = "添加圣物", inputTip = {"输入圣物ID"}, callBack = nil},
{type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//fourspirit <uid> %s", btnTip = "四灵通关层数", inputTip = {"人#佛#妖#道"}, callBack = function() NetManager.GetFourElementGetInfo() end},
{type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//guildskilllevel <uid> %s", btnTip = "公会技能等级", inputTip = {"技能1#技能2#技能3#技能4"}, callBack = function() NetManager.GetAllGuildSkillData() end},
{type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//xiuxing <uid> %s", btnTip = "修行境界", inputTip = {"修行境界id"}, callBack = function(id) PracticeManager.UpdataFromServer(tonumber(id)) end},
{type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//godtree <uid> %s", btnTip = "建木神树等级", inputTip = {"神树等级"}, callBack = function(id) SacredTreeManager.treeLevel = tonumber(id) end},
{type = GMType.Function, subType = GMSubType.Chat, inputNum = 1, args = "//xuanyuan <uid> %s", btnTip = "轩辕宝镜跳关", inputTip = {"副本类型#副本id"}, callBack = function() NetManager.GetSituationInfoRequest() end},
{type = GMType.Function, subType = GMSubType.Func, inputNum = 1, args = "", btnTip = "跳转测试", inputTip = {"输入跳转ID"}, callBack = this.TestJump},
{type = GMType.Function, subType = GMSubType.Func, inputNum = 2, args = "", btnTip = "功能引导测试", inputTip = {"请输入功能ID", "1去主界面2去挂机界面"}, callBack = this.TestFuncGuide},
@ -351,14 +359,6 @@ end
function this.OpenRedDebug()
UIManager.OpenPanel(UIName.RedpotDebugPanel)
end
-- 添加圣物
function this.AddHoly(text)
local command = "//addholy %s %s"
command = string.format(command, PlayerManager.uid, text)
Log(command)
ChatManager.RequestGMCommand(command)
end
-- 进入战斗测试场景
function this.GoTestBattle()
UIManager.OpenPanel(UIName.BattleTestPanel)
@ -486,6 +486,17 @@ function GMPanel:OnOpen(...)
config.callBack(unpack(args))
end
PopupTipPanel.ShowTip("GM应用成功")
elseif config.subType == GMSubType.Chat then
-- 替换uid
local formatStr = string.gsub(config.args, "<uid>", PlayerManager.uid)
-- 参数赋值
local gmstr = string.format(formatStr, unpack(args))
ChatManager.RequestGMCommand(gmstr, function()
if config.callBack then
config.callBack(unpack(args))
end
PopupTipPanel.ShowTip("GM应用成功")
end)
end
end)
end