Blame view

src/actions/GmAction.lua 5.23 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)
2d392ede   zhouhaihai   热更新 最终版
19
  	return csvdb["itemCsv"][1]["name"] .. " -=- " .. csvdb["itemCsv"][2]["name"] .. " -=- " .. role:getItemCount(123) .. " -=- " .. table.pack(next(role.heros))[2]:getBattleValue()
5e5d7680   zhouhaihai   热更新 优化
20
  end
0a07bdd9   zhouahaihai   角色升级 。gm
21
22
23
  
  function _M.hero(role, pms)
  	local heroType = tonum(pms.pm1)
056c01a0   zhouhaihai   简化装备
24
25
26
  	if not role:addHero({type = heroType}) then
  		return "失败"
  	end
0a07bdd9   zhouahaihai   角色升级 。gm
27
28
29
  	return "成功"
  end
  
43cc5f51   gaofengduan   调整 equip 数据结构
30
31
32
33
34
35
36
37
  function _M.equip(role, pms)
  	local typ = tonum(pms.pm1)
  	local level = tonum(pms.pm2)
  	local count = tonum(pms.pm3)
  	role:addEquip({type = typ,level = level,count = count})
  	return "成功"
  end
  
ad484303   gaofengduan   add rune
38
39
40
41
42
43
44
  function _M.rune(role, pms)
  	local typ = tonum(pms.pm1)
  	local id = tonum(pms.pm2)
  	local result = role:addRune({type = typ,id = id})
  	return result
  end
  
cb85faac   zhouhaihai   增加gm命令
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  function _M.fb(role, pms) -- 直接通关
  	local carbonId = tonum(pms.pm1)
  	if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end
  	local passCarbon = role:getProperty("hangPass")
  	local addPre 
  	addPre = function(carbonId)
  		local carbonData = csvdb["idle_battleCsv"][carbonId]
  		for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do
  			passCarbon[pre] = 1
  			role:checkTaskEnter(role.TaskType.HangPass, {id = pre})
  			addPre(pre)
  		end
  	end
  	passCarbon[carbonId] = 1
  	addPre(carbonId)
  	role:updateProperty({field = "hangPass", value = passCarbon})
  	role:checkTaskEnter(role.TaskType.HangPass, {id = carbonId})
  	return "成功"
  end
  
6433fe76   zhouhaihai   到某一关
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  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
  			passCarbon[pre] = 1
  			role:checkTaskEnter(role.TaskType.HangPass, {id = pre})
  			addPre(pre)
  		end
  	end
  	addPre(carbonId)
  	role:updateProperty({field = "hangInfo", value = {}})
  	role:updateProperty({field = "hangPass", value = passCarbon})
  	role:checkTaskEnter(role.TaskType.HangPass, {id = carbonId})
  	return "成功"
  end
  
cb85faac   zhouhaihai   增加gm命令
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
  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(role.TaskType.LoveBreak, {heroType = heroType, loveL = level})
  		end
  	end
  	return "成功"
  end
  
  function _M.exp(role, pms)
  	local exp =  tonum(pms.pm1)
  	exp = math.floor(math.max(exp, 0))
  	role:addPlayExp(exp)
  	return "成功"
  end
  
8c74292c   zhouahaihai   增加item 以及 角色突破
114
  function _M.get(role, pms)
747f05a1   gaofengduan   add gm get all
115
  	if pms.pm1 == "ALL" then
58559948   zhouhaihai   getall gm
116
117
118
119
  		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
120
121
  			end
  		end
58559948   zhouhaihai   getall gm
122
  		role:award(reward)
3c8a6b8a   zhouhaihai   get equip
123
124
125
126
127
128
  	elseif pms.pm1 == "EQUIP" then
  		for itemId = 7000 , 8000 do
  			if csvdb["itemCsv"][itemId] then
  				role:award({[itemId] = 100})
  			end
  		end
966034ca   zhouhaihai   获取碎片零件gm
129
  	elseif pms.pm1 == "RUNE" then
58751698   zhouhaihai   修改id 区间
130
  		for itemId = 2000 , 3000 do
966034ca   zhouhaihai   获取碎片零件gm
131
  			if csvdb["itemCsv"][itemId] then
a0013f0b   zhouhaihai   零件分批推送
132
  				role:award({[itemId] = 1})
966034ca   zhouhaihai   获取碎片零件gm
133
134
135
136
137
138
139
140
  			end
  		end
  	elseif pms.pm1 == "FRAG" then
  		for itemId = 100 , 400 do
  			if csvdb["itemCsv"][itemId] then
  				role:award({[itemId] = 100})
  			end
  		end
3b069d52   zhouhaihai   增加获取 food 后台
141
142
143
144
145
146
  	elseif pms.pm1 == "FOOD" then
  		for itemId = 4000 , 5000 do
  			if csvdb["itemCsv"][itemId] then
  				role:award({[itemId] = 100})
  			end
  		end
cb85faac   zhouhaihai   增加gm命令
147
148
149
150
151
152
  	elseif pms.pm1 == "HERO" then
  		for itemId = 400 , 700 do
  			if csvdb["itemCsv"][itemId] then
  				role:award({[itemId] = 1})
  			end
  		end
747f05a1   gaofengduan   add gm get all
153
154
155
156
157
  	else
  		local itemId = tonum(pms.pm1)
  		if not csvdb["itemCsv"][itemId] then
  			return "物品不存在"
  		end
ee999bde   zhouhaihai   零件优化
158
  		local count = tonum(pms.pm2, 1)
747f05a1   gaofengduan   add gm get all
159
  		role:award({[itemId] = count})
8c74292c   zhouahaihai   增加item 以及 角色突破
160
  	end
8c74292c   zhouahaihai   增加item 以及 角色突破
161
162
163
  	return "成功"
  end
  
4b7c7c96   zhouahaihai   增加 清空 挂机 冒险gm 角色经验
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
  function _M.advc(role, pms)
  	role:updateProperty({field = "advInfo", value = {}})
  	role:updateProperty({field = "advItems", value = ""})
  	role:updateProperty({field = "advTeam", value = {}})
  	role.advData = nil
  	return "成功"
  end
  
  function _M.idlec(role, pms)
  	role:updateProperty({field = "hangTeam", value = {}})
  	role:updateProperty({field = "hangInfo", value = {}})
  	role:updateProperty({field = "hangBag", value = {}})
  	role.advData = nil
  	return "成功"
  end
  
4af997e0   zhouhaihai   到达指定层
180
  function _M.tower(role, pms)
0e06d7a6   zhouhaihai   中文逗号
181
  	local level = tonum(pms.pm1, 1)
4af997e0   zhouhaihai   到达指定层
182
183
184
185
186
  	if not csvdb["tower_battleCsv"][level] then return  "不存在" end
  	role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}})
  	return "成功"
  end
  
314bc5df   zhengshouren   提交服务器初始代码
187
  return _M