Commit 2284b38e5f506e2c15ae4de570584e772a7e607b

Authored by jiyue
2 parents c4d8e9d2 d63519df

Merge branch 'cn/develop' into cn/publish/preview

src/GlobalVar.lua
... ... @@ -433,7 +433,7 @@ SystemBnousType = {
433 433 UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数
434 434 ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加
435 435 ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加,
436   - ExtraProp = 18, -- 每次探索加速额外获得道具
  436 + ExtraProps= 18, -- 每次探索加速额外获得道具
437 437 AccountLevel = 19, -- 账号等级提升角色等级上限
438 438 }
439 439  
... ...
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.findMinKeyByItem(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.findMinKeyByItem(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.findMinKeyByItem(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
... ... @@ -1549,9 +1552,11 @@ function _M.diamondConvertRpc(agent, data)
1549 1552 local allReward = {}
1550 1553 if remain > old then
1551 1554 allReward[ItemId.Jade] = remain - old
  1555 + role:checkWorldChangePoints({[ItemWorldLine.CostJade]= quan * globalCsv.recruit_cost})
1552 1556 elseif remain == old then
1553 1557 else
1554 1558 role:costItems({[ItemId.Jade] = old - remain}, {log = {desc = "convert", short1=oper}})
  1559 + role:checkWorldChangePoints({[ItemWorldLine.CostJade]= quan * globalCsv.recruit_cost - (old - remain)})
1555 1560 end
1556 1561  
1557 1562 if quan > 0 then
... ... @@ -1759,7 +1764,7 @@ function _M.itemConvertSpecialRpc(agent, data)
1759 1764 return true
1760 1765 end
1761 1766  
1762   -function _M.worldLineRoulette(agent, data)
  1767 +function _M.worldLineRouletteRpc(agent, data)
1763 1768 local role = agent.role
1764 1769  
1765 1770 local worldChangePoints = role:getProperty("worldChangePoints") or {}
... ... @@ -1776,7 +1781,7 @@ function _M.worldLineRoulette(agent, data)
1776 1781 for k, v in pairs(globalCsv.worldline_gift_magnification_1) do
1777 1782 worldline_gift_magnification_1[k] = {v}
1778 1783 end
1779   - for k, v in pairs(globalCsv.worldline_gift_magnification_0) do
  1784 + for k, v in pairs(globalCsv["worldline_gift_magnification_0.1"]) do
1780 1785 worldline_gift_magnification_0[k] = {v}
1781 1786 end
1782 1787  
... ... @@ -1788,21 +1793,21 @@ function _M.worldLineRoulette(agent, data)
1788 1793  
1789 1794 local points = math.floor((gift_base_10 + gift_base_1) * (gift_magnification_1 + gift_magnification_0))
1790 1795 worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1
1791   - worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points
  1796 + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + points
1792 1797 role:updateProperty({field = "worldChangePoints", value = worldChangePoints})
1793 1798  
1794   - SendPacket(actionCodes.Role_worldLineRoulette, MsgPack.pack(worldChangePoints))
  1799 + 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}))
1795 1800 return true
1796 1801 end
1797 1802  
1798   -function _M.worldLineReward(agent, data)
  1803 +function _M.worldLineRewardRpc(agent, data)
1799 1804 local role = agent.role
1800 1805 local worldLineReward = role:getProperty("worldLineReward") or {}
1801 1806 local worldChangePoints = role:getProperty("worldChangePoints") or {}
1802 1807 local points = worldChangePoints[ItemWorldLine.Points] or 0
1803 1808  
1804 1809 local reward, change = {}
1805   - for key, val in pairs(csvdb["worldline_rewardCsv"]) do
  1810 + for key, val in pairs(csvdb["worldline_awardCsv"]) do
1806 1811 if points >= key and not worldLineReward[key] then
1807 1812 for k, v in pairs(val.award:toNumMap()) do
1808 1813 reward[k] = (reward[k] or 0) + v
... ... @@ -1816,7 +1821,7 @@ function _M.worldLineReward(agent, data)
1816 1821 if next(reward) then
1817 1822 reward, change = role:award(reward, {log = {desc = "worldLine", int1 = role:getProperty("id")}})
1818 1823 end
1819   - SendPacket(actionCodes.Role_worldLineReward, MsgPack.pack(role:packReward(reward, change)))
  1824 + SendPacket(actionCodes.Role_worldLineRewardRpc, MsgPack.pack(role:packReward(reward, change)))
1820 1825 return true
1821 1826 end
1822 1827  
... ...
src/actions/StoreAction.lua
... ... @@ -535,8 +535,16 @@ function _M.getExploreCommandRewardRpc(agent, data)
535 535 return 3
536 536 end
537 537  
538   - if not role:checkHangPass(config.level) then
539   - return 4
  538 + for k, level in pairs(config.level:toNumMap()) do
  539 + if k == 1 then
  540 + if not role:checkHangPass(level) then
  541 + return 4
  542 + end
  543 + elseif k == 2 then
  544 + if not role:checkAdvChapterPass(level) then
  545 + return 4
  546 + end
  547 + end
540 548 end
541 549  
542 550 local gift = ""
... ...
src/models/RoleLog.lua
... ... @@ -146,6 +146,7 @@ local ItemReason = {
146 146 sparkLvlUp = 1214, -- 火花强化
147 147 sparkQualityUp = 1215, -- 火花升华
148 148 heroGenius = 1216, -- 英雄天赋点
  149 + heroStickers = 1217, -- 英雄贴纸
149 150  
150 151 -- pvp
151 152 pvpCHead = 1301, -- pvp 跨服竞技场头像
... ...
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,14 @@ function table.array2Table(arr)
865 865 return ret
866 866 end
867 867  
  868 +function table.findMinKeyByItem(t, item, change)
  869 + if next(t) and not t[item] then
  870 + item = item - change
  871 + return table.findMinKeyByItem(t, item, change)
  872 + else
  873 + return t[item]
  874 + end
  875 +end
868 876  
869 877 function table.rewardMerge(dest, src)
870 878 for k, v in pairs(src) do
... ...