Blame view

src/actions/GmAction.lua 15.2 KB
314bc5df   zhengshouren   提交服务器初始代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  local _M = {}
  local redisproxy = redisproxy
  function _M.clientRequest(agent, data)
  	local msg = MsgPack.unpack(data)
  	local role = agent.role
  	local action = _M[msg.cmd]
  	local bin = MsgPack.pack({ cmd = "指令失败" })
  	if not action then
  		SendPacket(actionCodes.Gm_receiveResponse, bin)
  		return true
  	end
  	local ret = action(role, msg)
  	bin = MsgPack.pack({ cmd = ret })
  	SendPacket(actionCodes.Gm_receiveResponse, bin)
  	return true
  end
  
5e5d7680   zhouhaihai   热更新 优化
18
  function _M.testhotfix(role, pms)
a5486ede   zhouhaihai   csvdata 修改为 share...
19
  	return csvdb["itemCsv"][1]["name"] .. " -=- " .. globalCsv["codeVersion"] .. " -=- " .. role:getItemCount(123) .. " -=- " .. table.pack(next(role.heros))[2]:getBattleValue()
5e5d7680   zhouhaihai   热更新 优化
20
  end
0a07bdd9   zhouahaihai   角色升级 。gm
21
  
3133cb76   zhouhaihai   日志
22
23
24
  function _M.ignoreout(role, pms)
  	pms = pms or {}
  	local status = tonum(pms.pm1, 1)
300ee7a1   zhouhaihai   一键升级
25
26
27
28
29
  	if status == 1 then  -- 忽视
  		role:updateProperty({field = "ignoreMt", value = 1})
  	else  -- 解除
  		role:updateProperty({field = "ignoreMt", value = 0})
  	end
3133cb76   zhouhaihai   日志
30
  	role:log("gm_action", {desc = "ignoreout", key1 = pms.sender})
300ee7a1   zhouhaihai   一键升级
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  	return "指令生效"
  end
  
  function _M.ban(role, pms)
  	local now = skynet.timex()
  	local time = tonum(pms.pm1, 1)
  	local ctype = tonum(pms.pm2, 0)
  
  	local isBan = role:getProperty("banTime") <= now
  	role:setBan(time, ctype)
  	if time > 0 then
  		role:sendGmMsg("server_accountBanned_1")
  		local agent = datacenter.get("agent", role:getProperty("id"))
  		if agent then
  			skynet.timeout(50, function ()
  				skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)
  			end)
  		end
  	end
3133cb76   zhouhaihai   日志
50
51
52
  
  	role:log("gm_action", {desc = "ban", int1 = time, int2 = ctype, key1 = pms.sender})
  
300ee7a1   zhouhaihai   一键升级
53
54
55
56
57
  	return isBan and "解封杀成功" or "封杀成功"
  end
  
  function _M.unban(role, pms)
  	role:setBan(0, 0)
3133cb76   zhouhaihai   日志
58
59
60
  
  	role:log("gm_action", {desc = "unban", key1 = pms.sender})
  
300ee7a1   zhouhaihai   一键升级
61
62
63
64
65
66
67
68
69
70
71
72
  	return "解封杀成功"
  end
  
  function _M.gmmsg(role, pms)
  	role:sendGmMsg(pms.pm1, true)
  
  	local agent = datacenter.get("agent", role:getProperty("id"))
  	if agent then
  		skynet.timeout(50, function ()
  			skynet.call(agent.gate_serv, "lua", "forcekick", agent.fd)
  		end)
  	end
3133cb76   zhouhaihai   日志
73
  	role:log("gm_action", {desc = "gmmsg", text1 = pms.pm1, key1 = pms.sender})
300ee7a1   zhouhaihai   一键升级
74
75
76
77
78
79
80
81
82
83
84
  
  	return "指令成功"
  end
  
  function _M.silent(role, pms)
  	local pm1 = tonum(pms.pm1)
  	if pm1 < 1 then
  		role:updateProperty({field = "silent", value = 0})
  		return "解禁言成功"
  	end
  	role:updateProperty({field = "silent", value = specTime({hour = 0}, skynet.timex()) + pm1 * 86400})
3133cb76   zhouhaihai   日志
85
86
  
  	role:log("gm_action", {desc = "silent", int1 = pms.pm1, key1 = pms.sender})
300ee7a1   zhouhaihai   一键升级
87
88
89
  	return "禁言成功"
  end
  
bd4fb541   zhouhaihai   增加物品过期系统
90
91
92
93
94
  function _M.pvp_cross_head(role, pms)
  	role:awardExpireItem(tonum(pms.expire), pms.reward, {log = {desc = "pvpCHead"}})
  	return "成功"
  end
  
300ee7a1   zhouhaihai   一键升级
95
  
58f3a42c   zhouhaihai   gm帮助
96
97
98
  local helpDes = {{"描述", "指令", "参数1", "参数2"	,"参数3"}}
  
  table.insert(helpDes, {"获得角色"	, "hero", "角色类型"})
0a07bdd9   zhouahaihai   角色升级 。gm
99
100
  function _M.hero(role, pms)
  	local heroType = tonum(pms.pm1)
3133cb76   zhouhaihai   日志
101
  	if not role:addHero({type = heroType, log = {desc = "gm"}}) then
056c01a0   zhouhaihai   简化装备
102
103
  		return "失败"
  	end
3133cb76   zhouhaihai   日志
104
105
  
  	role:log("gm_action", {desc = "hero", int1 = heroType, key1 = pms.sender})
0a07bdd9   zhouahaihai   角色升级 。gm
106
107
108
  	return "成功"
  end
  
faabdf3c   suhongyang   Gm加hero add level
109
110
111
112
  table.insert(helpDes, {"角色升级"	, "herol", "角色类型", "增加等级"})
  function _M.herol(role, pms)
  	local heroType = tonum(pms.pm1)
  	local addLevel = tonum(pms.pm2)
300ee7a1   zhouhaihai   一键升级
113
114
115
116
117
118
119
120
121
  	local hero = role:isHaveHero(heroType)
  
  	local MaxLv = 200
  
  	if not hero then
  		return "不存在的英雄类型"
  	end
  	if hero:getProperty("breakL") >= #csvdb["unit_breakCsv"] and hero:getProperty("level") >= MaxLv then
  		return "等级已满"
faabdf3c   suhongyang   Gm加hero add level
122
  	end
300ee7a1   zhouhaihai   一键升级
123
  	local nextLevel = math.min(addLevel + hero:getProperty("level"), MaxLv)
923162ce   zhouhaihai   优化
124
  	for i = 0, #csvdb["unit_breakCsv"] do
fd4e0f4f   suhongyang   不能直接突破满
125
126
127
128
129
130
131
132
  		local upLimit = csvdb["unit_breakCsv"][i].levelLimit
  		local lowLimit = csvdb["unit_breakCsv"][i - 1] and csvdb["unit_breakCsv"][i - 1].levelLimit or 0
  		if upLimit > nextLevel and lowLimit <= nextLevel then
  			local addbl = i - hero:getProperty("breakL")
  			if addbl > 0 then
  				hero:updateProperty({field = "breakL", delta = addbl})
  			end
  		end
d8c07167   suhongyang   防止突破满了还突破
133
  	end
b640afba   suhongyang   Gm升级直接突破
134
  	addLevel = math.min(hero:getMaxLevel() - hero:getProperty("level"), addLevel)
faabdf3c   suhongyang   Gm加hero add level
135
136
  	hero:updateProperty({field = "level", delta = addLevel})
  	role:checkTaskEnter("HeroLevelUp", {level = hero:getProperty("level")})
3133cb76   zhouhaihai   日志
137
138
139
  
  	role:log("gm_action", {desc = "herol", int1 = heroType, int2 = addLevel, key1 = pms.sender})
  
faabdf3c   suhongyang   Gm加hero add level
140
141
142
  	return "成功"
  end
  
300ee7a1   zhouhaihai   一键升级
143
144
145
146
147
148
149
  
  table.insert(helpDes, {"全部角色升级"	, "herola", "增加等级"})
  function _M.herola(role, pms)
  	local addLevel = tonum(pms.pm1)
  	for _, hero in pairs(role.heros) do
  		_M.herol(role, {pm1 = hero:getProperty("type"), pm2 = addLevel})
  	end
3133cb76   zhouhaihai   日志
150
151
152
  
  	role:log("gm_action", {desc = "herola", int1 = addLevel, key1 = pms.sender})
  
300ee7a1   zhouhaihai   一键升级
153
154
155
156
  	return "成功"
  end
  
  
58f3a42c   zhouhaihai   gm帮助
157
  table.insert(helpDes, {"获得装备"	, "equip", "装备类型"	, "装备等级", "装备个数"})
43cc5f51   gaofengduan   调整 equip 数据结构
158
159
160
161
  function _M.equip(role, pms)
  	local typ = tonum(pms.pm1)
  	local level = tonum(pms.pm2)
  	local count = tonum(pms.pm3)
3133cb76   zhouhaihai   日志
162
163
  	role:addEquip(typ, level, count, {log = {desc = "gm"}})
  	role:log("gm_action", {desc = "equip", int1 = typ, int2 = level, long1 = count, key1 = pms.sender})
43cc5f51   gaofengduan   调整 equip 数据结构
164
165
166
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
167
  table.insert(helpDes, {"获得零件"	, "rune", "零件类型", "零件id"})
ad484303   gaofengduan   add rune
168
169
170
  function _M.rune(role, pms)
  	local typ = tonum(pms.pm1)
  	local id = tonum(pms.pm2)
3133cb76   zhouhaihai   日志
171
172
173
  	local result = role:addRune({type = typ,id = id, log = {desc = "gm"}})
  	role:log("gm_action", {desc = "rune", int1 = typ, int2 = id, key1 = pms.sender})
  
ad484303   gaofengduan   add rune
174
175
176
  	return result
  end
  
58f3a42c   zhouhaihai   gm帮助
177
  table.insert(helpDes, {"通关挂机副本", "fb", "挂卡id"})
cb85faac   zhouhaihai   增加gm命令
178
179
180
  function _M.fb(role, pms) -- 直接通关
  	local carbonId = tonum(pms.pm1)
  	if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end
cb85faac   zhouhaihai   增加gm命令
181
182
183
184
  	local addPre 
  	addPre = function(carbonId)
  		local carbonData = csvdb["idle_battleCsv"][carbonId]
  		for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do
33be3111   zhouhaihai   修改hangPass 结构
185
  			role:hangFinish(pre)
03a6166a   zhouhaihai   餐厅优化
186
  			role:checkTaskEnter("HangPass", {id = pre})
cb85faac   zhouhaihai   增加gm命令
187
188
189
  			addPre(pre)
  		end
  	end
15e1f084   zhouhaihai   挂机gm
190
  	role:hangFinish(carbonId)
cb85faac   zhouhaihai   增加gm命令
191
  	addPre(carbonId)
3133cb76   zhouhaihai   日志
192
193
194
  
  	role:log("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender})
  
03a6166a   zhouhaihai   餐厅优化
195
  	role:checkTaskEnter("HangPass", {id = carbonId})
cb85faac   zhouhaihai   增加gm命令
196
197
198
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
199
  table.insert(helpDes, {"抵达挂机副本", "fbc", "副本id"})
6433fe76   zhouhaihai   到某一关
200
201
202
203
204
205
206
207
  function _M.fbc(role, pms) -- 直接通关
  	local carbonId = tonum(pms.pm1)
  	if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end
  	local passCarbon = {}
  	local addPre 
  	addPre = function(carbonId)
  		local carbonData = csvdb["idle_battleCsv"][carbonId]
  		for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do
33be3111   zhouhaihai   修改hangPass 结构
208
  			role:hangFinish(pre)
03a6166a   zhouhaihai   餐厅优化
209
  			role:checkTaskEnter("HangPass", {id = pre})
6433fe76   zhouhaihai   到某一关
210
211
212
  			addPre(pre)
  		end
  	end
00298f6a   zhouhaihai   gm action
213
  	role:updateProperty({field = "hangPass", value = {}})
6433fe76   zhouhaihai   到某一关
214
  	addPre(carbonId)
33be3111   zhouhaihai   修改hangPass 结构
215
  	
3133cb76   zhouhaihai   日志
216
217
  	role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender})
  
6433fe76   zhouhaihai   到某一关
218
219
220
  	return "成功"
  end
  
14f1591b   zhouhaihai   删除好感度相关
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
  -- table.insert(helpDes, {"好感度", "love", "角色类型", "好感度等级", "好感度经验"})
  -- function _M.love(role, pms)
  -- 	local heroType = tonum(pms.pm1)
  -- 	local level = tonum(pms.pm2)
  -- 	local exp = tonum(pms.pm3)
  -- 	local curPlus = csvdb["unit_love_plusCsv"][heroType]
  -- 	if not curPlus then return "参数错误" end
  -- 	level = math.max(math.min(curPlus.limit, level), 0)
  -- 	local curEffect = csvdb["unit_love_effectCsv"][level]
  -- 	exp = math.max(math.min(curEffect.loveValue, exp) , 0)
  -- 	for _, hero in pairs(role.heros) do
  -- 		if hero:getProperty("type") == heroType then
  -- 			hero:updateProperty({field = "loveL", value = level})
  -- 			hero:updateProperty({field = "loveExp", value = exp})
  -- 			if role:getProperty("loveStatus"):getv(heroType, 0) < level then
  -- 				role:changeUpdates({{type = "loveStatus", field = heroType, value = level}}) -- 总的
  -- 			end
  -- 			role:checkTaskEnter("LoveBreak", {heroType = heroType, loveL = level})
  -- 		end
  -- 	end
  -- 	return "成功"
  -- end
cb85faac   zhouhaihai   增加gm命令
243
  
58f3a42c   zhouhaihai   gm帮助
244
  table.insert(helpDes, {"玩家经验", "exp", "经验"})
cb85faac   zhouhaihai   增加gm命令
245
246
247
  function _M.exp(role, pms)
  	local exp =  tonum(pms.pm1)
  	exp = math.floor(math.max(exp, 0))
3133cb76   zhouhaihai   日志
248
249
250
251
  	role:addPlayExp(exp, {log = {desc = "gm"}})
  
  	role:log("gm_action", {desc = "exp", int1 = exp, key1 = pms.sender})
  
cb85faac   zhouhaihai   增加gm命令
252
253
254
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
255
256
257
258
259
260
261
  table.insert(helpDes, {"获得物品", "get", "物品ID", "个数"})
  table.insert(helpDes, {"获得所有物品", "get", "ALL"})
  table.insert(helpDes, {"获得所有装备", "get", "EQUIP"})
  table.insert(helpDes, {"获得所有零件", "get", "RUNE"})
  table.insert(helpDes, {"获得所有碎片", "get", "FRAG"})
  table.insert(helpDes, {"获得所有食物", "get", "FOOD"})
  table.insert(helpDes, {"获得所有角色", "get", "HERO"})
8c74292c   zhouahaihai   增加item 以及 角色突破
262
  function _M.get(role, pms)
747f05a1   gaofengduan   add gm get all
263
  	if pms.pm1 == "ALL" then
58559948   zhouhaihai   getall gm
264
265
266
267
  		local reward = {}
  		for id, data in pairs(csvdb["gm_getallCsv"]) do
  			if csvdb["itemCsv"][id] then
  				reward[id] = data.number
747f05a1   gaofengduan   add gm get all
268
269
  			end
  		end
3133cb76   zhouhaihai   日志
270
  		role:award(reward, {log = {desc = "gm"}})
3c8a6b8a   zhouhaihai   get equip
271
272
273
  	elseif pms.pm1 == "EQUIP" then
  		for itemId = 7000 , 8000 do
  			if csvdb["itemCsv"][itemId] then
3133cb76   zhouhaihai   日志
274
  				role:award({[itemId] = 100}, {log = {desc = "gm"}})
3c8a6b8a   zhouhaihai   get equip
275
276
  			end
  		end
966034ca   zhouhaihai   获取碎片零件gm
277
  	elseif pms.pm1 == "RUNE" then
58751698   zhouhaihai   修改id 区间
278
  		for itemId = 2000 , 3000 do
966034ca   zhouhaihai   获取碎片零件gm
279
  			if csvdb["itemCsv"][itemId] then
3133cb76   zhouhaihai   日志
280
  				role:award({[itemId] = 1}, {log = {desc = "gm"}})
966034ca   zhouhaihai   获取碎片零件gm
281
282
283
284
285
  			end
  		end
  	elseif pms.pm1 == "FRAG" then
  		for itemId = 100 , 400 do
  			if csvdb["itemCsv"][itemId] then
3133cb76   zhouhaihai   日志
286
  				role:award({[itemId] = 100}, {log = {desc = "gm"}})
966034ca   zhouhaihai   获取碎片零件gm
287
288
  			end
  		end
3b069d52   zhouhaihai   增加获取 food 后台
289
290
291
  	elseif pms.pm1 == "FOOD" then
  		for itemId = 4000 , 5000 do
  			if csvdb["itemCsv"][itemId] then
3133cb76   zhouhaihai   日志
292
  				role:award({[itemId] = 100}, {log = {desc = "gm"}})
3b069d52   zhouhaihai   增加获取 food 后台
293
294
  			end
  		end
cb85faac   zhouhaihai   增加gm命令
295
296
297
  	elseif pms.pm1 == "HERO" then
  		for itemId = 400 , 700 do
  			if csvdb["itemCsv"][itemId] then
3133cb76   zhouhaihai   日志
298
  				role:award({[itemId] = 1}, {log = {desc = "gm"}})
cb85faac   zhouhaihai   增加gm命令
299
300
  			end
  		end
747f05a1   gaofengduan   add gm get all
301
302
303
304
305
  	else
  		local itemId = tonum(pms.pm1)
  		if not csvdb["itemCsv"][itemId] then
  			return "物品不存在"
  		end
ee999bde   zhouhaihai   零件优化
306
  		local count = tonum(pms.pm2, 1)
3133cb76   zhouhaihai   日志
307
308
  		role:award({[itemId] = count}, {log = {desc = "gm"}})
  		role:log("gm_action", {desc = "get", int1 = itemId, int2 = count, key1 = pms.sender})
8c74292c   zhouahaihai   增加item 以及 角色突破
309
  	end
8c74292c   zhouahaihai   增加item 以及 角色突破
310
311
312
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
313
  table.insert(helpDes, {"冒险清除"	, "advc"})
4b7c7c96   zhouahaihai   增加 清空 挂机 冒险gm 角色经验
314
  function _M.advc(role, pms)
badeee4e   zhouhaihai   优化gm 冒险清除
315
316
317
318
319
320
321
  	local advTeam = role:getProperty("advTeam")
  	advTeam.player = nil
  
  	local reward = role:getProperty("advItems"):toNumMap()
  	for itemId, count in pairs(reward) do
  		reward[itemId] = math.ceil(count * globalCsv.adv_fail_reward_ratio / 100) -- 奖励相当于失败
  	end
3133cb76   zhouhaihai   日志
322
  	role:award(reward, {log = {desc = "gm"}})
badeee4e   zhouhaihai   优化gm 冒险清除
323
324
325
326
327
328
329
330
331
  
  	role:updateProperties({
  		advInfo = {}, 
  		advTeam = advTeam,
  		advItems = "",
  		advAFGet = {},
  		advAFWear = {},
  	}, notNotify)
  	role.advData = nil
3133cb76   zhouhaihai   日志
332
333
334
  
  	role:log("gm_action", {desc = "advc", key1 = pms.sender})
  
4b7c7c96   zhouahaihai   增加 清空 挂机 冒险gm 角色经验
335
336
337
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
338
  table.insert(helpDes, {"冒险次数恢复", "advf"})
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
339
340
  function _M.advf(role, pms)
  	role.dailyData:updateProperty({field = "advC", value = 0})
a230673a   zhouhaihai   回复体力
341
  	role.dailyData:updateProperty({field = "advElC", value = 0})
3133cb76   zhouhaihai   日志
342
343
344
  
  	role:log("gm_action", {desc = "advf", key1 = pms.sender})
  
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
345
346
347
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
348
  table.insert(helpDes, {"冒险通关", "adv", "章节id", "层数"})
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
349
350
351
352
  function _M.adv(role, pms)
  	local chapterId = tonum(pms.pm1)
  	local layer = tonum(pms.pm2)
  
150e01af   zhouhaihai   gmbug
353
  	local advCsv = csvdb["adv_chapterCsv"][chapterId]
35e2e3c4   zhouhaihai   优化 gm advt 增加感知b...
354
  	if not advCsv then return "不存在的章节" end
7cd50d19   zhouhaihai   gm
355
  	if math.floor(chapterId / 100) ~= 2 then
150e01af   zhouhaihai   gmbug
356
  		layer = math.min(layer, advCsv.limitlevel)
7cd50d19   zhouhaihai   gm
357
  	end
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
358
  	local advPass = role:getProperty("advPass")
33be3111   zhouhaihai   修改hangPass 结构
359
  
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
360
361
  	if (advPass[chapterId] or 0) < layer then
  		advPass[chapterId] = layer
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
362
363
  		role:updateProperty({field = "advPass", value = advPass})
  	end
bec06592   zhouhaihai   日志整理
364
  	role:log("gm_action", {desc = "adv", int1 = chapterId, int2 = layer, key1 = pms.sender})
4faef572   zhouhaihai   冒险任务,冒险扫荡, 冒险中继
365
366
367
368
  
  	return "成功"
  end
  
35e2e3c4   zhouhaihai   优化 gm advt 增加感知b...
369
  table.insert(helpDes, {"冒险到达指定层", "advt", "章节id", "层数", "地图id(选)"})
4d943586   zhouhaihai   直通 advt gm
370
371
372
  function _M.advt(role, pms)
  	local chapterId = tonum(pms.pm1)
  	local layer = tonum(pms.pm2)
35e2e3c4   zhouhaihai   优化 gm advt 增加感知b...
373
  	local mapId = tonum(pms.pm3)
150e01af   zhouhaihai   gmbug
374
375
  	local advCsv = csvdb["adv_chapterCsv"][chapterId]
  	if not advCsv then return "不存在的章节" end
4d943586   zhouhaihai   直通 advt gm
376
  
35e2e3c4   zhouhaihai   优化 gm advt 增加感知b...
377
378
379
  	local status = _M.adv(role, {pm1 = chapterId, pm2 = layer - 1})
  	if status ~= "成功" then return status end
  
7cd50d19   zhouhaihai   gm
380
  	local advData = role:getAdvData()
35e2e3c4   zhouhaihai   优化 gm advt 增加感知b...
381
382
  	if advData:isRunning() then
  		advData:forceOver()
7cd50d19   zhouhaihai   gm
383
  	end
4d943586   zhouhaihai   直通 advt gm
384
  
35e2e3c4   zhouhaihai   优化 gm advt 增加感知b...
385
386
387
388
389
390
  	advData:initByChapter({
  		chapterId = chapterId, 
  		level = layer, 
  		isEnter = true,
  		debugMapId = mapId,
  	})
3133cb76   zhouhaihai   日志
391
  	role:log("gm_action", {desc = "advt", int1 = chapterId, int2 = layer, key1 = pms.sender})
4d943586   zhouhaihai   直通 advt gm
392
393
394
  	return "成功"
  end
  
300ee7a1   zhouhaihai   一键升级
395
  table.insert(helpDes, {"冒险队等级增加", "advl", "经验"})
f60b89b1   zhouhaihai   奖励副本
396
  function _M.advl(role, pms)
300ee7a1   zhouhaihai   一键升级
397
398
  	local exp = tonum(pms.pm1)
  	role:addAdvLvExp(math.max(0, exp))
3133cb76   zhouhaihai   日志
399
400
401
  
  	role:log("gm_action", {desc = "advl", int1 = exp, key1 = pms.sender})
  
f60b89b1   zhouhaihai   奖励副本
402
403
404
  	return "成功"
  end
  
68d3fbaf   zhouhaihai   冒险内加经验
405
406
407
408
409
410
411
412
413
  table.insert(helpDes, {"冒险内等级增加", "advcl", "经验值"})
  function _M.advcl(role, pms)
  	local exp = tonum(pms.pm1)
  	local advData = role:getAdvData()
  
  	if not advData.chapterId then
  		return "先随便开启一关"
  	end
  	advData.battle.player:addExp(exp)
679a1fc5   zhouhaihai   增加冒险经验 保存
414
  	advData:saveDB()
3133cb76   zhouhaihai   日志
415
416
  	role:log("gm_action", {desc = "advcl", int1 = exp, key1 = pms.sender})
  		
68d3fbaf   zhouhaihai   冒险内加经验
417
418
419
  	return "成功"
  end
  
58f3a42c   zhouhaihai   gm帮助
420
  table.insert(helpDes, {"挂机清除"	, "idlec"})
4b7c7c96   zhouahaihai   增加 清空 挂机 冒险gm 角色经验
421
422
423
424
  function _M.idlec(role, pms)
  	role:updateProperty({field = "hangTeam", value = {}})
  	role:updateProperty({field = "hangInfo", value = {}})
  	role:updateProperty({field = "hangBag", value = {}})
3133cb76   zhouhaihai   日志
425
426
  	role:log("gm_action", {desc = "idlec", key1 = pms.sender})
  
4b7c7c96   zhouahaihai   增加 清空 挂机 冒险gm 角色经验
427
428
429
430
  	role.advData = nil
  	return "成功"
  end
  
d3da3368   zhouhaihai   冒险地图被动技, buff 神器
431
432
  table.insert(helpDes, {"冒险内可使用道具", "advit", "ALL"})
  table.insert(helpDes, {"冒险内消耗道具", "advit", "itemId", "count"})
db3c56ad   zhouhaihai   冒险相关
433
  function _M.advit(role, pms)
98761edc   zhouhaihai   buff 补充
434
  	local reward = {}
d3da3368   zhouhaihai   冒险地图被动技, buff 神器
435
436
437
438
439
  	if pms.pm1 == "ALL" then
  		for k, v in pairs(csvdb["adv_itemCsv"]) do
  			if csvdb["itemCsv"][k] and v.effect ~= 0 then
  				reward[k] = 1
  			end
db3c56ad   zhouhaihai   冒险相关
440
  		end
d3da3368   zhouhaihai   冒险地图被动技, buff 神器
441
  		for k , v in pairs(csvdb["adv_artifactCsv"]) do
6afea142   zhouhaihai   gmBUG
442
  			if v[1].unlock == 0 then
d3da3368   zhouhaihai   冒险地图被动技, buff 神器
443
444
445
446
447
448
449
  				reward[k] = 1
  			end
  		end
  	else
  		local itemId = tonum(pms.pm1)
  		local count = tonum(pms.pm2)
  		reward[itemId] = count
3133cb76   zhouhaihai   日志
450
451
  
  		role:log("gm_action", {desc = "advit", int1 = itemId, int2 = count, key1 = pms.sender})
db3c56ad   zhouhaihai   冒险相关
452
  	end
d3da3368   zhouhaihai   冒险地图被动技, buff 神器
453
454
  	
  	
98761edc   zhouhaihai   buff 补充
455
  	local adv = role:getAdvData()
3133cb76   zhouhaihai   日志
456
  	adv:award(reward, {log = {desc = "gm"}})
db3c56ad   zhouhaihai   冒险相关
457
458
459
460
  	return "成功"
  end
  
  
58f3a42c   zhouhaihai   gm帮助
461
  table.insert(helpDes, {"爬塔到指定层", "tower", "层数"})
4af997e0   zhouhaihai   到达指定层
462
  function _M.tower(role, pms)
0e06d7a6   zhouhaihai   中文逗号
463
  	local level = tonum(pms.pm1, 1)
4af997e0   zhouhaihai   到达指定层
464
465
  	if not csvdb["tower_battleCsv"][level] then return  "不存在" end
  	role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}})
3133cb76   zhouhaihai   日志
466
467
468
  
  	role:log("gm_action", {desc = "tower", int1 = level, key1 = pms.sender})
  
4af997e0   zhouhaihai   到达指定层
469
470
471
  	return "成功"
  end
  
147ef2ce   zhouhaihai   邮件 Gm
472
473
474
475
476
477
478
479
480
481
482
483
484
485
  table.insert(helpDes, {"发送邮件", "email", "id", "奖励"})
  function _M.email(role, pms)
  	local id = tonum(pms.pm1, 0)
  	local reward = pms.pm2
  	redisproxy:insertEmail({
  		roleId = role:getProperty("id"), 
  		emailId = id,
  		createtime = skynet.timex(),
  		title = id == 0 and "来自GM的邮件!" or nil, 
  		stitle = id == 0 and "GM测试" or nil, 
  		content = id == 0 and "测试内容测试内容!!!\n\t 巴拉巴拉!" or nil, 
  		attachments = id == 0 and reward or nil,
  		rewardPms = id ~= 0 and reward or nil,
  	})
3133cb76   zhouhaihai   日志
486
487
488
  
  	role:log("gm_action", {desc = "email", int1 = id, key1 = pms.sender})
  
147ef2ce   zhouhaihai   邮件 Gm
489
490
  	return "成功"
  end
58f3a42c   zhouhaihai   gm帮助
491
  
4f8dfe80   chenyueqi   补充gm帮助描述
492
  table.insert(helpDes, {"清除引导", "cguide", "0全/1强/2弱"})
59701355   chenyueqi   增加清除引导记录的命令
493
494
495
496
497
498
499
500
501
502
503
504
  function _M.cguide(role, pms)
  	local id = tonum(pms.pm1, 0)
  	if id == 0 then
  		role:updateProperties({
  			newerGuide = "1=1",
  			funcGuide = "",
  		}, notNotify)
  	elseif id == 1 then
  		role:updateProperty({field = "newerGuide", value = "1=1"})
  	elseif id == 2 then
  		role:updateProperty({field = "funcGuide", value = ""})
  	end
3133cb76   zhouhaihai   日志
505
506
  
  	role:log("gm_action", {desc = "cguide", int1 = id, key1 = pms.sender})
4f8dfe80   chenyueqi   补充gm帮助描述
507
  	return "成功"
59701355   chenyueqi   增加清除引导记录的命令
508
509
  end
  
58f3a42c   zhouhaihai   gm帮助
510
511
512
513
514
  function _M.helpRpc(agent, data)
  	SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes}))
  	return true
  end
  
192b96d3   zhouhaihai   重置
515
516
  -- 充值回调
  function _M.ayncPurchase(role, params)
ec8caae5   zhouhaihai   多一点输出
517
  	return role:handlePurchase(params) or ""
192b96d3   zhouhaihai   重置
518
  end
58f3a42c   zhouhaihai   gm帮助
519
  
147ef2ce   zhouhaihai   邮件 Gm
520
521
  
  
314bc5df   zhengshouren   提交服务器初始代码
522
  return _M