Blame view

robot/unitTest/adv.lua 985 Bytes
4dc77717   zhouhaihai   压测
1
2
3
4
5
6
7
8
9
10
  local MsgPack = MsgPack
  local skynet = require "skynet"
  
  
  local TIME_WAIT = 10 
  
  local _M = class("hang", require("unitTest.unitTest"))
  
  function _M:start()
  	sendServer(actionCodes.Gm_clientRequest,  MsgPack.pack({cmd = "fb", pm1 = 10606}))
a5fa0074   zhouhaihai   robot
11
12
  	requestServer(actionCodes.Adv_roleFormatRpc,  MsgPack.pack({index = 1, title = "hehe", leader = 1, leader2 = 2, heros = {[1] = 1, [2] = 2}}))
  	requestServer(actionCodes.Adv_selectTeamRpc,  MsgPack.pack({index = 1}))
4dc77717   zhouhaihai   压测
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  	self:task()
  end
  
  
  local taskMap = {
  	startAdv = {100},
  	rank = {10},
  }
  
  function _M:task()
  	local curTask = math.randWeight(taskMap, 1)
  	self[curTask](self)
  	skynet.timeout(TIME_WAIT * 100, handler(self, self.task))
  end
  
  function _M:startAdv()
a5fa0074   zhouhaihai   robot
29
30
  	sendServer(actionCodes.Gm_clientRequest,  MsgPack.pack({cmd = "advf"}))
  	requestServer(actionCodes.Adv_startAdvRpc,  MsgPack.pack({chapterId = 101}))
4dc77717   zhouhaihai   压测
31
32
33
34
35
36
37
38
39
40
  	requestServer(actionCodes.Adv_exitAdvRpc, '')
  end
  
  
  function _M:rank()
  	requestServer(actionCodes.Adv_rankRpc, '')
  end
  
  
  return _M