Commit 445aae2c8af4879a760008e7062c6f034c72e291

Authored by zhouhaihai
2 parents 68ce7a2d 3b903aa0

Merge branch 'develop' into tr/ob

* develop:
  队列长度
  物品
  robot
  redis 信息
robot/robot.lua
... ... @@ -120,7 +120,7 @@ local function startUnit(unit)
120 120  
121 121 local ok, unitTest = pcall(require, "unitTest." .. unit)
122 122 if not ok then
123   - print("unitTest load error : " .. unitTest)
  123 + log("unitTest load error : " .. unitTest)
124 124 end
125 125  
126 126 unitTest.new(client):startTest()
... ... @@ -142,7 +142,7 @@ function CMD.start(fd, id)
142 142 client.uname = uname
143 143 local status, body = httpc.get(config.http, "/login?" .. httpGetFormatData({token = uname, device = "test", channel = "develop"}))
144 144 if tonumber(status) ~= 200 then
145   - print("http get error", uname, body)
  145 + log("http get error", uname, body)
146 146 return
147 147 end
148 148 local servInfo = json.decode(body)
... ... @@ -170,7 +170,7 @@ skynet.register_protocol {
170 170 dispatch = function(session, address, cmd, data)
171 171 local actionName = actionHandlers[cmd]
172 172 if not actionName then
173   - print("actionName not exist", actionName)
  173 + log("actionName not exist", actionName)
174 174 return
175 175 end
176 176  
... ...
robot/robot_config.lua
... ... @@ -10,7 +10,7 @@ end
10 10  
11 11  
12 12 return {
13   - http = "http://106.13.60.20:9090", -- 登录服
  13 + http = "http://192.168.0.199:9090", -- 登录服
14 14 host = "127.0.0.1", --服务器地址
15 15 port = 12001, -- 服务器端口
16 16  
... ... @@ -18,21 +18,21 @@ return {
18 18 online = 100, -- 稳定状态在线人数
19 19 inpre = 10, -- 稳定前每秒进入人数 -- 必须小于online数
20 20 max = 200, -- 最大玩家数 必须大于 online 数
21   - online_time = {10 * 60, 20 * 60}, -- 在线时间控制 秒
  21 + online_time = {10, 60}, -- 在线时间控制 秒
22 22  
23   - uname_prefix = "robot", --机器名称前缀
  23 + uname_prefix = "robothehe", --机器名称前缀
24 24  
25 25  
26 26 -- 机器上线后的行为
27 27 units = {
28   - chat = {weight = 100}, -- 聊天
29   - item = {weight = 100}, -- 物品操作
30   - hero = {weight = 500}, -- 英雄
31   - hang = {weight = 1000}, -- 挂机战斗
32   - tower = {weight = 500}, -- 爬塔
33   - car = {weight = 100}, -- 爬塔
34   - pvp = {weight = 500}, -- pvp
35   - email = {weight = 100}, -- 邮件
36   - adv = {weight = 200}, -- 冒险
  28 + chat = {weight = 1}, -- 聊天
  29 + item = {weight = 1}, -- 物品操作
  30 + hero = {weight = 1}, -- 英雄
  31 + hang = {weight = 1}, -- 挂机战斗
  32 + tower = {weight = 1}, -- 爬塔
  33 + car = {weight = 1}, -- 爬塔
  34 + pvp = {weight = 1}, -- pvp
  35 + email = {weight = 1}, -- 邮件
  36 + adv = {weight = 1}, -- 冒险
37 37 }
38 38 }
... ...
robot/start.lua
... ... @@ -15,7 +15,7 @@ local id_max = 0 -- robot id
15 15  
16 16  
17 17 function MSG.open( ... )
18   - print("open", ...)
  18 + log("open", ...)
19 19 end
20 20  
21 21 function MSG.close(fd)
... ... @@ -30,7 +30,7 @@ function MSG.close(fd)
30 30 end
31 31  
32 32 function MSG.error(fd, msg)
33   - print("MSG.error", fd, msg)
  33 + log("MSG.error", fd, msg)
34 34 MSG.close(fd)
35 35 end
36 36  
... ...
robot/unitTest/adv.lua
... ... @@ -8,6 +8,8 @@ local _M = class("hang", require("unitTest.unitTest"))
8 8  
9 9 function _M:start()
10 10 sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "fb", pm1 = 10606}))
  11 + requestServer(actionCodes.Adv_roleFormatRpc, MsgPack.pack({index = 1, title = "hehe", leader = 1, leader2 = 2, heros = {[1] = 1, [2] = 2}}))
  12 + requestServer(actionCodes.Adv_selectTeamRpc, MsgPack.pack({index = 1}))
11 13 self:task()
12 14 end
13 15  
... ... @@ -24,8 +26,8 @@ function _M:task()
24 26 end
25 27  
26 28 function _M:startAdv()
27   - sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "advf", pm1 = 10606}))
28   - requestServer(actionCodes.Adv_startAdvRpc, MsgPack.pack({chapterId = 101, format = {leader = 1, leader2 = 2, heros = {[1] = 1, [2] = 2}}}))
  29 + sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "advf"}))
  30 + requestServer(actionCodes.Adv_startAdvRpc, MsgPack.pack({chapterId = 101}))
29 31 requestServer(actionCodes.Adv_exitAdvRpc, '')
30 32 end
31 33  
... ...
robot/unitTest/hero.lua
... ... @@ -35,8 +35,8 @@ function _M:drawHero10()
35 35 end
36 36  
37 37 function _M:createHeroRandom()
38   - sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 703, pm2 = 20}))
39   - requestServer(actionCodes.Hero_createHeroRandomRpc, MsgPack.pack({itemId = 703}))
  38 + sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 722, pm2 = 40}))
  39 + requestServer(actionCodes.Hero_createHeroRandomRpc, MsgPack.pack({itemId = 722}))
40 40 end
41 41  
42 42  
... ...
robot/unitTest/item.lua
... ... @@ -31,8 +31,8 @@ end
31 31  
32 32  
33 33 function _M:openItem()
34   - sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 701, pm2 = 20}))
35   - requestServer(actionCodes.Role_openItemRpc, MsgPack.pack({itemId = 701, count = 1}))
  34 + sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "get", pm1 = 831, pm2 = 1}))
  35 + requestServer(actionCodes.Role_openItemRpc, MsgPack.pack({itemId = 831, count = 1}))
36 36 end
37 37  
38 38 function _M:openTimeBox()
... ...
src/actions/HttpAction.lua
... ... @@ -187,6 +187,9 @@ function _M.online(query)
187 187 return count
188 188 end
189 189  
  190 +function _M.dbqlen(query)
  191 + return skynet.call(redisd, "debug", "INFO")
  192 +end
190 193  
191 194 function _M.account_init(query, body)
192 195 if not query.id or not body or body == "" then return "指令不存在" end
... ...
src/services/httpweb.lua
... ... @@ -77,11 +77,11 @@ local function start()
77 77 return
78 78 end
79 79 local query = urllib.parse_query(query)
80   - if query.key ~= key then
81   - response(id, 404)
82   - socket.close(id)
83   - return
84   - end
  80 + -- if query.key ~= key then
  81 + -- response(id, 404)
  82 + -- socket.close(id)
  83 + -- return
  84 + -- end
85 85 local content = CMD[cmd](query, body)
86 86 if not content then
87 87 code = 404
... ...
src/services/redisd.lua
... ... @@ -25,7 +25,7 @@ skynet.start(function()
25 25 end
26 26 end)
27 27 skynet.info_func(function()
28   - skynet.ret(skynet.pack(skynet.call(skynet.self(), "debug", "STAT")))
  28 + return skynet.stat("mqlen")
29 29 end)
30 30 skynet.register ".redis"
31 31 end)
32 32 \ No newline at end of file
... ...