Commit af6197fdd8d8d2af1d56b4c3287dd01791eeb7df
1 parent
21c09fa2
feat: 兑换魔鬼训练营门票
Showing
3 changed files
with
22 additions
and
0 deletions
Show diff stats
src/ProtocolCode.lua
@@ -64,6 +64,7 @@ actionCodes = { | @@ -64,6 +64,7 @@ actionCodes = { | ||
64 | Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具 | 64 | Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具 |
65 | Role_worldLineRouletteRpc = 146, --世界线抽轮盘 | 65 | Role_worldLineRouletteRpc = 146, --世界线抽轮盘 |
66 | Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励 | 66 | Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励 |
67 | + Role_itemConvertDevilTicketRpc = 148, -- 兑换魔鬼训练营门票 | ||
67 | 68 | ||
68 | Adv_startAdvRpc = 151, | 69 | Adv_startAdvRpc = 151, |
69 | Adv_startHangRpc = 152, | 70 | Adv_startHangRpc = 152, |
src/actions/RoleAction.lua
@@ -1819,4 +1819,24 @@ function _M.worldLineRewardRpc(agent, data) | @@ -1819,4 +1819,24 @@ function _M.worldLineRewardRpc(agent, data) | ||
1819 | return true | 1819 | return true |
1820 | end | 1820 | end |
1821 | 1821 | ||
1822 | +function _M.itemConvertDevilTicketRpc(agent, data) | ||
1823 | + local role = agent.role | ||
1824 | + local msg = MsgPack.unpack(data) | ||
1825 | + local itemId = msg.itemId --道具id | ||
1826 | + local count = msg.count or 1 --兑换生成的数量 | ||
1827 | + local itemData = csvdb["itemCsv"][itemId] | ||
1828 | + if itemData.use_type ~= 11 then return 2 end | ||
1829 | + | ||
1830 | + local createCost = globalCsv.moguixunlianying_create_cost[itemId]:toArray(true, "=") | ||
1831 | + if not next(createCost) then return 3 end | ||
1832 | + | ||
1833 | + local cost = {[itemId] = createCost[1] * count} | ||
1834 | + if not role:checkItemEnough(cost) then return 4 end | ||
1835 | + role:costItems({cost}, {log = {desc = "itemConvertDevilTicket"}}) | ||
1836 | + local reward, change = role:award({[createCost[2]] = count}, {log = {desc = "itemConvertDevilTicket", int1 = itemId, int2 = cost[itemId]}}) | ||
1837 | + | ||
1838 | + SendPacket(actionCodes.Role_itemConvertDevilTicketRpc, MsgPack.pack(role:packReward(reward, change))) | ||
1839 | + return true | ||
1840 | +end | ||
1841 | + | ||
1822 | return _M | 1842 | return _M |
1823 | \ No newline at end of file | 1843 | \ No newline at end of file |
src/models/RoleLog.lua
@@ -73,6 +73,7 @@ local ItemReason = { | @@ -73,6 +73,7 @@ local ItemReason = { | ||
73 | regularWorldBossReward = 157, -- 常规世界boss | 73 | regularWorldBossReward = 157, -- 常规世界boss |
74 | regularWorldBossMilestone = 158, -- 常规世界boss伤害里程碑 | 74 | regularWorldBossMilestone = 158, -- 常规世界boss伤害里程碑 |
75 | regularWorldBossBattle = 159, -- 常规世界boss战斗奖励 | 75 | regularWorldBossBattle = 159, -- 常规世界boss战斗奖励 |
76 | + itemConvertDevilTicket = 160, -- 兑换魔鬼训练营门票 | ||
76 | 77 | ||
77 | 78 | ||
78 | 79 |