local MsgPack = MsgPack local skynet = require "skynet" local TIME_WAIT = 10 local _M = class("hang", require("unitTest.unitTest")) function _M:start() self:task() end local taskMap = { hangBattle = {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:hangBattle() sendServer(actionCodes.Gm_clientRequest, MsgPack.pack({cmd = "fbc", pm1 = 10101})) requestServer(actionCodes.Hang_startRpc, MsgPack.pack({carbonId = 10101}), function() requestServer(actionCodes.Hang_startBattleRpc, MsgPack.pack({carbonId = 10101}), function(data) local msg = MsgPack.unpack(data) requestServer(actionCodes.Hang_endBattleRpc, MsgPack.pack({key = msg.key, carbonId = 10101, starNum = 1})) end) end) end return _M