Commit d9d1ba366c82fb2ee164ccdd2ec6158f291e477a
Merge branch 'cn/develop' into cn/player
Showing
4 changed files
with
77 additions
and
33 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/actions/PvpAction.lua
@@ -325,7 +325,7 @@ function _M.startBattleRpc(agent, data) | @@ -325,7 +325,7 @@ function _M.startBattleRpc(agent, data) | ||
325 | 325 | ||
326 | if not result and not matchInfo then return 4 end | 326 | if not result and not matchInfo then return 4 end |
327 | 327 | ||
328 | - if not result then | 328 | + if not revenge then |
329 | -- 次数扣一波 | 329 | -- 次数扣一波 |
330 | local pvpFree = role.dailyData:getProperty("pvpFree") | 330 | local pvpFree = role.dailyData:getProperty("pvpFree") |
331 | if pvpFree >= globalCsv.pvp_battle_free_count then | 331 | if pvpFree >= globalCsv.pvp_battle_free_count then |
@@ -335,7 +335,9 @@ function _M.startBattleRpc(agent, data) | @@ -335,7 +335,9 @@ function _M.startBattleRpc(agent, data) | ||
335 | else | 335 | else |
336 | role.dailyData:updateProperty({field = "pvpFree", delta = 1}) | 336 | role.dailyData:updateProperty({field = "pvpFree", delta = 1}) |
337 | end | 337 | end |
338 | + end | ||
338 | 339 | ||
340 | + if not result then | ||
339 | key = tostring(math.random()) | 341 | key = tostring(math.random()) |
340 | _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge, pvpTC = pvpTC} | 342 | _pvpStartBattleCacheC = {idx = idx, key = key, revenge = revenge, pvpTC = pvpTC} |
341 | 343 | ||
@@ -574,8 +576,9 @@ function _M.startBattleHRpc(agent, data) | @@ -574,8 +576,9 @@ function _M.startBattleHRpc(agent, data) | ||
574 | 576 | ||
575 | if not result and not enemyTeamRecord then return 4 end | 577 | if not result and not enemyTeamRecord then return 4 end |
576 | 578 | ||
577 | - if not result then | 579 | + if not revenge then |
578 | -- 次数扣一波 | 580 | -- 次数扣一波 |
581 | + print("xxxxx") | ||
579 | local pvpFreeH = role.dailyData:getProperty("pvpFreeH") | 582 | local pvpFreeH = role.dailyData:getProperty("pvpFreeH") |
580 | if pvpFreeH >= globalCsv.pvp_battle_free_count_high then | 583 | if pvpFreeH >= globalCsv.pvp_battle_free_count_high then |
581 | local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} | 584 | local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} |
@@ -584,7 +587,9 @@ function _M.startBattleHRpc(agent, data) | @@ -584,7 +587,9 @@ function _M.startBattleHRpc(agent, data) | ||
584 | else | 587 | else |
585 | role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) | 588 | role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) |
586 | end | 589 | end |
590 | + end | ||
587 | 591 | ||
592 | + if not result then | ||
588 | 593 | ||
589 | -- 只发送指定的那个敌人 | 594 | -- 只发送指定的那个敌人 |
590 | if enemyTeamRecord.robot then | 595 | if enemyTeamRecord.robot then |
@@ -643,17 +648,6 @@ function _M.endBattleHRpc(agent, data) | @@ -643,17 +648,6 @@ function _M.endBattleHRpc(agent, data) | ||
643 | match = _pvpRecordInfoCacheH[msg.idx] | 648 | match = _pvpRecordInfoCacheH[msg.idx] |
644 | _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 | 649 | _revengeRecord[match.id] = now + RevengeWaitTime -- 1分钟内不能再打 |
645 | 650 | ||
646 | - if isWin then | ||
647 | - -- 次数扣一波 | ||
648 | - local pvpFreeH = role.dailyData:getProperty("pvpFreeH") | ||
649 | - if pvpFreeH >= globalCsv.pvp_battle_free_count_high then | ||
650 | - local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} | ||
651 | - if not role:checkItemEnough(cost) then return 5 end | ||
652 | - role:costItems(cost, {log = {desc = "startPvp", int1 = 2}}) | ||
653 | - else | ||
654 | - role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) | ||
655 | - end | ||
656 | - end | ||
657 | else | 651 | else |
658 | local pvpMH = role:getProperty("pvpMH") | 652 | local pvpMH = role:getProperty("pvpMH") |
659 | match = pvpMH[msg.idx] | 653 | match = pvpMH[msg.idx] |
@@ -728,6 +722,17 @@ function _M.endBattleHRpc(agent, data) | @@ -728,6 +722,17 @@ function _M.endBattleHRpc(agent, data) | ||
728 | })) | 722 | })) |
729 | return true | 723 | return true |
730 | end | 724 | end |
725 | + if revenge and isWin then | ||
726 | + -- 次数扣一波 | ||
727 | + local pvpFreeH = role.dailyData:getProperty("pvpFreeH") | ||
728 | + if pvpFreeH >= globalCsv.pvp_battle_free_count_high then | ||
729 | + local cost = {[ItemId.PvpKey] = globalCsv.pvp_battle_high_cost} | ||
730 | + if not role:checkItemEnough(cost) then return 5 end | ||
731 | + role:costItems(cost, {log = {desc = "startPvp", int1 = 2}}) | ||
732 | + else | ||
733 | + role.dailyData:updateProperty({field = "pvpFreeH", delta = 1}) | ||
734 | + end | ||
735 | + end | ||
731 | 736 | ||
732 | -- 战斗结束了发奖 | 737 | -- 战斗结束了发奖 |
733 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true) | 738 | local temp = string.randWeight(csvdb["player_expCsv"][role:getProperty("level")].pvpgroupBonus, true) |
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) |