Commit a4a0fce1dcb502e7c6c62a14ceb834f8bc48d657
Merge branch 'develop' into player
# Conflicts: # src/actions/StoreAction.lua
Showing
16 changed files
with
400 additions
and
64 deletions
Show diff stats
src/GlobalVar.lua
| 1 | 1 | XXTEA_KEY = "699D448D6D24f7F941E9F6E99F823E18" |
| 2 | 2 | RESET_TIME = 4 |
| 3 | 3 | |
| 4 | -START_RESET_TIME_BASE = 1584921600 -- 0时区 | |
| 4 | +START_RESET_TIME_BASE = 1584316800 -- 0时区 | |
| 5 | 5 | TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", START_RESET_TIME_BASE))) / 3600) -- 本地时区 |
| 6 | 6 | |
| 7 | 7 | START_RESET_TIME = START_RESET_TIME_BASE - TIME_ZONE * 3600 |
| ... | ... | @@ -76,7 +76,13 @@ FuncOpenType = { |
| 76 | 76 | AdvWS = 6, -- 工坊解锁 |
| 77 | 77 | AdvWheelSurf = 7, -- 抽奖解锁 |
| 78 | 78 | TimeBoxSlot = 8, -- 时钟箱槽 |
| 79 | + AdvCount = 9, -- 冒险 次数上限 | |
| 80 | + AdvCountEL = 10, -- 无尽冒险 次数上限 | |
| 79 | 81 | } |
| 82 | +TypeIsFunc = {} | |
| 83 | +for _, v in pairs(FuncOpenType) do | |
| 84 | + TypeIsFunc[v] = true | |
| 85 | +end | |
| 80 | 86 | |
| 81 | 87 | -- 关卡通关相关的 功能开放 对应 guide_unlock |
| 82 | 88 | FuncUnlock = { |
| ... | ... | @@ -90,10 +96,6 @@ FuncUnlock = { |
| 90 | 96 | Adv = 8, -- 冒险 |
| 91 | 97 | } |
| 92 | 98 | |
| 93 | -TypeIsFunc = {} | |
| 94 | -for _, v in pairs(FuncOpenType) do | |
| 95 | - TypeIsFunc[v] = true | |
| 96 | -end | |
| 97 | 99 | |
| 98 | 100 | -- 物品起始id |
| 99 | 101 | ItemStartId = { |
| ... | ... | @@ -252,3 +254,8 @@ SettingStatus = { |
| 252 | 254 | } |
| 253 | 255 | |
| 254 | 256 | EMAIL_LIMIT = 20 --邮件最大数量 |
| 257 | + | |
| 258 | +RedPointTags = { | |
| 259 | + PvpCR = 1, | |
| 260 | + PvpHR = 2, | |
| 261 | +} | ... | ... |
src/ProtocolCode.lua
| ... | ... | @@ -174,6 +174,12 @@ actionCodes = { |
| 174 | 174 | Store_rechargeRpc = 550, |
| 175 | 175 | Store_dailyBuyRpc = 551, |
| 176 | 176 | Store_dinerBuyRpc = 552, |
| 177 | + Store_googleRechargeRpc = 553, | |
| 178 | + Store_purchaseOrderResult = 554, | |
| 179 | + Store_ayncPurchaseRpc = 555, | |
| 180 | + Store_myCardRechargeRpc = 556, | |
| 181 | + Store_iosRechargeRpc = 557, | |
| 182 | + | |
| 177 | 183 | |
| 178 | 184 | Email_listRpc = 600, |
| 179 | 185 | Email_drawAllAttachRpc = 601, | ... | ... |
src/actions/GmAction.lua
src/actions/HangAction.lua
| ... | ... | @@ -474,7 +474,12 @@ function _M.endBonusBattleRpc(agent, data) |
| 474 | 474 | bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 |
| 475 | 475 | role.dailyData:updateProperty({field = "bonusC", value = bonusC}) |
| 476 | 476 | |
| 477 | - reward = role:award(bonusData.reward, {log = {desc = "bonusBattle", int1 = id}}) | |
| 477 | + reward = bonusData.reward:toNumMap() | |
| 478 | + local chance = bonusData.chance:randWeight(true) | |
| 479 | + if chance[1] ~= 0 then | |
| 480 | + reward[chance[1]] = (reward[chance[1]] or 0) + chance[2] | |
| 481 | + end | |
| 482 | + reward = role:award(reward, {log = {desc = "bonusBattle", int1 = id}}) | |
| 478 | 483 | role:checkTaskEnter("BonusPass", {id = id}) |
| 479 | 484 | end |
| 480 | 485 | ... | ... |
src/actions/HeroAction.lua
| ... | ... | @@ -762,7 +762,7 @@ function _M.drawHeroRpc(agent, data) |
| 762 | 762 | |
| 763 | 763 | -- 开始抽 |
| 764 | 764 | local resultPool = {} |
| 765 | - local function fillDrawPool(fixRare, fixCamp, ssrUp) | |
| 765 | + local function fillDrawPool(fixRare, fixCamp, ssrUp, floorBack) | |
| 766 | 766 | local condition = {"rare", "camp"} |
| 767 | 767 | local values = {fixRare, fixCamp} |
| 768 | 768 | |
| ... | ... | @@ -781,8 +781,16 @@ function _M.drawHeroRpc(agent, data) |
| 781 | 781 | for _, weight in pairs(lpool) do |
| 782 | 782 | all = all + weight[1] |
| 783 | 783 | end |
| 784 | - | |
| 785 | - lpool[4][1] = lpool[4][1] + (ssrUp or 0) * all | |
| 784 | + --[[ | |
| 785 | + SSR概率值:初始概率 + 步长概率 | |
| 786 | + SR概率值:初始概率 * [ (初始概率+R初始概率) - 步长概率 ] /(初始概率+R初始概率) | |
| 787 | + R概率值:初始概率 * [ (初始概率+SR初始概率) - 步长概率 ] /(初始概率+SR初始概率) | |
| 788 | + ]] | |
| 789 | + local ssrAdd = (ssrUp or 0) * all | |
| 790 | + local last = all - lpool[4][1] | |
| 791 | + lpool[4][1] = lpool[4][1] + ssrAdd | |
| 792 | + lpool[3][1] = lpool[3][1] * (last - ssrAdd) / last | |
| 793 | + lpool[2][1] = lpool[2][1] * (last - ssrAdd) / last | |
| 786 | 794 | end |
| 787 | 795 | |
| 788 | 796 | if next(lpool) then |
| ... | ... | @@ -791,7 +799,7 @@ function _M.drawHeroRpc(agent, data) |
| 791 | 799 | end |
| 792 | 800 | end |
| 793 | 801 | |
| 794 | - for itemId, oneData in pairs(csvdb["build_poolCsv"]) do | |
| 802 | + for itemId, oneData in pairs(floorBack and csvdb["build_floorCsv"] or csvdb["build_poolCsv"]) do | |
| 795 | 803 | if oneData["pool_" .. pool] and oneData["pool_" .. pool] ~= "" then |
| 796 | 804 | local itemData = csvdb["itemCsv"][itemId] |
| 797 | 805 | while itemData do |
| ... | ... | @@ -839,13 +847,15 @@ function _M.drawHeroRpc(agent, data) |
| 839 | 847 | |
| 840 | 848 | local ssrUp = 0 |
| 841 | 849 | if draw_ssr_up_count_rate then |
| 842 | - ssrUp = math.floor(ssrUpCount / draw_ssr_up_count_rate[1]) * draw_ssr_up_count_rate[2] / 100 | |
| 850 | + ssrUp = math.min(math.floor(ssrUpCount / draw_ssr_up_count_rate[1]) * draw_ssr_up_count_rate[2], draw_ssr_up_count_rate[3]) / 100 | |
| 843 | 851 | end |
| 844 | 852 | while not next(resultPool) do |
| 845 | 853 | if isNewerSSR then |
| 846 | 854 | fillDrawPool(4) -- 新手保底的 ssr |
| 847 | 855 | elseif isFloorBack then |
| 848 | - fillDrawPool(3) -- 保底 sr 【郑斌】明确 | |
| 856 | + -- 保底 sr 【郑斌】明确 | |
| 857 | + -- 保底 sr 改为 池子随机 sr 或者 ssr【郑斌】 | |
| 858 | + fillDrawPool(nil, nil, nil, true) | |
| 849 | 859 | else |
| 850 | 860 | fillDrawPool(nil, nil, ssrUp) |
| 851 | 861 | end |
| ... | ... | @@ -857,17 +867,17 @@ function _M.drawHeroRpc(agent, data) |
| 857 | 867 | if itemData.quality == 4 then |
| 858 | 868 | ssrCount = ssrCount + 1 |
| 859 | 869 | ssrUpCount = 0 |
| 860 | - | |
| 861 | 870 | if btype == 4 then |
| 862 | 871 | newerHadSSR = newerHadSSR + 1 |
| 863 | 872 | end |
| 864 | - elseif itemData.quality == 3 then | |
| 865 | - floorHeroCount = 0 | |
| 866 | - ssrUpCount = ssrUpCount + 1 | |
| 867 | 873 | else |
| 868 | 874 | ssrUpCount = ssrUpCount + 1 |
| 869 | 875 | end |
| 870 | 876 | |
| 877 | + if itemData.quality >= 3 then | |
| 878 | + floorHeroCount = 0 | |
| 879 | + end | |
| 880 | + | |
| 871 | 881 | if role:isHaveHero(itemData.id - ItemStartId.Hero) then |
| 872 | 882 | local fragId = itemData.id - ItemStartId.Hero |
| 873 | 883 | local heroData = csvdb["unitCsv"][fragId] | ... | ... |
src/actions/PvpAction.lua
| ... | ... | @@ -381,6 +381,8 @@ function _M.endBattleRpc(agent, data) |
| 381 | 381 | sdelta = matchScore - oldMatchScore, |
| 382 | 382 | })) |
| 383 | 383 | red:ltrim(dbKey, 0, 9) |
| 384 | + | |
| 385 | + rpcRole(match.id, "redPTag", RedPointTags.PvpCR, now) | |
| 384 | 386 | end |
| 385 | 387 | end) |
| 386 | 388 | |
| ... | ... | @@ -670,6 +672,7 @@ function _M.endBattleHRpc(agent, data) |
| 670 | 672 | record = recordBattle, |
| 671 | 673 | })) |
| 672 | 674 | red:ltrim(dbKey, 0, 9) |
| 675 | + rpcRole(match.id, "redPTag", RedPointTags.PvpHR, now) | |
| 673 | 676 | end |
| 674 | 677 | end) |
| 675 | 678 | |
| ... | ... | @@ -786,7 +789,7 @@ function _M.recordListRpc(agent, data) |
| 786 | 789 | info.video = temp.video |
| 787 | 790 | info.sdelta = temp.sdelta |
| 788 | 791 | end |
| 789 | - | |
| 792 | + role:clearRedPTag(RedPointTags.PvpCR) | |
| 790 | 793 | elseif ptype == 2 then -- 高级pvp |
| 791 | 794 | local rlist = redisproxy:lrange(string.format(RECORD_PVP_HIGH, roleId), 0 , 9) |
| 792 | 795 | local tempList = {} |
| ... | ... | @@ -806,6 +809,8 @@ function _M.recordListRpc(agent, data) |
| 806 | 809 | info.sdelta = temp.sdelta |
| 807 | 810 | info.record = temp.record |
| 808 | 811 | end |
| 812 | + role:clearRedPTag(RedPointTags.PvpHR) | |
| 813 | + | |
| 809 | 814 | else |
| 810 | 815 | return |
| 811 | 816 | end |
| ... | ... | @@ -819,18 +824,8 @@ function _M.highDivisionGiftRpc(agent, data) |
| 819 | 824 | |
| 820 | 825 | local pvpHGTime = role:getProperty("pvpHGTime") |
| 821 | 826 | if pvpHGTime == 0 then return end |
| 822 | - local score = role:unpackPvpScore(redisproxy:zscore(role:getPvpDBKey(RANK_PVP_HIGHT), roleId)) | |
| 823 | - | |
| 824 | - local divisionId = nil | |
| 825 | - for _id, division in ipairs(csvdb["pvp_group_divisionCsv"]) do | |
| 826 | - if score >= division.division then | |
| 827 | - divisionId = _id | |
| 828 | - else | |
| 829 | - break | |
| 830 | - end | |
| 831 | - end | |
| 832 | 827 | |
| 833 | - local newTime, newReward = role:calculatePvpHGift(divisionId) | |
| 828 | + local newTime, newReward = role:calculatePvpHGift(role:getPvpHDivision()) | |
| 834 | 829 | if not next(newReward) then return end |
| 835 | 830 | |
| 836 | 831 | role:updateProperties({ | ... | ... |
src/actions/StoreAction.lua
| 1 | 1 | local _M = {} |
| 2 | 2 | |
| 3 | +local serverId = tonumber(skynet.getenv("servId")) | |
| 4 | +local md5 = require "md5" | |
| 5 | + | |
| 6 | +local function makeOrder(roleId, rechargeId) | |
| 7 | + local orderId = redisproxy:hincrby("autoincrement_set", "order", 1) | |
| 8 | + local partnerOrderId = string.format("%d_%d_%d", serverId, roleId, orderId) | |
| 9 | + local orderKey = string.format("order:%d:%d", roleId, orderId) | |
| 10 | + redisproxy:del(orderKey) | |
| 11 | + local order = require("models.Order").new({ | |
| 12 | + key = orderKey, | |
| 13 | + order = partnerOrderId, | |
| 14 | + rechargeId = rechargeId, | |
| 15 | + }) | |
| 16 | + order:create() | |
| 17 | + redisproxy:sadd(string.format("role:%d:orders", roleId), partnerOrderId) | |
| 18 | + return partnerOrderId | |
| 19 | +end | |
| 20 | + | |
| 21 | +-- 入口在正式服关闭 -- mock 充值 | |
| 3 | 22 | function _M.rechargeRpc(agent , data) |
| 4 | 23 | local role = agent.role |
| 5 | 24 | local msg = MsgPack.unpack(data) |
| ... | ... | @@ -7,33 +26,152 @@ function _M.rechargeRpc(agent , data) |
| 7 | 26 | local id = msg.id |
| 8 | 27 | local dataSet = csvdb["shop_rechargeCsv"][id] |
| 9 | 28 | if not dataSet then return end |
| 10 | - local diamondCount | |
| 11 | - if dataSet.type == 0 then -- 钻石 | |
| 12 | - local rechargeF = role:getProperty("rechargeF") | |
| 13 | - diamondCount = dataSet.diamond + dataSet.diamondExtra | |
| 14 | - if not rechargeF[id] then | |
| 15 | - diamondCount = diamondCount + dataSet.diamondFirst | |
| 16 | - rechargeF[id] = 1 | |
| 17 | - role:updateProperty({field = "rechargeF", value = rechargeF}) | |
| 18 | - else | |
| 19 | - return --钻石只能买一次 | |
| 20 | - end | |
| 21 | - role:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) | |
| 22 | - elseif dataSet.type == 1 then --月卡 | |
| 23 | - return | |
| 24 | - elseif dataSet.type == 2 then -- 赛季通行证 | |
| 25 | - return | |
| 26 | - else | |
| 27 | - return | |
| 29 | + local roleId = role:getProperty("id") | |
| 30 | + | |
| 31 | + --创建订单号 | |
| 32 | + local partnerOrderId = makeOrder(roleId, id) | |
| 33 | + SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId })) | |
| 34 | + | |
| 35 | + -- 测试的 直接发奖励了 | |
| 36 | + skynet.timeout(10, function () | |
| 37 | + role:handlePurchase({ | |
| 38 | + order = partnerOrderId, | |
| 39 | + amount = dataSet.rmb, | |
| 40 | + game_money = dataSet.diamond, | |
| 41 | + product_id = dataSet.productId, | |
| 42 | + pay_time = skynet.timex(), | |
| 43 | + transactionId = "onlyTest", | |
| 44 | + }) | |
| 45 | + end) | |
| 46 | + | |
| 47 | + return true | |
| 48 | +end | |
| 49 | + | |
| 50 | +local function table_keys( t ) | |
| 51 | + local keys = {} | |
| 52 | + for k, _ in pairs( t ) do | |
| 53 | + keys[#keys + 1] = k | |
| 54 | + end | |
| 55 | + return keys | |
| 56 | +end | |
| 57 | + | |
| 58 | +local function signPms(params, secret_key) | |
| 59 | + local keys = table_keys(params) | |
| 60 | + table.sort(keys) | |
| 61 | + local urlCode = "" | |
| 62 | + for index, key in ipairs(keys) do | |
| 63 | + urlCode = urlCode .. params[key] | |
| 28 | 64 | end |
| 65 | + return md5.sumhexa(urlCode .. secret_key):lower() | |
| 66 | +end | |
| 29 | 67 | |
| 30 | - -- 累充 | |
| 31 | - local rmb = dataSet.rmb | |
| 32 | - role:updateProperty({field = "rmbC", delta = rmb}) | |
| 33 | - | |
| 34 | - role:log("role_action", {desc = "recharge", int1 = id, int2 = rmb}) | |
| 35 | 68 | |
| 36 | - SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount})) | |
| 69 | +-- google 充值 入口 | |
| 70 | +function _M.googleRechargeRpc(agent, data) | |
| 71 | + local role = agent.role | |
| 72 | + local msg = MsgPack.unpack(data) | |
| 73 | + local id = msg.id | |
| 74 | + local dataSet = csvdb["shop_rechargeCsv"][id] | |
| 75 | + if not dataSet then return end | |
| 76 | + local roleId = role:getProperty("id") | |
| 77 | + | |
| 78 | + role.ignoreHeartbeat = true | |
| 79 | + --创建订单号 | |
| 80 | + local partnerOrderId = makeOrder(roleId, id) | |
| 81 | + -- 签名 | |
| 82 | + local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075" | |
| 83 | + local need = { | |
| 84 | + out_trade_no = partnerOrderId, | |
| 85 | + money = dataSet.rmb, | |
| 86 | + game_money = dataSet.diamond, | |
| 87 | + product_id = dataSet.productId, | |
| 88 | + } | |
| 89 | + local sign = signPms(need, secret_key) | |
| 90 | + | |
| 91 | + SendPacket(actionCodes.Store_googleRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign})) | |
| 92 | + return true | |
| 93 | +end | |
| 94 | + | |
| 95 | +-- mycard 充值 入口 | |
| 96 | +function _M.myCardRechargeRpc(agent, data) | |
| 97 | + local role = agent.role | |
| 98 | + local msg = MsgPack.unpack(data) | |
| 99 | + local id = msg.id | |
| 100 | + local dataSet = csvdb["shop_rechargeCsv"][id] | |
| 101 | + if not dataSet then return end | |
| 102 | + local roleId = role:getProperty("id") | |
| 103 | + | |
| 104 | + role.ignoreHeartbeat = true | |
| 105 | + --创建订单号 | |
| 106 | + local partnerOrderId = makeOrder(roleId, id) | |
| 107 | + -- 签名 | |
| 108 | + local secret_key = "48759e07540f46d9af17ec82669b4272" | |
| 109 | + local need = { | |
| 110 | + out_trade_no = partnerOrderId, | |
| 111 | + money = dataSet.rmb, | |
| 112 | + game_money = dataSet.diamond, | |
| 113 | + } | |
| 114 | + local sign = signPms(need, secret_key) | |
| 115 | + | |
| 116 | + SendPacket(actionCodes.Store_myCardRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign})) | |
| 117 | + return true | |
| 118 | +end | |
| 119 | + | |
| 120 | +-- mycard 充值 入口 | |
| 121 | +function _M.iosRechargeRpc(agent, data) | |
| 122 | + local role = agent.role | |
| 123 | + local msg = MsgPack.unpack(data) | |
| 124 | + local id = msg.id | |
| 125 | + local dataSet = csvdb["shop_rechargeCsv"][id] | |
| 126 | + if not dataSet then return end | |
| 127 | + local roleId = role:getProperty("id") | |
| 128 | + | |
| 129 | + role.ignoreHeartbeat = true | |
| 130 | + --创建订单号 | |
| 131 | + local partnerOrderId = makeOrder(roleId, id) | |
| 132 | + -- 签名 | |
| 133 | + local secret_key = "9647d2efe1074c73b9ac19af4337a70e" | |
| 134 | + local need = { | |
| 135 | + out_trade_no = partnerOrderId, | |
| 136 | + money = dataSet.rmb, | |
| 137 | + game_money = dataSet.diamond, | |
| 138 | + product_id = dataSet.productId, | |
| 139 | + } | |
| 140 | + local sign = signPms(need, secret_key) | |
| 141 | + | |
| 142 | + SendPacket(actionCodes.Store_iosRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign})) | |
| 143 | + return true | |
| 144 | +end | |
| 145 | + | |
| 146 | +function _M.purchaseOrderResult(agent, data) | |
| 147 | + local role = agent.role | |
| 148 | + | |
| 149 | + local roleId = role:getProperty("id") | |
| 150 | + local msg = MsgPack.unpack(data) | |
| 151 | + | |
| 152 | + role.ignoreHeartbeat = false | |
| 153 | + | |
| 154 | + local partnerOrderStr = msg.order | |
| 155 | + local _, _, orderId = string.match(partnerOrderStr, "(.+)_(.+)_(.+)") | |
| 156 | + local orderObject = require("models.Order").new({ key = string.format("order:%d:%d", roleId, orderId) }) | |
| 157 | + if not orderObject:load() then | |
| 158 | + -- 订单不存在 | |
| 159 | + skynet.error("cancelPurchaseRpc", string.format("order %s not exist", partnerOrderStr)) | |
| 160 | + return true | |
| 161 | + end | |
| 162 | + | |
| 163 | + if msg.status == "success" then | |
| 164 | + orderObject:setProperty("transactionId", msg.platformOrder or "") | |
| 165 | + return true | |
| 166 | + end | |
| 167 | + | |
| 168 | + if orderObject:getProperty("finishTime") > 0 then | |
| 169 | + return true | |
| 170 | + end | |
| 171 | + | |
| 172 | + orderObject:setProperty("status", msg.status) | |
| 173 | + | |
| 174 | + redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr) | |
| 37 | 175 | return true |
| 38 | 176 | end |
| 39 | 177 | ... | ... |
src/adv/AdvPassive.lua
| ... | ... | @@ -300,7 +300,7 @@ function Passive:canEffect(effType, effValue) |
| 300 | 300 | return |
| 301 | 301 | end |
| 302 | 302 | --禁用被动技 |
| 303 | - if self.owner:getPassiveIdx(self) <= self.owner:getDisablePassiveCount() then | |
| 303 | + if self.owner:getDisablePassiveCount() == 0 or self.owner:getPassiveIdx(self) <= self.owner:getDisablePassiveCount() then | |
| 304 | 304 | return |
| 305 | 305 | end |
| 306 | 306 | return true | ... | ... |
src/models/Diner.lua
| ... | ... | @@ -73,11 +73,11 @@ function Diner:refreshDailyData(notify) |
| 73 | 73 | local guide = self.owner:getProperty("newerGuide") |
| 74 | 74 | local master, slave = string.match(guide,"(%d+)=(%d+)") |
| 75 | 75 | if tonumber(master) <= 26 then |
| 76 | - entrust[1] = 1031 | |
| 77 | - entrust[2] = 3 | |
| 76 | + entrust[1] = 1001 | |
| 77 | + entrust[2] = 1 | |
| 78 | 78 | elseif tonumber(master) <= 29 then |
| 79 | 79 | local temp = entrust[1] |
| 80 | - entrust[1] = 3 | |
| 80 | + entrust[1] = 1 | |
| 81 | 81 | entrust[2] = temp |
| 82 | 82 | end |
| 83 | 83 | ... | ... |
src/models/HeroPlugin.lua
| ... | ... | @@ -208,10 +208,10 @@ function HeroPlugin.bind(Hero) |
| 208 | 208 | end |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - -- 战斗力(当前属性)= POWER[(生命 + 防御 * 23 + 闪避 * 4)*(攻击*14 + 命中 * 2)*(1 + 暴击几率/100 * 暴击伤害/100)* 攻击速度 / 60000 ,0.8 ] | |
| 211 | + -- 战斗力(当前属性)= POWER[(生命 + 防御 * 7 + 闪避 * 4)*(攻击*4 + 命中 * 2)*(1 + 暴击几率/100 * 暴击伤害/100)* 攻击速度 / 60000 ,0.8 ] | |
| 212 | 212 | function Hero:getBattleValue(activeRelation) -- isReal包括队伍加成 |
| 213 | 213 | local attrs = self:getTotalAttrs({activeRelation = activeRelation}) |
| 214 | - local battleValue = ((attrs["hp"] + attrs["def"] * 23 + attrs["miss"] * 4) * (attrs["atk"] * 14 + attrs["hit"] * 2) * (1 + attrs["crit"]/100 * attrs["critHurt"]/100) * attrs["atkSpeed"] / 600000) ^ 0.8 | |
| 214 | + local battleValue = ((attrs["hp"] + attrs["def"] * 7 + attrs["miss"] * 4) * (attrs["atk"] * 4 + attrs["hit"] * 2) * (1 + attrs["crit"]/100 * attrs["critHurt"]/100) * attrs["atkSpeed"] / 600000) ^ 0.8 | |
| 215 | 215 | return math.floor(battleValue) |
| 216 | 216 | end |
| 217 | 217 | ... | ... |
| ... | ... | @@ -0,0 +1,26 @@ |
| 1 | +local Order = class("Order", require("shared.ModelBase")) | |
| 2 | + | |
| 3 | +function Order:ctor(properties) | |
| 4 | + Order.super.ctor(self, properties) | |
| 5 | +end | |
| 6 | + | |
| 7 | +Order.schema = { | |
| 8 | + key = {"string"}, -- redis key | |
| 9 | + order = {"string"}, -- 自己订单号 | |
| 10 | + rechargeId = {"number", 0}, | |
| 11 | + transactionId = {"string", ""}, | |
| 12 | + createTime = {"number", skynet.timex()}, -- 订单创建时间 | |
| 13 | + finishTime = {"number", 0}, -- 服务端验证完成时间 | |
| 14 | + status = {"string", "create"}, | |
| 15 | +} | |
| 16 | + | |
| 17 | +Order.fields = { | |
| 18 | + order = true, | |
| 19 | + rechargeId = true, | |
| 20 | + transactionId = true, | |
| 21 | + createTime = true, | |
| 22 | + finishTime = true, | |
| 23 | + status = true, | |
| 24 | +} | |
| 25 | + | |
| 26 | +return Order | |
| 0 | 27 | \ No newline at end of file | ... | ... |
src/models/Role.lua
| ... | ... | @@ -150,6 +150,8 @@ Role.schema = { |
| 150 | 150 | |
| 151 | 151 | sudoku = {"table", {}}, -- 九宫格 {[-1] = 1, task = {[1] = {}, [2] = {}}}} -- [-1] 阶段 如果为 -1 关闭(都做完了), task 当前阶段任务进度, reward 连串奖励领取情况 |
| 152 | 152 | sign = {"table", {}}, -- 签到记录 {[1] = 20181029} |
| 153 | + | |
| 154 | + redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } | |
| 153 | 155 | } |
| 154 | 156 | |
| 155 | 157 | |
| ... | ... | @@ -359,6 +361,8 @@ function Role:data() |
| 359 | 361 | |
| 360 | 362 | sudoku = self:getProperty("sudoku"), |
| 361 | 363 | sign = self:getProperty("sign"), |
| 364 | + | |
| 365 | + redp = self:getProperty("redp"), | |
| 362 | 366 | } |
| 363 | 367 | end |
| 364 | 368 | ... | ... |
src/models/RoleCross.lua
| ... | ... | @@ -67,6 +67,15 @@ RoleCross.bind = function (Role) |
| 67 | 67 | return info |
| 68 | 68 | end |
| 69 | 69 | |
| 70 | + function Role:redPTag(tag, pms) | |
| 71 | + pms = pms or 1 | |
| 72 | + local redp = self:getProperty("redp") | |
| 73 | + if not redp[tag] or redp[tag] ~= pms then | |
| 74 | + redp[tag] = pms | |
| 75 | + self:updateProperty({field = "redp", value = redp}) | |
| 76 | + end | |
| 77 | + end | |
| 78 | + | |
| 70 | 79 | function Role:accountInit(initData) |
| 71 | 80 | -- 道具 |
| 72 | 81 | local reward = {} |
| ... | ... | @@ -318,6 +327,16 @@ function CMD.pvpHRankInfo(roleId) |
| 318 | 327 | return info |
| 319 | 328 | end |
| 320 | 329 | |
| 330 | +-- 记录红点 | |
| 331 | +function CMD.redPTag(roleId, tag, pms) | |
| 332 | + pms = pms or 1 | |
| 333 | + local redp = CMD.getProperty(roleId, "redp") | |
| 334 | + if not redp[tag] or redp[tag] ~= pms then | |
| 335 | + redp[tag] = pms | |
| 336 | + CMD.setProperty(roleId, "redp", redp) | |
| 337 | + end | |
| 338 | +end | |
| 339 | + | |
| 321 | 340 | RoleCross.handle = function(cmd, roleId, ...) |
| 322 | 341 | SRole = SRole or require("models.Role") |
| 323 | 342 | if CMD[cmd] then | ... | ... |
src/models/RolePlugin.lua
| ... | ... | @@ -830,13 +830,11 @@ function RolePlugin.bind(Role) |
| 830 | 830 | end |
| 831 | 831 | |
| 832 | 832 | function Role:getAdvHangLimit() |
| 833 | - -- todo | |
| 834 | - return globalCsv.adv_daily_cross_count | |
| 833 | + return globalCsv.adv_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCount) | |
| 835 | 834 | end |
| 836 | 835 | |
| 837 | 836 | function Role:getAdvElLimit() |
| 838 | - -- todo | |
| 839 | - return globalCsv.adv_endless_daily_cross_count | |
| 837 | + return globalCsv.adv_endless_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCountEL) | |
| 840 | 838 | end |
| 841 | 839 | |
| 842 | 840 | -- 走 guide_unlock 表的 被动解锁 |
| ... | ... | @@ -1293,6 +1291,7 @@ function RolePlugin.bind(Role) |
| 1293 | 1291 | end |
| 1294 | 1292 | local breathes = { |
| 1295 | 1293 | ["email"] = breath(120), -- email |
| 1294 | + ["pvphg"] = breath(300), -- 高级竞技场 奖励满的红点 | |
| 1296 | 1295 | } |
| 1297 | 1296 | function Role:checkNewEvent(now) |
| 1298 | 1297 | if now - self:getProperty("ltime") < 5 then |
| ... | ... | @@ -1339,6 +1338,21 @@ function RolePlugin.bind(Role) |
| 1339 | 1338 | end |
| 1340 | 1339 | end |
| 1341 | 1340 | end |
| 1341 | + | |
| 1342 | + checks["pvphg"] = function() | |
| 1343 | + if not self:isTimeResetOpen(TimeReset.PvpHight) then return end | |
| 1344 | + | |
| 1345 | + local pvpHGTime = self:getProperty("pvpHGTime") | |
| 1346 | + if pvpHGTime == 0 then return end | |
| 1347 | + local division = self:getPvpHDivision() | |
| 1348 | + local divisionData = csvdb["pvp_group_divisionCsv"][division] | |
| 1349 | + | |
| 1350 | + local newTime, newReward = self:calculatePvpHGift(division) | |
| 1351 | + if table.pack(next(newReward))[2] >= divisionData.limit then | |
| 1352 | + return true | |
| 1353 | + end | |
| 1354 | + | |
| 1355 | + end | |
| 1342 | 1356 | |
| 1343 | 1357 | local events = {} |
| 1344 | 1358 | for name, breath in pairs(breathes) do |
| ... | ... | @@ -1392,6 +1406,101 @@ function RolePlugin.bind(Role) |
| 1392 | 1406 | return false |
| 1393 | 1407 | end |
| 1394 | 1408 | |
| 1409 | + -- 消除指定tag 红点 | |
| 1410 | + function Role:clearRedPTag(tag) | |
| 1411 | + local redp = self:getProperty("redp") | |
| 1412 | + redp[tag] = nil | |
| 1413 | + self:updateProperty({field = "redp", value = redp}) | |
| 1414 | + end | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + -- 充值 -- | |
| 1418 | + --[[ | |
| 1419 | + request.order = data.out_trade_no | |
| 1420 | + request.amount = data.money / 100 | |
| 1421 | + request.game_money = data.game_money | |
| 1422 | + request.product_id = data.product_id | |
| 1423 | + request.pay_time = data.pay_time | |
| 1424 | + request.transactionId = data.order_no | |
| 1425 | + ]] | |
| 1426 | + function Role:handlePurchase(params) | |
| 1427 | + local roleId = self:getProperty("id") | |
| 1428 | + local partnerOrderStr = params.order | |
| 1429 | + | |
| 1430 | + local _, _, orderId = string.match(partnerOrderStr, "(.+)_(.+)_(.+)") | |
| 1431 | + local orderObject = require("models.Order").new({ key = string.format("order:%d:%d", roleId, orderId) }) | |
| 1432 | + if not orderObject:load() then | |
| 1433 | + -- 订单不存在 | |
| 1434 | + skynet.error("ayncPurchaseRpc", string.format("order %s not exist", partnerOrderStr)) | |
| 1435 | + return | |
| 1436 | + end | |
| 1437 | + | |
| 1438 | + if orderObject:getProperty("finishTime") > 0 then | |
| 1439 | + -- 订单已经处理 | |
| 1440 | + SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ result = "handled" })) | |
| 1441 | + return | |
| 1442 | + end | |
| 1443 | + | |
| 1444 | + local rechargeData = csvdb["shop_rechargeCsv"][orderObject:getProperty("rechargeId")] | |
| 1445 | + if rechargeData.rmb ~= tonumber(params.amount) then | |
| 1446 | + skynet.error(string.format("fake order: %s, roleId: %d, order: %s", | |
| 1447 | + params.transactionId, roleId, partnerOrderStr | |
| 1448 | + )) | |
| 1449 | + return | |
| 1450 | + end | |
| 1451 | + | |
| 1452 | + local diamond = self:recharge({ | |
| 1453 | + id = orderObject:getProperty("rechargeId"), | |
| 1454 | + transactionId = params.transactionId, | |
| 1455 | + pay_time = params.pay_time, | |
| 1456 | + order = partnerOrderStr | |
| 1457 | + }) | |
| 1458 | + orderObject:setProperty("finishTime", skynet.time()) | |
| 1459 | + orderObject:setProperty("status", "finish") | |
| 1460 | + | |
| 1461 | + redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr) | |
| 1462 | + SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, | |
| 1463 | + result = "success", diamond = diamond})) | |
| 1464 | + | |
| 1465 | + return orderObject:getProperty("rechargeId") | |
| 1466 | + end | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + function Role:recharge(params) | |
| 1470 | + local id = tonumber(params.id) | |
| 1471 | + local rechargeData = csvdb["shop_rechargeCsv"][id] | |
| 1472 | + if not rechargeData then | |
| 1473 | + skynet.error("recharge id not exist", id) | |
| 1474 | + return | |
| 1475 | + end | |
| 1476 | + | |
| 1477 | + local diamondCount = 0 | |
| 1478 | + if rechargeData.type == 0 then -- 钻石 | |
| 1479 | + local rechargeF = self:getProperty("rechargeF") | |
| 1480 | + diamondCount = rechargeData.diamond + rechargeData.diamondExtra | |
| 1481 | + if not rechargeF[id] then | |
| 1482 | + diamondCount = diamondCount + rechargeData.diamondFirst | |
| 1483 | + rechargeF[id] = 1 | |
| 1484 | + self:updateProperty({field = "rechargeF", value = rechargeF}) | |
| 1485 | + end | |
| 1486 | + self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}}) | |
| 1487 | + elseif rechargeData.type == 1 then --月卡 | |
| 1488 | + return | |
| 1489 | + elseif rechargeData.type == 2 then -- 赛季通行证 | |
| 1490 | + return | |
| 1491 | + else | |
| 1492 | + return | |
| 1493 | + end | |
| 1494 | + | |
| 1495 | + -- 累充 | |
| 1496 | + local rmb = rechargeData.rmb | |
| 1497 | + self:updateProperty({field = "rmbC", delta = rmb}) | |
| 1498 | + | |
| 1499 | + self:log("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time}) | |
| 1500 | + | |
| 1501 | + return diamondCount | |
| 1502 | + end | |
| 1503 | + | |
| 1395 | 1504 | end |
| 1396 | 1505 | |
| 1397 | 1506 | return RolePlugin |
| 1398 | 1507 | \ No newline at end of file | ... | ... |
src/models/RolePvp.lua
| ... | ... | @@ -82,6 +82,19 @@ function Role:changePvpScoreCommon(matchId, isWin) |
| 82 | 82 | return table.unpack(result) |
| 83 | 83 | end |
| 84 | 84 | |
| 85 | +function Role:getPvpHDivision(score) | |
| 86 | + local score = score or self:unpackPvpScore(redisproxy:zscore(self:getPvpDBKey(RANK_PVP_HIGHT), self:getProperty("id"))) | |
| 87 | + local divisionId = nil | |
| 88 | + for _id, division in ipairs(csvdb["pvp_group_divisionCsv"]) do | |
| 89 | + if score >= division.division then | |
| 90 | + divisionId = _id | |
| 91 | + else | |
| 92 | + break | |
| 93 | + end | |
| 94 | + end | |
| 95 | + return divisionId | |
| 96 | +end | |
| 97 | + | |
| 85 | 98 | function Role:calculatePvpHGift(division) |
| 86 | 99 | local now = skynet.timex() |
| 87 | 100 | local oldTime = self:getProperty("pvpHGTime") |
| ... | ... | @@ -140,7 +153,7 @@ function Role:changePvpScoreHigh(matchId, isWin) |
| 140 | 153 | break |
| 141 | 154 | end |
| 142 | 155 | end |
| 143 | - if newDivision ~= oldMyDivision then | |
| 156 | + if newDivision ~= oldMyDivision or self:getProperty("pvpHGTime") == 0 then | |
| 144 | 157 | --刷新段位奖励 |
| 145 | 158 | local newTime, newReward = self:calculatePvpHGift(oldMyDivision) |
| 146 | 159 | self:updateProperties({ | ... | ... |