Commit f8a0d3696e862530ab4b92531599a2ba0ccd8a73

Authored by jiyue
2 parents bdd6c00d a8a9adb2

Merge branch 'cn/develop' into cn/publish/preview

src/GlobalVar.lua
... ... @@ -388,6 +388,7 @@ TriggerEventType = {
388 388 FoodSell = 11, -- 循环卖菜
389 389 RuneUp = 12, -- 循环强化符文
390 390 CostDiamond = 13, -- 循环消耗钻石
  391 + BuyLimitPack = 14, --购买指定id礼包 触发
391 392 }
392 393  
393 394 DrawCardType = {
... ... @@ -440,4 +441,12 @@ ItemOccupy = {
440 441 Spark = 5, --火花
441 442 Other = 6,
442 443 CanUsed = 7, --可使用
  444 +}
  445 +
  446 +-- 世界变动积分
  447 +ItemWorldLine = {
  448 + RouletteCount = 1, --抽轮盘次数
  449 + Points = 2, --积分
  450 + CostDiamond = 3, --消耗钻石
  451 + CostJade = 4, --消耗红光玉
443 452 }
444 453 \ No newline at end of file
... ...
src/ProtocolCode.lua
... ... @@ -13,6 +13,8 @@ actionCodes = {
13 13 Gm_clientRequest = 20,
14 14 Gm_receiveResponse = 21,
15 15 Gm_helpRpc = 22,
  16 + Gm_clientLuaCommandNtf = 23,
  17 + Gm_clientUploadLuaResult = 24,
16 18  
17 19 Role_notifyNewEvent = 100,
18 20 Role_queryLoginRpc = 101,
... ... @@ -59,7 +61,9 @@ actionCodes = {
59 61 Role_runeBuyRpc = 142, -- 铭文购买
60 62 Role_setFriendTeamRpc = 143, -- 设置好友切磋队伍
61 63 Role_setBgRpc = 144, -- 设置看板娘
62   - Role_itemConvertMonthCardRpc = 145, -- 兑换月卡道具
  64 + Role_itemConvertMonthCardRpc = 145, -- 兑换月卡/战令道具
  65 + Role_worldLineRoulette = 146, --世界线抽轮盘
  66 + Role_worldLineReward = 147, -- 世界线一键领取奖励
63 67  
64 68 Adv_startAdvRpc = 151,
65 69 Adv_startHangRpc = 152,
... ... @@ -225,6 +229,7 @@ actionCodes = {
225 229 Store_getExploreCommandRewardRpc = 563, --探索指令
226 230 Store_getTotalRechargeAwardRpc = 564, -- 累计充值
227 231 Store_monthCardRewardRpc = 565, --每日月卡+特刊奖励
  232 + Store_dyhxAndroidRechargeRpc = 566, -- 东银河充值
228 233  
229 234 Store_biliCloudRechargeRpc = 596,
230 235 Store_biliAndroidRechargeRpc = 597,
... ...
src/actions/ActivityAction.lua
... ... @@ -1345,8 +1345,8 @@ function _M.buyBattleCommandLvlRpc(agent, data)
1345 1345 end
1346 1346 if cost == 0 then return 5 end
1347 1347  
1348   - if not role:checkItemEnough({[ItemId.Jade] = cost}) then return 6 end
1349   - role:costItems({[ItemId.Jade] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}})
  1348 + if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return 6 end
  1349 + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "actBuyBpLevel", int1 = curLvl}})
1350 1350 actData["lvl"] = nextLvl
1351 1351 role.activity:updateActData("BattleCommand", actData)
1352 1352 role:mylog("act_action", {desc="buyBcLvl", int1=count, int2=nextLvl})
... ...
src/actions/GmAction.lua
... ... @@ -675,6 +675,13 @@ function _M.helpRpc(agent, data)
675 675 return true
676 676 end
677 677  
  678 +function _M.clientUploadLuaResult(agent, data)
  679 + local role = agent.role
  680 + local msg = MsgPack.unpack(data)
  681 + role:mylog("gm_action", {desc = "upload_lua", int1 = id, key1 = msg.result})
  682 + return true
  683 +end
  684 +
678 685 function _M.test(role, pms)
679 686 local id = tonum(pms.pm1, 0)
680 687 local actid = nil
... ... @@ -1086,4 +1093,10 @@ function _M.reset_capsule(role, pms, capsule_serv)
1086 1093 return "成功"
1087 1094 end
1088 1095  
  1096 +function _M.do_lua(role, pms)
  1097 + local luaStr = pms.pm1
  1098 + SendPacket(actionCodes.Gm_clientLuaCommandNtf, MsgPack.pack({lua = luaStr}))
  1099 + return "成功"
  1100 +end
  1101 +
1089 1102 return _M
1090 1103 \ No newline at end of file
... ...
src/actions/RoleAction.lua
... ... @@ -1718,7 +1718,7 @@ function _M.itemConvertMonthCardRpc(agent, data)
1718 1718 local itemId = msg.item_id
1719 1719 local typ = msg.typ
1720 1720 local count = msg.count
1721   - local exchangeId = msg.change_id
  1721 + local exchangeId = msg.exchange_id
1722 1722  
1723 1723 if not ItemId[itemId] then return 1 end
1724 1724  
... ... @@ -1741,7 +1741,68 @@ function _M.itemConvertMonthCardRpc(agent, data)
1741 1741 end
1742 1742  
1743 1743 SendPacket(actionCodes.Role_itemConvertMonthCardRpc, MsgPack.pack(role:packReward(reward)))
1744   - return status
  1744 + return true
  1745 +end
  1746 +
  1747 +function _M.worldLineRoulette(agent, data)
  1748 + local role = agent.role
  1749 +
  1750 + local worldChangePoints = role:getProperty("worldChangePoints") or {}
  1751 + local rouletteCount = worldChangePoints[ItemWorldLine.RouletteCount] or 0
  1752 + if rouletteCount == 0 then return 1 end
  1753 +
  1754 + local worldline_gift_base_10, worldline_gift_base_1, worldline_gift_magnification_10, worldline_gift_magnification_1 = {}, {}, {}, {}
  1755 + for k, v in pairs(globalCsv.worldline_gift_base_10) do
  1756 + worldline_gift_base_10[k] = {v}
  1757 + end
  1758 + for k, v in pairs(globalCsv.worldline_gift_base_1) do
  1759 + worldline_gift_base_1[k] = {v}
  1760 + end
  1761 + for k, v in pairs(globalCsv.worldline_gift_magnification_10) do
  1762 + worldline_gift_magnification_10[k] = {v}
  1763 + end
  1764 + for k, v in pairs(globalCsv.worldline_gift_magnification_1) do
  1765 + worldline_gift_magnification_1[k] = {v}
  1766 + end
  1767 +
  1768 + local gift_base_10 = (math.randWeight(worldline_gift_base_10, 1) or 0) * 10
  1769 + local gift_base_1 = math.randWeight(worldline_gift_base_1, 1) or 0
  1770 +
  1771 + local gift_magnification_10 = (math.randWeight(worldline_gift_magnification_10, 1) or 0) * 10
  1772 + local gift_magnification_1 = math.randWeight(worldline_gift_magnification_1, 1) or 0
  1773 +
  1774 + local points = (gift_base_10 + gift_base_1) * (gift_magnification_10 + gift_magnification_1)
  1775 + worldChangePoints[ItemWorldLine.RouletteCount] = worldChangePoints[ItemWorldLine.RouletteCount] - 1
  1776 + worldChangePoints[ItemWorldLine.Points] = worldChangePoints[ItemWorldLine.Points] + points
  1777 + role:updateProperty({field = "worldChangePoints", value = worldChangePoints})
  1778 +
  1779 + SendPacket(actionCodes.Role_worldLineRoulette, MsgPack.pack(worldChangePoints))
  1780 + return true
  1781 +end
  1782 +
  1783 +function _M.worldLineReward(agent, data)
  1784 + local role = agent.role
  1785 + local worldLineReward = role:getProperty("worldLineReward") or {}
  1786 + local worldChangePoints = role:getProperty("worldChangePoints") or {}
  1787 + local points = worldChangePoints[ItemWorldLine.Points] or 0
  1788 +
  1789 + local reward, change = {}
  1790 + for key, val in pairs(csvdb["worldline_rewardCsv"]) do
  1791 + if points >= key and not worldLineReward[key] then
  1792 + for k, v in pairs(val.award:toNumMap()) do
  1793 + reward[k] = (reward[k] or 0) + v
  1794 + end
  1795 + worldLineReward[key] = 1
  1796 + end
  1797 + end
  1798 +
  1799 + role:updateProperty({field = "worldLineReward", value = worldLineReward})
  1800 +
  1801 + if next(reward) then
  1802 + reward, change = role:award(reward, {log = {desc = "worldLine", int1 = role:getProperty("id")}})
  1803 + end
  1804 + SendPacket(actionCodes.Role_worldLineReward, MsgPack.pack(role:packReward(reward, change)))
  1805 + return true
1745 1806 end
1746 1807  
1747 1808 return _M
1748 1809 \ No newline at end of file
... ...
src/actions/StoreAction.lua
... ... @@ -254,6 +254,34 @@ function _M.iosRechargeRpc(agent, data)
254 254 return true
255 255 end
256 256  
  257 +-- dyh android 充值 入口
  258 +function _M.dyhxAndroidRechargeRpc(agent, data)
  259 + local role = agent.role
  260 + local msg = MsgPack.unpack(data)
  261 + local id = msg.id
  262 + local choose = msg.choose or ""
  263 + local dataSet = csvdb["shop_rechargeCsv"][id]
  264 + if not dataSet then return end
  265 + local roleId = role:getProperty("id")
  266 +
  267 + role.ignoreHeartbeat = true
  268 + --创建订单号
  269 + local partnerOrderId = role:getPurchaseOrder(id,nil,choose)
  270 + -- 签名
  271 + local secret_key = "51ba4398c69d4d229d5402295dc38b50"
  272 + local need = {
  273 + out_trade_no = partnerOrderId,
  274 + money = dataSet.rmb * 100,
  275 + game_money = dataSet.diamond,
  276 + notify_url = msg.notifyUrl
  277 + }
  278 + local sign = signDyhPms(need, secret_key)
  279 +
  280 + SendPacket(actionCodes.Store_dyhxAndroidRechargeRpc, MsgPack.pack({ order = partnerOrderId, sign = sign}))
  281 + return true
  282 +end
  283 +
  284 +
257 285 function _M.purchaseOrderResult(agent, data)
258 286 local role = agent.role
259 287  
... ...
src/models/Role.lua
... ... @@ -214,6 +214,9 @@ Role.schema = {
214 214 heroCnt = {"number", 0}, -- 英雄数量
215 215 friendTeam = {"table", {}}, -- 好友切磋队伍信息 {bInfo = {}, team = {}, v = 0}
216 216 bgId = {"number", 0}, -- 看板娘id
  217 +
  218 + worldChangePoints = {"table", {}}, -- 世界变动积分 {[1]= 转盘抽取次数, [2]= 获得的积分, [3]=魔导石消耗, [4]= 虹光玉消耗}
  219 + worldLineReward = {"table", {}}, -- 世界积分 领取记录 {[id] = 1}
217 220 }
218 221  
219 222  
... ... @@ -457,6 +460,8 @@ function Role:data()
457 460 unlockChap = self:getProperty("unlockChap"), -- 解锁的章节
458 461 friendTeam = self:getProperty("friendTeam"),
459 462 bgId = self:getProperty("bgId"),
  463 + worldChangePoints = self:getProperty("worldChangePoints"),
  464 + worldLineReward = self:getProperty("worldLineReward"),
460 465 }
461 466 end
462 467  
... ...
src/models/RoleLog.lua
... ... @@ -163,6 +163,8 @@ local ItemReason = {
163 163 CapsuleReward = 1411, --扭蛋机奖励
164 164 CapsuleConvert = 1412, --扭蛋机 消耗票 兑换
165 165 CapsuleCoinCost = 1413, --抽扭蛋机消耗
  166 +
  167 + worldLine = 1500, --世界线积分
166 168 }
167 169  
168 170  
... ...
src/models/RolePlugin.lua
... ... @@ -574,12 +574,14 @@ function RolePlugin.bind(Role)
574 574 self:notifyUpdateProperty("diamond", self:getAllDiamond())
575 575  
576 576 self:checkTaskEnter("CostDiamond", {count = count})
  577 + self:checkWorldChangePoints({[ItemWorldLine.CostDiamond]=count})
577 578 return true
578 579 end
579 580  
580 581 function Role:costJade(param)
581 582 self:addItem(param)
582 583 self:checkTaskEnter("CostJade", {count = - param.count})
  584 + self:checkWorldChangePoints({[ItemWorldLine.CostJade]= -param.count})
583 585 end
584 586  
585 587 function Role:increBy(field, val)
... ... @@ -2455,7 +2457,8 @@ function RolePlugin.bind(Role)
2455 2457 elseif rechargeData.shop == 3 then -- 礼包商店
2456 2458 reward, _ = self:award(rechargeData.itemFirst, {isRecharge = true, log = {desc = "recharge", int1 = id}})
2457 2459  
2458   - --增加购买记录
  2460 + self:checkTaskEnter("BuyLimitPack", {id = id})
  2461 + --增加购买记录
2459 2462 local buyRecord = self.storeData:getProperty("buyR") or {}
2460 2463 buyRecord[id] = (buyRecord[id] or 0) + 1
2461 2464 self.storeData:updateProperty({field = "buyR", value = buyRecord})
... ... @@ -3263,6 +3266,24 @@ function RolePlugin.bind(Role)
3263 3266  
3264 3267 return capsule:getSpecialNotify(roleId)
3265 3268 end
  3269 +
  3270 + function Role:checkWorldChangePoints(param)
  3271 + local worldChangePoints = self:getProperty("worldChangePoints") or {}
  3272 + if param[ItemWorldLine.CostJade] then
  3273 + worldChangePoints[ItemWorldLine.CostJade] = (worldChangePoints[ItemWorldLine.CostJade] or 0) + param[ItemWorldLine.CostJade]
  3274 + local cost = math.floor(worldChangePoints[ItemWorldLine.CostJade] / globalCsv.worldline_gift)
  3275 + worldChangePoints[ItemWorldLine.CostJade] = worldChangePoints[ItemWorldLine.CostJade] - cost * globalCsv.worldline_gift
  3276 + worldChangePoints[ItemWorldLine.RouletteCount] = (worldChangePoints[ItemWorldLine.RouletteCount] or 0) + cost
  3277 + end
  3278 +
  3279 + if param[ItemWorldLine.CostDiamond] then
  3280 + worldChangePoints[ItemWorldLine.CostDiamond] = (worldChangePoints[ItemWorldLine.CostDiamond] or 0) + param[ItemWorldLine.CostDiamond]
  3281 + local cost = math.floor(worldChangePoints[ItemWorldLine.CostDiamond] / globalCsv.worldline_count_currency)
  3282 + worldChangePoints[ItemWorldLine.CostDiamond] = worldChangePoints[ItemWorldLine.CostDiamond] - cost * globalCsv.worldline_count_currency
  3283 + worldChangePoints[ItemWorldLine.Points] = (worldChangePoints[ItemWorldLine.Points] or 0) + cost
  3284 + end
  3285 + self:setProperty("worldChangePoints", worldChangePoints)
  3286 + end
3266 3287 end
3267 3288  
3268 3289 return RolePlugin
3269 3290 \ No newline at end of file
... ...
src/models/RoleTask.lua
... ... @@ -116,6 +116,7 @@ local TaskType = {
116 116 Appoint = 912, -- 触发限时礼包,指定id
117 117 Rename = 913, -- 重命名
118 118 CostJade = 914, -- 消耗虹光玉
  119 + BuyLimitPack = 915, -- 购买指定id礼包触发
119 120  
120 121 --功能未实现 todo
121 122 AdvShop = 1002, -- 冒险商城
... ... @@ -280,6 +281,7 @@ local StoreListener = {
280 281 [TaskType.FoodSell]= {{TriggerEventType.FoodSell, f("count")}},
281 282 [TaskType.RuneUp] = {{TriggerEventType.RuneUp, 1}},
282 283 [TaskType.CostDiamond] = {{TriggerEventType.CostDiamond, f("count")}},
  284 + [TaskType.BuyLimitPack] = {{TriggerEventType.BuyLimitPack, f("id")}},
283 285 }
284 286 }
285 287  
... ...
src/models/Store.lua
... ... @@ -610,56 +610,56 @@ function Store:OnTriggerLimitTimePack(eventType, param)
610 610 break
611 611 end
612 612 end
613   - if config ~= nil then
614   - -- 每日循环弹窗
615   - local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1}
616   - if typeMap[eventType] then
617   - local dayInfo = self:getProperty("dayLimitInfo")
618   - local info = dayInfo[eventType] or {}
619   - local count = (info["count"] or 0) + param
620   - local triggerCount = info["trigger"] or 0
621   - local flag = nil
622   - if count >= config.condition then
623   - if triggerCount < config.triggerLimit then
624   - info["trigger"] = triggerCount + 1
625   - info["count"] = 0
626   - flag = true
627   - else
628   - info["count"] = config.condition - 1
629   - end
  613 + if not config then return end
  614 +
  615 + -- 每日循环弹窗
  616 + local typeMap = {[TriggerEventType.DrawHero] = 1, [TriggerEventType.FoodSell] = 1, [TriggerEventType.RuneUp] = 1, [TriggerEventType.CostDiamond] = 1}
  617 + if typeMap[eventType] then
  618 + local dayInfo = self:getProperty("dayLimitInfo")
  619 + local info = dayInfo[eventType] or {}
  620 + local count = (info["count"] or 0) + param
  621 + local triggerCount = info["trigger"] or 0
  622 + local flag = nil
  623 + if count >= config.condition then
  624 + if triggerCount < config.triggerLimit then
  625 + info["trigger"] = triggerCount + 1
  626 + info["count"] = 0
  627 + flag = true
630 628 else
631   - info["count"] = count
632   - end
633   - dayInfo[eventType] = info
634   - self:updateProperty({field = "dayLimitInfo", value = dayInfo})
635   - if not flag then
636   - return
  629 + info["count"] = config.condition - 1
637 630 end
  631 + else
  632 + info["count"] = count
638 633 end
639   - local rechargeCfg = csvdb["shop_normalCsv"][config.packId]
640   - if rechargeCfg then
641   - limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
642   - self.owner:log("push_gift", {
643   - gift_id = rechargeCfg.id, --礼包ID
644   - gift_name = rechargeCfg.descId, --礼包名称
645   - })
646   - if config.isLoop ~= 0 then
647   - local payR = self:getProperty("payR")
648   - if payR[rechargeCfg.id] then
649   - payR[rechargeCfg.id] = nil
650   - self:updateProperty({field = "payR", value = payR})
651   - end
  634 + dayInfo[eventType] = info
  635 + self:updateProperty({field = "dayLimitInfo", value = dayInfo})
  636 + if not flag then
  637 + return
  638 + end
  639 + end
  640 + local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId]
  641 + if rechargeCfg then
  642 + limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id}
  643 + self.owner:log("push_gift", {
  644 + gift_id = rechargeCfg.id, --礼包ID
  645 + gift_name = rechargeCfg.descId, --礼包名称
  646 + })
  647 + if config.isLoop ~= 0 then
  648 + local payR = self:getProperty("payR")
  649 + if payR[rechargeCfg.id] then
  650 + payR[rechargeCfg.id] = nil
  651 + self:updateProperty({field = "payR", value = payR})
652 652 end
653   - -- 每日抽卡限时礼包 触发重置
654   - --if eventType == TriggerEventType.DrawHeroCnt then
655   - -- local payR = self:getProperty("buyR")
656   - -- if payR[rechargeCfg.id] then
657   - -- payR[rechargeCfg.id] = nil
658   - -- self:updateProperty({field = "buyR", value = payR})
659   - -- end
660   - --end
661   - self:updateProperty({field = "limitTPack", value = limitPack})
662 653 end
  654 + -- 每日抽卡限时礼包 触发重置
  655 + --if eventType == TriggerEventType.DrawHeroCnt then
  656 + -- local payR = self:getProperty("buyR")
  657 + -- if payR[rechargeCfg.id] then
  658 + -- payR[rechargeCfg.id] = nil
  659 + -- self:updateProperty({field = "buyR", value = payR})
  660 + -- end
  661 + --end
  662 + self:updateProperty({field = "limitTPack", value = limitPack})
663 663 end
664 664 --if next(result) then
665 665 -- self:updateProperty({field = "packTrigger", value = triggerRecord})
... ...