Commit 766ddd19022aa338668d679346172504f984cb3a

Authored by jiyue
2 parents f8a0d369 8c154e11

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

# Conflicts:
#	src/csvdata
@@ -430,6 +430,7 @@ SystemBnousType = { @@ -430,6 +430,7 @@ SystemBnousType = {
430 UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数 430 UpSpeedNum = 15, -- 加速次数上限增加 15=1探索加速or 2齿轮加速or 3餐厅加速=增加次数
431 ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加 431 ChangeBaseCount = 16, -- 每日奖励关卡挑战卡基础数量增加
432 ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加, 432 ChangeBuyCount = 17, -- 每日奖励关卡挑战卡可购买次数增加,
  433 + ExtraProp = 18, -- 每次探索加速额外获得道具
433 } 434 }
434 435
435 -- 开箱物品类型 436 -- 开箱物品类型
src/ProtocolCode.lua
@@ -61,7 +61,7 @@ actionCodes = { @@ -61,7 +61,7 @@ actionCodes = {
61 Role_runeBuyRpc = 142, -- 铭文购买 61 Role_runeBuyRpc = 142, -- 铭文购买
62 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍 62 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍
63 Role_setBgRpc = 144, -- 设置看板娘 63 Role_setBgRpc = 144, -- 设置看板娘
64 - Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具 64 + Role_itemConvertSpecialRpc = 145, -- 兑换月卡/战令探索指令等 特殊道具
65 Role_worldLineRoulette = 146, --世界线抽轮盘 65 Role_worldLineRoulette = 146, --世界线抽轮盘
66 Role_worldLineReward = 147, -- 世界线一键领取奖励 66 Role_worldLineReward = 147, -- 世界线一键领取奖励
67 67
@@ -250,7 +250,7 @@ actionCodes = { @@ -250,7 +250,7 @@ actionCodes = {
250 Activity_actCalendaTaskRpc = 655, 250 Activity_actCalendaTaskRpc = 655,
251 Activity_actPaySignRpc = 656, 251 Activity_actPaySignRpc = 656,
252 Activity_exchangeRpc = 657, 252 Activity_exchangeRpc = 657,
253 - Activity_gachakonRpc = 658, 253 + Activity_gachakonRpc = 658, --狩猎祭 抽扭蛋机
254 Activity_hangDropRpc = 659, 254 Activity_hangDropRpc = 659,
255 Activity_startBattleRpc = 660, 255 Activity_startBattleRpc = 660,
256 Activity_endBattleRpc = 661, 256 Activity_endBattleRpc = 661,
@@ -268,6 +268,7 @@ actionCodes = { @@ -268,6 +268,7 @@ actionCodes = {
268 Activity_returnerTaskRpc = 673, 268 Activity_returnerTaskRpc = 673,
269 Activity_actNewUserTaskRpc = 674, 269 Activity_actNewUserTaskRpc = 674,
270 Activity_buyBattleTicketRpc = 675, 270 Activity_buyBattleTicketRpc = 675,
  271 + Activity_resetGachakonRpc = 676, --狩猎祭,重制扭蛋机
271 272
272 Radio_startQuestRpc = 700, 273 Radio_startQuestRpc = 700,
273 Radio_finishQuestRpc = 701, 274 Radio_finishQuestRpc = 701,
src/actions/ActivityAction.lua
@@ -479,6 +479,20 @@ function _M.gachakonRpc(agent, data) @@ -479,6 +479,20 @@ function _M.gachakonRpc(agent, data)
479 return true 479 return true
480 end 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 function _M.hangDropRpc(agent, data) 496 function _M.hangDropRpc(agent, data)
483 local role = agent.role 497 local role = agent.role
484 local msg = MsgPack.unpack(data) 498 local msg = MsgPack.unpack(data)
src/actions/HangAction.lua
@@ -528,16 +528,20 @@ function _M.quickRpc(agent , data) @@ -528,16 +528,20 @@ function _M.quickRpc(agent , data)
528 end 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 end 536 end
539 end 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 local change 545 local change
542 reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}}) 546 reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}})
543 if reward[ItemId.Gold] then 547 if reward[ItemId.Gold] then
src/actions/RoleAction.lua
@@ -1712,18 +1712,18 @@ function _M.setBgRpc(agent, data) @@ -1712,18 +1712,18 @@ function _M.setBgRpc(agent, data)
1712 return true 1712 return true
1713 end 1713 end
1714 1714
1715 -function _M.itemConvertMonthCardRpc(agent, data) 1715 +function _M.itemConvertSpecialRpc(agent, data)
1716 local role = agent.role 1716 local role = agent.role
1717 local msg = MsgPack.unpack(data) 1717 local msg = MsgPack.unpack(data)
1718 local itemId = msg.item_id 1718 local itemId = msg.item_id
1719 - local typ = msg.typ  
1720 - local count = msg.count 1719 + local count = msg.count or 1
1721 local exchangeId = msg.exchange_id 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 if not role:checkItemEnough({[itemId] = count}) then return 2 end 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 local rechargeData = csvdb["shop_rechargeCsv"][exchangeId] 1728 local rechargeData = csvdb["shop_rechargeCsv"][exchangeId]
1729 if not rechargeData then 1729 if not rechargeData then
@@ -1751,27 +1751,27 @@ function _M.worldLineRoulette(agent, data) @@ -1751,27 +1751,27 @@ function _M.worldLineRoulette(agent, data)
1751 local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0 1751 local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0
1752 if rouletteCount == 0 then return 1 end 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 for k, v in pairs(globalCsv.worldline_gift_base_10) do 1755 for k, v in pairs(globalCsv.worldline_gift_base_10) do
1756 worldline_gift_base_10[k] = {v} 1756 worldline_gift_base_10[k] = {v}
1757 end 1757 end
1758 for k, v in pairs(globalCsv.worldline_gift_base_1) do 1758 for k, v in pairs(globalCsv.worldline_gift_base_1) do
1759 worldline_gift_base_1[k] = {v} 1759 worldline_gift_base_1[k] = {v}
1760 end 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 1761 for k, v in pairs(globalCsv.worldline_gift_magnification_1) do
1765 worldline_gift_magnification_1[k] = {v} 1762 worldline_gift_magnification_1[k] = {v}
1766 end 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 local gift_base_10 = (math.randWeight(worldline_gift_base_10, 1) or 0) * 10 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 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 local gift_magnification_1 = math.randWeight(worldline_gift_magnification_1, 1) or 0 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 worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1 1775 worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1
1776 worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points 1776 worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points
1777 role:updateProperty({field = "worldChangePoints", value = worldChangePoints}) 1777 role:updateProperty({field = "worldChangePoints", value = worldChangePoints})
@@ -35,10 +35,17 @@ local function handle_timeout() @@ -35,10 +35,17 @@ local function handle_timeout()
35 skynet.timeout(100, handle_timeout) 35 skynet.timeout(100, handle_timeout)
36 end 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 function start_agent_timer() 44 function start_agent_timer()
39 if agentInfo.open_timer then return end 45 if agentInfo.open_timer then return end
40 agentInfo.open_timer = true 46 agentInfo.open_timer = true
41 skynet.timeout(150, handle_timeout) 47 skynet.timeout(150, handle_timeout)
  48 + skynet.timeout(6000, handle_gc)
42 end 49 end
43 50
44 function cancel_agent_timer() 51 function cancel_agent_timer()
src/models/Activity.lua
@@ -93,6 +93,8 @@ Activity.schema = { @@ -93,6 +93,8 @@ Activity.schema = {
93 93
94 act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100} 94 act34 = {"table", {}}, -- 战令记录{unlock = 1, freeR = "", payR = "", lvl = 10, sum = 100}
95 act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1} 95 act36 = {"table", {}}, -- 每日活跃签到 {0=day, 1=1,2=1,3=1}
  96 +
  97 + reset20 = {"number", 1}, -- 重置扭蛋机
96 } 98 }
97 99
98 function Activity:data() 100 function Activity:data()
@@ -121,6 +123,8 @@ function Activity:data() @@ -121,6 +123,8 @@ function Activity:data()
121 123
122 act34 = self:getProperty("act34"), 124 act34 = self:getProperty("act34"),
123 act36 = self:getProperty("act36"), 125 act36 = self:getProperty("act36"),
  126 +
  127 + reset20 = self:getProperty("reset20")
124 } 128 }
125 end 129 end
126 130
@@ -207,6 +211,24 @@ function Activity:isOpenById(id, activityType) @@ -207,6 +211,24 @@ function Activity:isOpenById(id, activityType)
207 return self._isOpen[id] 211 return self._isOpen[id]
208 end 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 function Activity:getActData(actType) 232 function Activity:getActData(actType)
211 actType = checkActivityType(actType) 233 actType = checkActivityType(actType)
212 return self:getProperty("act" .. actType) 234 return self:getProperty("act" .. actType)
@@ -756,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = { @@ -756,8 +778,14 @@ activityFunc[Activity.ActivityType.Gachakon] = {
756 self:updateActData(actType, {}, not notify) 778 self:updateActData(actType, {}, not notify)
757 end, 779 end,
758 ["crossDay"] = function(self, actType, notify) 780 ["crossDay"] = function(self, actType, notify)
  781 + self:updateResetData(actType, 1)
759 self:updateActData(actType, {}, not notify) 782 self:updateActData(actType, {}, not notify)
760 end, 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,6 +893,15 @@ function Activity:refreshWeekData(notify)
865 end 893 end
866 end 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 function Activity:checkActivity(notNotify, activityType, ...) 905 function Activity:checkActivity(notNotify, activityType, ...)
869 if not activityType then return end 906 if not activityType then return end
870 if not self:isOpen(activityType) then return end 907 if not self:isOpen(activityType) then return end
src/models/RoleLog.lua
@@ -66,8 +66,8 @@ local ItemReason = { @@ -66,8 +66,8 @@ local ItemReason = {
66 shopBuy = 150, -- 商店购买 66 shopBuy = 150, -- 商店购买
67 monthCardReward = 151, --月卡奖励 67 monthCardReward = 151, --月卡奖励
68 smonthCardReward = 152, --特刊奖励 68 smonthCardReward = 152, --特刊奖励
69 - itemConvertmonthCard = 153, --兑换月卡  
70 - itemConvertsmonthCard = 154, --兑换特刊 69 + itemConvertSpecial = 153, --兑换月卡/战令/探索指令 特殊道具
  70 + buyDiamondCardReward = 154, --购买钻石额外赠送奖励
71 71
72 advHang = 301, -- 拾荒挂机 72 advHang = 301, -- 拾荒挂机
73 hangBattle = 302, -- 挂机战斗 73 hangBattle = 302, -- 挂机战斗
src/models/RolePlugin.lua
@@ -2448,6 +2448,12 @@ function RolePlugin.bind(Role) @@ -2448,6 +2448,12 @@ function RolePlugin.bind(Role)
2448 self:updateProperty({field = "rechargeF", value = rechargeF}) 2448 self:updateProperty({field = "rechargeF", value = rechargeF})
2449 end 2449 end
2450 self:gainDiamond({count = diamondCount, isRecharge = true, sid = params.sid, log = {desc = "recharge", int1 = id}}) 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 elseif rechargeData.shop == 2 then --通行证商店 2457 elseif rechargeData.shop == 2 then --通行证商店
2452 --签收 + 订阅奖励 2458 --签收 + 订阅奖励
2453 local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id) 2459 local tmpreward, _ = self.storeData:onBuyCard(rechargeData.type, rechargeData.time, rechargeData.id, rechargeData.activity_id)
@@ -2458,10 +2464,6 @@ function RolePlugin.bind(Role) @@ -2458,10 +2464,6 @@ function RolePlugin.bind(Role)
2458 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}}) 2464 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2459 2465
2460 self:checkTaskEnter("BuyLimitPack", {id = id}) 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 else 2467 else
2466 skynet.error("[recharge] invalid recharge shop type " .. id) 2468 skynet.error("[recharge] invalid recharge shop type " .. id)
2467 return 3 2469 return 3
@@ -3016,6 +3018,16 @@ function RolePlugin.bind(Role) @@ -3016,6 +3018,16 @@ function RolePlugin.bind(Role)
3016 return levelBnous[SystemBnousType.ChangeBuyCount] or 0 3018 return levelBnous[SystemBnousType.ChangeBuyCount] or 0
3017 end 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 function Role:getLevelBnous() 3031 function Role:getLevelBnous()
3020 local levelBnous = {} 3032 local levelBnous = {}
3021 local curLevel = self:getProperty("level") 3033 local curLevel = self:getProperty("level")