Commit 317a46a9ed113032c8ee1709008c60cedfe025c0

Authored by liuzujun
1 parent e68ee005

添加特权卡

src/ProtocolCode.lua
... ... @@ -185,9 +185,9 @@ actionCodes = {
185 185 Store_iosRechargeRpc = 557,
186 186 Store_shopBuyRpc = 558,
187 187 Store_updateproperty = 559,
188   - Store_getFreeChectRpc = 559,
189   - Store_getGrowFundRewardRpc = 560, --成长助力奖励
190   - Store_getBattlePassRewardRpc = 561, --赛季卡奖励
  188 + Store_getFreeChectRpc = 560,
  189 + Store_getGrowFundRewardRpc = 561, --成长助力奖励
  190 + Store_getBattlePassRewardRpc = 562, --赛季卡奖励
191 191  
192 192  
193 193 Email_listRpc = 600,
... ...
src/actions/DinerAction.lua
... ... @@ -261,7 +261,14 @@ function _M.expediteSellRpc( agent, data )
261 261 role.dinerData:setProperty("expedite",count+1)
262 262 role.dinerData:notifyUpdateProperty("expedite", count+1)
263 263 local gift = reward:toNumMap()
  264 +
  265 + -- 特权卡获取加速获得额外道具
  266 + local coef = role.storeData:getProduceItemSpeedCoef()
264 267 for k, v in pairs(gift) do
  268 + if coef > 1 then
  269 + v = math.floor(v * coef)
  270 + gift[k] = v
  271 + end
265 272 if k == ItemId.Gold then
266 273 role:checkTaskEnter("FoodSellGold", {count = v})
267 274 end
... ...
src/actions/HangAction.lua
... ... @@ -48,7 +48,10 @@ local function checkReward(role)
48 48 curIC = curIC + count
49 49 end
50 50 end
51   - local selfFC = role:getProperty("hangBagLimit") --再加上月卡的栏位 TODO
  51 +
  52 + -- 特权卡挂机额外栏位
  53 + local privExtraCnt = role.storeData:getHangSlotExtraCount()
  54 + local selfFC = role:getProperty("hangBagLimit") + privExtraCnt
52 55 local selfIC = selfFC * globalCsv.idle_field_limit
53 56  
54 57 local function randomItem()
... ... @@ -391,6 +394,15 @@ function _M.quickRpc(agent , data)
391 394 local cur = pool[math.randWeight(pool, 3)]
392 395 reward[cur[1]] = (reward[cur[1]] or 0) + cur[2]
393 396 end
  397 +
  398 + -- 特权卡获取加速获得额外道具
  399 + local coef = role.storeData:getProduceItemSpeedCoef()
  400 + if coef > 1 then
  401 + for k, cnt in pairs(reward) do
  402 + reward[k] = math.floor(cnt * coef)
  403 + end
  404 + end
  405 +
394 406 local change
395 407 reward, change = role:award(reward, {log = {desc = "quickHang", int1 = hangInfo.carbonId}})
396 408 if reward[ItemId.Gold] then
... ...
src/actions/HeroAction.lua
... ... @@ -921,32 +921,33 @@ function _M.drawHeroRpc(agent, data)
921 921 return true
922 922 end
923 923  
924   --- function _M.repayHeroRpc(agent, data)
925   --- local role = agent.role
  924 +function _M.repayHeroRpc(agent, data)
  925 + local role = agent.role
926 926  
927   --- local repayHero = role:getProperty("repayHero")
928   --- if repayHero < globalCsv.draw_super_repay_count then
929   --- return
930   --- end
  927 + local repayHero = role:getProperty("repayHero")
  928 + if repayHero < globalCsv.draw_free_count then
  929 + return
  930 + end
  931 + local result = repayHero - globalCsv.draw_free_count
931 932  
932   --- role:updateProperty({field = "repayHero", value = 0})
933   --- local id = math.randWeight(csvdb["build_giftCsv"], "pool_1")
934   -
935   --- local reward = {}
936   --- local itemData = csvdb["itemCsv"][id]
937   --- if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then
938   --- local fragId = itemData.id - ItemStartId.Hero
939   --- local heroData = csvdb["unitCsv"][fragId]
940   --- local count = globalCsv.draw_unit_tofragment[heroData.rare]
941   --- role:award({[fragId] = count}, {log = {desc = "heroRepay"}})
942   --- reward = {id = fragId, count = count, from = id, fcount = 1}
943   --- else
944   --- role:award({[id] = 1}, {log = {desc = "heroRepay"}})
945   --- reward = {id = id, count = 1}
946   --- end
947   --- role:log("hero_action", {desc = "heroRepay"})
948   --- SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward}))
949   --- return true
950   --- end
  933 + role:updateProperty({field = "repayHero", value = result})
  934 + local id = math.randWeight(csvdb["build_giftCsv"], "pool_1")
  935 +
  936 + local reward = {}
  937 + local itemData = csvdb["itemCsv"][id]
  938 + if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then
  939 + local fragId = itemData.id - ItemStartId.Hero
  940 + local heroData = csvdb["unitCsv"][fragId]
  941 + local count = globalCsv.draw_unit_tofragment[heroData.rare]
  942 + role:award({[fragId] = count}, {log = {desc = "heroRepay"}})
  943 + reward = {id = fragId, count = count, from = id, fcount = 1}
  944 + else
  945 + role:award({[id] = 1}, {log = {desc = "heroRepay"}})
  946 + reward = {id = id, count = 1}
  947 + end
  948 + role:log("hero_action", {desc = "heroRepay", int1=result})
  949 + SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward}))
  950 + return true
  951 +end
951 952  
952 953 return _M
953 954 \ No newline at end of file
... ...
src/actions/RoleAction.lua
... ... @@ -459,7 +459,12 @@ function _M.openTimeBoxRpc(agent, data)
459 459 local msg = MsgPack.unpack(data)
460 460 local oper = msg.oper -- 操作 1 - 2
461 461 local slot = msg.slot -- 位置 1 - 6
462   - if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot)) then return end
  462 +
  463 + -- 特权卡时间箱额外栏位
  464 + local privExtraCnt = role.storeData:getTimeBoxSlotExtraCount()
  465 + if oper == 1 then
  466 + if math.illegalNum(slot, 1, role:getFuncLv(FuncOpenType.TimeBoxSlot) + privExtraCnt) then return end
  467 + end
463 468  
464 469 local boxL = role:getProperty("boxL")
465 470 local reward, change = {}
... ... @@ -635,7 +640,7 @@ function _M.taskRpc(agent, data)
635 640  
636 641 if not role:isFuncUnlock(FuncUnlock.TaskAchiv) then return end
637 642  
638   - local taskType = msg.type -- 1 日常 2 周
  643 + local taskType = msg.type -- 1 日常 2 周
639 644 local taskId = msg.id --任务id
640 645 local roleField = {"dTask", "wTask"}
641 646 if not roleField[taskType] then return 1 end
... ... @@ -655,9 +660,11 @@ function _M.taskRpc(agent, data)
655 660  
656 661 role:changeUpdates({
657 662 { type = roleField[taskType], field = {"t", taskId}, value = -1 },
658   - { type = roleField[taskType], field = "a", value = active}
  663 + { type = roleField[taskType], field = "a", value = active},
659 664 })
660 665  
  666 + role:updateProperty({field = "battlePoint", role:getProperty("battlePoint") + 100})
  667 +
661 668 SendPacket(actionCodes.Role_taskRpc, MsgPack.pack(role:packReward(reward, change)))
662 669 return true
663 670 end
... ... @@ -1047,6 +1054,8 @@ function _M.goldBuyRpc(agent, data)
1047 1054 if goldC == 0 then
1048 1055 return 3
1049 1056 end
  1057 + local coef = role.storeData:getGearExchangeCoef()
  1058 + goldC = goldC * coef
1050 1059 role.dailyData:updateProperty({field = "goldBuyT", value = curT + 1})
1051 1060 role:costItems({[ItemId.Diamond] = costD}, {log = {desc = "goldBuy"}})
1052 1061 local reward, change = role:award({[ItemId.Gold] = goldC}, {log = {desc = "goldBuy"}})
... ...
src/actions/StoreAction.lua
... ... @@ -323,6 +323,7 @@ function _M.getFreeCheckRpc(agent, data)
323 323 role.storeData:updateProperty({field = "payR", value = rechargeRecord})
324 324  
325 325 SendPacket(actionCodes.Store_getFreeChectRpc, MsgPack.pack({reward = reward}))
  326 + return true
326 327 end
327 328  
328 329 function _M.getGrowFundRewardRpc(agent, data)
... ... @@ -358,6 +359,7 @@ function _M.getGrowFundRewardRpc(agent, data)
358 359 local reward, _ = role:award(gift, {log = {desc = "grownFund", int1 = id}})
359 360  
360 361 SendPacket(actionCodes.Store_getGrowFundRewardRpc, MsgPack.pack({reward = reward}))
  362 + return true
361 363 end
362 364  
363 365 function _M.getBattlePassRewardRpc(agent, data)
... ... @@ -406,6 +408,7 @@ function _M.getBattlePassRewardRpc(agent, data)
406 408 local reward, _ = role:award(gift, {log = {desc = "battleCard", int1 = id}})
407 409  
408 410 SendPacket(actionCodes.Store_getBattlePassRewardRpc, MsgPack.pack({reward = reward}))
  411 + return true
409 412 end
410 413  
411 414 return _M
412 415 \ No newline at end of file
... ...
src/models/Daily.lua
... ... @@ -25,6 +25,8 @@ Daily.schema = {
25 25  
26 26 advSupRe = {"number", 0}, -- 冒险支援效果刷新次数
27 27 goldBuyT = {"number", 0}, -- 金币购买次数
  28 +
  29 + unlockPool = {"table", {}} -- 解锁的属性卡池
28 30 }
29 31  
30 32 function Daily:updateProperty(params)
... ...
src/models/Role.lua
... ... @@ -20,6 +20,7 @@ function Role:ctor( properties )
20 20 Role.super.ctor(self, properties)
21 21 self.ignoreHeartbeat = false
22 22 self.dailyData = nil
  23 + self.storeData = nil
23 24 self.heros = {}
24 25 self.runeBag = {}
25 26 self.advData = nil
... ... @@ -140,12 +141,13 @@ Role.schema = {
140 141  
141 142 rechargeF = {"table", {}}, -- 是否首次充值某一项 -- —{[id] = 1} -- 不存在就是没有充值过
142 143 dinerS = {"table", {}}, -- 美食币商城 购买记录 {[id] = count}
  144 + battlePoint = {"number", 0}, -- 赛季卡使用的活跃点
143 145  
144 146 rmbC = {"number", 0}, -- 人民币重置额
145 147  
146 148 emailSync = {"number", 0}, -- 已经同步到的邮件Id
147 149  
148   - -- repayHero = {"number", 0}, -- 超级招募 回馈
  150 + repayHero = {"number", 0}, -- 超级招募 回馈
149 151 floorHero = {"table", {}}, -- 招募保底 -- {[poolId] = count}
150 152 ssrUp = {"table", {}}, -- ssr up -- {[poolId] = count}
151 153 newerDraw = {"table", {}}, -- 新手池子 {N, 1} 抽了多少次, 是否出了ssr
... ... @@ -360,6 +362,7 @@ function Role:data()
360 362  
361 363 rechargeF = self:getProperty("rechargeF"),
362 364 dinerS = self:getProperty("dinerS"),
  365 + battlePoint = self:getProperty("battlePoint"),
363 366  
364 367 rmbC = self:getProperty("rmbC"),
365 368 -- repayHero = self:getProperty("repayHero"),
... ...
src/models/Store.lua
... ... @@ -16,7 +16,8 @@ Store.schema = {
16 16 battleCardEx = {"number", 0}, -- 赛季卡过期时间戳
17 17 battleFR = {"string", ""}, -- 免费赛季卡领取记录
18 18 battleLR = {"string", ""}, -- 付费赛季卡领取记录
19   - limitTPack = {"table", {}} -- 限时礼包 {id=expire_ts}
  19 + limitTPack = {"table", {}}, -- 限时礼包 {id=expire_ts}
  20 + privCardEx = {"number", 0} -- 特权卡过期时间戳
20 21 }
21 22  
22 23 function Store:updateProperty(params)
... ... @@ -81,19 +82,95 @@ function Store:sendMonthCardEmail()
81 82 end
82 83 end
83 84  
  85 +function Store:isMonthCardExpire()
  86 + local timeNow = skynet.timex()
  87 + local ts = self:getProperty("monthCardEx")
  88 + return ts < timeNow
  89 +end
  90 +
  91 +function Store:isSuperMonthCardExpire()
  92 + local timeNow = skynet.timex()
  93 + local ts = self:getProperty("smonthCardEx")
  94 + return ts < timeNow
  95 +end
  96 +
  97 +function Store:isPrivCardExpire()
  98 + local timeNow = skynet.timex()
  99 + local ts = self:getProperty("privCardEx")
  100 + return ts < timeNow
  101 +end
  102 +
  103 +function Store:isBattleCardExpire()
  104 + local timeNow = skynet.timex()
  105 + local ts = self:getProperty("battleCardEx")
  106 + return ts < timeNow
  107 +end
  108 +
  109 +-- 挂机栏位 特权卡额外个数
  110 +function Store:getHangSlotExtraCount()
  111 + if self:isPrivCardExpire() then
  112 + return 0
  113 + end
  114 +
  115 + return 4
  116 +end
  117 +
  118 +-- 探索加速/餐厅加速 特权卡系数
  119 +function Store:getProduceItemSpeedCoef()
  120 + if self:isPrivCardExpire() then
  121 + return 1
  122 + end
  123 +
  124 + return 1 + 0.25
  125 +end
  126 +
  127 +-- 拆解室栏位 特权卡额外个数
  128 +function Store:getTimeBoxSlotExtraCount()
  129 + if self:isPrivCardExpire() then
  130 + return 0
  131 + end
  132 +
  133 + return 3
  134 +end
  135 +
  136 +-- 齿轮兑换 特权卡系数
  137 +function Store:getGearExchangeCoef()
  138 + if self:isPrivCardExpire() then
  139 + return 1
  140 + end
  141 +
  142 + return 1 + 0.5
  143 +end
  144 +
84 145 -- 购买通行证
85 146 function Store:onBuyCard(type, duration)
86   - duration = duration == "" and 0 or tonumber(duration)
87 147 local timeNow = skynet.timex()
88 148 if type == CardType.NormalMonthCard then
89   - self:updateProperty({field = "monthCardEx", value = timeNow + duration})
  149 + if self:isMonthCardExpire() then
  150 + self:updateProperty({field = "monthCardEx", value = timeNow + duration})
  151 + else
  152 + self:updateProperty({field = "monthCardEx", value = self:getProperty("monthCardEx") + duration})
  153 + end
90 154 elseif type == CardType.SuperMonthCard then
91   - self:updateProperty({field = "smonthCardEx", value = timeNow + duration})
  155 + if self:isSuperMonthCardExpire() then
  156 + self:updateProperty({field = "smonthCardEx", value = timeNow + duration})
  157 + else
  158 + self:updateProperty({field = "smonthCardEx", value = self:getProperty("smonthCardEx") + duration})
  159 + end
92 160 elseif type == CardType.PrivilegeCard then
  161 + if self:isPrivCardExpire() then
  162 + self:updateProperty({field = "privCardEx", value = timeNow + duration})
  163 + else
  164 + self:updateProperty({field = "privCardEx", value = self:getProperty("privCardEx") + duration})
  165 + end
93 166 elseif type == CardType.GrowFund then
94 167 self:updateProperty({field = "growFund", value = 1})
95 168 elseif type == CardType.BattleCard then
96   - self:updateProperty({field = "battleCardEx", value = timeNow + duration})
  169 + if self:isBattleCardExpire() then
  170 + self:updateProperty({field = "battleCardEx", value = timeNow + duration})
  171 + else
  172 + self:updateProperty({field = "battleCardEx", value = self:getProperty("battleCardEx") + duration})
  173 + end
97 174 end
98 175 end
99 176  
... ... @@ -128,6 +205,7 @@ function Store:data()
128 205 battleCardEx = self:getProperty("battleCardEx"),
129 206 battleCardR = self:getProperty("battleCardR"),
130 207 limitTPack = self:getProperty("limitTPack"),
  208 + privCardEx = self:getProperty("privCardEx"),
131 209 }
132 210 end
133 211  
... ...