Commit a8a9adb25864737a779d1e6f43128ea73381fb83
Merge branch 'cn/develop' of 120.26.43.151:wasteland/server into cn/develop
Showing
8 changed files
with
149 additions
and
47 deletions
Show diff stats
src/GlobalVar.lua
@@ -388,6 +388,7 @@ TriggerEventType = { | @@ -388,6 +388,7 @@ TriggerEventType = { | ||
388 | FoodSell = 11, -- 循环卖菜 | 388 | FoodSell = 11, -- 循环卖菜 |
389 | RuneUp = 12, -- 循环强化符文 | 389 | RuneUp = 12, -- 循环强化符文 |
390 | CostDiamond = 13, -- 循环消耗钻石 | 390 | CostDiamond = 13, -- 循环消耗钻石 |
391 | + BuyLimitPack = 14, --购买指定id礼包 触发 | ||
391 | } | 392 | } |
392 | 393 | ||
393 | DrawCardType = { | 394 | DrawCardType = { |
@@ -440,4 +441,12 @@ ItemOccupy = { | @@ -440,4 +441,12 @@ ItemOccupy = { | ||
440 | Spark = 5, --火花 | 441 | Spark = 5, --火花 |
441 | Other = 6, | 442 | Other = 6, |
442 | CanUsed = 7, --可使用 | 443 | CanUsed = 7, --可使用 |
444 | +} | ||
445 | + | ||
446 | +-- 世界变动积分 | ||
447 | +ItemWorldLine = { | ||
448 | + RouletteCount = 1, --抽轮盘次数 | ||
449 | + Points = 2, --积分 | ||
450 | + CostDiamond = 3, --消耗钻石 | ||
451 | + CostJade = 4, --消耗红光玉 | ||
443 | } | 452 | } |
444 | \ No newline at end of file | 453 | \ No newline at end of file |
src/ProtocolCode.lua
@@ -62,6 +62,8 @@ actionCodes = { | @@ -62,6 +62,8 @@ actionCodes = { | ||
62 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 | 62 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 |
63 | Role_setBgRpc = 144, -- 设置看板娘 | 63 | Role_setBgRpc = 144, -- 设置看板娘 |
64 | Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具 | 64 | Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具 |
65 | + Role_worldLineRoulette = 146, --世界线抽轮盘 | ||
66 | + Role_worldLineReward = 147, -- 世界线一键领取奖励 | ||
65 | 67 | ||
66 | Adv_startAdvRpc = 151, | 68 | Adv_startAdvRpc = 151, |
67 | Adv_startHangRpc = 152, | 69 | Adv_startHangRpc = 152, |
src/actions/RoleAction.lua
@@ -1741,7 +1741,68 @@ function _M.itemConvertMonthCardRpc(agent, data) | @@ -1741,7 +1741,68 @@ function _M.itemConvertMonthCardRpc(agent, data) | ||
1741 | end | 1741 | end |
1742 | 1742 | ||
1743 | SendPacket(actionCodes.Role_itemConvertMonthCardRpc, MsgPack.pack(role:packReward(reward))) | 1743 | SendPacket(actionCodes.Role_itemConvertMonthCardRpc, MsgPack.pack(role:packReward(reward))) |
1744 | - return status | 1744 | + return true |
1745 | +end | ||
1746 | + | ||
1747 | +function _M.worldLineRoulette(agent, data) | ||
1748 | + local role = agent.role | ||
1749 | + | ||
1750 | + local worldChangePoints = role:getProperty("worldChangePoints") or {} | ||
1751 | + local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0 | ||
1752 | + if rouletteCount == 0 then return 1 end | ||
1753 | + | ||
1754 | + local worldline_gift_base_10, worldline_gift_base_1, worldline_gift_magnification_10, worldline_gift_magnification_1 = {}, {}, {}, {} | ||
1755 | + for k, v in pairs(globalCsv.worldline_gift_base_10) do | ||
1756 | + worldline_gift_base_10[k] = {v} | ||
1757 | + end | ||
1758 | + for k, v in pairs(globalCsv.worldline_gift_base_1) do | ||
1759 | + worldline_gift_base_1[k] = {v} | ||
1760 | + end | ||
1761 | + for k, v in pairs(globalCsv.worldline_gift_magnification_10) do | ||
1762 | + worldline_gift_magnification_10[k] = {v} | ||
1763 | + end | ||
1764 | + for k, v in pairs(globalCsv.worldline_gift_magnification_1) do | ||
1765 | + worldline_gift_magnification_1[k] = {v} | ||
1766 | + end | ||
1767 | + | ||
1768 | + local gift_base_10 = (math.randWeight(worldline_gift_base_10, 1) or 0) * 10 | ||
1769 | + local gift_base_1 = math.randWeight(worldline_gift_base_1, 1) or 0 | ||
1770 | + | ||
1771 | + local gift_magnification_10 = (math.randWeight(worldline_gift_magnification_10, 1) or 0) * 10 | ||
1772 | + local gift_magnification_1 = math.randWeight(worldline_gift_magnification_1, 1) or 0 | ||
1773 | + | ||
1774 | + local points = (gift_base_10 + gift_base_1) * (gift_magnification_10 + gift_magnification_1) | ||
1775 | + worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1 | ||
1776 | + worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points | ||
1777 | + role:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | ||
1778 | + | ||
1779 | + SendPacket(actionCodes.Role_worldLineRoulette, MsgPack.pack(worldChangePoints)) | ||
1780 | + return true | ||
1781 | +end | ||
1782 | + | ||
1783 | +function _M.worldLineReward(agent, data) | ||
1784 | + local role = agent.role | ||
1785 | + local worldLineReward = role:getProperty("worldLineReward") or {} | ||
1786 | + local worldChangePoints = role:getProperty("worldChangePoints") or {} | ||
1787 | + local points = worldChangePoints[ItemWorldLine.Points] or 0 | ||
1788 | + | ||
1789 | + local reward, change = {} | ||
1790 | + for key, val in pairs(csvdb["worldline_rewardCsv"]) do | ||
1791 | + if points >= key and not worldLineReward[key] then | ||
1792 | + for k, v in pairs(val.award:toNumMap()) do | ||
1793 | + reward[k] = (reward[k] or 0) + v | ||
1794 | + end | ||
1795 | + worldLineReward[key] = 1 | ||
1796 | + end | ||
1797 | + end | ||
1798 | + | ||
1799 | + role:updateProperty({field = "worldLineReward", value = worldLineReward}) | ||
1800 | + | ||
1801 | + if next(reward) then | ||
1802 | + reward, change = role:award(reward, {log = {desc = "worldLine", int1 = role:getProperty("id")}}) | ||
1803 | + end | ||
1804 | + SendPacket(actionCodes.Role_worldLineReward, MsgPack.pack(role:packReward(reward, change))) | ||
1805 | + return true | ||
1745 | end | 1806 | end |
1746 | 1807 | ||
1747 | return _M | 1808 | return _M |
1748 | \ No newline at end of file | 1809 | \ No newline at end of file |
src/models/Role.lua
@@ -214,6 +214,9 @@ Role.schema = { | @@ -214,6 +214,9 @@ Role.schema = { | ||
214 | heroCnt = {"number", 0}, -- 英雄数量 | 214 | heroCnt = {"number", 0}, -- 英雄数量 |
215 | friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0} | 215 | friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0} |
216 | bgId = {"number", 0}, -- 看板娘id | 216 | bgId = {"number", 0}, -- 看板娘id |
217 | + | ||
218 | + worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗} | ||
219 | + worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1} | ||
217 | } | 220 | } |
218 | 221 | ||
219 | 222 | ||
@@ -457,6 +460,8 @@ function Role:data() | @@ -457,6 +460,8 @@ function Role:data() | ||
457 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 | 460 | unlockChap = self:getProperty("unlockChap"), -- 解锁的章节 |
458 | friendTeam = self:getProperty("friendTeam"), | 461 | friendTeam = self:getProperty("friendTeam"), |
459 | bgId = self:getProperty("bgId"), | 462 | bgId = self:getProperty("bgId"), |
463 | + worldChangePoints = self:getProperty("worldChangePoints"), | ||
464 | + worldLineReward = self:getProperty("worldLineReward"), | ||
460 | } | 465 | } |
461 | end | 466 | end |
462 | 467 |
src/models/RoleLog.lua
@@ -163,6 +163,8 @@ local ItemReason = { | @@ -163,6 +163,8 @@ local ItemReason = { | ||
163 | CapsuleReward = 1411, --扭蛋机奖励 | 163 | CapsuleReward = 1411, --扭蛋机奖励 |
164 | CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 | 164 | CapsuleConvert = 1412, --扭蛋机 消耗票 兑换 |
165 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 | 165 | CapsuleCoinCost = 1413, --抽扭蛋机消耗 |
166 | + | ||
167 | + worldLine = 1500, --世界线积分 | ||
166 | } | 168 | } |
167 | 169 | ||
168 | 170 |
src/models/RolePlugin.lua
@@ -574,12 +574,14 @@ function RolePlugin.bind(Role) | @@ -574,12 +574,14 @@ function RolePlugin.bind(Role) | ||
574 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) | 574 | self:notifyUpdateProperty("diamond", self:getAllDiamond()) |
575 | 575 | ||
576 | self:checkTaskEnter("CostDiamond", {count = count}) | 576 | self:checkTaskEnter("CostDiamond", {count = count}) |
577 | + self:checkWorldChangePoints({[ItemWorldLine.CostDiamond]=count}) | ||
577 | return true | 578 | return true |
578 | end | 579 | end |
579 | 580 | ||
580 | function Role:costJade(param) | 581 | function Role:costJade(param) |
581 | self:addItem(param) | 582 | self:addItem(param) |
582 | self:checkTaskEnter("CostJade", {count = - param.count}) | 583 | self:checkTaskEnter("CostJade", {count = - param.count}) |
584 | + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count}) | ||
583 | end | 585 | end |
584 | 586 | ||
585 | function Role:increBy(field, val) | 587 | function Role:increBy(field, val) |
@@ -2455,7 +2457,8 @@ function RolePlugin.bind(Role) | @@ -2455,7 +2457,8 @@ function RolePlugin.bind(Role) | ||
2455 | elseif rechargeData.shop == 3 then -- 礼包商店 | 2457 | elseif rechargeData.shop == 3 then -- 礼包商店 |
2456 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) | 2458 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
2457 | 2459 | ||
2458 | - --增加购买记录 | 2460 | + self:checkTaskEnter("BuyLimitPack", {id = id}) |
2461 | + --增加购买记录 | ||
2459 | local buyRecord = self.storeData:getProperty("buyR") or {} | 2462 | local buyRecord = self.storeData:getProperty("buyR") or {} |
2460 | buyRecord[id] = (buyRecord[id] or 0) + 1 | 2463 | buyRecord[id] = (buyRecord[id] or 0) + 1 |
2461 | self.storeData:updateProperty({field = "buyR", value = buyRecord}) | 2464 | self.storeData:updateProperty({field = "buyR", value = buyRecord}) |
@@ -3263,6 +3266,24 @@ function RolePlugin.bind(Role) | @@ -3263,6 +3266,24 @@ function RolePlugin.bind(Role) | ||
3263 | 3266 | ||
3264 | return capsule:getSpecialNotify(roleId) | 3267 | return capsule:getSpecialNotify(roleId) |
3265 | end | 3268 | end |
3269 | + | ||
3270 | + function Role:checkWorldChangePoints(param) | ||
3271 | + local worldChangePoints = self:getProperty("worldChangePoints") or {} | ||
3272 | + if param[ItemWorldLine.CostJade] then | ||
3273 | + worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostJade] | ||
3274 | + local cost = math.floor(worldChangePoints[ItemWorldLine.CostJade] / globalCsv.worldline_gift) | ||
3275 | + worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost * globalCsv.worldline_gift | ||
3276 | + worldChangePoints[ItemWorldLine.RouletteCount] = (worldChangePoints[ItemWorldLine.RouletteCount] or 0) + cost | ||
3277 | + end | ||
3278 | + | ||
3279 | + if param[ItemWorldLine.CostDiamond] then | ||
3280 | + worldChangePoints[ItemWorldLine.CostDiamond] = (worldChangePoints[ItemWorldLine.CostDiamond] or 0) + param[ItemWorldLine.CostDiamond] | ||
3281 | + local cost = math.floor(worldChangePoints[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency) | ||
3282 | + worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency | ||
3283 | + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost | ||
3284 | + end | ||
3285 | + self:setProperty("worldChangePoints", worldChangePoints) | ||
3286 | + end | ||
3266 | end | 3287 | end |
3267 | 3288 | ||
3268 | return RolePlugin | 3289 | return RolePlugin |
3269 | \ No newline at end of file | 3290 | \ No newline at end of file |
src/models/RoleTask.lua
@@ -116,6 +116,7 @@ local TaskType = { | @@ -116,6 +116,7 @@ local TaskType = { | ||
116 | Appoint = 912, -- 触发限时礼包,指定id | 116 | Appoint = 912, -- 触发限时礼包,指定id |
117 | Rename = 913, -- 重命名 | 117 | Rename = 913, -- 重命名 |
118 | CostJade = 914, -- 消耗虹光玉 | 118 | CostJade = 914, -- 消耗虹光玉 |
119 | + BuyLimitPack = 915, -- 购买指定id礼包触发 | ||
119 | 120 | ||
120 | --功能未实现 todo | 121 | --功能未实现 todo |
121 | AdvShop = 1002, -- 冒险商城 | 122 | AdvShop = 1002, -- 冒险商城 |
@@ -280,6 +281,7 @@ local StoreListener = { | @@ -280,6 +281,7 @@ local StoreListener = { | ||
280 | [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, | 281 | [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}}, |
281 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, | 282 | [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}}, |
282 | [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, | 283 | [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}}, |
284 | + [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}}, | ||
283 | } | 285 | } |
284 | } | 286 | } |
285 | 287 |
src/models/Store.lua
@@ -610,56 +610,56 @@ function Store:OnTriggerLimitTimePack(eventType, param) | @@ -610,56 +610,56 @@ function Store:OnTriggerLimitTimePack(eventType, param) | ||
610 | break | 610 | break |
611 | end | 611 | end |
612 | end | 612 | end |
613 | - if config ~= nil then | ||
614 | - -- 每日循环弹窗 | ||
615 | - local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} | ||
616 | - if typeMap[eventType] then | ||
617 | - local dayInfo = self:getProperty("dayLimitInfo") | ||
618 | - local info = dayInfo[eventType] or {} | ||
619 | - local count = (info["count"] or 0) + param | ||
620 | - local triggerCount = info["trigger"] or 0 | ||
621 | - local flag = nil | ||
622 | - if count >= config.condition then | ||
623 | - if triggerCount < config.triggerLimit then | ||
624 | - info["trigger"] = triggerCount + 1 | ||
625 | - info["count"] = 0 | ||
626 | - flag = true | ||
627 | - else | ||
628 | - info["count"] = config.condition - 1 | ||
629 | - end | 613 | + if not config then return end |
614 | + | ||
615 | + -- 每日循环弹窗 | ||
616 | + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1} | ||
617 | + if typeMap[eventType] then | ||
618 | + local dayInfo = self:getProperty("dayLimitInfo") | ||
619 | + local info = dayInfo[eventType] or {} | ||
620 | + local count = (info["count"] or 0) + param | ||
621 | + local triggerCount = info["trigger"] or 0 | ||
622 | + local flag = nil | ||
623 | + if count >= config.condition then | ||
624 | + if triggerCount < config.triggerLimit then | ||
625 | + info["trigger"] = triggerCount + 1 | ||
626 | + info["count"] = 0 | ||
627 | + flag = true | ||
630 | else | 628 | else |
631 | - info["count"] = count | ||
632 | - end | ||
633 | - dayInfo[eventType] = info | ||
634 | - self:updateProperty({field = "dayLimitInfo", value = dayInfo}) | ||
635 | - if not flag then | ||
636 | - return | 629 | + info["count"] = config.condition - 1 |
637 | end | 630 | end |
631 | + else | ||
632 | + info["count"] = count | ||
638 | end | 633 | end |
639 | - local rechargeCfg = csvdb["shop_normalCsv"][config.packId] | ||
640 | - if rechargeCfg then | ||
641 | - limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} | ||
642 | - self.owner:log("push_gift", { | ||
643 | - gift_id = rechargeCfg.id, --礼包ID | ||
644 | - gift_name = rechargeCfg.descId, --礼包名称 | ||
645 | - }) | ||
646 | - if config.isLoop ~= 0 then | ||
647 | - local payR = self:getProperty("payR") | ||
648 | - if payR[rechargeCfg.id] then | ||
649 | - payR[rechargeCfg.id] = nil | ||
650 | - self:updateProperty({field = "payR", value = payR}) | ||
651 | - end | 634 | + dayInfo[eventType] = info |
635 | + self:updateProperty({field = "dayLimitInfo", value = dayInfo}) | ||
636 | + if not flag then | ||
637 | + return | ||
638 | + end | ||
639 | + end | ||
640 | + local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId] | ||
641 | + if rechargeCfg then | ||
642 | + limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} | ||
643 | + self.owner:log("push_gift", { | ||
644 | + gift_id = rechargeCfg.id, --礼包ID | ||
645 | + gift_name = rechargeCfg.descId, --礼包名称 | ||
646 | + }) | ||
647 | + if config.isLoop ~= 0 then | ||
648 | + local payR = self:getProperty("payR") | ||
649 | + if payR[rechargeCfg.id] then | ||
650 | + payR[rechargeCfg.id] = nil | ||
651 | + self:updateProperty({field = "payR", value = payR}) | ||
652 | end | 652 | end |
653 | - -- 每日抽卡限时礼包 触发重置 | ||
654 | - --if eventType == TriggerEventType.DrawHeroCnt then | ||
655 | - -- local payR = self:getProperty("buyR") | ||
656 | - -- if payR[rechargeCfg.id] then | ||
657 | - -- payR[rechargeCfg.id] = nil | ||
658 | - -- self:updateProperty({field = "buyR", value = payR}) | ||
659 | - -- end | ||
660 | - --end | ||
661 | - self:updateProperty({field = "limitTPack", value = limitPack}) | ||
662 | end | 653 | end |
654 | + -- 每日抽卡限时礼包 触发重置 | ||
655 | + --if eventType == TriggerEventType.DrawHeroCnt then | ||
656 | + -- local payR = self:getProperty("buyR") | ||
657 | + -- if payR[rechargeCfg.id] then | ||
658 | + -- payR[rechargeCfg.id] = nil | ||
659 | + -- self:updateProperty({field = "buyR", value = payR}) | ||
660 | + -- end | ||
661 | + --end | ||
662 | + self:updateProperty({field = "limitTPack", value = limitPack}) | ||
663 | end | 663 | end |
664 | --if next(result) then | 664 | --if next(result) then |
665 | -- self:updateProperty({field = "packTrigger", value = triggerRecord}) | 665 | -- self:updateProperty({field = "packTrigger", value = triggerRecord}) |