Commit d4f83f164ed30dcd919405ffd1e7b77ce5ce6cb4
1 parent
a997a3b0
feat: 一番赏 增加抽扭蛋机消耗票 指令
Capsule_convertCapsuleRpc = 890, --兑换消耗票
Showing
4 changed files
with
27 additions
and
3 deletions
Show diff stats
src/ProtocolCode.lua
| @@ -59,7 +59,7 @@ actionCodes = { | @@ -59,7 +59,7 @@ actionCodes = { | ||
| 59 | Role_runeBuyRpc = 142, -- 铭文购买 | 59 | Role_runeBuyRpc = 142, -- 铭文购买 |
| 60 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 | 60 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 |
| 61 | Role_setBgRpc = 144, -- 设置看板娘 | 61 | Role_setBgRpc = 144, -- 设置看板娘 |
| 62 | - Role_itemExchangeRpc = 145, -- 道具兑换 | 62 | + Role_itemConvertMonthCardRpc = 145, -- 兑换月卡道具 |
| 63 | 63 | ||
| 64 | Adv_startAdvRpc = 151, | 64 | Adv_startAdvRpc = 151, |
| 65 | Adv_startHangRpc = 152, | 65 | Adv_startHangRpc = 152, |
| @@ -284,6 +284,7 @@ actionCodes = { | @@ -284,6 +284,7 @@ actionCodes = { | ||
| 284 | Capsule_payReward = 857, -- 特殊赏 奖励通知 | 284 | Capsule_payReward = 857, -- 特殊赏 奖励通知 |
| 285 | Capsule_exitRpc = 858, -- 退出 | 285 | Capsule_exitRpc = 858, -- 退出 |
| 286 | Capsule_getDataRpc = 859, --获取扭蛋机信息 | 286 | Capsule_getDataRpc = 859, --获取扭蛋机信息 |
| 287 | + Capsule_convertCapsuleRpc = 890, --兑换消耗票 | ||
| 287 | } | 288 | } |
| 288 | 289 | ||
| 289 | rpcResponseBegin = 10000 | 290 | rpcResponseBegin = 10000 |
src/actions/CapsuleAction.lua
| @@ -173,4 +173,26 @@ function _M.getDataRpc(agent, data) | @@ -173,4 +173,26 @@ function _M.getDataRpc(agent, data) | ||
| 173 | 173 | ||
| 174 | end | 174 | end |
| 175 | 175 | ||
| 176 | +function _M.convertCapsuleRpc(agent, data) | ||
| 177 | + local role = agent.role | ||
| 178 | + local msg = MsgPack.unpack(data) | ||
| 179 | + local coin = msg.coin | ||
| 180 | + local count = msg.count or 1 | ||
| 181 | + | ||
| 182 | + local cost, convert = {} | ||
| 183 | + for k, v in pairs(globalCsv.ichibankuji_buy_cost)do | ||
| 184 | + if k == coin then | ||
| 185 | + convert = v:toArray(true, "=") | ||
| 186 | + break | ||
| 187 | + end | ||
| 188 | + end | ||
| 189 | + cost[convert[1]] = convert[2] * count | ||
| 190 | + if not role:checkItemEnough(cost) then return 1 end | ||
| 191 | + role:costItems(cost, {log = {desc = "CapsuleConvert", int1 = convert[1], int2 = cost[convert[1]]}}) | ||
| 192 | + | ||
| 193 | + local reward, change = role:award({coin = count}, {log = {desc = "CapsuleConvert"}}) | ||
| 194 | + SendPacket(actionCodes.Capsule_convertCapsuleRpc, MsgPack.pack(role:packReward(reward, change))) | ||
| 195 | + return true | ||
| 196 | +end | ||
| 197 | + | ||
| 176 | return _M | 198 | return _M |
| 177 | \ No newline at end of file | 199 | \ No newline at end of file |
src/actions/RoleAction.lua
| @@ -1710,7 +1710,7 @@ function _M.setBgRpc(agent, data) | @@ -1710,7 +1710,7 @@ function _M.setBgRpc(agent, data) | ||
| 1710 | return true | 1710 | return true |
| 1711 | end | 1711 | end |
| 1712 | 1712 | ||
| 1713 | -function _M.itemExchangeRpc(agent, data) | 1713 | +function _M.itemConvertMonthCardRpc(agent, data) |
| 1714 | local role = agent.role | 1714 | local role = agent.role |
| 1715 | local msg = MsgPack.unpack(data) | 1715 | local msg = MsgPack.unpack(data) |
| 1716 | local itemId = msg.item_id | 1716 | local itemId = msg.item_id |
| @@ -1738,7 +1738,7 @@ function _M.itemExchangeRpc(agent, data) | @@ -1738,7 +1738,7 @@ function _M.itemExchangeRpc(agent, data) | ||
| 1738 | end | 1738 | end |
| 1739 | end | 1739 | end |
| 1740 | 1740 | ||
| 1741 | - SendPacket(actionCodes.Role_itemExchangeRpc, MsgPack.pack(role:packReward(reward))) | 1741 | + SendPacket(actionCodes.Role_itemConvertMonthCardRpc, MsgPack.pack(role:packReward(reward))) |
| 1742 | return status | 1742 | return status |
| 1743 | end | 1743 | end |
| 1744 | 1744 |
src/models/RoleLog.lua
| @@ -161,6 +161,7 @@ local ItemReason = { | @@ -161,6 +161,7 @@ local ItemReason = { | ||
| 161 | returner = 1410, -- 回归者奖励 | 161 | returner = 1410, -- 回归者奖励 |
| 162 | 162 | ||
| 163 | CapsuleReward = 1411, --扭蛋机奖励 | 163 | CapsuleReward = 1411, --扭蛋机奖励 |
| 164 | + CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 | ||
| 164 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 | 165 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 |
| 165 | } | 166 | } |
| 166 | 167 |