Commit 2d9a616a3c3fff5a8c0cd66697e088c2ed045701

Authored by zhouhaihai
2 parents 2a1d5c8c 9e25c63d

Merge branch 'develop' into qa

@@ -76,7 +76,13 @@ FuncOpenType = { @@ -76,7 +76,13 @@ FuncOpenType = {
76 AdvWS = 6, -- 工坊解锁 76 AdvWS = 6, -- 工坊解锁
77 AdvWheelSurf = 7, -- 抽奖解锁 77 AdvWheelSurf = 7, -- 抽奖解锁
78 TimeBoxSlot = 8, -- 时钟箱槽 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 -- 关卡通关相关的 功能开放 对应 guide_unlock 87 -- 关卡通关相关的 功能开放 对应 guide_unlock
82 FuncUnlock = { 88 FuncUnlock = {
@@ -90,10 +96,6 @@ FuncUnlock = { @@ -90,10 +96,6 @@ FuncUnlock = {
90 Adv = 8, -- 冒险 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 -- 物品起始id 100 -- 物品起始id
99 ItemStartId = { 101 ItemStartId = {
@@ -252,3 +254,8 @@ SettingStatus = { @@ -252,3 +254,8 @@ SettingStatus = {
252 } 254 }
253 255
254 EMAIL_LIMIT = 20 --邮件最大数量 256 EMAIL_LIMIT = 20 --邮件最大数量
  257 +
  258 +RedPointTags = {
  259 + PvpCR = 1,
  260 + PvpHR = 2,
  261 +}
src/ProtocolCode.lua
@@ -174,6 +174,12 @@ actionCodes = { @@ -174,6 +174,12 @@ actionCodes = {
174 Store_rechargeRpc = 550, 174 Store_rechargeRpc = 550,
175 Store_dailyBuyRpc = 551, 175 Store_dailyBuyRpc = 551,
176 Store_dinerBuyRpc = 552, 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 Email_listRpc = 600, 184 Email_listRpc = 600,
179 Email_drawAllAttachRpc = 601, 185 Email_drawAllAttachRpc = 601,
src/actions/GmAction.lua
@@ -514,6 +514,10 @@ function _M.helpRpc(agent, data) @@ -514,6 +514,10 @@ function _M.helpRpc(agent, data)
514 return true 514 return true
515 end 515 end
516 516
  517 +-- 充值回调
  518 +function _M.ayncPurchase(role, params)
  519 + return role:handlePurchase(params)
  520 +end
517 521
518 522
519 523
src/actions/HangAction.lua
@@ -474,7 +474,12 @@ function _M.endBonusBattleRpc(agent, data) @@ -474,7 +474,12 @@ function _M.endBonusBattleRpc(agent, data)
474 bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1 474 bonusC[bonusData.type]["c"] = bonusC[bonusData.type]["c"] + 1
475 role.dailyData:updateProperty({field = "bonusC", value = bonusC}) 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 role:checkTaskEnter("BonusPass", {id = id}) 483 role:checkTaskEnter("BonusPass", {id = id})
479 end 484 end
480 485
src/actions/HeroAction.lua
@@ -762,7 +762,7 @@ function _M.drawHeroRpc(agent, data) @@ -762,7 +762,7 @@ function _M.drawHeroRpc(agent, data)
762 762
763 -- 开始抽 763 -- 开始抽
764 local resultPool = {} 764 local resultPool = {}
765 - local function fillDrawPool(fixRare, fixCamp, ssrUp) 765 + local function fillDrawPool(fixRare, fixCamp, ssrUp, floorBack)
766 local condition = {"rare", "camp"} 766 local condition = {"rare", "camp"}
767 local values = {fixRare, fixCamp} 767 local values = {fixRare, fixCamp}
768 768
@@ -781,8 +781,16 @@ function _M.drawHeroRpc(agent, data) @@ -781,8 +781,16 @@ function _M.drawHeroRpc(agent, data)
781 for _, weight in pairs(lpool) do 781 for _, weight in pairs(lpool) do
782 all = all + weight[1] 782 all = all + weight[1]
783 end 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 end 794 end
787 795
788 if next(lpool) then 796 if next(lpool) then
@@ -791,7 +799,7 @@ function _M.drawHeroRpc(agent, data) @@ -791,7 +799,7 @@ function _M.drawHeroRpc(agent, data)
791 end 799 end
792 end 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 if oneData["pool_" .. pool] and oneData["pool_" .. pool] ~= "" then 803 if oneData["pool_" .. pool] and oneData["pool_" .. pool] ~= "" then
796 local itemData = csvdb["itemCsv"][itemId] 804 local itemData = csvdb["itemCsv"][itemId]
797 while itemData do 805 while itemData do
@@ -839,13 +847,15 @@ function _M.drawHeroRpc(agent, data) @@ -839,13 +847,15 @@ function _M.drawHeroRpc(agent, data)
839 847
840 local ssrUp = 0 848 local ssrUp = 0
841 if draw_ssr_up_count_rate then 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 end 851 end
844 while not next(resultPool) do 852 while not next(resultPool) do
845 if isNewerSSR then 853 if isNewerSSR then
846 fillDrawPool(4) -- 新手保底的 ssr 854 fillDrawPool(4) -- 新手保底的 ssr
847 elseif isFloorBack then 855 elseif isFloorBack then
848 - fillDrawPool(3) -- 保底 sr 【郑斌】明确 856 + -- 保底 sr 【郑斌】明确
  857 + -- 保底 sr 改为 池子随机 sr 或者 ssr【郑斌】
  858 + fillDrawPool(nil, nil, nil, true)
849 else 859 else
850 fillDrawPool(nil, nil, ssrUp) 860 fillDrawPool(nil, nil, ssrUp)
851 end 861 end
@@ -857,17 +867,17 @@ function _M.drawHeroRpc(agent, data) @@ -857,17 +867,17 @@ function _M.drawHeroRpc(agent, data)
857 if itemData.quality == 4 then 867 if itemData.quality == 4 then
858 ssrCount = ssrCount + 1 868 ssrCount = ssrCount + 1
859 ssrUpCount = 0 869 ssrUpCount = 0
860 -  
861 if btype == 4 then 870 if btype == 4 then
862 newerHadSSR = newerHadSSR + 1 871 newerHadSSR = newerHadSSR + 1
863 end 872 end
864 - elseif itemData.quality == 3 then  
865 - floorHeroCount = 0  
866 - ssrUpCount = ssrUpCount + 1  
867 else 873 else
868 ssrUpCount = ssrUpCount + 1 874 ssrUpCount = ssrUpCount + 1
869 end 875 end
870 876
  877 + if itemData.quality >= 3 then
  878 + floorHeroCount = 0
  879 + end
  880 +
871 if role:isHaveHero(itemData.id - ItemStartId.Hero) then 881 if role:isHaveHero(itemData.id - ItemStartId.Hero) then
872 local fragId = itemData.id - ItemStartId.Hero 882 local fragId = itemData.id - ItemStartId.Hero
873 local heroData = csvdb["unitCsv"][fragId] 883 local heroData = csvdb["unitCsv"][fragId]
src/actions/PvpAction.lua
@@ -381,6 +381,8 @@ function _M.endBattleRpc(agent, data) @@ -381,6 +381,8 @@ function _M.endBattleRpc(agent, data)
381 sdelta = matchScore - oldMatchScore, 381 sdelta = matchScore - oldMatchScore,
382 })) 382 }))
383 red:ltrim(dbKey, 0, 9) 383 red:ltrim(dbKey, 0, 9)
  384 +
  385 + rpcRole(match.id, "redPTag", RedPointTags.PvpCR, now)
384 end 386 end
385 end) 387 end)
386 388
@@ -670,6 +672,7 @@ function _M.endBattleHRpc(agent, data) @@ -670,6 +672,7 @@ function _M.endBattleHRpc(agent, data)
670 record = recordBattle, 672 record = recordBattle,
671 })) 673 }))
672 red:ltrim(dbKey, 0, 9) 674 red:ltrim(dbKey, 0, 9)
  675 + rpcRole(match.id, "redPTag", RedPointTags.PvpHR, now)
673 end 676 end
674 end) 677 end)
675 678
@@ -786,7 +789,7 @@ function _M.recordListRpc(agent, data) @@ -786,7 +789,7 @@ function _M.recordListRpc(agent, data)
786 info.video = temp.video 789 info.video = temp.video
787 info.sdelta = temp.sdelta 790 info.sdelta = temp.sdelta
788 end 791 end
789 - 792 + role:clearRedPTag(RedPointTags.PvpCR)
790 elseif ptype == 2 then -- 高级pvp 793 elseif ptype == 2 then -- 高级pvp
791 local rlist = redisproxy:lrange(string.format(RECORD_PVP_HIGH, roleId), 0 , 9) 794 local rlist = redisproxy:lrange(string.format(RECORD_PVP_HIGH, roleId), 0 , 9)
792 local tempList = {} 795 local tempList = {}
@@ -806,6 +809,8 @@ function _M.recordListRpc(agent, data) @@ -806,6 +809,8 @@ function _M.recordListRpc(agent, data)
806 info.sdelta = temp.sdelta 809 info.sdelta = temp.sdelta
807 info.record = temp.record 810 info.record = temp.record
808 end 811 end
  812 + role:clearRedPTag(RedPointTags.PvpHR)
  813 +
809 else 814 else
810 return 815 return
811 end 816 end
src/actions/StoreAction.lua
1 local _M = {} 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 function _M.rechargeRpc(agent , data) 22 function _M.rechargeRpc(agent , data)
4 local role = agent.role 23 local role = agent.role
5 local msg = MsgPack.unpack(data) 24 local msg = MsgPack.unpack(data)
6 local id = msg.id 25 local id = msg.id
7 local dataSet = csvdb["shop_rechargeCsv"][id] 26 local dataSet = csvdb["shop_rechargeCsv"][id]
8 if not dataSet then return end 27 if not dataSet then return end
9 - local diamondCount  
10 - if dataSet.type == 0 then -- 钻石  
11 - local rechargeF = role:getProperty("rechargeF")  
12 - diamondCount = dataSet.diamond + dataSet.diamondExtra  
13 - if not rechargeF[id] then  
14 - diamondCount = diamondCount + dataSet.diamondFirst  
15 - rechargeF[id] = 1  
16 - role:updateProperty({field = "rechargeF", value = rechargeF})  
17 - end  
18 - role:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})  
19 - elseif dataSet.type == 1 then --月卡  
20 - return  
21 - elseif dataSet.type == 2 then -- 赛季通行证  
22 - return  
23 - else  
24 - return 28 + local roleId = role:getProperty("id")
  29 +
  30 + --创建订单号
  31 + local partnerOrderId = makeOrder(roleId, id)
  32 + SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId }))
  33 +
  34 + -- 测试的 直接发奖励了
  35 + skynet.timeout(10, function ()
  36 + role:handlePurchase({
  37 + order = partnerOrderId,
  38 + amount = dataSet.rmb,
  39 + game_money = dataSet.diamond,
  40 + product_id = dataSet.productId,
  41 + pay_time = skynet.timex(),
  42 + transactionId = "onlyTest",
  43 + })
  44 + end)
  45 +
  46 + return true
  47 +end
  48 +
  49 +local function table_keys( t )
  50 + local keys = {}
  51 + for k, _ in pairs( t ) do
  52 + keys[#keys + 1] = k
  53 + end
  54 + return keys
  55 +end
  56 +
  57 +local function signPms(params, secret_key)
  58 + local keys = table_keys(params)
  59 + table.sort(keys)
  60 + local urlCode = ""
  61 + for index, key in ipairs(keys) do
  62 + urlCode = urlCode .. params[key]
25 end 63 end
  64 + return md5.sumhexa(urlCode .. secret_key):lower()
  65 +end
26 66
27 - -- 累充  
28 - local rmb = dataSet.rmb  
29 - role:updateProperty({field = "rmbC", delta = rmb})  
30 -  
31 - role:log("role_action", {desc = "recharge", int1 = id, int2 = rmb})  
32 67
33 - SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({diamond = diamondCount})) 68 +-- google 充值 入口
  69 +function _M.googleRechargeRpc(agent, data)
  70 + local role = agent.role
  71 + local msg = MsgPack.unpack(data)
  72 + local id = msg.id
  73 + local dataSet = csvdb["shop_rechargeCsv"][id]
  74 + if not dataSet then return end
  75 + local roleId = role:getProperty("id")
  76 +
  77 + role.ignoreHeartbeat = true
  78 + --创建订单号
  79 + local partnerOrderId = makeOrder(roleId, id)
  80 + -- 签名
  81 + local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075"
  82 + local need = {
  83 + out_trade_no = partnerOrderId,
  84 + money = dataSet.rmb,
  85 + game_money = dataSet.diamond,
  86 + product_id = dataSet.productId,
  87 + }
  88 + local sign = signPms(need, secret_key)
  89 +
  90 + SendPacket(actionCodes.Store_googleRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign}))
  91 + return true
  92 +end
  93 +
  94 +-- mycard 充值 入口
  95 +function _M.myCardRechargeRpc(agent, data)
  96 + local role = agent.role
  97 + local msg = MsgPack.unpack(data)
  98 + local id = msg.id
  99 + local dataSet = csvdb["shop_rechargeCsv"][id]
  100 + if not dataSet then return end
  101 + local roleId = role:getProperty("id")
  102 +
  103 + role.ignoreHeartbeat = true
  104 + --创建订单号
  105 + local partnerOrderId = makeOrder(roleId, id)
  106 + -- 签名
  107 + local secret_key = "48759e07540f46d9af17ec82669b4272"
  108 + local need = {
  109 + out_trade_no = partnerOrderId,
  110 + money = dataSet.rmb,
  111 + game_money = dataSet.diamond,
  112 + }
  113 + local sign = signPms(need, secret_key)
  114 +
  115 + SendPacket(actionCodes.Store_myCardRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign}))
  116 + return true
  117 +end
  118 +
  119 +-- mycard 充值 入口
  120 +function _M.iosRechargeRpc(agent, data)
  121 + local role = agent.role
  122 + local msg = MsgPack.unpack(data)
  123 + local id = msg.id
  124 + local dataSet = csvdb["shop_rechargeCsv"][id]
  125 + if not dataSet then return end
  126 + local roleId = role:getProperty("id")
  127 +
  128 + role.ignoreHeartbeat = true
  129 + --创建订单号
  130 + local partnerOrderId = makeOrder(roleId, id)
  131 + -- 签名
  132 + local secret_key = "9647d2efe1074c73b9ac19af4337a70e"
  133 + local need = {
  134 + out_trade_no = partnerOrderId,
  135 + money = dataSet.rmb,
  136 + game_money = dataSet.diamond,
  137 + product_id = dataSet.productId,
  138 + }
  139 + local sign = signPms(need, secret_key)
  140 +
  141 + SendPacket(actionCodes.Store_iosRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign}))
  142 + return true
  143 +end
  144 +
  145 +function _M.purchaseOrderResult(agent, data)
  146 + local role = agent.role
  147 +
  148 + local roleId = role:getProperty("id")
  149 + local msg = MsgPack.unpack(data)
  150 +
  151 + role.ignoreHeartbeat = false
  152 +
  153 + local partnerOrderStr = msg.order
  154 + local _, _, orderId = string.match(partnerOrderStr, "(.+)_(.+)_(.+)")
  155 + local orderObject = require("models.Order").new({ key = string.format("order:%d:%d", roleId, orderId) })
  156 + if not orderObject:load() then
  157 + -- 订单不存在
  158 + skynet.error("cancelPurchaseRpc", string.format("order %s not exist", partnerOrderStr))
  159 + return true
  160 + end
  161 +
  162 + if msg.status == "success" then
  163 + orderObject:setProperty("transactionId", msg.platformOrder or "")
  164 + return true
  165 + end
  166 +
  167 + if orderObject:getProperty("finishTime") > 0 then
  168 + return true
  169 + end
  170 +
  171 + orderObject:setProperty("status", msg.status)
  172 +
  173 + redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr)
34 return true 174 return true
35 end 175 end
36 176
src/models/Diner.lua
@@ -73,11 +73,11 @@ function Diner:refreshDailyData(notify) @@ -73,11 +73,11 @@ function Diner:refreshDailyData(notify)
73 local guide = self.owner:getProperty("newerGuide") 73 local guide = self.owner:getProperty("newerGuide")
74 local master, slave = string.match(guide,"(%d+)=(%d+)") 74 local master, slave = string.match(guide,"(%d+)=(%d+)")
75 if tonumber(master) <= 26 then 75 if tonumber(master) <= 26 then
76 - entrust[1] = 1031  
77 - entrust[2] = 3 76 + entrust[1] = 1001
  77 + entrust[2] = 1
78 elseif tonumber(master) <= 29 then 78 elseif tonumber(master) <= 29 then
79 local temp = entrust[1] 79 local temp = entrust[1]
80 - entrust[1] = 3 80 + entrust[1] = 1
81 entrust[2] = temp 81 entrust[2] = temp
82 end 82 end
83 83
src/models/HeroPlugin.lua
@@ -208,10 +208,10 @@ function HeroPlugin.bind(Hero) @@ -208,10 +208,10 @@ function HeroPlugin.bind(Hero)
208 end 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 function Hero:getBattleValue(activeRelation) -- isReal包括队伍加成 212 function Hero:getBattleValue(activeRelation) -- isReal包括队伍加成
213 local attrs = self:getTotalAttrs({activeRelation = activeRelation}) 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 return math.floor(battleValue) 215 return math.floor(battleValue)
216 end 216 end
217 217
src/models/Order.lua 0 → 100644
@@ -0,0 +1,26 @@ @@ -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 \ No newline at end of file 27 \ No newline at end of file
src/models/Role.lua
@@ -150,6 +150,8 @@ Role.schema = { @@ -150,6 +150,8 @@ Role.schema = {
150 150
151 sudoku = {"table", {}}, -- 九宫格 {[-1] = 1, task = {[1] = {}, [2] = {}}}} -- [-1] 阶段 如果为 -1 关闭(都做完了), task 当前阶段任务进度, reward 连串奖励领取情况 151 sudoku = {"table", {}}, -- 九宫格 {[-1] = 1, task = {[1] = {}, [2] = {}}}} -- [-1] 阶段 如果为 -1 关闭(都做完了), task 当前阶段任务进度, reward 连串奖励领取情况
152 sign = {"table", {}}, -- 签到记录 {[1] = 20181029} 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,6 +361,8 @@ function Role:data()
359 361
360 sudoku = self:getProperty("sudoku"), 362 sudoku = self:getProperty("sudoku"),
361 sign = self:getProperty("sign"), 363 sign = self:getProperty("sign"),
  364 +
  365 + redp = self:getProperty("redp"),
362 } 366 }
363 end 367 end
364 368
src/models/RoleCross.lua
@@ -67,6 +67,15 @@ RoleCross.bind = function (Role) @@ -67,6 +67,15 @@ RoleCross.bind = function (Role)
67 return info 67 return info
68 end 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 function Role:accountInit(initData) 79 function Role:accountInit(initData)
71 -- 道具 80 -- 道具
72 local reward = {} 81 local reward = {}
@@ -318,6 +327,16 @@ function CMD.pvpHRankInfo(roleId) @@ -318,6 +327,16 @@ function CMD.pvpHRankInfo(roleId)
318 return info 327 return info
319 end 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 RoleCross.handle = function(cmd, roleId, ...) 340 RoleCross.handle = function(cmd, roleId, ...)
322 SRole = SRole or require("models.Role") 341 SRole = SRole or require("models.Role")
323 if CMD[cmd] then 342 if CMD[cmd] then
src/models/RolePlugin.lua
@@ -830,13 +830,11 @@ function RolePlugin.bind(Role) @@ -830,13 +830,11 @@ function RolePlugin.bind(Role)
830 end 830 end
831 831
832 function Role:getAdvHangLimit() 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 end 834 end
836 835
837 function Role:getAdvElLimit() 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 end 838 end
841 839
842 -- 走 guide_unlock 表的 被动解锁 840 -- 走 guide_unlock 表的 被动解锁
@@ -1392,6 +1390,101 @@ function RolePlugin.bind(Role) @@ -1392,6 +1390,101 @@ function RolePlugin.bind(Role)
1392 return false 1390 return false
1393 end 1391 end
1394 1392
  1393 + -- 消除指定tag 红点
  1394 + function Role:clearRedPTag(tag)
  1395 + local redp = self:getProperty("redp")
  1396 + redp[tag] = nil
  1397 + self:updateProperty({field = "redp", value = redp})
  1398 + end
  1399 +
  1400 +
  1401 + -- 充值 --
  1402 + --[[
  1403 + request.order = data.out_trade_no
  1404 + request.amount = data.money / 100
  1405 + request.game_money = data.game_money
  1406 + request.product_id = data.product_id
  1407 + request.pay_time = data.pay_time
  1408 + request.transactionId = data.order_no
  1409 + ]]
  1410 + function Role:handlePurchase(params)
  1411 + local roleId = self:getProperty("id")
  1412 + local partnerOrderStr = params.order
  1413 +
  1414 + local _, _, orderId = string.match(partnerOrderStr, "(.+)_(.+)_(.+)")
  1415 + local orderObject = require("models.Order").new({ key = string.format("order:%d:%d", roleId, orderId) })
  1416 + if not orderObject:load() then
  1417 + -- 订单不存在
  1418 + skynet.error("ayncPurchaseRpc", string.format("order %s not exist", partnerOrderStr))
  1419 + return
  1420 + end
  1421 +
  1422 + if orderObject:getProperty("finishTime") > 0 then
  1423 + -- 订单已经处理
  1424 + SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ result = "handled" }))
  1425 + return
  1426 + end
  1427 +
  1428 + local rechargeData = csvdb["shop_rechargeCsv"][orderObject:getProperty("rechargeId")]
  1429 + if rechargeData.rmb ~= tonumber(params.amount) then
  1430 + skynet.error(string.format("fake order: %s, roleId: %d, order: %s",
  1431 + params.transactionId, roleId, partnerOrderStr
  1432 + ))
  1433 + return
  1434 + end
  1435 +
  1436 + local diamond = self:recharge({
  1437 + id = orderObject:getProperty("rechargeId"),
  1438 + transactionId = params.transactionId,
  1439 + pay_time = params.pay_time,
  1440 + order = partnerOrderStr
  1441 + })
  1442 + orderObject:setProperty("finishTime", skynet.time())
  1443 + orderObject:setProperty("status", "finish")
  1444 +
  1445 + redisproxy:srem(string.format("role:%d:orders", roleId), partnerOrderStr)
  1446 + SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr,
  1447 + result = "success", diamond = diamond}))
  1448 +
  1449 + return orderObject:getProperty("rechargeId")
  1450 + end
  1451 +
  1452 +
  1453 + function Role:recharge(params)
  1454 + local id = tonumber(params.id)
  1455 + local rechargeData = csvdb["shop_rechargeCsv"][id]
  1456 + if not rechargeData then
  1457 + skynet.error("recharge id not exist", id)
  1458 + return
  1459 + end
  1460 +
  1461 + local diamondCount = 0
  1462 + if rechargeData.type == 0 then -- 钻石
  1463 + local rechargeF = self:getProperty("rechargeF")
  1464 + diamondCount = rechargeData.diamond + rechargeData.diamondExtra
  1465 + if not rechargeF[id] then
  1466 + diamondCount = diamondCount + rechargeData.diamondFirst
  1467 + rechargeF[id] = 1
  1468 + self:updateProperty({field = "rechargeF", value = rechargeF})
  1469 + end
  1470 + self:gainDiamond({count = diamondCount, isRecharge = true, log = {desc = "recharge", int1 = id}})
  1471 + elseif rechargeData.type == 1 then --月卡
  1472 + return
  1473 + elseif rechargeData.type == 2 then -- 赛季通行证
  1474 + return
  1475 + else
  1476 + return
  1477 + end
  1478 +
  1479 + -- 累充
  1480 + local rmb = rechargeData.rmb
  1481 + self:updateProperty({field = "rmbC", delta = rmb})
  1482 +
  1483 + self:log("role_action", {desc = "recharge", int1 = id, int2 = rmb, key1 = params.transactionId, key2 = params.order, long1 = params.pay_time})
  1484 +
  1485 + return diamondCount
  1486 + end
  1487 +
1395 end 1488 end
1396 1489
1397 return RolePlugin 1490 return RolePlugin
1398 \ No newline at end of file 1491 \ No newline at end of file
src/models/RolePvp.lua
@@ -140,7 +140,7 @@ function Role:changePvpScoreHigh(matchId, isWin) @@ -140,7 +140,7 @@ function Role:changePvpScoreHigh(matchId, isWin)
140 break 140 break
141 end 141 end
142 end 142 end
143 - if newDivision ~= oldMyDivision then 143 + if newDivision ~= oldMyDivision or self:getProperty("pvpHGTime") == 0 then
144 --刷新段位奖励 144 --刷新段位奖励
145 local newTime, newReward = self:calculatePvpHGift(oldMyDivision) 145 local newTime, newReward = self:calculatePvpHGift(oldMyDivision)
146 self:updateProperties({ 146 self:updateProperties({