Commit c759f4a4a31b80822a6d505505effd74de239c70
Merge remote-tracking branch 'origin/cn/develop' into cn/develop
Showing
3 changed files
with
59 additions
and
20 deletions
Show diff stats
src/actions/HeroAction.lua
@@ -867,7 +867,7 @@ function _M.drawHeroRpc(agent, data) | @@ -867,7 +867,7 @@ function _M.drawHeroRpc(agent, data) | ||
867 | if not unitPool then return 7 end | 867 | if not unitPool then return 7 end |
868 | -- ssr硬性保底 | 868 | -- ssr硬性保底 |
869 | local isSSRup = false | 869 | local isSSRup = false |
870 | - if unitPool["rare_"..HeroQuality.SSR] or 0 > 0 then | 870 | + if (unitPool["rare_"..HeroQuality.SSR] or 0) > 0 then |
871 | isSSRup = true | 871 | isSSRup = true |
872 | end | 872 | end |
873 | 873 | ||
@@ -878,34 +878,57 @@ function _M.drawHeroRpc(agent, data) | @@ -878,34 +878,57 @@ function _M.drawHeroRpc(agent, data) | ||
878 | local values = {} | 878 | local values = {} |
879 | 879 | ||
880 | -- check ssr up | 880 | -- check ssr up |
881 | - if isSSRup then | ||
882 | - local ssrUpMap = role:getProperty("ssrUp") or {} | ||
883 | - local ssrFloorCnt = ssrUpMap[poolId] or 0 | ||
884 | - if ssrFloorCnt >= (globalCsv.draw_ssr_guarantee or 40) - 1 then | 881 | + local ssrUpMap = role:getProperty("ssrUp") or {} |
882 | + local ssrFloorCnt = ssrUpMap[poolId] or 0 | ||
883 | + if isSSRup and (ssrFloorCnt >= (globalCsv.draw_ssr_guarantee or 40) - 1) then | ||
884 | + --if ssrFloorCnt >= (globalCsv.draw_ssr_guarantee or 40) - 1 then | ||
885 | values[1] = HeroQuality.SSR | 885 | values[1] = HeroQuality.SSR |
886 | ssrUpMap[poolId] = 0 | 886 | ssrUpMap[poolId] = 0 |
887 | - else | ||
888 | - for idx, field in ipairs(condition) do | ||
889 | - if not values[idx] then | ||
890 | - local lpool = {} | ||
891 | - local curIdx = 1 | ||
892 | - while unitPool[field .. "_" .. curIdx] do | ||
893 | - lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
894 | - curIdx = curIdx + 1 | ||
895 | - end | ||
896 | - | ||
897 | - if next(lpool) then | ||
898 | - values[idx] = math.randWeight(lpool, 1) | ||
899 | - end | 887 | + --else |
888 | + -- for idx, field in ipairs(condition) do | ||
889 | + -- if not values[idx] then | ||
890 | + -- local lpool = {} | ||
891 | + -- local curIdx = 1 | ||
892 | + -- while unitPool[field .. "_" .. curIdx] do | ||
893 | + -- lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
894 | + -- curIdx = curIdx + 1 | ||
895 | + -- end | ||
896 | + | ||
897 | + -- if next(lpool) then | ||
898 | + -- values[idx] = math.randWeight(lpool, 1) | ||
899 | + -- end | ||
900 | + -- end | ||
901 | + -- end | ||
902 | + -- if values[1] == HeroQuality.SSR then | ||
903 | + -- ssrUpMap[poolId] = 0 | ||
904 | + -- else | ||
905 | + -- ssrUpMap[poolId] = ssrFloorCnt + 1 | ||
906 | + -- end | ||
907 | + --end | ||
908 | + role:updateProperty({field="ssrUp", value = ssrUpMap, notNotify = true}) | ||
909 | + else | ||
910 | + for idx, field in ipairs(condition) do | ||
911 | + if not values[idx] then | ||
912 | + local lpool = {} | ||
913 | + local curIdx = 1 | ||
914 | + while unitPool[field .. "_" .. curIdx] do | ||
915 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
916 | + curIdx = curIdx + 1 | ||
917 | + end | ||
918 | + | ||
919 | + if next(lpool) then | ||
920 | + values[idx] = math.randWeight(lpool, 1) | ||
900 | end | 921 | end |
901 | end | 922 | end |
923 | + end | ||
924 | + if isSSRup then | ||
902 | if values[1] == HeroQuality.SSR then | 925 | if values[1] == HeroQuality.SSR then |
903 | ssrUpMap[poolId] = 0 | 926 | ssrUpMap[poolId] = 0 |
904 | else | 927 | else |
905 | ssrUpMap[poolId] = ssrFloorCnt + 1 | 928 | ssrUpMap[poolId] = ssrFloorCnt + 1 |
906 | end | 929 | end |
930 | + role:updateProperty({field="ssrUp", value = ssrUpMap, notNotify = true}) | ||
907 | end | 931 | end |
908 | - role:updateProperty({field="ssrUp", value = ssrUpMap, notNotify = true}) | ||
909 | end | 932 | end |
910 | 933 | ||
911 | 934 |
src/utils/CommonFunc.lua
@@ -349,4 +349,15 @@ function httpGetFormatData(params) | @@ -349,4 +349,15 @@ function httpGetFormatData(params) | ||
349 | end | 349 | end |
350 | 350 | ||
351 | return table.concat(body, "&") | 351 | return table.concat(body, "&") |
352 | -end | ||
353 | \ No newline at end of file | 352 | \ No newline at end of file |
353 | +end | ||
354 | + | ||
355 | +function logdump(obj, prefix) | ||
356 | + for k,v in pairs(obj) do | ||
357 | + local vt = type(v) | ||
358 | + if vt == "table" then | ||
359 | + logdump(v, prefix..':'..k) | ||
360 | + elseif vt == 'string' or vt == 'number' then | ||
361 | + skynet.error(prefix..':'..k..'='..v) | ||
362 | + end | ||
363 | + end | ||
364 | +end |
src/utils/MysqlUtil.lua
1 | local skynet = require "skynet" | 1 | local skynet = require "skynet" |
2 | local mysqlproxy = require "shared.mysqlproxy" | 2 | local mysqlproxy = require "shared.mysqlproxy" |
3 | +require "utils.CommonFunc" | ||
3 | 4 | ||
4 | 5 | ||
5 | function getDbCfgVal(tbName, keyName, fieldName) | 6 | function getDbCfgVal(tbName, keyName, fieldName) |
@@ -29,20 +30,24 @@ end | @@ -29,20 +30,24 @@ end | ||
29 | 30 | ||
30 | function addFriend(roleId, friendId) | 31 | function addFriend(roleId, friendId) |
31 | local stmt_csp = mysqlproxy:prepare("call add_friends(?, ?, ?)") | 32 | local stmt_csp = mysqlproxy:prepare("call add_friends(?, ?, ?)") |
33 | + --logdump(stmt_csp, '') | ||
32 | local r = mysqlproxy:execute(stmt_csp, roleId, friendId, skynet.timex()) | 34 | local r = mysqlproxy:execute(stmt_csp, roleId, friendId, skynet.timex()) |
33 | if r[1][1]["t_error"] == 0 then | 35 | if r[1][1]["t_error"] == 0 then |
34 | rpcRole(roleId, "addFriend", friendId) | 36 | rpcRole(roleId, "addFriend", friendId) |
35 | rpcRole(friendId, "addFriend", roleId) | 37 | rpcRole(friendId, "addFriend", roleId) |
36 | end | 38 | end |
39 | + mysqlproxy:stmt_close(stmt_csp) | ||
37 | end | 40 | end |
38 | 41 | ||
39 | function delFriend(roleId, friendId) | 42 | function delFriend(roleId, friendId) |
40 | local stmt_csp = mysqlproxy:prepare("call del_friends(?, ?)") | 43 | local stmt_csp = mysqlproxy:prepare("call del_friends(?, ?)") |
44 | + --logdump(stmt_csp, '') | ||
41 | local r = mysqlproxy:execute(stmt_csp, roleId, friendId) | 45 | local r = mysqlproxy:execute(stmt_csp, roleId, friendId) |
42 | if r[1][1]["t_error"] == 0 then | 46 | if r[1][1]["t_error"] == 0 then |
43 | rpcRole(roleId, "delFriend", friendId) | 47 | rpcRole(roleId, "delFriend", friendId) |
44 | rpcRole(friendId, "delFriend", roleId) | 48 | rpcRole(friendId, "delFriend", roleId) |
45 | end | 49 | end |
50 | + mysqlproxy:stmt_close(stmt_csp) | ||
46 | end | 51 | end |
47 | 52 | ||
48 | function roleExists(roleId) | 53 | function roleExists(roleId) |