Commit e3f6fe3441d77f62beec329c11912e9d088b3176

Authored by zhangqijia
1 parent 21395b80

feat: 月卡特权,购买魔导石会有 cardReward 的奖励

1. 月卡特权
2. 删除破冰礼包多余的购买记录。
3. 修改兑换特殊道具的协议名字,日志名字。
src/ProtocolCode.lua
@@ -61,7 +61,7 @@ actionCodes = { @@ -61,7 +61,7 @@ actionCodes = {
61 Role_runeBuyRpc = 142, -- 铭文购买 61 Role_runeBuyRpc = 142, -- 铭文购买
62 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 62 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍
63 Role_setBgRpc = 144, -- 设置看板娘 63 Role_setBgRpc = 144, -- 设置看板娘
64 - Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具 64 + Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具
65 Role_worldLineRoulette = 146, --世界线抽轮盘 65 Role_worldLineRoulette = 146, --世界线抽轮盘
66 Role_worldLineReward = 147, -- 世界线一键领取奖励 66 Role_worldLineReward = 147, -- 世界线一键领取奖励
67 67
src/actions/RoleAction.lua
@@ -1712,18 +1712,18 @@ function _M.setBgRpc(agent, data) @@ -1712,18 +1712,18 @@ function _M.setBgRpc(agent, data)
1712 return true 1712 return true
1713 end 1713 end
1714 1714
1715 -function _M.itemConvertMonthCardRpc(agent, data) 1715 +function _M.itemConvertSpecialRpc(agent, data)
1716 local role = agent.role 1716 local role = agent.role
1717 local msg = MsgPack.unpack(data) 1717 local msg = MsgPack.unpack(data)
1718 local itemId = msg.item_id 1718 local itemId = msg.item_id
1719 - local typ = msg.typ  
1720 - local count = msg.count 1719 + local count = msg.count or 1
1721 local exchangeId = msg.exchange_id 1720 local exchangeId = msg.exchange_id
1722 1721
1723 - if not ItemId[itemId] then return 1 end 1722 + local itemData = csvdb["itemCsv"][itemId]
  1723 + if not itemData then return 1 end
1724 1724
1725 if not role:checkItemEnough({[itemId] = count}) then return 2 end 1725 if not role:checkItemEnough({[itemId] = count}) then return 2 end
1726 - role:costItems({[itemId] = count}, {log = {desc = "itemConvertmonthCard", int1 = count, int2 = count}}) 1726 + role:costItems({[itemId] = count}, {log = {desc = "itemConvertSpecial", int1 = itemId, int2 = itemData.type}})
1727 1727
1728 local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] 1728 local rechargeData = csvdb["shop_rechargeCsv"][exchangeId]
1729 if not rechargeData then 1729 if not rechargeData then
src/models/RoleLog.lua
@@ -66,8 +66,8 @@ local ItemReason = { @@ -66,8 +66,8 @@ local ItemReason = {
66 shopBuy = 150, -- 商店购买 66 shopBuy = 150, -- 商店购买
67 monthCardReward = 151, --月卡奖励 67 monthCardReward = 151, --月卡奖励
68 smonthCardReward = 152, --特刊奖励 68 smonthCardReward = 152, --特刊奖励
69 - itemConvertmonthCard = 153, --兑换月卡  
70 - itemConvertsmonthCard = 154, --兑换特刊 69 + itemConvertSpecial = 153, --兑换月卡/战令/探索指令 特殊道具
  70 + buyDiamondCardReward = 154, --购买钻石额外赠送奖励
71 71
72 advHang = 301, -- 拾荒挂机 72 advHang = 301, -- 拾荒挂机
73 hangBattle = 302, -- 挂机战斗 73 hangBattle = 302, -- 挂机战斗
src/models/RolePlugin.lua
@@ -2448,6 +2448,12 @@ function RolePlugin.bind(Role) @@ -2448,6 +2448,12 @@ function RolePlugin.bind(Role)
2448 self:updateProperty({field = "rechargeF", value = rechargeF}) 2448 self:updateProperty({field = "rechargeF", value = rechargeF})
2449 end 2449 end
2450 self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}}) 2450 self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}})
  2451 +
  2452 + --已购月卡 购买魔导石 赠送cardReward
  2453 + if not self.storeData:isMonthCardExpire() then
  2454 + reward, _ = self:award(rechargeData.cardReward, {isRecharge = true, log = {desc = "buyDiamondCardReward", int1 = id}})
  2455 + end
  2456 +
2451 elseif rechargeData.shop == 2 then --通行证商店 2457 elseif rechargeData.shop == 2 then --通行证商店
2452 --签收 + 订阅奖励 2458 --签收 + 订阅奖励
2453 local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) 2459 local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id)
@@ -2458,10 +2464,6 @@ function RolePlugin.bind(Role) @@ -2458,10 +2464,6 @@ function RolePlugin.bind(Role)
2458 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) 2464 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2459 2465
2460 self:checkTaskEnter("BuyLimitPack", {id = id}) 2466 self:checkTaskEnter("BuyLimitPack", {id = id})
2461 - --增加购买记录  
2462 - local buyRecord = self.storeData:getProperty("buyR") or {}  
2463 - buyRecord[id] = (buyRecord[id] or 0) + 1  
2464 - self.storeData:updateProperty({field = "buyR", value = buyRecord})  
2465 else 2467 else
2466 skynet.error("[recharge] invalid recharge shop type " .. id) 2468 skynet.error("[recharge] invalid recharge shop type " .. id)
2467 return 3 2469 return 3