Commit 93f6e69bdbe4f5405c6c34844013610a13b09e65
1 parent
19d3f079
拾荒选择时间,抽卡增加sr保底
Showing
11 changed files
with
143 additions
and
32 deletions
Show diff stats
src/GlobalVar.lua
src/actions/AdvAction.lua
... | ... | @@ -184,11 +184,22 @@ function _M.startHangRpc(agent, data) |
184 | 184 | local role = agent.role |
185 | 185 | local msg = MsgPack.unpack(data) |
186 | 186 | local chapterId = msg.chapterId --关卡id |
187 | + local campId = msg.campId or 2 --营地id | |
187 | 188 | local format = msg.format --编队 |
189 | + local index = msg.index or 1--时间索引id | |
188 | 190 | |
189 | - local chapterData = csvdb["adv_chapterCsv"][chapterId] | |
191 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
190 | 192 | if not chapterData then return 1 end |
191 | - if chapterData.idleReward == "" then return 2 end --没有奖励 没有挂机 | |
193 | + local campSiteData = chapterData[campId] | |
194 | + if not campSiteData then return 1 end | |
195 | + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 | |
196 | + | |
197 | + local adv_idle_time = globalCsv.adv_idle_time[index] | |
198 | + local adv_idle_energy = globalCsv.adv_idle_energy[index] | |
199 | + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index] | |
200 | + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then | |
201 | + return 2 | |
202 | + end | |
192 | 203 | |
193 | 204 | local advHang = role:getProperty("advHang") |
194 | 205 | if advHang[chapterId] then return 3 end --正在挂机 |
... | ... | @@ -201,7 +212,7 @@ function _M.startHangRpc(agent, data) |
201 | 212 | if not next(advRelay[chapterId] or {}) then return 6 end -- 没有开放 |
202 | 213 | |
203 | 214 | |
204 | - if not role:checkAdvCount(chapterData.limitlevel) then return 7 end -- 是否有体力 | |
215 | + if not role:checkAdvCount(adv_idle_energy) then return 7 end -- 是否有体力 | |
205 | 216 | |
206 | 217 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return 8 end --编队是否正确 |
207 | 218 | |
... | ... | @@ -220,7 +231,7 @@ function _M.startHangRpc(agent, data) |
220 | 231 | + 0.226 * player["hit"] |
221 | 232 | + 0.26 * player["miss"] |
222 | 233 | |
223 | - if battleV < chapterData.idleValue then return 9 end -- 战斗力是否满足 | |
234 | + if battleV < campSiteData.idleValue then return 9 end -- 战斗力是否满足 | |
224 | 235 | |
225 | 236 | local info = {} |
226 | 237 | info.format = {} |
... | ... | @@ -230,7 +241,9 @@ function _M.startHangRpc(agent, data) |
230 | 241 | for slot, heroId in pairs(format.heros) do |
231 | 242 | info.format.heros[slot] = heroId |
232 | 243 | end |
233 | - info.time = skynet.timex() + chapterData.idleTime --挂机时间 | |
244 | + info.time = skynet.timex() + adv_idle_time --挂机时间 | |
245 | + info.campId = campId | |
246 | + info.index = index | |
234 | 247 | |
235 | 248 | -- 没有在战斗 用team来挂机了 把team清掉 |
236 | 249 | if not role:getAdvData():isRunning() then |
... | ... | @@ -239,7 +252,7 @@ function _M.startHangRpc(agent, data) |
239 | 252 | |
240 | 253 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
241 | 254 | |
242 | - role:changeAdvCount(chapterData.limitlevel) | |
255 | + role:changeAdvCount(adv_idle_energy) | |
243 | 256 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
244 | 257 | role:log("adv_action", {desc = "startHang", int1 = chapterId}) |
245 | 258 | |
... | ... | @@ -257,13 +270,24 @@ function _M.quickHangRpc(agent, data) |
257 | 270 | local info = advHang[chapterId] |
258 | 271 | if not info then return end |
259 | 272 | |
260 | - local chapterData = csvdb["adv_chapterCsv"][chapterId] | |
273 | + local index = info.index | |
274 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
261 | 275 | if not chapterData then return end |
276 | + | |
277 | + local campSiteData = chapterData[info.campId] | |
278 | + if not campSiteData then return 1 end | |
279 | + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 | |
280 | + | |
281 | + local adv_idle_time = globalCsv.adv_idle_time[index] | |
282 | + if not adv_idle_time then | |
283 | + return 2 | |
284 | + end | |
285 | + | |
262 | 286 | |
263 | 287 | local reward, isFull |
264 | 288 | if skynet.timex() >= info.time then return end -- 已经完成了 |
265 | 289 | |
266 | - local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate) | |
290 | + local cost = math.ceil((info.time - skynet.timex()) / adv_idle_time * globalCsv.adv_idle_quicken) | |
267 | 291 | |
268 | 292 | if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end |
269 | 293 | role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}}) |
... | ... | @@ -287,11 +311,24 @@ function _M.endHangRpc(agent, data) |
287 | 311 | local info = advHang[chapterId] |
288 | 312 | if not info then return end |
289 | 313 | |
290 | - local chapterData = csvdb["adv_chapterCsv"][chapterId] | |
314 | + local index = info.index or 1 | |
315 | + local chapterData = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
291 | 316 | if not chapterData then return end |
317 | + local campSiteData = chapterData[info.campId or 2] | |
318 | + if not campSiteData then return 1 end | |
319 | + if campSiteData.idleReward_1 == "" and campSiteData.idleReward_2 == "" then return 2 end --没有奖励 没有挂机 | |
320 | + | |
321 | + local adv_idle_time = globalCsv.adv_idle_time[index] | |
322 | + local adv_idle_energy = globalCsv.adv_idle_energy[index] | |
323 | + local adv_idle_reward_coef = globalCsv.adv_idle_reward[index] | |
324 | + if not adv_idle_time or not adv_idle_energy or not adv_idle_reward_coef then | |
325 | + return 2 | |
326 | + end | |
292 | 327 | |
293 | 328 | local reward, isFull, change |
294 | 329 | if skynet.timex() >= info.time then |
330 | + -- 最新需求加成取消 | |
331 | + --[[ | |
295 | 332 | -- 英雄加成 |
296 | 333 | local idleUnit = chapterData.idleUnit:toNumMap() |
297 | 334 | local upUnit = 0 |
... | ... | @@ -316,15 +353,17 @@ function _M.endHangRpc(agent, data) |
316 | 353 | end |
317 | 354 | |
318 | 355 | if not maxCampsite then return end |
356 | + ]] | |
357 | + local totalReward = campSiteData.idleReward_1 .. " " .. campSiteData.idleReward_2 | |
319 | 358 | |
320 | - local idleReward = chapterData.idleReward:toNumMap() | |
359 | + local idleReward = totalReward:toNumMap() | |
321 | 360 | for itemId, count in pairs(idleReward) do |
322 | - idleReward[itemId] = math.floor(count * (maxCampsite.idleValue + upUnit) / 100) | |
361 | + idleReward[itemId] = count * adv_idle_reward_coef | |
323 | 362 | end |
324 | 363 | reward, change = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) |
325 | 364 | else |
326 | 365 | if cancel then |
327 | - role:changeAdvCount(-chapterData.limitlevel) | |
366 | + --role:changeAdvCount(-chapterData.limitlevel) | |
328 | 367 | -- if role:getProperty("advC") <= 0 then |
329 | 368 | -- isFull = true |
330 | 369 | -- else | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -69,7 +69,7 @@ local function checkReward(role) |
69 | 69 | while #tempPool > 0 do |
70 | 70 | local idx = math.randWeight(tempPool, 3) |
71 | 71 | local cur = clone(pool[idx]) |
72 | - if cur[1] ~= 1 then -- 轮空 id | |
72 | + if cur[1] ~= 0 then -- 轮空 id | |
73 | 73 | if cur[1] == ItemId.BreakCost and doubleTime > 0 then |
74 | 74 | cur[2] = cur[2] * 2 |
75 | 75 | end |
... | ... | @@ -242,6 +242,9 @@ function _M.endBattleRpc(agent, data) |
242 | 242 | |
243 | 243 | role:checkTaskEnter("HangPass", {id = carbonId}) |
244 | 244 | end |
245 | + if hangInfo.carbonId < carbonId then | |
246 | + hangInfo.carbonId = carbonId | |
247 | + end | |
245 | 248 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
246 | 249 | |
247 | 250 | local team = role:getProperty("pvpTC") | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -938,6 +938,9 @@ function _M.drawHeroRpc(agent, data) |
938 | 938 | local drawCount = {1, 10} -- 抽取次数 |
939 | 939 | if not drawCount[drawType] then return 2 end |
940 | 940 | |
941 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | |
942 | + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | |
943 | + | |
941 | 944 | -- 计算抽卡消耗品 |
942 | 945 | local cost = {} |
943 | 946 | local lastCount = drawCount[drawType] |
... | ... | @@ -976,16 +979,21 @@ function _M.drawHeroRpc(agent, data) |
976 | 979 | end |
977 | 980 | |
978 | 981 | --TODO 活动覆盖 |
982 | + local actPoolId = role.activity:getActivityPool(btype, subType) | |
983 | + if actPoolId ~= 0 then | |
984 | + poolId = actPoolId | |
985 | + end | |
979 | 986 | |
980 | 987 | local unitPool = csvdb["build_unitCsv"][poolId] |
981 | 988 | if not unitPool then return 4 end |
982 | 989 | |
983 | 990 | -- 开始抽 |
984 | 991 | local resultPool = {} |
985 | - local function fillDrawPool() | |
992 | + local function fillDrawPool(isFloorBack) | |
986 | 993 | local condition = {"rare", "camp"} |
987 | 994 | local values = {} |
988 | 995 | |
996 | + | |
989 | 997 | for idx, field in ipairs(condition) do |
990 | 998 | if not values[idx] then |
991 | 999 | local lpool = {} |
... | ... | @@ -1001,8 +1009,9 @@ function _M.drawHeroRpc(agent, data) |
1001 | 1009 | end |
1002 | 1010 | end |
1003 | 1011 | |
1004 | - for itemId, oneData in pairs(csvdb["build_poolCsv"]) do | |
1005 | - if oneData["pool_" .. poolId] and oneData["pool_" .. poolId] ~= "" then | |
1012 | + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | |
1013 | + local pool_str = "pool_" .. poolId | |
1014 | + if oneData[pool_str] and oneData[pool_str] ~= "" then | |
1006 | 1015 | local itemData = csvdb["itemCsv"][itemId] |
1007 | 1016 | while itemData do |
1008 | 1017 | if itemData.type ~= ItemType.Hero then break end |
... | ... | @@ -1013,8 +1022,8 @@ function _M.drawHeroRpc(agent, data) |
1013 | 1022 | if heroData[field] ~= values[idx] then ok = false break end |
1014 | 1023 | end |
1015 | 1024 | if not ok then break end |
1016 | - if oneData["pool_" .. poolId] > 0 then | |
1017 | - resultPool[itemId] = {oneData["pool_" .. poolId]} -- itemId, count, 概率 | |
1025 | + if oneData[pool_str] > 0 then | |
1026 | + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | |
1018 | 1027 | end |
1019 | 1028 | break |
1020 | 1029 | end |
... | ... | @@ -1027,9 +1036,13 @@ function _M.drawHeroRpc(agent, data) |
1027 | 1036 | local ssrCount = 0 |
1028 | 1037 | local reward = {} |
1029 | 1038 | for i = 1, drawCount[drawType] do |
1039 | + floorHeroCount = floorHeroCount + 1 | |
1040 | + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts | |
1030 | 1041 | resultPool = {} |
1031 | - while not next(resultPool) do | |
1032 | - fillDrawPool() | |
1042 | + fillDrawPool(isFloorBack) | |
1043 | + if not next(resultPool) then | |
1044 | + skynet.error("random pool error, poolId:" .. poolId) | |
1045 | + return | |
1033 | 1046 | end |
1034 | 1047 | |
1035 | 1048 | -- 引导必送 613 丝路德 |
... | ... | @@ -1039,6 +1052,10 @@ function _M.drawHeroRpc(agent, data) |
1039 | 1052 | ssrCount = ssrCount + 1 |
1040 | 1053 | end |
1041 | 1054 | |
1055 | + if itemData.quality >= HeroQuality.SR then | |
1056 | + floorHeroCount = 0 | |
1057 | + end | |
1058 | + | |
1042 | 1059 | if role:isHaveHero(itemData.id - ItemStartId.Hero) then |
1043 | 1060 | local fragId = itemData.id - ItemStartId.Hero |
1044 | 1061 | local heroData = csvdb["unitCsv"][fragId] |
... | ... | @@ -1051,6 +1068,12 @@ function _M.drawHeroRpc(agent, data) |
1051 | 1068 | end |
1052 | 1069 | end |
1053 | 1070 | |
1071 | + if draw_floor_back_counts then | |
1072 | + local floorHero = role:getProperty("floorHero") | |
1073 | + floorHero[btype] = floorHeroCount | |
1074 | + role:setProperty("floorHero", floorHero) | |
1075 | + end | |
1076 | + | |
1054 | 1077 | if btype == 1 or btype == 2 then |
1055 | 1078 | local repayHero = role:getProperty("repayHero") or 0 |
1056 | 1079 | repayHero = repayHero + drawCount[drawType] | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -116,14 +116,14 @@ function _M.loginRpc( agent, data ) |
116 | 116 | end |
117 | 117 | if msg.deviceMode then |
118 | 118 | local deviceMode = tostring(msg.deviceMode) |
119 | - if self:getProperty("dmode") ~= deviceMode then | |
120 | - self:setProperty("dmode", deviceMode) | |
119 | + if role:getProperty("dmode") ~= deviceMode then | |
120 | + role:setProperty("dmode", deviceMode) | |
121 | 121 | end |
122 | 122 | end |
123 | 123 | if msg.device then |
124 | 124 | local device = tostring(msg.device) |
125 | - if self:getProperty("device") ~= device then | |
126 | - self:setProperty("device", device) | |
125 | + if role:getProperty("device") ~= device then | |
126 | + role:setProperty("device", device) | |
127 | 127 | end |
128 | 128 | end |
129 | 129 | |
... | ... | @@ -299,7 +299,7 @@ function _M.createRpc(agent, data) |
299 | 299 | sid = msg.subId or 0, |
300 | 300 | name = roleName, |
301 | 301 | uname = msg.uname or "", |
302 | - device = tostring(msg.device) | |
302 | + device = tostring(msg.device), | |
303 | 303 | dmode = msg.deviceMode and tostring(msg.deviceMode) or nil |
304 | 304 | }) |
305 | 305 | ... | ... |
src/models/Activity.lua
... | ... | @@ -8,6 +8,8 @@ Activity.ActivityType = { |
8 | 8 | DrawHero = 4, --抽卡周 招募 |
9 | 9 | AdvDraw = 5, --拾荒抽周 资助 |
10 | 10 | OpenBox = 6, --拆解周 时钟箱 |
11 | + | |
12 | + SsrUpPoolChange = 10, -- 特定英雄活动,切卡池 | |
11 | 13 | } |
12 | 14 | |
13 | 15 | |
... | ... | @@ -181,13 +183,16 @@ activityFunc[Activity.ActivityType.Sign] = { |
181 | 183 | --loop2:累计招募N次 |
182 | 184 | --loop3:累计资助N次 |
183 | 185 | --loop4:时钟箱拆解N个 |
184 | -function Activity:checkWeeklyAct(actType, notify, count) | |
186 | +function Activity:checkWeeklyAct(actType, notify, count, pool) | |
185 | 187 | local actInfoMap = { |
186 | 188 | [Activity.ActivityType.DrawHero] = {mailId = MailId.ActDrawCardReward, table = "activity_loop2Csv"}, |
187 | 189 | [Activity.ActivityType.AdvDraw] = {mailId = MailId.ActAdvDrawReward, table = "activity_loop3Csv"}, |
188 | 190 | [Activity.ActivityType.OpenBox] = {mailId = MailId.ActOpenBoxReward, table = "activity_loop4Csv"}, |
189 | 191 | [Activity.ActivityType.FoodSell] = {mailId = MailId.ActSellFoodReward, table = "activity_loop1Csv"} |
190 | 192 | } |
193 | + if actType == Activity.ActivityType.DrawHero and pool == DrawCardType.FriendDraw then | |
194 | + return | |
195 | + end | |
191 | 196 | local info = actInfoMap[actType] |
192 | 197 | if not info then return end |
193 | 198 | |
... | ... | @@ -234,8 +239,8 @@ end |
234 | 239 | |
235 | 240 | -- 抽卡周 |
236 | 241 | activityFunc[Activity.ActivityType.DrawHero] = { |
237 | - ["check"] = function(self, actType, notify, count) -- 检查 | |
238 | - self:checkWeeklyAct(actType, notify, count) | |
242 | + ["check"] = function(self, actType, notify, count, pool) -- 检查 | |
243 | + self:checkWeeklyAct(actType, notify, count, pool) | |
239 | 244 | end, |
240 | 245 | ["init"] = function(self, actType, isCrossDay, notify) |
241 | 246 | local roundData = self:getProperty("round") |
... | ... | @@ -355,5 +360,23 @@ function Activity:getActHangDoubleTime(lastTs, nowTs) |
355 | 360 | return 0 |
356 | 361 | end |
357 | 362 | |
363 | +-- 获取活动卡池id | |
364 | +function Activity:getActivityPool(mainType, subType) | |
365 | + if not self:isOpen(Activity.ActivityType.SsrUpPoolChange) then | |
366 | + return 0 | |
367 | + end | |
368 | + local actData = csvdb["activity_ctrlCsv"][Activity.ActivityType.SsrUpPoolChange] | |
369 | + if not actData then return 0 end | |
370 | + | |
371 | + local poolMap = actData.condition2:toMap(true, "=") | |
372 | + local key = mainType .. "_" .. subType | |
373 | + for k, v in pairs(poolMap) do | |
374 | + if k == key then | |
375 | + return v | |
376 | + end | |
377 | + end | |
378 | + return 0 | |
379 | +end | |
380 | + | |
358 | 381 | |
359 | 382 | return Activity | ... | ... |
src/models/Role.lua
src/models/RoleTask.lua
... | ... | @@ -212,7 +212,7 @@ local Activity = require("models.Activity") |
212 | 212 | local ActivityListener = { |
213 | 213 | func = "checkActivityTask", |
214 | 214 | listen = { |
215 | - [TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count")}}, | |
215 | + [TaskType.DrawHero] = {{Activity.ActivityType.DrawHero, f("count"), f("pool")}}, | |
216 | 216 | [TaskType.FoodSell] = {{Activity.ActivityType.FoodSell, f("count")}}, |
217 | 217 | [TaskType.AdvDraw] = {{Activity.ActivityType.AdvDraw, f("count")}}, |
218 | 218 | [TaskType.OpenBox] = {{Activity.ActivityType.OpenBox, f("count")}}, | ... | ... |
src/models/Store.lua
... | ... | @@ -309,7 +309,7 @@ function Store:OnTriggerLimitTimePack(eventType, param) |
309 | 309 | end |
310 | 310 | record[0] = cfg.id |
311 | 311 | record[eventType] = (record[eventType] or 0) + 1 |
312 | - if record[eventType] == 1 or record[eventType] % 10 == 0 then | |
312 | + if record[eventType] > 0 and record[eventType] % 10 == 0 then | |
313 | 313 | local pool = cfg.packId:toArray(true, "=") |
314 | 314 | local idx = math.random(1, #pool) |
315 | 315 | shopGoodsId = pool[idx] |
... | ... | @@ -342,6 +342,7 @@ function Store:data() |
342 | 342 | battleLR = self:getProperty("battleLR"), |
343 | 343 | limitTPack = self:getProperty("limitTPack"), |
344 | 344 | privCardEx = self:getProperty("privCardEx"), |
345 | + packTrigger = self:getProperty("packTrigger") | |
345 | 346 | } |
346 | 347 | end |
347 | 348 | ... | ... |
src/utils/StringUtil.lua
... | ... | @@ -331,4 +331,20 @@ function string.setbit(str, pos, yes) |
331 | 331 | else |
332 | 332 | return str:sub(1, pos-1) .. yes .. str:sub(pos+1, -1) |
333 | 333 | end |
334 | +end | |
335 | + | |
336 | +--[[ | |
337 | +from: 1=2 3=4 | |
338 | +to: {["1"]="2" or 2,["3"]="4" or 4} | |
339 | +]] | |
340 | +function string.toMap(str, tonum, sep) | |
341 | + local str_vec = string.split(str, " ") | |
342 | + local tab = {} | |
343 | + for _, v in pairs(str_vec) do | |
344 | + local vec = string.split(v, sep) | |
345 | + if #vec == 2 then | |
346 | + tab[vec[1]] = tonum and tonumber(vec[2]) or vec[2] | |
347 | + end | |
348 | + end | |
349 | + return tab | |
334 | 350 | end |
335 | 351 | \ No newline at end of file | ... | ... |