Commit a6dc627f8c230cba4460dda2253384f4cd010f10

Authored by liuzujun
1 parent 5bc88864

自选箱子协议

src/GlobalVar.lua
... ... @@ -68,6 +68,7 @@ ItemType = {
68 68 AdvItem = 14, -- 冒险道具
69 69 FuncOpen = 15, -- 管理功能开放
70 70 SpeedBox = 16, -- 加速箱子
  71 + SelectItemBox = 17, -- 自选箱子
71 72 }
72 73  
73 74 --在这个里面的会记录的是功能开放 对应类型open 而不是 ID
... ...
src/ProtocolCode.lua
... ... @@ -46,6 +46,7 @@ actionCodes = {
46 46 Role_goldBuyRpc = 131,
47 47 Role_getDownloadCvRewardRpc = 132,
48 48 Role_updateFeedbackInfoRpc = 133,
  49 + Role_useSelectItemRpc = 134, -- 使用多选一礼包
49 50  
50 51 Adv_startAdvRpc = 151,
51 52 Adv_startHangRpc = 152,
... ...
src/actions/RoleAction.lua
... ... @@ -1207,4 +1207,31 @@ function _M.updateFeedbackInfoRpc(agent, data)
1207 1207 return true
1208 1208 end
1209 1209  
  1210 +function _M.useSelectItemRpc(agent, data)
  1211 + local role = agent.role
  1212 + local msg = MsgPack.unpack(data)
  1213 + local itemId = msg.itemId
  1214 + local index = msg.index
  1215 + local count = msg.count
  1216 + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end
  1217 + local itemData = csvdb["itemCsv"][itemId]
  1218 + if itemData.type ~= ItemType.SelectItemBox then return end
  1219 + local itemMap = itemData.use_effect:toNumMap()
  1220 + local i = 1
  1221 + local reward, change = {}
  1222 + for k, v in pairs(itemMap) do
  1223 + if i == index then
  1224 + reward[k] = v * count
  1225 + break
  1226 + end
  1227 + i = i + 1
  1228 + end
  1229 +
  1230 + if next(reward) then
  1231 + reward, change = role:award(reward, {log = {desc = "openItem", int1 = itemId, int2 = count}})
  1232 + role:costItems({[itemId] = count}, {log = {desc = "openItem"}})
  1233 + end
  1234 + SendPacket(actionCodes.Role_useSelectItemRpc, MsgPack.pack(role:packReward(reward, change)))
  1235 +end
  1236 +
1210 1237 return _M
1211 1238 \ No newline at end of file
... ...
1   -Subproject commit 15cca1cea5a190b9ed014890efdf3343dd28c2b8
  1 +Subproject commit d90070e4a761a53afb25de2f01c51401af9791c1
... ...
src/models/Activity.lua
... ... @@ -260,7 +260,6 @@ activityFunc[Activity.ActivityType.DrawHero] = {
260 260 -- ["close"] = function(self, actType, notify)
261 261 -- end,
262 262 ["crossDay"] = function(self, actType, notify)
263   - print("cross day draw card")
264 263 self.owner:sendMail(MailId.ActDrawCard)
265 264 end,
266 265 }
... ... @@ -278,7 +277,6 @@ activityFunc[Activity.ActivityType.FoodSell] = {
278 277 -- ["close"] = function(self, actType, notify)
279 278 -- end,
280 279 ["crossDay"] = function(self, actType, notify)
281   - print("cross day sell food")
282 280 self.owner:sendMail(MailId.ActSellFood)
283 281 end,
284 282 }
... ... @@ -313,7 +311,6 @@ activityFunc[Activity.ActivityType.OpenBox] = {
313 311 -- ["close"] = function(self, actType, notify)
314 312 -- end,
315 313 ["crossDay"] = function(self, actType, notify)
316   - print("cross day open box")
317 314 self.owner:sendMail(MailId.ActOpenBox)
318 315 end,
319 316 }
... ...
src/models/RoleTimeReset.lua
... ... @@ -34,7 +34,6 @@ end
34 34 ResetFunc["CrossMonth"] = function(self, notify, response)
35 35 local ltime = self:getProperty("ltime")
36 36 if isCrossMonth(ltime, skynet.timex()) then
37   - print("cross month")
38 37 self.storeData:resetStoreReored(3) --商店跨月重置 time_reset表关联id
39 38 end
40 39 end
... ...