diff --git a/src/GlobalVar.lua b/src/GlobalVar.lua index 86f5ba4..27e4807 100644 --- a/src/GlobalVar.lua +++ b/src/GlobalVar.lua @@ -304,4 +304,10 @@ TriggerEventType = { HangPass = 1, LevelUp = 2, TowerPass = 3, +} + +DrawCardType = { + SpecifyDraw = 1, + NormalDraw = 2, + FriendDraw = 3 } \ No newline at end of file diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 4279a6b..1ba9e2b 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -184,11 +184,22 @@ function _M.startHangRpc(agent, data) local role = agent.role local msg = MsgPack.unpack(data) local chapterId = msg.chapterId --关卡id + local campId = msg.campId or 2 --营地id local format = msg.format --编队 + local index = msg.index or 1--时间索引id - local chapterData = csvdb["adv_chapterCsv"][chapterId] + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] if not chapterData then return 1 end - if chapterData.idleReward == "" then return 2 end --没有奖励 没有挂机 + local campSiteData = chapterData[campId] + if not campSiteData then return 1 end + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 + + local adv_idle_time = globalCsv.adv_idle_time[index] + local adv_idle_energy = globalCsv.adv_idle_energy[index] + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index] + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then + return 2 + end local advHang = role:getProperty("advHang") if advHang[chapterId] then return 3 end --正在挂机 @@ -201,7 +212,7 @@ function _M.startHangRpc(agent, data) if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 - if not role:checkAdvCount(chapterData.limitlevel) then return 7 end -- 是否有体力 + if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 @@ -220,7 +231,7 @@ function _M.startHangRpc(agent, data) + 0.226 * player["hit"] + 0.26 * player["miss"] - if battleV < chapterData.idleValue then return 9 end -- 战斗力是否满足 + if battleV < campSiteData.idleValue then return 9 end -- 战斗力是否满足 local info = {} info.format = {} @@ -230,7 +241,9 @@ function _M.startHangRpc(agent, data) for slot, heroId in pairs(format.heros) do info.format.heros[slot] = heroId end - info.time = skynet.timex() + chapterData.idleTime --挂机时间 + info.time = skynet.timex() + adv_idle_time --挂机时间 + info.campId = campId + info.index = index -- 没有在战斗 用team来挂机了 把team清掉 if not role:getAdvData():isRunning() then @@ -239,7 +252,7 @@ function _M.startHangRpc(agent, data) role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) - role:changeAdvCount(chapterData.limitlevel) + role:changeAdvCount(adv_idle_energy) role:checkTaskEnter("AdvStart", {id = chapterId}) role:log("adv_action", {desc = "startHang", int1 = chapterId}) @@ -257,13 +270,24 @@ function _M.quickHangRpc(agent, data) local info = advHang[chapterId] if not info then return end - local chapterData = csvdb["adv_chapterCsv"][chapterId] + local index = info.index + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] if not chapterData then return end + + local campSiteData = chapterData[info.campId] + if not campSiteData then return 1 end + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 + + local adv_idle_time = globalCsv.adv_idle_time[index] + if not adv_idle_time then + return 2 + end + local reward, isFull if skynet.timex() >= info.time then return end -- 已经完成了 - local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate) + local cost = math.ceil((info.time - skynet.timex()) / adv_idle_time * globalCsv.adv_idle_quicken) if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}}) @@ -287,11 +311,24 @@ function _M.endHangRpc(agent, data) local info = advHang[chapterId] if not info then return end - local chapterData = csvdb["adv_chapterCsv"][chapterId] + local index = info.index or 1 + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] if not chapterData then return end + local campSiteData = chapterData[info.campId or 2] + if not campSiteData then return 1 end + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 + + local adv_idle_time = globalCsv.adv_idle_time[index] + local adv_idle_energy = globalCsv.adv_idle_energy[index] + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index] + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then + return 2 + end local reward, isFull, change if skynet.timex() >= info.time then + -- 最新需求加成取消 + --[[ -- 英雄加成 local idleUnit = chapterData.idleUnit:toNumMap() local upUnit = 0 @@ -316,15 +353,17 @@ function _M.endHangRpc(agent, data) end if not maxCampsite then return end + ]] + local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 - local idleReward = chapterData.idleReward:toNumMap() + local idleReward = totalReward:toNumMap() for itemId, count in pairs(idleReward) do - idleReward[itemId] = math.floor(count * (maxCampsite.idleValue + upUnit) / 100) + idleReward[itemId] = count * adv_idle_reward_coef end reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) else if cancel then - role:changeAdvCount(-chapterData.limitlevel) + --role:changeAdvCount(-chapterData.limitlevel) -- if role:getProperty("advC") <= 0 then -- isFull = true -- else diff --git a/src/actions/HangAction.lua b/src/actions/HangAction.lua index 9ddbc3c..fa8b946 100644 --- a/src/actions/HangAction.lua +++ b/src/actions/HangAction.lua @@ -69,7 +69,7 @@ local function checkReward(role) while #tempPool > 0 do local idx = math.randWeight(tempPool, 3) local cur = clone(pool[idx]) - if cur[1] ~= 1 then -- 轮空 id + if cur[1] ~= 0 then -- 轮空 id if cur[1] == ItemId.BreakCost and doubleTime > 0 then cur[2] = cur[2] * 2 end @@ -242,6 +242,9 @@ function _M.endBattleRpc(agent, data) role:checkTaskEnter("HangPass", {id = carbonId}) end + if hangInfo.carbonId < carbonId then + hangInfo.carbonId = carbonId + end role:updateProperty({field = "hangInfo", value = hangInfo}) local team = role:getProperty("pvpTC") diff --git a/src/actions/HeroAction.lua b/src/actions/HeroAction.lua index b13484c..2b80a47 100644 --- a/src/actions/HeroAction.lua +++ b/src/actions/HeroAction.lua @@ -938,6 +938,9 @@ function _M.drawHeroRpc(agent, data) local drawCount = {1, 10} -- 抽取次数 if not drawCount[drawType] then return 2 end + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 + -- 计算抽卡消耗品 local cost = {} local lastCount = drawCount[drawType] @@ -976,16 +979,21 @@ function _M.drawHeroRpc(agent, data) end --TODO 活动覆盖 + local actPoolId = role.activity:getActivityPool(btype, subType) + if actPoolId ~= 0 then + poolId = actPoolId + end local unitPool = csvdb["build_unitCsv"][poolId] if not unitPool then return 4 end -- 开始抽 local resultPool = {} - local function fillDrawPool() + local function fillDrawPool(isFloorBack) local condition = {"rare", "camp"} local values = {} + for idx, field in ipairs(condition) do if not values[idx] then local lpool = {} @@ -1001,8 +1009,9 @@ function _M.drawHeroRpc(agent, data) end end - for itemId, oneData in pairs(csvdb["build_poolCsv"]) do - if oneData["pool_" .. poolId] and oneData["pool_" .. poolId] ~= "" then + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do + local pool_str = "pool_" .. poolId + if oneData[pool_str] and oneData[pool_str] ~= "" then local itemData = csvdb["itemCsv"][itemId] while itemData do if itemData.type ~= ItemType.Hero then break end @@ -1013,8 +1022,8 @@ function _M.drawHeroRpc(agent, data) if heroData[field] ~= values[idx] then ok = false break end end if not ok then break end - if oneData["pool_" .. poolId] > 0 then - resultPool[itemId] = {oneData["pool_" .. poolId]} -- itemId, count, 概率 + if oneData[pool_str] > 0 then + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 end break end @@ -1027,9 +1036,13 @@ function _M.drawHeroRpc(agent, data) local ssrCount = 0 local reward = {} for i = 1, drawCount[drawType] do + floorHeroCount = floorHeroCount + 1 + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts resultPool = {} - while not next(resultPool) do - fillDrawPool() + fillDrawPool(isFloorBack) + if not next(resultPool) then + skynet.error("random pool error, poolId:" .. poolId) + return end -- 引导必送 613 丝路德 @@ -1039,6 +1052,10 @@ function _M.drawHeroRpc(agent, data) ssrCount = ssrCount + 1 end + if itemData.quality >= HeroQuality.SR then + floorHeroCount = 0 + end + if role:isHaveHero(itemData.id - ItemStartId.Hero) then local fragId = itemData.id - ItemStartId.Hero local heroData = csvdb["unitCsv"][fragId] @@ -1051,6 +1068,12 @@ function _M.drawHeroRpc(agent, data) end end + if draw_floor_back_counts then + local floorHero = role:getProperty("floorHero") + floorHero[btype] = floorHeroCount + role:setProperty("floorHero", floorHero) + end + if btype == 1 or btype == 2 then local repayHero = role:getProperty("repayHero") or 0 repayHero = repayHero + drawCount[drawType] diff --git a/src/actions/RoleAction.lua b/src/actions/RoleAction.lua index e6a14fc..e883b04 100644 --- a/src/actions/RoleAction.lua +++ b/src/actions/RoleAction.lua @@ -116,14 +116,14 @@ function _M.loginRpc( agent, data ) end if msg.deviceMode then local deviceMode = tostring(msg.deviceMode) - if self:getProperty("dmode") ~= deviceMode then - self:setProperty("dmode", deviceMode) + if role:getProperty("dmode") ~= deviceMode then + role:setProperty("dmode", deviceMode) end end if msg.device then local device = tostring(msg.device) - if self:getProperty("device") ~= device then - self:setProperty("device", device) + if role:getProperty("device") ~= device then + role:setProperty("device", device) end end @@ -299,7 +299,7 @@ function _M.createRpc(agent, data) sid = msg.subId or 0, name = roleName, uname = msg.uname or "", - device = tostring(msg.device) + device = tostring(msg.device), dmode = msg.deviceMode and tostring(msg.deviceMode) or nil }) diff --git a/src/csvdata b/src/csvdata index 3929031..677f005 160000 --- a/src/csvdata +++ b/src/csvdata @@ -1 +1 @@ -Subproject commit 3929031d3194a0403fab720ab39bc40bc79c734d +Subproject commit 677f005ec716d0367b8823833a47f2aba29fe08e diff --git a/src/models/Activity.lua b/src/models/Activity.lua index 9d072f0..4b416de 100644 --- a/src/models/Activity.lua +++ b/src/models/Activity.lua @@ -8,6 +8,8 @@ Activity.ActivityType = { DrawHero = 4, --抽卡周 招募 AdvDraw = 5, --拾荒抽周 资助 OpenBox = 6, --拆解周 时钟箱 + + SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 } @@ -181,13 +183,16 @@ activityFunc[Activity.ActivityType.Sign] = { --loop2:累计招募N次 --loop3:累计资助N次 --loop4:时钟箱拆解N个 -function Activity:checkWeeklyAct(actType, notify, count) +function Activity:checkWeeklyAct(actType, notify, count, pool) local actInfoMap = { [Activity.ActivityType.DrawHero] = {mailId = MailId.ActDrawCardReward, table = "activity_loop2Csv"}, [Activity.ActivityType.AdvDraw] = {mailId = MailId.ActAdvDrawReward, table = "activity_loop3Csv"}, [Activity.ActivityType.OpenBox] = {mailId = MailId.ActOpenBoxReward, table = "activity_loop4Csv"}, [Activity.ActivityType.FoodSell] = {mailId = MailId.ActSellFoodReward, table = "activity_loop1Csv"} } + if actType == Activity.ActivityType.DrawHero and pool == DrawCardType.FriendDraw then + return + end local info = actInfoMap[actType] if not info then return end @@ -234,8 +239,8 @@ end -- 抽卡周 activityFunc[Activity.ActivityType.DrawHero] = { - ["check"] = function(self, actType, notify, count) -- 检查 - self:checkWeeklyAct(actType, notify, count) + ["check"] = function(self, actType, notify, count, pool) -- 检查 + self:checkWeeklyAct(actType, notify, count, pool) end, ["init"] = function(self, actType, isCrossDay, notify) local roundData = self:getProperty("round") @@ -355,5 +360,23 @@ function Activity:getActHangDoubleTime(lastTs, nowTs) return 0 end +-- 获取活动卡池id +function Activity:getActivityPool(mainType, subType) + if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then + return 0 + end + local actData = csvdb["activity_ctrlCsv"][Activity.ActivityType.SsrUpPoolChange] + if not actData then return 0 end + + local poolMap = actData.condition2:toMap(true, "=") + local key = mainType .. "_" .. subType + for k, v in pairs(poolMap) do + if k == key then + return v + end + end + return 0 +end + return Activity diff --git a/src/models/Role.lua b/src/models/Role.lua index 2180ee9..5e05863 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -39,7 +39,7 @@ Role.schema = { sid = {"number", 0}, device = {"string", ""}, dmode = {"string", ""}, - lday = {"string", 0}, + lday = {"number", 0}, banTime = {"number", 0}, banType = {"number", 0}, heartWarning = {"number", 0}, diff --git a/src/models/RoleTask.lua b/src/models/RoleTask.lua index d6ee90b..263ea9a 100644 --- a/src/models/RoleTask.lua +++ b/src/models/RoleTask.lua @@ -212,7 +212,7 @@ local Activity = require("models.Activity") local ActivityListener = { func = "checkActivityTask", listen = { - [TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count")}}, + [TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count"), f("pool")}}, [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}}, [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, diff --git a/src/models/Store.lua b/src/models/Store.lua index d912b57..178e486 100644 --- a/src/models/Store.lua +++ b/src/models/Store.lua @@ -309,7 +309,7 @@ function Store:OnTriggerLimitTimePack(eventType, param) end record[0] = cfg.id record[eventType] = (record[eventType] or 0) + 1 - if record[eventType] == 1 or record[eventType] % 10 == 0 then + if record[eventType] > 0 and record[eventType] % 10 == 0 then local pool = cfg.packId:toArray(true, "=") local idx = math.random(1, #pool) shopGoodsId = pool[idx] @@ -342,6 +342,7 @@ function Store:data() battleLR = self:getProperty("battleLR"), limitTPack = self:getProperty("limitTPack"), privCardEx = self:getProperty("privCardEx"), + packTrigger = self:getProperty("packTrigger") } end diff --git a/src/utils/StringUtil.lua b/src/utils/StringUtil.lua index af05651..92899a6 100644 --- a/src/utils/StringUtil.lua +++ b/src/utils/StringUtil.lua @@ -331,4 +331,20 @@ function string.setbit(str, pos, yes) else return str:sub(1, pos-1) .. yes .. str:sub(pos+1, -1) end +end + +--[[ +from: 1=2 3=4 +to: {["1"]="2" or 2,["3"]="4" or 4} +]] +function string.toMap(str, tonum, sep) + local str_vec = string.split(str, " ") + local tab = {} + for _, v in pairs(str_vec) do + local vec = string.split(v, sep) + if #vec == 2 then + tab[vec[1]] = tonum and tonumber(vec[2]) or vec[2] + end + end + return tab end \ No newline at end of file -- libgit2 0.21.2