pvp.lua
872 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local MsgPack = MsgPack
local skynet = require "skynet"
local TIME_WAIT = 10 
local _M = class("pvp", require("unitTest.unitTest"))
function _M:start()
	sendServer(actionCodes.Gm_clientRequest,  MsgPack.pack({cmd = "fb", pm1 = 10606}))
	self:task()
end
local taskMap = {
	info = {1000},
	refresh = {100},
	rank = {100},
	record = {100},
}
function _M:task()
	local curTask = math.randWeight(taskMap, 1)
	self[curTask](self)
	skynet.timeout(TIME_WAIT * 100, handler(self, self.task))
end
function _M:info()
	requestServer(actionCodes.Pvp_infoRpc, MsgPack.pack({ptype = 1}))
end
function _M:refresh()
	requestServer(actionCodes.Pvp_refreshMatchCRpc, '')
end
function _M:rank()
	requestServer(actionCodes.Pvp_rankListRpc, MsgPack.pack({ptype = 1}))
end
function _M:record()
	requestServer(actionCodes.Pvp_recordListRpc, MsgPack.pack({ptype = 1}))
end
return _M