Blame view

src/actions/GmAction.lua 786 Bytes
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
  
0a07bdd9   zhouahaihai   角色升级 。gm
18
19
20
21
22
23
24
  
  function _M.hero(role, pms)
  	local heroType = tonum(pms.pm1)
  	role:addHero({type = heroType})
  	return "成功"
  end
  
8c74292c   zhouahaihai   增加item 以及 角色突破
25
26
27
28
29
30
31
32
33
34
  function _M.get(role, pms)
  	local itemId = tonum(pms.pm1)
  	if not csvdb["itemCsv"][itemId] then
  		return "物品不存在"
  	end
  	local count = tonum(pms.pm2)
  	role:award({[itemId] = count}, {})
  	return "成功"
  end
  
314bc5df   zhengshouren   提交服务器初始代码
35
  return _M