diff --git a/src/ProtocolCode.lua b/src/ProtocolCode.lua index 7cef4ca..33c2ea0 100644 --- a/src/ProtocolCode.lua +++ b/src/ProtocolCode.lua @@ -61,7 +61,7 @@ actionCodes = { Role_runeBuyRpc = 142, -- 铭文购买 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 Role_setBgRpc = 144, -- 设置看板娘 - Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具 + Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具 Role_worldLineRoulette = 146, --世界线抽轮盘 Role_worldLineReward = 147, -- 世界线一键领取奖励 diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index cf5d904..2c0b8de 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -1712,18 +1712,18 @@ function _M.setBgRpc(agent, data) return true end -function _M.itemConvertMonthCardRpc(agent, data) +function _M.itemConvertSpecialRpc(agent, data) local role = agent.role local msg = MsgPack.unpack(data) local itemId = msg.item_id - local typ = msg.typ - local count = msg.count + local count = msg.count or 1 local exchangeId = msg.exchange_id - if not ItemId[itemId] then return 1 end + local itemData = csvdb["itemCsv"][itemId] + if not itemData then return 1 end if not role:checkItemEnough({[itemId] = count}) then return 2 end - role:costItems({[itemId] = count}, {log = {desc = "itemConvertmonthCard", int1 = count, int2 = count}}) + role:costItems({[itemId] = count}, {log = {desc = "itemConvertSpecial", int1 = itemId, int2 = itemData.type}}) local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] if not rechargeData then diff --git a/src/models/RoleLog.lua b/src/models/RoleLog.lua index 9907d9c..f3be330 100644 --- a/src/models/RoleLog.lua +++ b/src/models/RoleLog.lua @@ -66,8 +66,8 @@ local ItemReason = { shopBuy = 150, -- 商店购买 monthCardReward = 151, --月卡奖励 smonthCardReward = 152, --特刊奖励 - itemConvertmonthCard = 153, --兑换月卡 - itemConvertsmonthCard = 154, --兑换特刊 + itemConvertSpecial = 153, --兑换月卡/战令/探索指令 特殊道具 + buyDiamondCardReward = 154, --购买钻石额外赠送奖励 advHang = 301, -- 拾荒挂机 hangBattle = 302, -- 挂机战斗 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 93856ff..628645e 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -2448,6 +2448,12 @@ function RolePlugin.bind(Role) self:updateProperty({field = "rechargeF", value = rechargeF}) end self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}}) + + --已购月卡 购买魔导石 赠送cardReward + if not self.storeData:isMonthCardExpire() then + reward, _ = self:award(rechargeData.cardReward, {isRecharge = true, log = {desc = "buyDiamondCardReward", int1 = id}}) + end + elseif rechargeData.shop == 2 then --通行证商店 --签收 + 订阅奖励 local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) @@ -2458,10 +2464,6 @@ function RolePlugin.bind(Role) reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) self:checkTaskEnter("BuyLimitPack", {id = id}) - --增加购买记录 - local buyRecord = self.storeData:getProperty("buyR") or {} - buyRecord[id] = (buyRecord[id] or 0) + 1 - self.storeData:updateProperty({field = "buyR", value = buyRecord}) else skynet.error("[recharge] invalid recharge shop type " .. id) return 3 -- libgit2 0.21.2