Commit 766ddd19022aa338668d679346172504f984cb3a
Merge branch 'cn/develop' into cn/publish/preview
# Conflicts: # src/csvdata
Showing
9 changed files
with
102 additions
and
26 deletions
Show diff stats
src/GlobalVar.lua
src/ProtocolCode.lua
| ... | ... | @@ -61,7 +61,7 @@ actionCodes = { |
| 61 | 61 | Role_runeBuyRpc = 142, -- 铭文购买 |
| 62 | 62 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 |
| 63 | 63 | Role_setBgRpc = 144, -- 设置看板娘 |
| 64 | - Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具 | |
| 64 | + Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具 | |
| 65 | 65 | Role_worldLineRoulette = 146, --世界线抽轮盘 |
| 66 | 66 | Role_worldLineReward = 147, -- 世界线一键领取奖励 |
| 67 | 67 | |
| ... | ... | @@ -250,7 +250,7 @@ actionCodes = { |
| 250 | 250 | Activity_actCalendaTaskRpc = 655, |
| 251 | 251 | Activity_actPaySignRpc = 656, |
| 252 | 252 | Activity_exchangeRpc = 657, |
| 253 | - Activity_gachakonRpc = 658, | |
| 253 | + Activity_gachakonRpc = 658, --狩猎祭 抽扭蛋机 | |
| 254 | 254 | Activity_hangDropRpc = 659, |
| 255 | 255 | Activity_startBattleRpc = 660, |
| 256 | 256 | Activity_endBattleRpc = 661, |
| ... | ... | @@ -268,6 +268,7 @@ actionCodes = { |
| 268 | 268 | Activity_returnerTaskRpc = 673, |
| 269 | 269 | Activity_actNewUserTaskRpc = 674, |
| 270 | 270 | Activity_buyBattleTicketRpc = 675, |
| 271 | + Activity_resetGachakonRpc = 676, --狩猎祭,重制扭蛋机 | |
| 271 | 272 | |
| 272 | 273 | Radio_startQuestRpc = 700, |
| 273 | 274 | Radio_finishQuestRpc = 701, | ... | ... |
src/actions/ActivityAction.lua
| ... | ... | @@ -479,6 +479,20 @@ function _M.gachakonRpc(agent, data) |
| 479 | 479 | return true |
| 480 | 480 | end |
| 481 | 481 | |
| 482 | +function _M.resetGachakonRpc(agent, data) | |
| 483 | + local role = agent.role | |
| 484 | + local msg = MsgPack.unpack(data) | |
| 485 | + local actid = msg.actid | |
| 486 | + | |
| 487 | + if not role.activity:isOpenById(actid, "Gachakon") then return 1 end | |
| 488 | + | |
| 489 | + if role.activity:isResetById(actid, "Gachakon") then return 2 end | |
| 490 | + role.activity:resetActDataById(actid) | |
| 491 | + | |
| 492 | + SendPacket(actionCodes.Activity_resetGachakonRpc, MsgPack.pack({})) | |
| 493 | + return true | |
| 494 | +end | |
| 495 | + | |
| 482 | 496 | function _M.hangDropRpc(agent, data) |
| 483 | 497 | local role = agent.role |
| 484 | 498 | local msg = MsgPack.unpack(data) | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -528,16 +528,20 @@ function _M.quickRpc(agent , data) |
| 528 | 528 | end |
| 529 | 529 | |
| 530 | 530 | --宝藏加速 |
| 531 | - local treasureList= role.dailyData:quickTreasureList(hangInfo.carbonId, time) or {} | |
| 532 | - if next(treasureList) then | |
| 533 | - for id, val in pairs(treasureList) do | |
| 534 | - local award = val.award:toNumMap() | |
| 535 | - for k,v in pairs(award) do | |
| 536 | - reward[k] = (reward[k] or 0) + v | |
| 537 | - end | |
| 531 | + local treasureList = role.dailyData:quickTreasureList(hangInfo.carbonId, time) or {} | |
| 532 | + for id, val in pairs(treasureList) do | |
| 533 | + local award = val.award:toNumMap() | |
| 534 | + for k,v in pairs(award) do | |
| 535 | + reward[k] = (reward[k] or 0) + v | |
| 538 | 536 | end |
| 539 | 537 | end |
| 540 | 538 | |
| 539 | + --等级 额外奖励 | |
| 540 | + local levelReward = role:getExtraProp() | |
| 541 | + for k, v in pairs(levelReward or {}) do | |
| 542 | + reward[k] = (reward[k] or 0) + v | |
| 543 | + end | |
| 544 | + | |
| 541 | 545 | local change |
| 542 | 546 | reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) |
| 543 | 547 | if reward[ItemId.Gold] then | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -1712,18 +1712,18 @@ function _M.setBgRpc(agent, data) |
| 1712 | 1712 | return true |
| 1713 | 1713 | end |
| 1714 | 1714 | |
| 1715 | -function _M.itemConvertMonthCardRpc(agent, data) | |
| 1715 | +function _M.itemConvertSpecialRpc(agent, data) | |
| 1716 | 1716 | local role = agent.role |
| 1717 | 1717 | local msg = MsgPack.unpack(data) |
| 1718 | 1718 | local itemId = msg.item_id |
| 1719 | - local typ = msg.typ | |
| 1720 | - local count = msg.count | |
| 1719 | + local count = msg.count or 1 | |
| 1721 | 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 | 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 | 1728 | local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] |
| 1729 | 1729 | if not rechargeData then |
| ... | ... | @@ -1751,27 +1751,27 @@ function _M.worldLineRoulette(agent, data) |
| 1751 | 1751 | local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0 |
| 1752 | 1752 | if rouletteCount == 0 then return 1 end |
| 1753 | 1753 | |
| 1754 | - local worldline_gift_base_10, worldline_gift_base_1, worldline_gift_magnification_10, worldline_gift_magnification_1 = {}, {}, {}, {} | |
| 1754 | + local worldline_gift_base_10, worldline_gift_base_1, worldline_gift_magnification_1, worldline_gift_magnification_0 = {}, {}, {}, {} | |
| 1755 | 1755 | for k, v in pairs(globalCsv.worldline_gift_base_10) do |
| 1756 | 1756 | worldline_gift_base_10[k] = {v} |
| 1757 | 1757 | end |
| 1758 | 1758 | for k, v in pairs(globalCsv.worldline_gift_base_1) do |
| 1759 | 1759 | worldline_gift_base_1[k] = {v} |
| 1760 | 1760 | end |
| 1761 | - for k, v in pairs(globalCsv.worldline_gift_magnification_10) do | |
| 1762 | - worldline_gift_magnification_10[k] = {v} | |
| 1763 | - end | |
| 1764 | 1761 | for k, v in pairs(globalCsv.worldline_gift_magnification_1) do |
| 1765 | 1762 | worldline_gift_magnification_1[k] = {v} |
| 1766 | 1763 | end |
| 1764 | + for k, v in pairs(globalCsv.worldline_gift_magnification_0) do | |
| 1765 | + worldline_gift_magnification_0[k] = {v} | |
| 1766 | + end | |
| 1767 | 1767 | |
| 1768 | 1768 | local gift_base_10 = (math.randWeight(worldline_gift_base_10, 1) or 0) * 10 |
| 1769 | 1769 | local gift_base_1 = math.randWeight(worldline_gift_base_1, 1) or 0 |
| 1770 | 1770 | |
| 1771 | - local gift_magnification_10 = (math.randWeight(worldline_gift_magnification_10, 1) or 0) * 10 | |
| 1772 | 1771 | local gift_magnification_1 = math.randWeight(worldline_gift_magnification_1, 1) or 0 |
| 1772 | + local gift_magnification_0 = (math.randWeight(worldline_gift_magnification_0, 1) or 0) * (0.1) | |
| 1773 | 1773 | |
| 1774 | - local points = (gift_base_10 + gift_base_1) * (gift_magnification_10 + gift_magnification_1) | |
| 1774 | + local points = math.floor((gift_base_10 + gift_base_1) * (gift_magnification_1 + gift_magnification_0)) | |
| 1775 | 1775 | worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1 |
| 1776 | 1776 | worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points |
| 1777 | 1777 | role:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | ... | ... |
src/agent.lua
| ... | ... | @@ -35,10 +35,17 @@ local function handle_timeout() |
| 35 | 35 | skynet.timeout(100, handle_timeout) |
| 36 | 36 | end |
| 37 | 37 | |
| 38 | +local function handle_gc() | |
| 39 | + if agentInfo.open_timer then return end | |
| 40 | + collectgarbage("collect") | |
| 41 | + skynet.timeout(6000, handle_gc) | |
| 42 | +end | |
| 43 | + | |
| 38 | 44 | function start_agent_timer() |
| 39 | 45 | if agentInfo.open_timer then return end |
| 40 | 46 | agentInfo.open_timer = true |
| 41 | 47 | skynet.timeout(150, handle_timeout) |
| 48 | + skynet.timeout(6000, handle_gc) | |
| 42 | 49 | end |
| 43 | 50 | |
| 44 | 51 | function cancel_agent_timer() | ... | ... |
src/models/Activity.lua
| ... | ... | @@ -93,6 +93,8 @@ Activity.schema = { |
| 93 | 93 | |
| 94 | 94 | act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} |
| 95 | 95 | act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} |
| 96 | + | |
| 97 | + reset20 = {"number", 1}, -- 重置扭蛋机 | |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | function Activity:data() |
| ... | ... | @@ -121,6 +123,8 @@ function Activity:data() |
| 121 | 123 | |
| 122 | 124 | act34 = self:getProperty("act34"), |
| 123 | 125 | act36 = self:getProperty("act36"), |
| 126 | + | |
| 127 | + reset20 = self:getProperty("reset20") | |
| 124 | 128 | } |
| 125 | 129 | end |
| 126 | 130 | |
| ... | ... | @@ -207,6 +211,24 @@ function Activity:isOpenById(id, activityType) |
| 207 | 211 | return self._isOpen[id] |
| 208 | 212 | end |
| 209 | 213 | |
| 214 | +function Activity:isResetById(id, activityType) | |
| 215 | + activityType = checkActivityType(activityType) | |
| 216 | + local cfg = csvdb["activity_ctrlCsv"][id] | |
| 217 | + if not cfg then return false end | |
| 218 | + if activityType ~= 0 and cfg.showType ~= activityType then return false end | |
| 219 | + return self:getResetData(activityType) == 0 | |
| 220 | +end | |
| 221 | + | |
| 222 | +function Activity:getResetData(actType) | |
| 223 | + actType = checkActivityType(actType) | |
| 224 | + return self:getProperty("reset" .. actType) | |
| 225 | +end | |
| 226 | + | |
| 227 | +function Activity:updateResetData(actType, reset) | |
| 228 | + actType = checkActivityType(actType) | |
| 229 | + self:updateProperty({field = "reset" .. actType, value = reset}) | |
| 230 | +end | |
| 231 | + | |
| 210 | 232 | function Activity:getActData(actType) |
| 211 | 233 | actType = checkActivityType(actType) |
| 212 | 234 | return self:getProperty("act" .. actType) |
| ... | ... | @@ -756,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = { |
| 756 | 778 | self:updateActData(actType, {}, not notify) |
| 757 | 779 | end, |
| 758 | 780 | ["crossDay"] = function(self, actType, notify) |
| 781 | + self:updateResetData(actType, 1) | |
| 759 | 782 | self:updateActData(actType, {}, not notify) |
| 760 | 783 | end, |
| 784 | + ["reset"] = function(self, actType) | |
| 785 | + if self:getResetData(actType) == 0 then return end | |
| 786 | + self:updateResetData(actType, 0) | |
| 787 | + self:updateActData(actType, {}) | |
| 788 | + end | |
| 761 | 789 | } |
| 762 | 790 | |
| 763 | 791 | -- 活动卡池 |
| ... | ... | @@ -865,6 +893,15 @@ function Activity:refreshWeekData(notify) |
| 865 | 893 | end |
| 866 | 894 | end |
| 867 | 895 | |
| 896 | +function Activity:resetActDataById(actId) | |
| 897 | + local actData = csvdb["activity_ctrlCsv"][actId] | |
| 898 | + if not actData then return end | |
| 899 | + local actType = actData.showType | |
| 900 | + if activityFunc[actType] and activityFunc[actType]['reset'] then | |
| 901 | + activityFunc[actType]["reset"](self, actType) | |
| 902 | + end | |
| 903 | +end | |
| 904 | + | |
| 868 | 905 | function Activity:checkActivity(notNotify, activityType, ...) |
| 869 | 906 | if not activityType then return end |
| 870 | 907 | if not self:isOpen(activityType) then return end | ... | ... |
src/models/RoleLog.lua
| ... | ... | @@ -66,8 +66,8 @@ local ItemReason = { |
| 66 | 66 | shopBuy = 150, -- 商店购买 |
| 67 | 67 | monthCardReward = 151, --月卡奖励 |
| 68 | 68 | smonthCardReward = 152, --特刊奖励 |
| 69 | - itemConvertmonthCard = 153, --兑换月卡 | |
| 70 | - itemConvertsmonthCard = 154, --兑换特刊 | |
| 69 | + itemConvertSpecial = 153, --兑换月卡/战令/探索指令 特殊道具 | |
| 70 | + buyDiamondCardReward = 154, --购买钻石额外赠送奖励 | |
| 71 | 71 | |
| 72 | 72 | advHang = 301, -- 拾荒挂机 |
| 73 | 73 | hangBattle = 302, -- 挂机战斗 | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -2448,6 +2448,12 @@ function RolePlugin.bind(Role) |
| 2448 | 2448 | self:updateProperty({field = "rechargeF", value = rechargeF}) |
| 2449 | 2449 | end |
| 2450 | 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 | 2457 | elseif rechargeData.shop == 2 then --通行证商店 |
| 2452 | 2458 | --签收 + 订阅奖励 |
| 2453 | 2459 | local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) |
| ... | ... | @@ -2458,10 +2464,6 @@ function RolePlugin.bind(Role) |
| 2458 | 2464 | reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) |
| 2459 | 2465 | |
| 2460 | 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 | 2467 | else |
| 2466 | 2468 | skynet.error("[recharge] invalid recharge shop type " .. id) |
| 2467 | 2469 | return 3 |
| ... | ... | @@ -3016,6 +3018,16 @@ function RolePlugin.bind(Role) |
| 3016 | 3018 | return levelBnous[SystemBnousType.ChangeBuyCount] or 0 |
| 3017 | 3019 | end |
| 3018 | 3020 | |
| 3021 | + function Role:getExtraProp() | |
| 3022 | + local levelBnous = self:getLevelBnous() | |
| 3023 | + local extraPropReward = levelBnous[SystemBnousType.ExtraProp] or {} | |
| 3024 | + local reward = {} | |
| 3025 | + for k, v in pairs(extraPropReward) do | |
| 3026 | + reward[k] = (reward[k] or 0) + v | |
| 3027 | + end | |
| 3028 | + return reward | |
| 3029 | + end | |
| 3030 | + | |
| 3019 | 3031 | function Role:getLevelBnous() |
| 3020 | 3032 | local levelBnous = {} |
| 3021 | 3033 | local curLevel = self:getProperty("level") | ... | ... |