Commit a6dc627f8c230cba4460dda2253384f4cd010f10
1 parent
5bc88864
自选箱子协议
Showing
6 changed files
with
30 additions
and
5 deletions
Show diff stats
src/GlobalVar.lua
src/ProtocolCode.lua
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 | ... | ... |
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 | ... | ... |