Commit a0013f0b66f36f14f252f5c4599c849360ceec23

Authored by zhouhaihai
1 parent ffe27b94

零件分批推送

Showing 2 changed files with 32 additions and 7 deletions   Show diff stats
src/actions/GmAction.lua
@@ -55,7 +55,7 @@ function _M.get(role, pms) @@ -55,7 +55,7 @@ function _M.get(role, pms)
55 elseif pms.pm1 == "RUNE" then 55 elseif pms.pm1 == "RUNE" then
56 for itemId = 2000 , 3000 do 56 for itemId = 2000 , 3000 do
57 if csvdb["itemCsv"][itemId] then 57 if csvdb["itemCsv"][itemId] then
58 - role:award({[itemId] = 3}) 58 + role:award({[itemId] = 1})
59 end 59 end
60 end 60 end
61 elseif pms.pm1 == "FRAG" then 61 elseif pms.pm1 == "FRAG" then
src/actions/RoleAction.lua
@@ -15,6 +15,7 @@ local tconcat = table.concat @@ -15,6 +15,7 @@ local tconcat = table.concat
15 local httpc = require("http.httpc") 15 local httpc = require("http.httpc")
16 16
17 local WAVE_HERO_NUMS = 150 17 local WAVE_HERO_NUMS = 150
  18 +local WAVE_RUNE_NUMS = 150
18 19
19 local function validName(name) 20 local function validName(name)
20 name = string.upper(name) 21 name = string.upper(name)
@@ -141,6 +142,16 @@ function _M.loginRpc( agent, data ) @@ -141,6 +142,16 @@ function _M.loginRpc( agent, data )
141 table_insert(modules, "heros") 142 table_insert(modules, "heros")
142 end 143 end
143 144
  145 + local runeIds = {}
  146 + for id ,_ in pairs(role.runeBag) do
  147 + table.insert(runeIds, id)
  148 + end
  149 + local runeWave = math.ceil(#runeIds / WAVE_RUNE_NUMS)
  150 + if #runeIds <= 50 then
  151 + runeWave = 0
  152 + table_insert(modules, "runeBag")
  153 + end
  154 +
144 for _, name in ipairs(modules) do 155 for _, name in ipairs(modules) do
145 response[name] = {} 156 response[name] = {}
146 for id, unit in pairs(role[name]) do 157 for id, unit in pairs(role[name]) do
@@ -148,18 +159,31 @@ function _M.loginRpc( agent, data ) @@ -148,18 +159,31 @@ function _M.loginRpc( agent, data )
148 end 159 end
149 end 160 end
150 161
151 - response.wave = 2 + heroWave 162 + response.wave = 1 + heroWave + runeWave
152 163
153 SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response)) 164 SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(response))
154 165
155 - local runeResp = {runeBag = {}}  
156 - for _,rune in pairs(role.runeBag) do  
157 - runeResp.runeBag[rune:getProperty("uid")]=rune:data() 166 + local curWave = 1
  167 +
  168 + local runeIndex = 1
  169 + for index = curWave + 1, curWave + runeWave do
  170 + local runeResponse = {runeBag = {}}
  171 + for i = runeIndex, runeIndex + WAVE_RUNE_NUMS do
  172 + local runeId = runeIds[i]
  173 + if not runeId then
  174 + break
  175 + end
  176 + local rune = role.runeBag[runeId]
  177 + table.insert(runeResponse.runeBag, rune:data())
  178 + runeIndex = runeIndex + 1
  179 + end
  180 + runeResponse.runeWave = index
  181 + SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(runeResponse))
158 end 182 end
159 - SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(runeResp)) 183 + curWave = curWave + runeWave
160 184
161 local heroIndex = 1 185 local heroIndex = 1
162 - for index = 3, heroWave + 2 do 186 + for index = curWave + 1, curWave + heroWave do
163 local heroResponse = {heros = {}} 187 local heroResponse = {heros = {}}
164 for i = heroIndex, heroIndex + WAVE_HERO_NUMS do 188 for i = heroIndex, heroIndex + WAVE_HERO_NUMS do
165 local heroId = heroIds[i] 189 local heroId = heroIds[i]
@@ -173,6 +197,7 @@ function _M.loginRpc( agent, data ) @@ -173,6 +197,7 @@ function _M.loginRpc( agent, data )
173 heroResponse.heroWave = index 197 heroResponse.heroWave = index
174 SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(heroResponse)) 198 SendPacket(actionCodes.Role_loginRpc, MsgPack.pack(heroResponse))
175 end 199 end
  200 + curWave = curWave + heroWave
176 201
177 -- role:log("login", { ip = agent.ip, diamond = role:getProperty("diamond"), reDiamond = role:getProperty("reDiamond")}) 202 -- role:log("login", { ip = agent.ip, diamond = role:getProperty("diamond"), reDiamond = role:getProperty("reDiamond")})
178 203