Commit 871df4785ccb9dde9c1843e45d049d077904cf2e
Merge branch 'develop' into tr/publish
Showing
16 changed files
with
258 additions
and
66 deletions
Show diff stats
src/actions/AdvAction.lua
... | ... | @@ -439,6 +439,16 @@ function _M.finishTaskRpc(agent, data) |
439 | 439 | role:checkTaskEnter("AdvOverTask", {id = taskId}) |
440 | 440 | |
441 | 441 | adv:mylog({desc = "finishTask", int1 = taskId}) |
442 | + | |
443 | + role:log("mission_pick_achiev", { | |
444 | + mission_threadid = adv.chapterId, -- 大地图ID | |
445 | + mission_threadname = (csvdb["adv_chapterCsv"][adv.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | |
446 | + mission_id = adv.level, -- 关卡ID | |
447 | + mission_sequenceid = adv.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
448 | + mission_pick_achiev_id = taskId, -- 任务ID | |
449 | + mission_pick_achiev_reward = reward, -- 任务奖励,[{"id":101,"num":10},{"id":102,"num":20},{"id":103,"num":30}] | |
450 | + }) | |
451 | + | |
442 | 452 | |
443 | 453 | SendPacket(actionCodes.Adv_finishTaskRpc, MsgPack.pack(role:packReward(reward, change))) |
444 | 454 | return true |
... | ... | @@ -501,6 +511,15 @@ function _M.useItemRpc(agent, data) |
501 | 511 | adv:checkAchievement(adv.AchievType.UseItem, count, itemId) |
502 | 512 | adv:mylog({desc = "useItem", int1 = itemId, int2 = count}) |
503 | 513 | |
514 | + role:log("mission_pick_use", { | |
515 | + mission_threadid = adv.chapterId, -- 大地图ID | |
516 | + mission_threadname = (csvdb["adv_chapterCsv"][adv.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | |
517 | + mission_id = adv.level, -- 关卡ID | |
518 | + item_id = itemId, -- 道具ID | |
519 | + mission_pick_use_num = count, -- 道具使用量 | |
520 | + mission_sequenceid = adv.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
521 | + }) | |
522 | + | |
504 | 523 | for i = 1, count do |
505 | 524 | adv:doActive(itemData.effect, target) -- target |
506 | 525 | end |
... | ... | @@ -587,6 +606,7 @@ function _M.wearArtifactRpc(agent, data) |
587 | 606 | |
588 | 607 | local status = adv:wearArtifact(slot, id) |
589 | 608 | if not status then return 3 end |
609 | + | |
590 | 610 | adv:saveDB() |
591 | 611 | |
592 | 612 | role:finishGuide(55) |
... | ... | @@ -612,7 +632,20 @@ function _M.upArtifactRpc(agent, data) |
612 | 632 | if not adv:cost(cost, {}, true) then return 4 end |
613 | 633 | |
614 | 634 | local status = adv:artifactLevelUp(id) |
615 | - if not status then return 5 end | |
635 | + if not status then | |
636 | + return 5 | |
637 | + else | |
638 | + role:log("mission_pick_reform", { | |
639 | + mission_threadid = adv.chapterId, -- 大地图ID | |
640 | + mission_threadname = (csvdb["adv_chapterCsv"][adv.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | |
641 | + mission_id = adv.level, -- 关卡ID | |
642 | + mission_pick_equip_id = id, -- 神器ID | |
643 | + mission_pick_reform_beflv = curLevel, -- 神器原等级 | |
644 | + mission_pick_reform_aftlv = curLevel + 1, -- 神器现等级 | |
645 | + mission_pick_reform_cost = cost[ItemId.AdvPoint], -- 消耗探险点数 | |
646 | + mission_sequenceid = adv.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
647 | + }) | |
648 | + end | |
616 | 649 | adv:cost(cost, {log = {desc = "upArtifact", int1 = id}}) |
617 | 650 | adv:backCost(cost) |
618 | 651 | if status == 1 then -- 现在穿着呢。更新下 |
... | ... | @@ -774,7 +807,7 @@ function _M.wheelSurfRpc(agent, data) |
774 | 807 | |
775 | 808 | if not role:checkItemEnough(costs) then return 5 end |
776 | 809 | role:costItems(costs, {log = {desc = "advWheelSurf", int1 = ptype}}) |
777 | - role:addAdvLvExp(costs[ItemId.OldCoin] or 0) | |
810 | + local oldLv, lv = role:addAdvLvExp(costs[ItemId.OldCoin] or 0) | |
778 | 811 | local advDrawB = role:getProperty("advDrawB") |
779 | 812 | advDrawB[ptype] = (advDrawB[ptype] or 0) + count |
780 | 813 | role:updateProperty({field = "advDrawB", value = advDrawB}) |
... | ... | @@ -793,6 +826,16 @@ function _M.wheelSurfRpc(agent, data) |
793 | 826 | role:checkTaskEnter("AdvDraw", {count = count, ptype = ptype}) |
794 | 827 | role:mylog("adv_action", {desc = "advWheelSurf", int1 = ptype, int2 = count}) |
795 | 828 | |
829 | + role:log("mission_pick_fund", { | |
830 | + item_id = ItemId.OldCoin, -- 资助花费道具ID | |
831 | + mission_pick_fund_amount = costs[ItemId.OldCoin], -- 资助花费道具数量 | |
832 | + mission_pick_fund_cnt = count, -- 资助花费道具次数,1或者10 | |
833 | + mission_pick_fund_reward = reward, -- 资助获得奖励,[{"id":100,"num":10},{"id":101,"num":20},{"id":102,"num":30}] | |
834 | + mission_pick_fund_stagereward = {}, -- 资助阶段奖励 | |
835 | + mission_pick_fund_beflv = oldLv, -- 资助前资助等级 | |
836 | + mission_pick_fund_aftlv = lv, -- 资助后资助等级 | |
837 | + }) | |
838 | + | |
796 | 839 | SendPacket(actionCodes.Adv_wheelSurfRpc, MsgPack.pack({reward = backReward})) |
797 | 840 | return true |
798 | 841 | end | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -268,12 +268,12 @@ function _M.endBattleRpc(agent, data) |
268 | 268 | end |
269 | 269 | local nextCarbonId = role:getNextCarbonId(carbonId) |
270 | 270 | -- 设置挂机关卡 |
271 | - if isWin and (hangInfo.carbonId or 0) < nextCarbonId then | |
272 | - hangInfo.expCarbonId = nextCarbonId | |
273 | - local cfg = csvdb["idle_battleCsv"][nextCarbonId] | |
274 | - if cfg then | |
275 | - hangInfo.bossTime = skynet.timex() + cfg.idle_time | |
276 | - end | |
271 | + if isWin then --and (hangInfo.carbonId or 0) < nextCarbonId then | |
272 | + hangInfo.expCarbonId = carbonId | |
273 | + --local cfg = csvdb["idle_battleCsv"][nextCarbonId] | |
274 | + --if cfg then | |
275 | + -- hangInfo.bossTime = skynet.timex() + cfg.idle_time | |
276 | + --end | |
277 | 277 | end |
278 | 278 | role:updateProperty({field = "hangInfo", value = hangInfo}) |
279 | 279 | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -946,7 +946,28 @@ function _M.drawHeroRpc(agent, data) |
946 | 946 | local drawCardReward, val = role:getDrawCardExtraReward(oldVal, newVal) |
947 | 947 | -- 空字符穿代表直接给英雄 走以前repayHeroRpc |
948 | 948 | if drawCardReward == "" then |
949 | - local id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | |
949 | + local repayHeroMaxCount = role:getProperty("repayMaxC") or 0 | |
950 | + repayHeroMaxCount = repayHeroMaxCount + 1 | |
951 | + | |
952 | + role:updateProperty({field = "repayMaxC", value = repayHeroMaxCount}) | |
953 | + local even = repayHeroMaxCount % 2 | |
954 | + local id = 0 | |
955 | + if even == 1 then | |
956 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | |
957 | + else | |
958 | + local giftHeroSet = {} | |
959 | + for gid, cfg in pairs(csvdb["build_giftCsv"]) do | |
960 | + if cfg["pool_1"] ~= 0 and not role:isHaveHero(gid - ItemStartId.Hero) then | |
961 | + giftHeroSet[gid] = {1} | |
962 | + end | |
963 | + end | |
964 | + if next(giftHeroSet) then | |
965 | + id = math.randWeight(giftHeroSet, 1) | |
966 | + end | |
967 | + end | |
968 | + if id == 0 then | |
969 | + id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | |
970 | + end | |
950 | 971 | |
951 | 972 | local r,change = {} |
952 | 973 | local itemData = csvdb["itemCsv"][id] | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -681,17 +681,18 @@ function _M.storyBookRewardRpc(agent, data) |
681 | 681 | local msg = MsgPack.unpack(data) |
682 | 682 | local storyId = msg.id |
683 | 683 | local storyBookData = csvdb["story_bookCsv"][storyId] |
684 | - if not storyBookData then return end | |
684 | + if not storyBookData then return 1 end | |
685 | 685 | local storyStatus = role:getProperty("storyB") |
686 | 686 | |
687 | 687 | local status = (storyStatus[storyId] or {}).s |
688 | 688 | |
689 | - if status == -1 then return end | |
689 | + if status == -1 then return 2 end | |
690 | 690 | |
691 | 691 | if not status or status ~= 1 then |
692 | - if storyBookData.unlockType == 1 and (role:getProperty("hangInfo").carbonId == tonumber(storyBookData.unlockData) or storyId == 1 or storyId == 2) then -- 挂机剧情正在挂机也可以领奖 | |
692 | + --if storyBookData.unlockType == 1 and (role:getProperty("hangInfo").carbonId == tonumber(storyBookData.unlockData) or storyId == 1 or storyId == 2) then -- 挂机剧情正在挂机也可以领奖 | |
693 | + if storyBookData.unlockType == 1 then -- 挂机剧情正在挂机也可以领奖 | |
693 | 694 | else |
694 | - return | |
695 | + return 3 | |
695 | 696 | end |
696 | 697 | end |
697 | 698 | -- 获取奖励 | ... | ... |
src/adv/Adv.lua
... | ... | @@ -51,6 +51,7 @@ function Adv:initByInfo(advInfo) |
51 | 51 | self.cacheUnlock = advInfo.cacheUnlock or {} |
52 | 52 | self.shopStatus = advInfo.shopStatus or {} |
53 | 53 | self.support = advInfo.support or {} |
54 | + self.logid = advInfo.logid or "auto" | |
54 | 55 | |
55 | 56 | self.maps = {} |
56 | 57 | for id, map in ipairs(advInfo.maps or {}) do |
... | ... | @@ -102,6 +103,7 @@ function Adv:initByChapter(params) |
102 | 103 | self.shopStatus = self.shopStatus or {} |
103 | 104 | self.support = self.support or {} |
104 | 105 | self.battle = nil -- 清掉 老的 battle |
106 | + self.logid = self.owner:getActionUcode() | |
105 | 107 | |
106 | 108 | if isEnter then -- 把 支援效果初始化为易用用的形式 |
107 | 109 | self:initSupport(support or {}) |
... | ... | @@ -206,6 +208,7 @@ function Adv:saveDB(notNotify) |
206 | 208 | advInfo.cacheUnlock = self.cacheUnlock |
207 | 209 | advInfo.shopStatus = self.shopStatus |
208 | 210 | advInfo.support = self.support |
211 | + advInfo.logid = self.logid | |
209 | 212 | advInfo.maps = {} |
210 | 213 | |
211 | 214 | self.battle:saveDB() |
... | ... | @@ -610,6 +613,15 @@ function Adv:wearArtifact(slot, id) |
610 | 613 | id = nil |
611 | 614 | end |
612 | 615 | self:mylog({desc = "wearArtifact", int1 = id}) |
616 | + self.owner:log("mission_pick_equip", { | |
617 | + mission_threadid = self.chapterId, -- 大地图ID | |
618 | + mission_threadname = (csvdb["adv_chapterCsv"][self.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | |
619 | + mission_id = self.level, -- 关卡ID | |
620 | + mission_pick_equip_type = 1, --神器操作类型:1:装备,2:卸下 | |
621 | + mission_pick_equip_id = id, --神器ID | |
622 | + mission_pick_equip_lv = advAFGet[id], --神器等级 | |
623 | + mission_sequenceid = self.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
624 | + }) | |
613 | 625 | |
614 | 626 | self.owner:changeUpdates({{type = "advAFWear", field = slot, value = id}}) |
615 | 627 | return true |
... | ... | @@ -670,7 +682,6 @@ function Adv:artifactLevelUp(id, level) |
670 | 682 | |
671 | 683 | self:mylog({desc = "artifactLevelUp", int1 = id, int2 = level}) |
672 | 684 | |
673 | - | |
674 | 685 | local status = 0 |
675 | 686 | if curWear[id] then -- 穿着呢 |
676 | 687 | local oldData = csvdb["adv_artifactCsv"][id][advAFGet[id]] |
... | ... | @@ -815,6 +826,49 @@ function Adv:over(success, rewardRatio, overType) |
815 | 826 | |
816 | 827 | self:mylog({desc = "over", short1 = success and 1 or 0, int1 = overType}) |
817 | 828 | |
829 | + | |
830 | + local team = self.owner:getProperty("advTeam") | |
831 | + local player = {} | |
832 | + local attrs = self.owner:getTeamBattleInfo(team).heros | |
833 | + for attrName, _ in pairs(AdvAttsEnum) do | |
834 | + for _, hero in pairs(attrs) do | |
835 | + player[attrName] = (player[attrName] or 0) + hero[attrName] | |
836 | + end | |
837 | + player[attrName] = player[attrName] * (globalCsv.adv_battle_attr_ratio[attrName] or 1) | |
838 | + end | |
839 | + | |
840 | + local battleV = 1 * player["hp"] | |
841 | + + 2 * player["atk"] | |
842 | + + 1.25 * player["def"] | |
843 | + + 0.226 * player["hit"] | |
844 | + + 0.26 * player["miss"] | |
845 | + | |
846 | + local heroList = {team.leader, team.leader2} | |
847 | + for _, hid in pairs(team.heros) do | |
848 | + if hid ~= team.leader and hid ~= team.leader2 then | |
849 | + heroList[#heroList + 1] = hid | |
850 | + end | |
851 | + end | |
852 | + | |
853 | + self.owner:log("mission_pick", { | |
854 | + mission_threadid = self.chapterId, -- 大地图ID | |
855 | + mission_threadname = (csvdb["adv_chapterCsv"][self.chapterId] or {})["chapter"] or "auto", -- 大地图名称 | |
856 | + mission_id = self.level, -- 关卡ID | |
857 | + mission_herolist = heroList, -- 英雄ID列表,[111, 222, 333, 444, 555] 前两个为队长、副队长 | |
858 | + mission_heroscore = battleV, -- 编队总评分 | |
859 | + mission_teamlv = 0, -- 编队等级 | |
860 | + mission_recscore = csvdb["adv_chapter_campsiteCsv"][self.chapterId][1].recommendValue, -- 关卡推荐评分 | |
861 | + mission_floor_bef = 0, -- 进入前关卡层数 | |
862 | + mission_floor_aft = self.level, -- 结束时关卡层数 | |
863 | + mission_team_status = {HP = team.player.hp, SP = team.player.sp}, -- 队伍状态,{"HP":100, "SP":100, "curse":7} | |
864 | + mission_result = success and 1 or (team.player.hp > 0 and 3 or 2), -- 战斗结果(0-无效,1-胜利,2-血量耗尽退出,3,主动退出) | |
865 | + mission_reward = reward, -- 获得奖励,[{"id":101,"num":10},{"id":102,"num":20},{"id":103,"num":30}] | |
866 | + mission_integral_bef = 0, -- 进入前积分 | |
867 | + mission_integral_aft = score, -- 完成后积分 | |
868 | + mission_cleartype = 1, -- 1正常通关;2代理拾荒 | |
869 | + mission_sequenceid = self.logid, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
870 | + }) | |
871 | + | |
818 | 872 | local chapterId = self.chapterId |
819 | 873 | self:clear() |
820 | 874 | self.owner:checkTaskEnter("AdvScore", {score = score}) | ... | ... |
src/adv/AdvPassive.lua
... | ... | @@ -120,7 +120,7 @@ Passive.GET_BUFF = 28 --获得指定buff |
120 | 120 | Passive.OPEN_BLOCK = 29 --翻开格子 |
121 | 121 | Passive.OPEN_MONSTER = 30 --翻开怪物 |
122 | 122 | Passive.PLAYER_BUFF = 31 --玩家获得buff |
123 | - | |
123 | +Passive.PLAYER_BUFF_CLASSIFY = 35 -- 获得指定标签的buff | |
124 | 124 | |
125 | 125 | -- 不同的开启条件 |
126 | 126 | local PassiveCondFactory = {} |
... | ... | @@ -183,6 +183,14 @@ PassiveCondFactory[Passive.GET_BUFF] = function(_Passive) |
183 | 183 | end |
184 | 184 | PassiveCondFactory[Passive.PLAYER_BUFF] = PassiveCondFactory[Passive.GET_BUFF] |
185 | 185 | |
186 | +PassiveCondFactory[Passive.PLAYER_BUFF_CLASSIFY] = function(_Passive) | |
187 | + _Passive._trigger = function(self, params) | |
188 | + if params.classify:sismember(self.passiveData.value) then | |
189 | + return true | |
190 | + end | |
191 | + end | |
192 | +end | |
193 | + | |
186 | 194 | |
187 | 195 | PassiveCondFactory[Passive.BORN_ONCE] = function(_Passive) |
188 | 196 | _Passive._afterRound = function(self) | ... | ... |
src/adv/AdvPlayer.lua
... | ... | @@ -163,7 +163,8 @@ function BaseObject:addBuff(buffId, releaser) |
163 | 163 | table.insert(self.buffs, buff) |
164 | 164 | buff:createAfter() |
165 | 165 | end |
166 | - self:triggerPassive(Passive.GET_BUFF, {buffId = buffId}) | |
166 | + self:triggerPassive(Passive.GET_BUFF, {trigger = releaser, buffId = buffId}) | |
167 | + self:triggerPassive(Passive.PLAYER_BUFF_CLASSIFY, {trigger = releaser, classify = buffData.classify}) | |
167 | 168 | return true |
168 | 169 | end |
169 | 170 | ... | ... |
src/models/Role.lua
... | ... | @@ -162,6 +162,7 @@ Role.schema = { |
162 | 162 | emailSync = {"number", 0}, -- 已经同步到的邮件Id |
163 | 163 | |
164 | 164 | repayHero = {"number", 0}, -- 招募次数 (除去友情招募) |
165 | + repayMaxC = {"number", 0}, -- 招募保底英雄领取次数 100一次 | |
165 | 166 | floorHero = {"table", {}}, -- 招募保底 -- {[poolId] = count} |
166 | 167 | ssrUp = {"table", {}}, -- ssr up -- {[poolId] = count} |
167 | 168 | newerDraw = {"table", {}}, -- 新手池子 {N, 1} 抽了多少次, 是否出了ssr | ... | ... |
src/models/RoleLog.lua
... | ... | @@ -422,6 +422,79 @@ local MethodType = { |
422 | 422 | gift_name = true, -- 礼包名称 |
423 | 423 | gift_reason = true, -- 礼包发放原因,见发放原因枚举表 |
424 | 424 | }, |
425 | + | |
426 | + push_gift = { -- 礼包推送 | |
427 | + gift_id = true, --礼包ID | |
428 | + gift_name = true, --礼包名称 | |
429 | + }, | |
430 | + | |
431 | + mission_pick = { --拾荒玩法 | |
432 | + mission_threadid = true, -- 大地图ID | |
433 | + mission_threadname = true, -- 大地图名称 | |
434 | + mission_id = true, -- 关卡ID | |
435 | + mission_herolist = "json", -- 英雄ID列表,[111, 222, 333, 444, 555] 前两个为队长、副队长 | |
436 | + mission_heroscore = true, -- 编队总评分 | |
437 | + mission_teamlv = true, -- 编队等级 | |
438 | + mission_recscore = true, -- 关卡推荐评分 | |
439 | + mission_floor_bef = true, -- 进入前关卡层数 | |
440 | + mission_floor_aft = true, -- 结束时关卡层数 | |
441 | + mission_team_status = "json", -- 队伍状态,{"HP":100, "SP":100, "curse":7} | |
442 | + mission_result = true, -- 战斗结果(0-无效,1-胜利,2-血量耗尽退出,3,主动退出) | |
443 | + mission_reward = "json", -- 获得奖励,[{"id":101,"num":10},{"id":102,"num":20},{"id":103,"num":30}] | |
444 | + mission_integral_bef = true, -- 进入前积分 | |
445 | + mission_integral_aft = true, -- 完成后积分 | |
446 | + mission_cleartype = true, -- 1正常通关;2代理拾荒 | |
447 | + mission_sequenceid = true, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
448 | + }, | |
449 | + | |
450 | + mission_pick_achiev = { --拾荒任务 | |
451 | + mission_threadid = true, -- 大地图ID | |
452 | + mission_threadname = true, -- 大地图名称 | |
453 | + mission_id = true, -- 关卡ID | |
454 | + mission_pick_achiev_id = true, -- 任务ID | |
455 | + mission_pick_achiev_reward = "json", -- 任务奖励,[{"id":101,"num":10},{"id":102,"num":20},{"id":103,"num":30}] | |
456 | + mission_sequenceid = true, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
457 | + }, | |
458 | + | |
459 | + mission_pick_equip = { -- 拾荒神器装备 | |
460 | + mission_threadid = true, --大地图ID | |
461 | + mission_threadname = true, --大地图名称 | |
462 | + mission_id = true, --关卡ID | |
463 | + mission_pick_equip_type = true, --神器操作类型:1:装备,2:卸下 | |
464 | + mission_pick_equip_id = true, --神器ID | |
465 | + mission_pick_equip_lv = true, --神器等级 | |
466 | + mission_sequenceid = true, --本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
467 | + }, | |
468 | + | |
469 | + mission_pick_reform = { --拾荒神器升级 | |
470 | + mission_threadid = true, -- 大地图ID | |
471 | + mission_threadname = true, -- 大地图名称 | |
472 | + mission_id = true, -- 关卡ID | |
473 | + mission_pick_equip_id = true, -- 神器ID | |
474 | + mission_pick_reform_beflv = true, -- 神器原等级 | |
475 | + mission_pick_reform_aftlv = true, -- 神器现等级 | |
476 | + mission_pick_reform_cost = true, -- 消耗探险点数 | |
477 | + mission_sequenceid = true, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
478 | + }, | |
479 | + | |
480 | + mission_pick_use = { --拾荒任务道具使用 | |
481 | + mission_threadid = true, -- 大地图ID | |
482 | + mission_threadname = true, -- 大地图名称 | |
483 | + mission_id = true, -- 关卡ID | |
484 | + item_id = true, -- 道具ID | |
485 | + mission_pick_use_num = true, -- 道具使用量 | |
486 | + mission_sequenceid = true, -- 本次拾荒ID,用于关联一次拾荒产生多条不同类型的日志 | |
487 | + }, | |
488 | + | |
489 | + mission_pick_fund = { --拾荒资助 | |
490 | + item_id = true, -- 资助花费道具ID | |
491 | + mission_pick_fund_amount = true, -- 资助花费道具数量 | |
492 | + mission_pick_fund_cnt = true, -- 资助花费道具次数,1或者10 | |
493 | + mission_pick_fund_reward = "json", -- 资助获得奖励,[{"id":100,"num":10},{"id":101,"num":20},{"id":102,"num":30}] | |
494 | + mission_pick_fund_stagereward = "json", -- 资助阶段奖励 | |
495 | + mission_pick_fund_beflv = true, -- 资助前资助等级 | |
496 | + mission_pick_fund_aftlv = true, -- 资助后资助等级 | |
497 | + }, | |
425 | 498 | } |
426 | 499 | |
427 | 500 | local function printError(info) | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -1189,6 +1189,7 @@ function RolePlugin.bind(Role) |
1189 | 1189 | function Role:addAdvLvExp(exp) |
1190 | 1190 | local advL = self:getProperty("advL") |
1191 | 1191 | local level = advL[1] |
1192 | + local oldLevel = level | |
1192 | 1193 | local newExp = (advL[2] or 0) + exp |
1193 | 1194 | |
1194 | 1195 | if not csvdb["adv_level_fundCsv"][level + 1] then |
... | ... | @@ -1211,6 +1212,7 @@ function RolePlugin.bind(Role) |
1211 | 1212 | advL[1] = level |
1212 | 1213 | advL[2] = newExp |
1213 | 1214 | self:updateProperty({field = "advL", value = advL}) |
1215 | + return oldLevel, level | |
1214 | 1216 | end |
1215 | 1217 | |
1216 | 1218 | function Role:getAdvWheelSurfLv(ptype) | ... | ... |
src/models/Store.lua
... | ... | @@ -353,6 +353,10 @@ function Store:OnTriggerLimitTimePack(eventType, param) |
353 | 353 | local rechargeCfg = csvdb["shop_rechargeCsv"][config.packId] |
354 | 354 | if rechargeCfg then |
355 | 355 | limitPack[rechargeCfg.id] = {timeNow + rechargeCfg.time, config.id} |
356 | + self.owner:log("push_gift", { | |
357 | + gift_id = rechargeCfg.id, --礼包ID | |
358 | + gift_name = rechargeCfg.title, --礼包名称 | |
359 | + }) | |
356 | 360 | self:updateProperty({field = "limitTPack", value = limitPack}) |
357 | 361 | end |
358 | 362 | end | ... | ... |
src/services/agent_ctrl.lua
... | ... | @@ -5,6 +5,7 @@ local netpack = require "skynet.netpack" |
5 | 5 | local xxtea = require "xxtea" |
6 | 6 | local deque = require "deque" |
7 | 7 | local datacenter = require "skynet.datacenter" |
8 | +local agent_queued = require "services.agent_queued" | |
8 | 9 | |
9 | 10 | local pcall = pcall |
10 | 11 | local string_format = string.format |
... | ... | @@ -59,16 +60,14 @@ function _M:exit_agent(fd) |
59 | 60 | |
60 | 61 | pcall(skynet.send, agent, "lua", "exit") |
61 | 62 | |
62 | - -- 这里检查是否有排队用户 | |
63 | - local nuid, nfd = skynet.call(queued_serv, "lua", "pop") | |
63 | + self.f2u[fd] = nil | |
64 | + self.u2f[uid] = nil | |
65 | + local nuid, nfd = agent_queued.pop() | |
64 | 66 | if not nuid then |
65 | 67 | pcall(skynet.send, poold, "lua", "feed") |
66 | 68 | else |
67 | 69 | self:query_agent(nfd, nuid, true) |
68 | 70 | end |
69 | - | |
70 | - self.f2u[fd] = nil | |
71 | - self.u2f[uid] = nil | |
72 | 71 | end |
73 | 72 | |
74 | 73 | -- @desc: 客户端连入 |
... | ... | @@ -82,7 +81,7 @@ function _M:socket_close(fd) |
82 | 81 | local uid = self.f2u[fd] |
83 | 82 | if not uid then |
84 | 83 | -- 排队中? |
85 | - pcall(skynet.call, queued_serv, "lua", "socket_close", fd) | |
84 | + agent_queued.socket_close(fd) | |
86 | 85 | return |
87 | 86 | end |
88 | 87 | self.f2e[fd] = skynet.timex() + AGENT_EXPIRE_TIME |
... | ... | @@ -102,7 +101,7 @@ function _M:socket_error(fd) |
102 | 101 | local uid = self.f2u[fd] |
103 | 102 | if not uid then |
104 | 103 | -- 排队中? |
105 | - pcall(skynet.call, queued_serv, "lua", "socket_close", fd) | |
104 | + agent_queued.socket_close(fd) | |
106 | 105 | return |
107 | 106 | end |
108 | 107 | |
... | ... | @@ -129,6 +128,7 @@ local next_log_time = 0 |
129 | 128 | local CHECK_AGENT_STATUS_INTERVAL = 100 -- 检查agent状态的定时间隔 |
130 | 129 | -- @desc: 检查agent状态,若过期,则让agent退出;并定时打日志统计在线人数 |
131 | 130 | function _M:check_agent_status() |
131 | + agent_queued.handle_timeout() | |
132 | 132 | local now = skynet.timex() |
133 | 133 | if now >= next_check_time then |
134 | 134 | next_check_time = now + CHECK_AGENT_STATUS_INTERVAL |
... | ... | @@ -196,16 +196,26 @@ function _M:query_agent(fd, uid, isQueue) |
196 | 196 | self.f2u[f] = nil |
197 | 197 | self.u2f[uid] = set_pack(fd, agent) |
198 | 198 | else |
199 | - -- 该uid未存储,则说明至少超过10分钟未登陆,由agent池服务pop出一个agent | |
200 | - local agent | |
199 | + local agent | |
201 | 200 | if isQueue then |
202 | - agent = skynet.newservice("agent") | |
201 | + agent = self.factory:pop() | |
202 | + if agent then | |
203 | + pcall(skynet.send, poold, "lua", "feed") | |
204 | + else | |
205 | + agent = skynet.newservice("agent") | |
206 | + end | |
203 | 207 | else |
208 | + -- 该uid未存储,则说明至少超过10分钟未登陆,由agent池服务pop出一个agent | |
209 | + if agent_queued.count() > 0 then | |
210 | + -- 服务器满 开始排队 | |
211 | + local rank = agent_queued.push(uid, fd) | |
212 | + query_agent_response(fd, {ret = "RET_SERVER_FULL", rank = rank}) | |
213 | + return | |
214 | + end | |
215 | + | |
204 | 216 | agent = self.factory:pop() |
205 | 217 | if not agent then |
206 | - -- 服务器满 | |
207 | - -- 开始排队 | |
208 | - local ok, rank = pcall(skynet.call, queued_serv, "lua", "push", uid, fd) | |
218 | + local rank = agent_queued.push(uid, fd) | |
209 | 219 | query_agent_response(fd, {ret = "RET_SERVER_FULL", rank = rank}) |
210 | 220 | return |
211 | 221 | end | ... | ... |
src/services/queued.lua renamed to src/services/agent_queued.lua
... | ... | @@ -18,7 +18,6 @@ local MAX_COUNT = tonumber(skynet.getenv("max_queue")) |
18 | 18 | -- 心跳定时间隔 |
19 | 19 | local HEART_TIMER_INTERVAL = 30 |
20 | 20 | local HEART_TIMEOUT_COUNT_MAX = 3 |
21 | -local gate_serv | |
22 | 21 | |
23 | 22 | local CMD = {} |
24 | 23 | local f2u = {} |
... | ... | @@ -28,7 +27,6 @@ local curIdx = 0 -- 下一个即将进入游戏的玩家索引 |
28 | 27 | local nextIdx = 0 -- 新加的位置 |
29 | 28 | |
30 | 29 | |
31 | - | |
32 | 30 | local function getRank(uid) |
33 | 31 | local info = u2i[uid] |
34 | 32 | if not info then return -1 end |
... | ... | @@ -63,18 +61,12 @@ skynet.register_protocol { |
63 | 61 | end, |
64 | 62 | dispatch = function(session, address, cmd, data) |
65 | 63 | skynet.ignoreret() |
66 | - cs(function() | |
67 | - if cmd == actionCodes.Sys_checkQueue then | |
68 | - checkQueue(session) | |
69 | - end | |
70 | - end) | |
64 | + if cmd == actionCodes.Sys_checkQueue then | |
65 | + checkQueue(session) | |
66 | + end | |
71 | 67 | end |
72 | 68 | } |
73 | 69 | |
74 | -function CMD.open(serv) | |
75 | - gate_serv = serv | |
76 | -end | |
77 | - | |
78 | 70 | function CMD.push(uid, fd) |
79 | 71 | uid = tostring(uid) |
80 | 72 | if u2i[uid] then -- 存在] |
... | ... | @@ -129,6 +121,7 @@ function CMD.pop() |
129 | 121 | end |
130 | 122 | end |
131 | 123 | |
124 | + | |
132 | 125 | -- 下线了 |
133 | 126 | function CMD.socket_close(fd) |
134 | 127 | local uid = f2u[fd] |
... | ... | @@ -138,8 +131,7 @@ function CMD.socket_close(fd) |
138 | 131 | info[2] = nil |
139 | 132 | end |
140 | 133 | |
141 | - | |
142 | -local function handle_timeout() | |
134 | +function CMD.handle_timeout() | |
143 | 135 | local now = skynet.timex() |
144 | 136 | for uid, info in pairs(u2i) do |
145 | 137 | if info[2] and info[3] and now >= info[3][3] then --存在fd 检查心跳 |
... | ... | @@ -153,26 +145,10 @@ local function handle_timeout() |
153 | 145 | end |
154 | 146 | end |
155 | 147 | end |
156 | - skynet.timeout(100, handle_timeout) | |
157 | 148 | end |
158 | 149 | |
150 | +function CMD.count() | |
151 | + return (nextIdx + MAX_COUNT - curIdx) % MAX_COUNT | |
152 | +end | |
159 | 153 | |
160 | -skynet.start(function() | |
161 | - skynet.dispatch("lua", function(session, source, command, ...) | |
162 | - -- skynet.trace() --执行序的跟踪统计 | |
163 | - local f = CMD[command] | |
164 | - if f then | |
165 | - skynet.ret(skynet.pack(f(...))) | |
166 | - end | |
167 | - end) | |
168 | - | |
169 | - skynet.info_func(function() | |
170 | - local info = {} | |
171 | - info.count = (nextIdx + MAX_COUNT - curIdx) % MAX_COUNT | |
172 | - return info | |
173 | - end) | |
174 | - | |
175 | - cs = queue() | |
176 | - | |
177 | - skynet.timeout(100, handle_timeout) | |
178 | -end) | |
179 | 154 | \ No newline at end of file |
155 | +return CMD | ... | ... |
src/services/poold.lua
src/services/watchdog.lua
... | ... | @@ -66,7 +66,6 @@ end |
66 | 66 | function CMD.start(conf) |
67 | 67 | skynet.call(gate_serv, "lua", "open" , conf) |
68 | 68 | skynet.call(redisd, "lua", "open", conf) |
69 | - skynet.call(queued_serv, "lua", "open", gate_serv) | |
70 | 69 | |
71 | 70 | if use_logd == 1 then |
72 | 71 | skynet.call(logd, "lua", "open") |
... | ... | @@ -138,5 +137,4 @@ skynet.start(function() |
138 | 137 | skynet.newservice("services/chated") |
139 | 138 | -- 网关服务 |
140 | 139 | gate_serv = skynet.newservice("gate") |
141 | - queued_serv = skynet.newservice("services/queued") | |
142 | 140 | end) | ... | ... |