Commit a8a9adb25864737a779d1e6f43128ea73381fb83

Authored by saicom
2 parents e0d725cc 5db4c63a

Merge branch 'cn/develop' of 120.26.43.151:wasteland/server into cn/develop

src/GlobalVar.lua
... ... @@ -388,6 +388,7 @@ TriggerEventType = {
388 388 FoodSell = 11, -- 循环卖菜
389 389 RuneUp = 12, -- 循环强化符文
390 390 CostDiamond = 13, -- 循环消耗钻石
  391 + BuyLimitPack = 14, --购买指定id礼包 触发
391 392 }
392 393  
393 394 DrawCardType = {
... ... @@ -440,4 +441,12 @@ ItemOccupy = {
440 441 Spark = 5, --火花
441 442 Other = 6,
442 443 CanUsed = 7, --可使用
  444 +}
  445 +
  446 +-- 世界变动积分
  447 +ItemWorldLine = {
  448 + RouletteCount = 1, --抽轮盘次数
  449 + Points = 2, --积分
  450 + CostDiamond = 3, --消耗钻石
  451 + CostJade = 4, --消耗红光玉
443 452 }
444 453 \ No newline at end of file
... ...
src/ProtocolCode.lua
... ... @@ -62,6 +62,8 @@ actionCodes = {
62 62 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍
63 63 Role_setBgRpc = 144, -- 设置看板娘
64 64 Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具
  65 + Role_worldLineRoulette = 146, --世界线抽轮盘
  66 + Role_worldLineReward = 147, -- 世界线一键领取奖励
65 67  
66 68 Adv_startAdvRpc = 151,
67 69 Adv_startHangRpc = 152,
... ...
src/actions/RoleAction.lua
... ... @@ -1741,7 +1741,68 @@ function _M.itemConvertMonthCardRpc(agent, data)
1741 1741 end
1742 1742  
1743 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 1806 end
1746 1807  
1747 1808 return _M
1748 1809 \ No newline at end of file
... ...
src/models/Role.lua
... ... @@ -214,6 +214,9 @@ Role.schema = {
214 214 heroCnt = {"number", 0}, -- 英雄数量
215 215 friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0}
216 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 460 unlockChap = self:getProperty("unlockChap"), -- 解锁的章节
458 461 friendTeam = self:getProperty("friendTeam"),
459 462 bgId = self:getProperty("bgId"),
  463 + worldChangePoints = self:getProperty("worldChangePoints"),
  464 + worldLineReward = self:getProperty("worldLineReward"),
460 465 }
461 466 end
462 467  
... ...
src/models/RoleLog.lua
... ... @@ -163,6 +163,8 @@ local ItemReason = {
163 163 CapsuleReward = 1411, --扭蛋机奖励
164 164 CapsuleConvert = 1412, --扭蛋机 消耗票 兑换
165 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 574 self:notifyUpdateProperty("diamond", self:getAllDiamond())
575 575  
576 576 self:checkTaskEnter("CostDiamond", {count = count})
  577 + self:checkWorldChangePoints({[ItemWorldLine.CostDiamond]=count})
577 578 return true
578 579 end
579 580  
580 581 function Role:costJade(param)
581 582 self:addItem(param)
582 583 self:checkTaskEnter("CostJade", {count = - param.count})
  584 + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count})
583 585 end
584 586  
585 587 function Role:increBy(field, val)
... ... @@ -2455,7 +2457,8 @@ function RolePlugin.bind(Role)
2455 2457 elseif rechargeData.shop == 3 then -- 礼包商店
2456 2458 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2457 2459  
2458   - --增加购买记录
  2460 + self:checkTaskEnter("BuyLimitPack", {id = id})
  2461 + --增加购买记录
2459 2462 local buyRecord = self.storeData:getProperty("buyR") or {}
2460 2463 buyRecord[id] = (buyRecord[id] or 0) + 1
2461 2464 self.storeData:updateProperty({field = "buyR", value = buyRecord})
... ... @@ -3263,6 +3266,24 @@ function RolePlugin.bind(Role)
3263 3266  
3264 3267 return capsule:getSpecialNotify(roleId)
3265 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 3287 end
3267 3288  
3268 3289 return RolePlugin
3269 3290 \ No newline at end of file
... ...
src/models/RoleTask.lua
... ... @@ -116,6 +116,7 @@ local TaskType = {
116 116 Appoint = 912, -- 触发限时礼包,指定id
117 117 Rename = 913, -- 重命名
118 118 CostJade = 914, -- 消耗虹光玉
  119 + BuyLimitPack = 915, -- 购买指定id礼包触发
119 120  
120 121 --功能未实现 todo
121 122 AdvShop = 1002, -- 冒险商城
... ... @@ -280,6 +281,7 @@ local StoreListener = {
280 281 [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}},
281 282 [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}},
282 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 610 break
611 611 end
612 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 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 630 end
  631 + else
  632 + info["count"] = count
638 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 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 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 663 end
664 664 --if next(result) then
665 665 -- self:updateProperty({field = "packTrigger", value = triggerRecord})
... ...