Commit e52c384f1048cf45fc2d22d9c3dbf8d24a0d6a9e
1 parent
be0c7a19
探索指令bug, 充值返利活动
Showing
8 changed files
with
66 additions
and
8 deletions
Show diff stats
src/actions/GmAction.lua
| ... | ... | @@ -487,7 +487,7 @@ function _M.test(role, pms) |
| 487 | 487 | local id = tonum(pms.pm1, 0) |
| 488 | 488 | --local hero = require ("actions.HeroAction") |
| 489 | 489 | --hero.unlockPoolRpc({role = role}, MsgPack.pack({type = id})) |
| 490 | - print(role:getNextCarbonId(id)) | |
| 490 | + print(role:getPaybackReward(0, 10000)) | |
| 491 | 491 | return "成功" |
| 492 | 492 | end |
| 493 | 493 | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -1211,20 +1211,18 @@ function _M.useSelectItemRpc(agent, data) |
| 1211 | 1211 | local role = agent.role |
| 1212 | 1212 | local msg = MsgPack.unpack(data) |
| 1213 | 1213 | local itemId = msg.itemId |
| 1214 | - local index = msg.index | |
| 1214 | + local subId = msg.subId | |
| 1215 | 1215 | local count = msg.count |
| 1216 | 1216 | if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end |
| 1217 | 1217 | local itemData = csvdb["itemCsv"][itemId] |
| 1218 | 1218 | if itemData.type ~= ItemType.SelectItemBox then return end |
| 1219 | 1219 | local itemMap = itemData.use_effect:toNumMap() |
| 1220 | - local i = 1 | |
| 1221 | 1220 | local reward, change = {} |
| 1222 | 1221 | for k, v in pairs(itemMap) do |
| 1223 | - if i == index then | |
| 1222 | + if k == subId then | |
| 1224 | 1223 | reward[k] = v * count |
| 1225 | 1224 | break |
| 1226 | 1225 | end |
| 1227 | - i = i + 1 | |
| 1228 | 1226 | end |
| 1229 | 1227 | |
| 1230 | 1228 | if next(reward) then |
| ... | ... | @@ -1232,6 +1230,7 @@ function _M.useSelectItemRpc(agent, data) |
| 1232 | 1230 | role:costItems({[itemId] = count}, {log = {desc = "openItem"}}) |
| 1233 | 1231 | end |
| 1234 | 1232 | SendPacket(actionCodes.Role_useSelectItemRpc, MsgPack.pack(role:packReward(reward, change))) |
| 1233 | + return true | |
| 1235 | 1234 | end |
| 1236 | 1235 | |
| 1237 | 1236 | return _M |
| 1238 | 1237 | \ No newline at end of file | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -386,7 +386,7 @@ function _M.getExploreCommandRewardRpc(agent, data) |
| 386 | 386 | local subId = msg.subId -- 领取的阶段id |
| 387 | 387 | |
| 388 | 388 | local tab_name = "reward_levelpass" .. id .. "Csv" |
| 389 | - local config = csvdb[tab_name][id] | |
| 389 | + local config = csvdb[tab_name][subId] | |
| 390 | 390 | if not config then return end |
| 391 | 391 | |
| 392 | 392 | local bpInfo = role.storeData:getProperty("bpInfo") or {} | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -9,6 +9,7 @@ Activity.ActivityType = { |
| 9 | 9 | AdvDraw = 5, --拾荒抽周 资助 |
| 10 | 10 | OpenBox = 6, --拆解周 时钟箱 |
| 11 | 11 | PaySignIn = 7, --付费签到 |
| 12 | + PayBack = 9, --返利 | |
| 12 | 13 | |
| 13 | 14 | SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 |
| 14 | 15 | } |
| ... | ... | @@ -38,6 +39,7 @@ Activity.schema = { |
| 38 | 39 | act5 = {"table", {}}, -- {0 = 拆解数量, 1=1, 2=1} 拆解周活动 1表示领取过该档位的奖励 |
| 39 | 40 | act6 = {"table", {}}, -- {0 = 拾荒消耗远古金币数量, 1=1, 2=1} 拾荒周活动 1表示领取过该档位的奖励 |
| 40 | 41 | act7 = {"table", {}}, -- {1 = 1, 2 = 1} == 付费签到活动 |
| 42 | + act9 = {"number", 0}, -- 充值返利 | |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | 45 | function Activity:data() |
| ... | ... | @@ -50,6 +52,7 @@ function Activity:data() |
| 50 | 52 | act5 = self:getProperty("act5"), |
| 51 | 53 | act6 = self:getProperty("act6"), |
| 52 | 54 | act7 = self:getProperty("act7"), |
| 55 | + act9 = self:getProperty("act9"), | |
| 53 | 56 | } |
| 54 | 57 | end |
| 55 | 58 | |
| ... | ... | @@ -324,6 +327,24 @@ activityFunc[Activity.ActivityType.PaySignIn] = { |
| 324 | 327 | -- end, |
| 325 | 328 | } |
| 326 | 329 | |
| 330 | +-- 充值反馈 | |
| 331 | +activityFunc[Activity.ActivityType.PayBack] = { | |
| 332 | + ["check"] = function(self, actType, notify, twd) -- 检查 | |
| 333 | + local oldVal = self:getActData(actType) or 0 | |
| 334 | + local newVal = oldVal + twd | |
| 335 | + local gift = self.owner:getPaybackReward(oldVal, newVal) | |
| 336 | + if gift ~= "" then | |
| 337 | + self.owner:sendMail(MailId.MonthCard, nil, gift) | |
| 338 | + end | |
| 339 | + self:updateActData(actType, newVal, not notify) | |
| 340 | + end, | |
| 341 | + ["init"] = function(self, actType, isCrossDay, notify) | |
| 342 | + self:updateActData(actType, {}, not notify) | |
| 343 | + end, | |
| 344 | + -- ["close"] = function(self, actType, notify) | |
| 345 | + -- end, | |
| 346 | +} | |
| 347 | + | |
| 327 | 348 | function Activity:initActivity(actType, isCrossDay, notify) |
| 328 | 349 | if activityFunc[actType] and activityFunc[actType]['close'] then |
| 329 | 350 | activityFunc[actType]["init"](self, actType, isCrossDay, notify) | ... | ... |
src/models/Role.lua
| ... | ... | @@ -149,6 +149,7 @@ Role.schema = { |
| 149 | 149 | battlePoint = {"number", 0}, -- 赛季卡使用的活跃点 |
| 150 | 150 | |
| 151 | 151 | rmbC = {"number", 0}, -- 人民币重置额 |
| 152 | + twdC = {"number", 0}, -- 台币总充值金额 | |
| 152 | 153 | |
| 153 | 154 | emailSync = {"number", 0}, -- 已经同步到的邮件Id |
| 154 | 155 | |
| ... | ... | @@ -373,6 +374,7 @@ function Role:data() |
| 373 | 374 | battlePoint = self:getProperty("battlePoint"), |
| 374 | 375 | |
| 375 | 376 | rmbC = self:getProperty("rmbC"), |
| 377 | + twdC = self:getProperty("twdC"), | |
| 376 | 378 | repayHero = self:getProperty("repayHero"), |
| 377 | 379 | newerDraw = self:getProperty("newerDraw"), |
| 378 | 380 | floorHero = self:getProperty("floorHero"), | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -1586,10 +1586,13 @@ function RolePlugin.bind(Role) |
| 1586 | 1586 | reward[ItemId.Diamond] = (reward[ItemId.Diamond] or 0) + diamondCount |
| 1587 | 1587 | end |
| 1588 | 1588 | |
| 1589 | + self:checkTaskEnter("Pay", {rmb = rechargeData.rmb, twd = rechargeData.twd}) | |
| 1590 | + | |
| 1589 | 1591 | -- 累充 |
| 1590 | 1592 | local rmb = rechargeData.rmb |
| 1591 | 1593 | self:updateProperty({field = "rmbC", delta = rmb}) |
| 1592 | - | |
| 1594 | + self:updateProperty({field = "twdC", delta = rechargeData.twd}) | |
| 1595 | + | |
| 1593 | 1596 | self:mylog("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time}) |
| 1594 | 1597 | |
| 1595 | 1598 | return nil, reward |
| ... | ... | @@ -1695,6 +1698,37 @@ function RolePlugin.bind(Role) |
| 1695 | 1698 | return nextId |
| 1696 | 1699 | end |
| 1697 | 1700 | |
| 1701 | + -- 根据累计充值金额计算奖励档位 | |
| 1702 | + function Role:getPaybackReward(oldVal, newVal) | |
| 1703 | + local maxVal, diff, extraReward = 0, 0, "" | |
| 1704 | + local gift = "" | |
| 1705 | + for k, v in pairs(csvdb["rebateCsv"]) do | |
| 1706 | + if k > maxVal then | |
| 1707 | + maxVal = k | |
| 1708 | + end | |
| 1709 | + if v.isLoop > diff then | |
| 1710 | + diff = v.isLoop | |
| 1711 | + extraReward = v.reward | |
| 1712 | + end | |
| 1713 | + if oldVal < k and newVal > k then | |
| 1714 | + gift = gift .. v.reward .. " " | |
| 1715 | + end | |
| 1716 | + end | |
| 1717 | + if newVal > maxVal then | |
| 1718 | + local cnt = 0 | |
| 1719 | + if oldVal < maxVal then | |
| 1720 | + cnt = math.floor((newVal - maxVal) / diff) | |
| 1721 | + else | |
| 1722 | + cnt = math.floor((newVal - maxVal) / diff) - math.floor((oldVal - maxVal) / diff) | |
| 1723 | + end | |
| 1724 | + for i = 1, cnt do | |
| 1725 | + gift = gift .. extraReward .. " " | |
| 1726 | + end | |
| 1727 | + end | |
| 1728 | + | |
| 1729 | + return gift | |
| 1730 | + end | |
| 1731 | + | |
| 1698 | 1732 | end |
| 1699 | 1733 | |
| 1700 | 1734 | return RolePlugin |
| 1701 | 1735 | \ No newline at end of file | ... | ... |
src/models/RoleTask.lua
| ... | ... | @@ -89,6 +89,7 @@ local TaskType = { |
| 89 | 89 | WeBlog = 1010, -- 关注微博 |
| 90 | 90 | SignIn = 1011, -- 签到 |
| 91 | 91 | ShopAll = 1013, -- 在任意商店购买 |
| 92 | + Pay = 1014, -- 充值 | |
| 92 | 93 | } |
| 93 | 94 | |
| 94 | 95 | local function f(field, func) |
| ... | ... | @@ -216,6 +217,7 @@ local ActivityListener = { |
| 216 | 217 | [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}}, |
| 217 | 218 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, |
| 218 | 219 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, |
| 220 | + [TaskType.Pay] = {{Activity.ActivityType.PayBack, f("twd")}}, | |
| 219 | 221 | } |
| 220 | 222 | } |
| 221 | 223 | ... | ... |