Commit f4c12f1b5c7f1b6b3894fa899e1fee4173cc9e5f
Merge branch 'cn/develop' of 120.26.43.151:wasteland/server into cn/develop
Showing
11 changed files
with
95 additions
and
60 deletions
Show diff stats
src/GlobalVar.lua
| ... | ... | @@ -95,6 +95,7 @@ ItemType = { |
| 95 | 95 | CommonPaster = 18, -- 万能贴纸 |
| 96 | 96 | BossTicket = 20, -- boss挑战门票 |
| 97 | 97 | Spark = 21, -- 火花 |
| 98 | + Stick = 23, -- 贴纸 | |
| 98 | 99 | } |
| 99 | 100 | |
| 100 | 101 | --在这个里面的会记录的是功能开放 对应类型open 而不是 ID |
| ... | ... | @@ -433,7 +434,7 @@ SystemBnousType = { |
| 433 | 434 | UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 |
| 434 | 435 | ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 |
| 435 | 436 | ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, |
| 436 | - ExtraProp = 18, -- 每次探索加速额外获得道具 | |
| 437 | + ExtraProps= 18, -- 每次探索加速额外获得道具 | |
| 437 | 438 | AccountLevel = 19, -- 账号等级提升角色等级上限 |
| 438 | 439 | } |
| 439 | 440 | ... | ... |
src/ProtocolCode.lua
| ... | ... | @@ -62,8 +62,8 @@ actionCodes = { |
| 62 | 62 | Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 |
| 63 | 63 | Role_setBgRpc = 144, -- 设置看板娘 |
| 64 | 64 | Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具 |
| 65 | - Role_worldLineRoulette = 146, --世界线抽轮盘 | |
| 66 | - Role_worldLineReward = 147, -- 世界线一键领取奖励 | |
| 65 | + Role_worldLineRouletteRpc = 146, --世界线抽轮盘 | |
| 66 | + Role_worldLineRewardRpc = 147, -- 世界线一键领取奖励 | |
| 67 | 67 | |
| 68 | 68 | Adv_startAdvRpc = 151, |
| 69 | 69 | Adv_startHangRpc = 152, |
| ... | ... | @@ -117,6 +117,7 @@ actionCodes = { |
| 117 | 117 | Hero_setWishPoolRpc = 226, |
| 118 | 118 | Hero_changeSparkRpc = 227, |
| 119 | 119 | Hero_saveGeniusTreeRpc = 228, |
| 120 | + Hero_stickersConvertRpc = 229, --兑换英雄贴纸 | |
| 120 | 121 | |
| 121 | 122 | Hang_startRpc = 251, |
| 122 | 123 | Hang_checkRpc = 252, | ... | ... |
src/actions/ActivityAction.lua
| ... | ... | @@ -327,12 +327,16 @@ function _M.actBattleCommandTaskRpc(agent, data) |
| 327 | 327 | end |
| 328 | 328 | end |
| 329 | 329 | |
| 330 | - local taskReward = {} | |
| 330 | + local taskReward | |
| 331 | 331 | if recordFlag then |
| 332 | + -- recordFlag = true时,taskCfg.reward 只会有经验奖励 | |
| 333 | + taskReward = {} | |
| 332 | 334 | for k, v in pairs(taskCfg.reward:toNumMap()) do |
| 333 | 335 | taskReward[k] = (taskReward[k] or 0) + v + taskCfg.battlepass_reward |
| 334 | 336 | break |
| 335 | 337 | end |
| 338 | + else | |
| 339 | + taskReward = taskCfg.reward | |
| 336 | 340 | end |
| 337 | 341 | |
| 338 | 342 | local reward, change = role:award(taskReward, {log = {desc = "battleCommandTask"}}) | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -506,14 +506,15 @@ function _M.buyAdvCountRpc(agent , data) |
| 506 | 506 | local msg = MsgPack.unpack(data) |
| 507 | 507 | |
| 508 | 508 | local count = msg.count --购买次数 |
| 509 | - local isEl = msg.isEl -- 是否是无尽模式 | |
| 509 | + local isEl = msg.isEl -- 是否是无尽模式 国服没有 | |
| 510 | 510 | local cost |
| 511 | 511 | if isEl then |
| 512 | 512 | if math.illegalNum(count, 1, globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC")) then return end |
| 513 | 513 | cost = {[ItemId.Jade] = count * globalCsv.adv_endless_daily_buy_cost} |
| 514 | 514 | else |
| 515 | - if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end | |
| 516 | - cost = {[ItemId.Jade] = count * globalCsv.adv_daily_buy_cost} | |
| 515 | + --if math.illegalNum(count, 1, globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC")) then return end | |
| 516 | + local advCount = (role.dailyData:getProperty("advBC") + count ) * globalCsv.adv_daily_buy_num | |
| 517 | + cost = {[ItemId.Jade] = table.findMinKeyByIndex(globalCsv.adv_buy_cost, advCount, globalCsv.adv_daily_buy_num)} | |
| 517 | 518 | end |
| 518 | 519 | |
| 519 | 520 | ... | ... |
src/actions/HangAction.lua
| ... | ... | @@ -128,12 +128,10 @@ local function checkReward(role, isTreasure, carbonId) |
| 128 | 128 | --挂机得到的宝藏加入到挂机奖励 |
| 129 | 129 | if isTreasure or false == true then |
| 130 | 130 | local treasureList= role.dailyData:checkTreasureList(carbonId or hangInfo.carbonId) or {} |
| 131 | - if next(treasureList) then | |
| 132 | - for _, val in pairs(treasureList) do | |
| 133 | - local award = val.award:toNumMap() | |
| 134 | - for k,v in pairs(award) do | |
| 135 | - items[k] = (items[k] or 0) + v | |
| 136 | - end | |
| 131 | + for _, val in pairs(treasureList) do | |
| 132 | + local award = val.award:toNumMap() | |
| 133 | + for k,v in pairs(award) do | |
| 134 | + items[k] = (items[k] or 0) + v | |
| 137 | 135 | end |
| 138 | 136 | end |
| 139 | 137 | end |
| ... | ... | @@ -473,30 +471,17 @@ function _M.quickRpc(agent , data) |
| 473 | 471 | local role = agent.role |
| 474 | 472 | |
| 475 | 473 | local hangInfo = role:getProperty("hangInfo") |
| 476 | - if not hangInfo.carbonId then return end | |
| 474 | + if not hangInfo.carbonId then return 1 end | |
| 477 | 475 | local carbonData = csvdb["idle_battleCsv"][hangInfo.carbonId] |
| 478 | 476 | --local expCarbonData = csvdb["idle_battleCsv"][hangInfo.expCarbonId] |
| 479 | 477 | local expCarbonData = hangInfo.expData or {} |
| 480 | 478 | |
| 479 | + local change = globalCsv.idle_quickproduce_time / 3600 | |
| 481 | 480 | local curCount = role.dailyData:getProperty("hangQC") + 1 |
| 482 | - local costs = globalCsv.idle_quickproduce_cost:toArray(true, "=") | |
| 483 | - | |
| 484 | - -- 增加今日探索加速次数 | |
| 485 | - local maxIdx = #costs | |
| 486 | - local maxCount = maxIdx + role:getBnousUpSpeedNum(UpSpeedType.ExplorationUpSpeed) | |
| 487 | - if curCount > maxCount then return end | |
| 481 | + local costCount = table.findMinKeyByIndex(globalCsv.idle_quickproduce_cost, curCount * change, change) | |
| 488 | 482 | |
| 489 | - if curCount > maxIdx then | |
| 490 | - for idx = maxIdx+1, curCount do | |
| 491 | - costs[idx] = costs[maxIdx] | |
| 492 | - end | |
| 493 | - end | |
| 494 | - | |
| 495 | - if not costs[curCount] then return end | |
| 496 | - if costs[curCount] > 0 then | |
| 497 | - if not role:checkItemEnough({[ItemId.Jade] = costs[curCount]}) then return end | |
| 498 | - role:costItems({[ItemId.Jade] = costs[curCount]}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | |
| 499 | - end | |
| 483 | + if not role:checkItemEnough({[ItemId.Jade] = costCount}) then return 2 end | |
| 484 | + role:costItems({[ItemId.Jade] = costCount}, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) | |
| 500 | 485 | |
| 501 | 486 | role.dailyData:updateProperty({field = "hangQC", value = curCount}) |
| 502 | 487 | |
| ... | ... | @@ -536,8 +521,8 @@ function _M.quickRpc(agent , data) |
| 536 | 521 | end |
| 537 | 522 | end |
| 538 | 523 | |
| 539 | - --等级 额外奖励 | |
| 540 | - local levelReward = role:getExtraProp() | |
| 524 | + --等级 每次探索加速额外获得道具 | |
| 525 | + local levelReward = role:getBnousExtraProps() | |
| 541 | 526 | for k, v in pairs(levelReward or {}) do |
| 542 | 527 | reward[k] = (reward[k] or 0) + v |
| 543 | 528 | end |
| ... | ... | @@ -586,13 +571,16 @@ function _M.buyBonusCountRpc(agent, data) |
| 586 | 571 | local bonusC = role.dailyData:getProperty("bonusC") |
| 587 | 572 | local extraCnt = role.storeData:getBonusExtraFightCount() |
| 588 | 573 | bonusC[btype] = bonusC[btype] or {c = 0, b = 0} |
| 589 | - local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] | |
| 590 | - if math.illegalNum(count, 1, lastCount) then return 1 end | |
| 574 | + --local lastCount = (globalCsv.bonus_daily_buy_count + role:getBnousChangeBuyCount()) * coef + extraCnt - bonusC[btype]["b"] | |
| 575 | + --if math.illegalNum(count, 1, lastCount) then return 1 end | |
| 576 | + | |
| 577 | + local costCount = bonusC[btype]["b"] + count | |
| 578 | + local cost = table.findMinKeyByIndex(globalCsv.bonus_buy_cost, costCount, 1) | |
| 591 | 579 | |
| 592 | - if not role:checkItemEnough({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}) then return 2 end | |
| 580 | + if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 2 end | |
| 593 | 581 | |
| 594 | - role:costItems({[ItemId.Jade] = globalCsv.bonus_buy_cost * count}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) | |
| 595 | - bonusC[btype]["b"] = bonusC[btype]["b"] + count | |
| 582 | + role:costItems({[ItemId.Jade] = cost}, {log = {desc = "buyBonusCount", int1 = btype, int2 = count}}) | |
| 583 | + bonusC[btype]["b"] = costCount | |
| 596 | 584 | bonusC[btype]["c"] = bonusC[btype]["c"] - count |
| 597 | 585 | |
| 598 | 586 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -1389,4 +1389,27 @@ function _M.saveGeniusTreeRpc(agent, data) |
| 1389 | 1389 | return true |
| 1390 | 1390 | end |
| 1391 | 1391 | |
| 1392 | +function _M.stickersConvertRpc(agent, data) | |
| 1393 | + local role = agent.role | |
| 1394 | + local msg = MsgPack.unpack(data) | |
| 1395 | + local itemId = msg.itemId | |
| 1396 | + local heroType = msg.heroType -- heroId-300 举例 [泡泡]= {[heroType] = 120, [heroId]= 420} | |
| 1397 | + | |
| 1398 | + local itemData = csvdb["itemCsv"][itemId] | |
| 1399 | + if not itemData then return 1 end | |
| 1400 | + | |
| 1401 | + local useEffect = itemData["use_effect"]:toNumMap() | |
| 1402 | + if not useEffect[heroType] then return 2 end | |
| 1403 | + | |
| 1404 | + if not role:isHaveHero(heroType) then return 3 end | |
| 1405 | + | |
| 1406 | + local cost = {[itemId] = 1} | |
| 1407 | + if not role:checkItemEnough(cost) then return 4 end | |
| 1408 | + role:costItems({[heroType] = cost}, {log = {desc = "heroStickers"}}) | |
| 1409 | + local reward, change = role:award({[heroType] = 1}, {log = {desc = "heroStickers"}}) | |
| 1410 | + | |
| 1411 | + SendPacket(actionCodes.Hero_stickersConvertRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 1412 | + return true | |
| 1413 | +end | |
| 1414 | + | |
| 1392 | 1415 | return _M | ... | ... |
src/actions/RoleAction.lua
| ... | ... | @@ -83,6 +83,9 @@ function _M.loginRpc( agent, data ) |
| 83 | 83 | end |
| 84 | 84 | end |
| 85 | 85 | |
| 86 | + -- 设备记录 | |
| 87 | + redisproxy:sadd(string_format("device:%d", roleId), msg.device) | |
| 88 | + | |
| 86 | 89 | local now = skynet.timex() |
| 87 | 90 | local role = agent.role |
| 88 | 91 | -- 2 |
| ... | ... | @@ -614,11 +617,11 @@ function _M.openItemRpc(agent, data) |
| 614 | 617 | local msg = MsgPack.unpack(data) |
| 615 | 618 | local itemId = msg.itemId |
| 616 | 619 | local count = msg.count |
| 617 | - if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end | |
| 620 | + if math.illegalNum(count, 1, role:getItemCount(itemId)) then return 1 end | |
| 618 | 621 | local itemData = csvdb["itemCsv"][itemId] |
| 619 | - if itemData.use_type ~= 2 then return end | |
| 622 | + if itemData.use_type ~= 2 then return 2 end | |
| 620 | 623 | local randomData = csvdb["item_randomCsv"][tonumber(itemData.use_effect)] |
| 621 | - if not randomData or randomData.openTime > 0 then return end | |
| 624 | + if not randomData or randomData.openTime > 0 then return 3 end | |
| 622 | 625 | |
| 623 | 626 | local reward = {} |
| 624 | 627 | for _i = 1, count do |
| ... | ... | @@ -1552,9 +1555,11 @@ function _M.diamondConvertRpc(agent, data) |
| 1552 | 1555 | local allReward = {} |
| 1553 | 1556 | if remain > old then |
| 1554 | 1557 | allReward[ItemId.Jade] = remain - old |
| 1558 | + role:checkWorldChangePoints({[ItemWorldLine.CostJade]= quan * globalCsv.recruit_cost}) | |
| 1555 | 1559 | elseif remain == old then |
| 1556 | 1560 | else |
| 1557 | 1561 | role:costItems({[ItemId.Jade] = old - remain}, {log = {desc = "convert", short1=oper}}) |
| 1562 | + role:checkWorldChangePoints({[ItemWorldLine.CostJade]= quan * globalCsv.recruit_cost - (old - remain)}) | |
| 1558 | 1563 | end |
| 1559 | 1564 | |
| 1560 | 1565 | if quan > 0 then |
| ... | ... | @@ -1601,7 +1606,7 @@ function _M.useSelectItemRpc(agent, data) |
| 1601 | 1606 | local count = msg.count |
| 1602 | 1607 | if math.illegalNum(count, 1, role:getItemCount(itemId)) then return end |
| 1603 | 1608 | local itemData = csvdb["itemCsv"][itemId] |
| 1604 | - if not (itemData.type == ItemType.SelectItemBox or itemData.type == ItemType.CommonPaster) then return end | |
| 1609 | + if not (itemData.type == ItemType.SelectItemBox or itemData.type == ItemType.CommonPaster or itemData.type == ItemType.Stick) then return end | |
| 1605 | 1610 | local itemMap = itemData.use_effect:toNumMap() |
| 1606 | 1611 | local reward, change = {} |
| 1607 | 1612 | for k, v in pairs(itemMap) do |
| ... | ... | @@ -1762,7 +1767,7 @@ function _M.itemConvertSpecialRpc(agent, data) |
| 1762 | 1767 | return true |
| 1763 | 1768 | end |
| 1764 | 1769 | |
| 1765 | -function _M.worldLineRoulette(agent, data) | |
| 1770 | +function _M.worldLineRouletteRpc(agent, data) | |
| 1766 | 1771 | local role = agent.role |
| 1767 | 1772 | |
| 1768 | 1773 | local worldChangePoints = role:getProperty("worldChangePoints") or {} |
| ... | ... | @@ -1779,7 +1784,7 @@ function _M.worldLineRoulette(agent, data) |
| 1779 | 1784 | for k, v in pairs(globalCsv.worldline_gift_magnification_1) do |
| 1780 | 1785 | worldline_gift_magnification_1[k] = {v} |
| 1781 | 1786 | end |
| 1782 | - for k, v in pairs(globalCsv.worldline_gift_magnification_0) do | |
| 1787 | + for k, v in pairs(globalCsv["worldline_gift_magnification_0.1"]) do | |
| 1783 | 1788 | worldline_gift_magnification_0[k] = {v} |
| 1784 | 1789 | end |
| 1785 | 1790 | |
| ... | ... | @@ -1791,21 +1796,21 @@ function _M.worldLineRoulette(agent, data) |
| 1791 | 1796 | |
| 1792 | 1797 | local points = math.floor((gift_base_10 + gift_base_1) * (gift_magnification_1 + gift_magnification_0)) |
| 1793 | 1798 | worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1 |
| 1794 | - worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points | |
| 1799 | + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + points | |
| 1795 | 1800 | role:updateProperty({field = "worldChangePoints", value = worldChangePoints}) |
| 1796 | 1801 | |
| 1797 | - SendPacket(actionCodes.Role_worldLineRoulette, MsgPack.pack(worldChangePoints)) | |
| 1802 | + SendPacket(actionCodes.Role_worldLineRouletteRpc, MsgPack.pack({base_10 = gift_base_10, base_1 = gift_base_1, magnification_1 = gift_magnification_1, magnification_0 = gift_magnification_0})) | |
| 1798 | 1803 | return true |
| 1799 | 1804 | end |
| 1800 | 1805 | |
| 1801 | -function _M.worldLineReward(agent, data) | |
| 1806 | +function _M.worldLineRewardRpc(agent, data) | |
| 1802 | 1807 | local role = agent.role |
| 1803 | 1808 | local worldLineReward = role:getProperty("worldLineReward") or {} |
| 1804 | 1809 | local worldChangePoints = role:getProperty("worldChangePoints") or {} |
| 1805 | 1810 | local points = worldChangePoints[ItemWorldLine.Points] or 0 |
| 1806 | 1811 | |
| 1807 | 1812 | local reward, change = {} |
| 1808 | - for key, val in pairs(csvdb["worldline_rewardCsv"]) do | |
| 1813 | + for key, val in pairs(csvdb["worldline_awardCsv"]) do | |
| 1809 | 1814 | if points >= key and not worldLineReward[key] then |
| 1810 | 1815 | for k, v in pairs(val.award:toNumMap()) do |
| 1811 | 1816 | reward[k] = (reward[k] or 0) + v |
| ... | ... | @@ -1819,7 +1824,7 @@ function _M.worldLineReward(agent, data) |
| 1819 | 1824 | if next(reward) then |
| 1820 | 1825 | reward, change = role:award(reward, {log = {desc = "worldLine", int1 = role:getProperty("id")}}) |
| 1821 | 1826 | end |
| 1822 | - SendPacket(actionCodes.Role_worldLineReward, MsgPack.pack(role:packReward(reward, change))) | |
| 1827 | + SendPacket(actionCodes.Role_worldLineRewardRpc, MsgPack.pack(role:packReward(reward, change))) | |
| 1823 | 1828 | return true |
| 1824 | 1829 | end |
| 1825 | 1830 | ... | ... |
src/actions/StoreAction.lua
| ... | ... | @@ -534,8 +534,16 @@ function _M.getExploreCommandRewardRpc(agent, data) |
| 534 | 534 | return 3 |
| 535 | 535 | end |
| 536 | 536 | |
| 537 | - if not role:checkHangPass(config.level) then | |
| 538 | - return 4 | |
| 537 | + for k, level in pairs(config.level:toNumMap()) do | |
| 538 | + if k == 1 then | |
| 539 | + if not role:checkHangPass(level) then | |
| 540 | + return 4 | |
| 541 | + end | |
| 542 | + elseif k == 2 then | |
| 543 | + if not role:checkAdvChapterPass(level) then | |
| 544 | + return 4 | |
| 545 | + end | |
| 546 | + end | |
| 539 | 547 | end |
| 540 | 548 | |
| 541 | 549 | local gift = "" | ... | ... |
src/models/RoleLog.lua
src/models/RolePlugin.lua
| ... | ... | @@ -3020,19 +3020,13 @@ function RolePlugin.bind(Role) |
| 3020 | 3020 | return levelBnous[SystemBnousType.ChangeBuyCount] or 0 |
| 3021 | 3021 | end |
| 3022 | 3022 | |
| 3023 | - function Role:getExtraProp() | |
| 3023 | + function Role:getBnousExtraProps() | |
| 3024 | 3024 | local levelBnous = self:getLevelBnous() |
| 3025 | - local extraPropReward = levelBnous[SystemBnousType.ExtraProp] or {} | |
| 3026 | - local reward = {} | |
| 3027 | - for k, v in pairs(extraPropReward) do | |
| 3028 | - reward[k] = (reward[k] or 0) + v | |
| 3029 | - end | |
| 3030 | - return reward | |
| 3025 | + return levelBnous[SystemBnousType.ExtraProps] or {} | |
| 3031 | 3026 | end |
| 3032 | 3027 | |
| 3033 | 3028 | function Role:getAccountLevel() |
| 3034 | 3029 | local levelBnous = self:getLevelBnous() |
| 3035 | - dump(levelBnous) | |
| 3036 | 3030 | return levelBnous[SystemBnousType.AccountLevel] or 0 |
| 3037 | 3031 | end |
| 3038 | 3032 | |
| ... | ... | @@ -3307,7 +3301,7 @@ function RolePlugin.bind(Role) |
| 3307 | 3301 | worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency |
| 3308 | 3302 | worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost |
| 3309 | 3303 | end |
| 3310 | - self:setProperty("worldChangePoints", worldChangePoints) | |
| 3304 | + self:updateProperty({field = "worldChangePoints", value = worldChangePoints}) | |
| 3311 | 3305 | end |
| 3312 | 3306 | end |
| 3313 | 3307 | ... | ... |
src/shared/functions.lua
| ... | ... | @@ -865,6 +865,15 @@ function table.array2Table(arr) |
| 865 | 865 | return ret |
| 866 | 866 | end |
| 867 | 867 | |
| 868 | +function table.findMinKeyByIndex(t, index, change) | |
| 869 | + if not next(t or {}) then return nil end | |
| 870 | + if not t[index] then | |
| 871 | + index = index - change | |
| 872 | + return table.findMinKeyByIndex(t, index, change) | |
| 873 | + else | |
| 874 | + return t[index] | |
| 875 | + end | |
| 876 | +end | |
| 868 | 877 | |
| 869 | 878 | function table.rewardMerge(dest, src) |
| 870 | 879 | for k, v in pairs(src) do | ... | ... |