Commit 686d4fd674e8d9ecc4a51d13f19ea194f0d7e4e5

Authored by liuzujun
1 parent 6a2b449c

兑换活动支持兑换多个, 新增卡池

src/actions/ActivityAction.lua
@@ -268,7 +268,8 @@ function _M.exchangeRpc(agent, data) @@ -268,7 +268,8 @@ function _M.exchangeRpc(agent, data)
268 local msg = MsgPack.unpack(data) 268 local msg = MsgPack.unpack(data)
269 local actid = msg.actid 269 local actid = msg.actid
270 local id = msg.id 270 local id = msg.id
271 - if not role.activity:isOpenById(actid) then return 1 end 271 + local count = msg.count
  272 + if not role.activity:isOpenById(actid, "Exchange") then return 1 end
272 273
273 local exchangeCfg = csvdb["activity_exchangeCsv"][actid] 274 local exchangeCfg = csvdb["activity_exchangeCsv"][actid]
274 if not exchangeCfg then return 2 end 275 if not exchangeCfg then return 2 end
@@ -278,13 +279,16 @@ function _M.exchangeRpc(agent, data) @@ -278,13 +279,16 @@ function _M.exchangeRpc(agent, data)
278 local curCount = exchangeData[id] or 0 279 local curCount = exchangeData[id] or 0
279 local actCfg = exchangeCfg[id] 280 local actCfg = exchangeCfg[id]
280 local limitArr = actCfg.limit:toArray(true, "=") 281 local limitArr = actCfg.limit:toArray(true, "=")
281 - if curCount >= limitArr[2] then return 4 end 282 + if curCount + count > limitArr[2] then return 4 end
282 283
283 local costs = actCfg.goods:toNumMap() 284 local costs = actCfg.goods:toNumMap()
  285 + for k,v in pairs(costs) do
  286 + costs[k] = v * count
  287 + end
284 if not role:checkItemEnough(costs) then return 5 end 288 if not role:checkItemEnough(costs) then return 5 end
285 role:costItems(costs, {log = {desc = "actExchange", int1 = actid, int2 = id}}) 289 role:costItems(costs, {log = {desc = "actExchange", int1 = actid, int2 = id}})
286 290
287 - curCount = curCount + 1 291 + curCount = curCount + count
288 exchangeData[id] = curCount 292 exchangeData[id] = curCount
289 curData[actid] = exchangeData 293 curData[actid] = exchangeData
290 role.activity:updateActData("Exchange", curData) 294 role.activity:updateActData("Exchange", curData)
@@ -304,7 +308,7 @@ function _M.gachakonRpc(agent, data) @@ -304,7 +308,7 @@ function _M.gachakonRpc(agent, data)
304 308
305 if count > 10 then return end 309 if count > 10 then return end
306 310
307 - if not role.activity:isOpenById(actid) then return 1 end 311 + if not role.activity:isOpenById(actid, "Gachakon") then return 1 end
308 312
309 local actCtrlData = csvdb["activity_ctrlCsv"][actid] 313 local actCtrlData = csvdb["activity_ctrlCsv"][actid]
310 if not actCtrlData then return 2 end 314 if not actCtrlData then return 2 end
@@ -365,7 +369,7 @@ function _M.hangDropRpc(agent, data) @@ -365,7 +369,7 @@ function _M.hangDropRpc(agent, data)
365 local role = agent.role 369 local role = agent.role
366 local msg = MsgPack.unpack(data) 370 local msg = MsgPack.unpack(data)
367 local actid = msg.actid 371 local actid = msg.actid
368 - if not role.activity:isOpenById(actid) then return 1 end 372 + if not role.activity:isOpenById(actid, "HangDrop") then return 1 end
369 373
370 local actCfg = csvdb["activity_putCsv"][actid] 374 local actCfg = csvdb["activity_putCsv"][actid]
371 if not actCfg then return 2 end 375 if not actCfg then return 2 end
@@ -382,7 +386,7 @@ function _M.hangDropRpc(agent, data) @@ -382,7 +386,7 @@ function _M.hangDropRpc(agent, data)
382 if type == 1 then 386 if type == 1 then
383 local actId = arr[2] 387 local actId = arr[2]
384 local carbonId = arr[3] 388 local carbonId = arr[3]
385 - if not role.activity:isOpenById(actid) then return 3 end 389 + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 3 end
386 local clInfo = role.activity:getActData("ChallengeLevel") or {} 390 local clInfo = role.activity:getActData("ChallengeLevel") or {}
387 if not clInfo[carbonId] then 391 if not clInfo[carbonId] then
388 break 392 break
@@ -439,7 +443,7 @@ function _M.startBattleRpc(agent, data) @@ -439,7 +443,7 @@ function _M.startBattleRpc(agent, data)
439 local actid = msg.actid 443 local actid = msg.actid
440 local id = msg.id 444 local id = msg.id
441 local count = msg.count 445 local count = msg.count
442 - if not role.activity:isOpenById(actid) then return 1 end 446 + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
443 447
444 local actCfg = csvdb["activity_battleCsv"][actid] 448 local actCfg = csvdb["activity_battleCsv"][actid]
445 if not actCfg then return 2 end 449 if not actCfg then return 2 end
@@ -542,7 +546,7 @@ function _M.endBattleRpc(agent, data) @@ -542,7 +546,7 @@ function _M.endBattleRpc(agent, data)
542 local isWin = msg.isWin 546 local isWin = msg.isWin
543 local heros = msg.heros 547 local heros = msg.heros
544 local support = msg.support 548 local support = msg.support
545 - if not role.activity:isOpenById(actid) then return 1 end 549 + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
546 550
547 if not role.__actBattleCache then return 2 end 551 if not role.__actBattleCache then return 2 end
548 552
@@ -686,7 +690,7 @@ function _M.battleRankRpc(agent, data) @@ -686,7 +690,7 @@ function _M.battleRankRpc(agent, data)
686 local role = agent.role 690 local role = agent.role
687 local msg = MsgPack.unpack(data) 691 local msg = MsgPack.unpack(data)
688 local actid = msg.actid 692 local actid = msg.actid
689 - if not role.activity:isOpenById(actid) then return 1 end 693 + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
690 694
691 local rankInfo = role:getRankInfoCommon(RANK_TYPE.ActBattleBoss) 695 local rankInfo = role:getRankInfoCommon(RANK_TYPE.ActBattleBoss)
692 696
@@ -701,7 +705,7 @@ function _M.battleMilestoneRpc(agent, data) @@ -701,7 +705,7 @@ function _M.battleMilestoneRpc(agent, data)
701 local id = msg.id 705 local id = msg.id
702 local index = msg.index 706 local index = msg.index
703 707
704 - if not role.activity:isOpenById(actid) then return 1 end 708 + if not role.activity:isOpenById(actid, "ChallengeLevel") then return 1 end
705 709
706 local actCfg = csvdb["activity_mileageCsv"][actid] 710 local actCfg = csvdb["activity_mileageCsv"][actid]
707 if not actCfg then return 3 end 711 if not actCfg then return 3 end
src/actions/GmAction.lua
@@ -529,6 +529,16 @@ function _M.guide(role, pms) @@ -529,6 +529,16 @@ function _M.guide(role, pms)
529 return "成功" 529 return "成功"
530 end 530 end
531 531
  532 +table.insert(helpDes, {"挑战关卡次数", "actbattle"})
  533 +function _M.actbattle(role, pms)
  534 + if not role.activity:isOpen("ChallengeLevel") then return end
  535 + local actData = role.activity:getActData("ChallengeLevel")
  536 + actData["ticket"] = 100
  537 + role.activity:updateActData("ChallengeLevel", actData)
  538 +
  539 + return "成功"
  540 +end
  541 +
532 function _M.helpRpc(agent, data) 542 function _M.helpRpc(agent, data)
533 SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes})) 543 SendPacket(actionCodes.Gm_helpRpc, MsgPack.pack({help = helpDes}))
534 return true 544 return true
src/actions/HeroAction.lua
@@ -714,6 +714,7 @@ end @@ -714,6 +714,7 @@ end
714 function _M.drawHeroRpc(agent, data) 714 function _M.drawHeroRpc(agent, data)
715 local role = agent.role 715 local role = agent.role
716 local msg = MsgPack.unpack(data) 716 local msg = MsgPack.unpack(data)
  717 + local actid = msg.actid
717 718
718 if not role:isFuncUnlock(FuncUnlock.GetHero) then return 1 end 719 if not role:isFuncUnlock(FuncUnlock.GetHero) then return 1 end
719 local btype = msg.pool -- 1 2 3 4 5 卡池类型 4新手卡池 5心愿卡池 720 local btype = msg.pool -- 1 2 3 4 5 卡池类型 4新手卡池 5心愿卡池
@@ -726,11 +727,32 @@ function _M.drawHeroRpc(agent, data) @@ -726,11 +727,32 @@ function _M.drawHeroRpc(agent, data)
726 end 727 end
727 end 728 end
728 729
  730 + -- 活动卡池
  731 + if actid then
  732 + if not role.activity:isOpenById(actid, "ActHeroPool") then return end
  733 + local cfg = csvdb["activity_ctrlCsv"][actid]
  734 + if not cfg then return end
  735 +
  736 + btype = cfg.condition
  737 + end
  738 +
729 if btype == 1 then 739 if btype == 1 then
730 -- 判断定向卡池活动开启 740 -- 判断定向卡池活动开启
731 if not role.activity:isOpen("RaceDraw") then 741 if not role.activity:isOpen("RaceDraw") then
732 return 742 return
733 end 743 end
  744 + elseif btype == 2 then
  745 + if role:getProperty("newerGuide") ~= "8=1" then
  746 + -- 判断普通卡池
  747 + if role.activity:isOpen("WishHeroPool") then
  748 + return
  749 + end
  750 + end
  751 + elseif btype == 5 then
  752 + -- 判断心愿单卡池
  753 + if not role.activity:isOpen("WishHeroPool") then
  754 + return
  755 + end
734 end 756 end
735 757
736 local buildTypeData = csvdb["build_typeCsv"][btype] 758 local buildTypeData = csvdb["build_typeCsv"][btype]
@@ -952,7 +974,7 @@ function _M.drawHeroRpc(agent, data) @@ -952,7 +974,7 @@ function _M.drawHeroRpc(agent, data)
952 }) 974 })
953 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 975 SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组
954 976
955 - if btype == 1 or btype == 2 then 977 + if (buildTypeData["can_feedback"] or 0) == 1 then
956 -- 达到一定次数,给响应奖励 978 -- 达到一定次数,给响应奖励
957 local oldVal = role:getProperty("repayHero") or 0 979 local oldVal = role:getProperty("repayHero") or 0
958 local newVal = oldVal + drawCount[drawType] 980 local newVal = oldVal + drawCount[drawType]
1 -Subproject commit bb227076bc3bb79747546fdddc380c8018e7e82b 1 +Subproject commit 2930f3efda2c82192c931929584fd2bc3f66e647
src/models/Activity.lua
@@ -24,6 +24,9 @@ Activity.ActivityType = { @@ -24,6 +24,9 @@ Activity.ActivityType = {
24 Exchange = 18, -- 兑换活动 24 Exchange = 18, -- 兑换活动
25 HangDrop = 19, -- 挂机掉落活动 25 HangDrop = 19, -- 挂机掉落活动
26 Gachakon = 20, -- 扭蛋活动 26 Gachakon = 20, -- 扭蛋活动
  27 +
  28 + WishHeroPool = 23, -- 心愿卡池
  29 + ActHeroPool = 24, -- 活动卡池
27 } 30 }
28 31
29 32
@@ -41,6 +44,13 @@ function Activity:ctor(properties) @@ -41,6 +44,13 @@ function Activity:ctor(properties)
41 self._isOpen = {} 44 self._isOpen = {}
42 end 45 end
43 46
  47 +function Activity:getType(actType)
  48 + if type(actType) == "string" then
  49 + actType = Activity.ActivityType[actType]
  50 + end
  51 + return actType or 0
  52 +end
  53 +
44 54
45 Activity.schema = { 55 Activity.schema = {
46 actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} 56 actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time}
@@ -153,7 +163,12 @@ function Activity:isOpen(activityType) @@ -153,7 +163,12 @@ function Activity:isOpen(activityType)
153 return false 163 return false
154 end 164 end
155 165
156 -function Activity:isOpenById(id) 166 +function Activity:isOpenById(id, activityType)
  167 + activityType = checkActivityType(activityType)
  168 + local cfg = csvdb["activity_ctrlCsv"][id]
  169 + if not cfg then return false end
  170 + if cfg.showType ~= activityType then return false end
  171 +
157 return self._isOpen[id] 172 return self._isOpen[id]
158 end 173 end
159 174