Commit ed546a4643b4e71cb4416827554dcc8bcf546694
Merge branch 'develop' into tr/qa
Showing
5 changed files
with
57 additions
and
23 deletions
Show diff stats
src/actions/HeroAction.lua
@@ -820,26 +820,44 @@ function _M.drawHeroRpc(agent, data) | @@ -820,26 +820,44 @@ function _M.drawHeroRpc(agent, data) | ||
820 | end | 820 | end |
821 | end | 821 | end |
822 | 822 | ||
823 | - for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | ||
824 | - local pool_str = "pool_" .. poolId | ||
825 | - if oneData[pool_str] and oneData[pool_str] ~= "" then | ||
826 | - local itemData = csvdb["itemCsv"][itemId] | ||
827 | - while itemData do | ||
828 | - if itemData.type ~= ItemType.Hero then break end | ||
829 | - local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
830 | - if not heroData then break end | ||
831 | - local ok = true | ||
832 | - -- 保底是全随机,不用比较类型 | ||
833 | - if not isFloorBack then | ||
834 | - for idx, field in ipairs(condition) do | ||
835 | - if heroData[field] ~= values[idx] then ok = false break end | 823 | + local weight = 0 |
824 | + local up_pool = nil | ||
825 | + local rand_v = math.randomInt(1, 100) | ||
826 | + if values[1] == HeroQuality.SR then | ||
827 | + weight = unitPool["up_sr_weight"] | ||
828 | + up_pool = unitPool["up_sr_id"] | ||
829 | + elseif values[1] == HeroQuality.SSR then | ||
830 | + weight = unitPool["up_ssr_weight"] | ||
831 | + up_pool = unitPool["up_ssr_id"] | ||
832 | + end | ||
833 | + --print(poolId, rand_v, weight, up_pool, values[1]) | ||
834 | + if rand_v < weight and up_pool then | ||
835 | + up_pool = up_pool:toArray(true, "=") | ||
836 | + for k, v in ipairs(up_pool) do | ||
837 | + resultPool[v] = {1} | ||
838 | + end | ||
839 | + else | ||
840 | + for itemId, oneData in pairs(isFloorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | ||
841 | + local pool_str = "pool_" .. poolId | ||
842 | + if oneData[pool_str] and oneData[pool_str] ~= "" then | ||
843 | + local itemData = csvdb["itemCsv"][itemId] | ||
844 | + while itemData do | ||
845 | + if itemData.type ~= ItemType.Hero then break end | ||
846 | + local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
847 | + if not heroData then break end | ||
848 | + local ok = true | ||
849 | + -- 保底是全随机,不用比较类型 | ||
850 | + if not isFloorBack then | ||
851 | + for idx, field in ipairs(condition) do | ||
852 | + if heroData[field] ~= values[idx] then ok = false break end | ||
853 | + end | ||
836 | end | 854 | end |
855 | + if not ok then break end | ||
856 | + if oneData[pool_str] > 0 then | ||
857 | + resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | ||
858 | + end | ||
859 | + break | ||
837 | end | 860 | end |
838 | - if not ok then break end | ||
839 | - if oneData[pool_str] > 0 then | ||
840 | - resultPool[itemId] = {oneData[pool_str]} -- itemId, count, 概率 | ||
841 | - end | ||
842 | - break | ||
843 | end | 861 | end |
844 | end | 862 | end |
845 | end | 863 | end |
@@ -874,7 +892,7 @@ function _M.drawHeroRpc(agent, data) | @@ -874,7 +892,7 @@ function _M.drawHeroRpc(agent, data) | ||
874 | if itemData.quality == HeroQuality.SSR then | 892 | if itemData.quality == HeroQuality.SSR then |
875 | ssrCount = ssrCount + 1 | 893 | ssrCount = ssrCount + 1 |
876 | if not guideHero then | 894 | if not guideHero then |
877 | - -- STODO 广播获得ssr英雄 | 895 | + -- 广播获得ssr英雄 |
878 | local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")} | 896 | local ntf = {heroId = itemData.id - ItemStartId.Hero, nick = role:getProperty("name")} |
879 | mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf)) | 897 | mcast_util.pub_world(actionCodes.Role_broadGetSSR, MsgPack.pack(ntf)) |
880 | end | 898 | end |
src/models/RoleTask.lua
@@ -633,7 +633,7 @@ function RoleTask.bind(Role) | @@ -633,7 +633,7 @@ function RoleTask.bind(Role) | ||
633 | count = count + 1 | 633 | count = count + 1 |
634 | end | 634 | end |
635 | end | 635 | end |
636 | - if calTask[id] < count then | 636 | + if (calTask[id] or 0) < count then |
637 | calTask[id] = count | 637 | calTask[id] = count |
638 | end | 638 | end |
639 | elseif cfg.type == 16 then -- 英雄星级收集进度 | 639 | elseif cfg.type == 16 then -- 英雄星级收集进度 |
@@ -643,7 +643,7 @@ function RoleTask.bind(Role) | @@ -643,7 +643,7 @@ function RoleTask.bind(Role) | ||
643 | count = count + 1 | 643 | count = count + 1 |
644 | end | 644 | end |
645 | end | 645 | end |
646 | - if calTask[id] < count then | 646 | + if (calTask[id] or 0) < count then |
647 | calTask[id] = count | 647 | calTask[id] = count |
648 | end | 648 | end |
649 | elseif cfg.type == 18 then -- 挂机累计收获id,y个 | 649 | elseif cfg.type == 18 then -- 挂机累计收获id,y个 |
src/models/Store.lua
@@ -176,7 +176,7 @@ end | @@ -176,7 +176,7 @@ end | ||
176 | -- 挂机道具掉落系数 特权卡挂机掉落系数 | 176 | -- 挂机道具掉落系数 特权卡挂机掉落系数 |
177 | function Store:getHangDropCoef() | 177 | function Store:getHangDropCoef() |
178 | if self:isPrivCardExpire() then | 178 | if self:isPrivCardExpire() then |
179 | - return 0, 0 | 179 | + return 1, 1 |
180 | end | 180 | end |
181 | 181 | ||
182 | return (1 + globalCsv.hang_drop_exp_coef) or 1, (1 + globalCsv.hang_drop_item_coef) or 1 | 182 | return (1 + globalCsv.hang_drop_exp_coef) or 1, (1 + globalCsv.hang_drop_item_coef) or 1 |
src/utils/StringUtil.lua
@@ -347,4 +347,20 @@ function string.toMap(str, tonum, sep) | @@ -347,4 +347,20 @@ function string.toMap(str, tonum, sep) | ||
347 | end | 347 | end |
348 | end | 348 | end |
349 | return tab | 349 | return tab |
350 | +end | ||
351 | + | ||
352 | +--[[ | ||
353 | +from: 1=2=3=4 | ||
354 | +to: {1,2,3,4} | ||
355 | +]] | ||
356 | +function string.toMap(str, tonum, sep) | ||
357 | + local str_vec = string.split(str, " ") | ||
358 | + local tab = {} | ||
359 | + for _, v in pairs(str_vec) do | ||
360 | + local vec = string.split(v, sep) | ||
361 | + if #vec == 2 then | ||
362 | + tab[vec[1]] = tonum and tonumber(vec[2]) or vec[2] | ||
363 | + end | ||
364 | + end | ||
365 | + return tab | ||
350 | end | 366 | end |
351 | \ No newline at end of file | 367 | \ No newline at end of file |