Commit 3c0ea5fb7070be0765111105354d334ffb613176
1 parent
f871be67
抽英雄
Showing
6 changed files
with
219 additions
and
147 deletions
Show diff stats
src/GlobalVar.lua
@@ -134,6 +134,9 @@ TimeReset = { | @@ -134,6 +134,9 @@ TimeReset = { | ||
134 | DailyBattle2 = 14, -- 特殊-每日副本(贴纸) | 134 | DailyBattle2 = 14, -- 特殊-每日副本(贴纸) |
135 | DailyBattle1 = 15, -- 特殊-每日副本(装备) | 135 | DailyBattle1 = 15, -- 特殊-每日副本(装备) |
136 | DailyBattle3 = 16, -- 特殊-每日副本(时钟箱) | 136 | DailyBattle3 = 16, -- 特殊-每日副本(时钟箱) |
137 | + DrawType1 = 17, -- 变异 抽卡加成 | ||
138 | + DrawType2 = 18, -- 通常 抽卡加成 | ||
139 | + DrawType3 = 19, -- 魔法 抽卡加成 | ||
137 | } | 140 | } |
138 | 141 | ||
139 | GuideStep = { | 142 | GuideStep = { |
src/actions/HeroAction.lua
@@ -233,7 +233,7 @@ function _M.commentHeroRpc(agent, data) | @@ -233,7 +233,7 @@ function _M.commentHeroRpc(agent, data) | ||
233 | result.status = 1 | 233 | result.status = 1 |
234 | else | 234 | else |
235 | local commentKey = getCommentKey(heroType) | 235 | local commentKey = getCommentKey(heroType) |
236 | - local SERV = string.format(".chatd%d", math.random(1, 5)) | 236 | + local SERV = string.format(".chated%d", math.random(1, 5)) |
237 | local legal, mod = skynet.call(SERV, "lua", "check", content) | 237 | local legal, mod = skynet.call(SERV, "lua", "check", content) |
238 | if not legal then | 238 | if not legal then |
239 | content = mod or "" | 239 | content = mod or "" |
@@ -668,208 +668,258 @@ function _M.getResetRewardRpc(agent, data) | @@ -668,208 +668,258 @@ function _M.getResetRewardRpc(agent, data) | ||
668 | end | 668 | end |
669 | 669 | ||
670 | 670 | ||
671 | -local function randomDrawCondition(pool, condition) | ||
672 | - local value = {} | ||
673 | - for idx, field in ipairs(condition) do | ||
674 | - local lpool = {} | ||
675 | - local curIdx = 1 | ||
676 | - while pool[field .. "_" .. curIdx] do | ||
677 | - table.insert(lpool, {pool[field .. "_" .. curIdx]}) | ||
678 | - curIdx = curIdx + 1 | ||
679 | - end | ||
680 | - if next(lpool) then | ||
681 | - value[idx] = math.randWeight(lpool, 1) | ||
682 | - end | ||
683 | - end | ||
684 | - return value | ||
685 | -end | ||
686 | - | ||
687 | - | ||
688 | -local function fillDrawPool(curPool, resultPool, isNeedFunc) | ||
689 | - for itemId, oneData in pairs(csvdb["build_poolCsv"]) do | ||
690 | - if oneData["pool_" .. curPool] and oneData["pool_" .. curPool] ~= "" then | ||
691 | - local itemData = csvdb["itemCsv"][itemId] | ||
692 | - if itemData and isNeedFunc(itemData) then | ||
693 | - for _, one in ipairs(oneData["pool_" .. curPool]:toTableArray(true)) do | ||
694 | - table.insert(resultPool, {itemId, one[1], one[2]}) -- itemId, count, 概率 | ||
695 | - end | ||
696 | - end | ||
697 | - end | ||
698 | - end | ||
699 | -end | ||
700 | 671 | ||
701 | function _M.drawHeroRpc(agent, data) | 672 | function _M.drawHeroRpc(agent, data) |
702 | local role = agent.role | 673 | local role = agent.role |
703 | local msg = MsgPack.unpack(data) | 674 | local msg = MsgPack.unpack(data) |
704 | 675 | ||
705 | if not role:isFuncUnlock(FuncUnlock.GetHero) then return end | 676 | if not role:isFuncUnlock(FuncUnlock.GetHero) then return end |
706 | - local pool = msg.pool -- 1 2 3 | 677 | + local btype = msg.pool -- 1 2 3 4 |
707 | local drawType = msg.type -- 1 单抽 2 十连 | 678 | local drawType = msg.type -- 1 单抽 2 十连 |
708 | 679 | ||
709 | - local buildTypeData = csvdb["build_typeCsv"][pool] | 680 | + local buildTypeData = csvdb["build_typeCsv"][btype] |
710 | if not buildTypeData then return 1 end | 681 | if not buildTypeData then return 1 end |
711 | 682 | ||
712 | - local costs = {{"draw_card", "draw_coin"}, {"draw10_card", "draw10_coin"}} -- 抽取消耗 | ||
713 | local drawCount = {1, 10} -- 抽取次数 | 683 | local drawCount = {1, 10} -- 抽取次数 |
684 | + if not drawCount[drawType] then return 2 end | ||
714 | 685 | ||
715 | - local costT = costs[drawType] | ||
716 | - if not costT then return 2 end | ||
717 | - local cost = buildTypeData[costT[1]]:toNumMap() | ||
718 | - if not role:checkItemEnough(cost) then | ||
719 | - cost = buildTypeData[costT[2]]:toNumMap() | ||
720 | - if not role:checkItemEnough(cost) then | ||
721 | - return 3 | 686 | + local newerDraw |
687 | + if btype == 4 then | ||
688 | + newerDraw = role:getProperty("newerDraw") | ||
689 | + if math.illegalNum(globalCsv.draw_newer[2] - (newerDraw[1] or 0), drawCount[drawType], globalCsv.draw_newer[2]) then return 11 end | ||
690 | + end | ||
691 | + | ||
692 | + local cost = {} | ||
693 | + local lastCount = drawCount[drawType] | ||
694 | + for _, costType in ipairs({"draw_card", "draw_coin"}) do | ||
695 | + if buildTypeData[costType] ~= "" then | ||
696 | + local curCost = buildTypeData[costType]:toArray(true, "=") | ||
697 | + local hadCount = role:getItemCount(curCost[1]) | ||
698 | + local curCount = math.floor(hadCount / curCost[2]) | ||
699 | + if curCount >= lastCount then | ||
700 | + cost[curCost[1]] = curCost[2] * lastCount | ||
701 | + lastCount = 0 | ||
702 | + break | ||
703 | + elseif curCount > 0 then | ||
704 | + cost[curCost[1]] = curCost[2] * curCount | ||
705 | + lastCount = lastCount - curCount | ||
706 | + end | ||
722 | end | 707 | end |
723 | end | 708 | end |
709 | + if lastCount > 0 then -- 钱不够 | ||
710 | + return 3 | ||
711 | + end | ||
724 | 712 | ||
725 | - -- 开始抽 | ||
726 | - local rateTypes = {"unitRate", "fragmentRate", "itemRate"} | 713 | + -- pool 固定的 |
714 | + local poolEnum = { | ||
715 | + [1] = { | ||
716 | + [1] = 1, | ||
717 | + [2] = 2, | ||
718 | + [3] = 3, | ||
719 | + }, | ||
720 | + [2] = 10, | ||
721 | + [3] = 11, | ||
722 | + [4] = 12, | ||
723 | + } | ||
727 | 724 | ||
728 | - local typePool = {} | ||
729 | - for _, rateType in ipairs(rateTypes) do | ||
730 | - table.insert(typePool, {buildTypeData[rateType]}) | 725 | + -- 抽取的池子 |
726 | + local pool = poolEnum[btype] | ||
727 | + if btype == 1 then | ||
728 | + -- 超级卡池子 每周轮换 有活动覆盖之 | ||
729 | + --TODO 活动判断 | ||
730 | + if false then | ||
731 | + else | ||
732 | + for idx, poolId in pairs(pool) do | ||
733 | + if role:isTimeResetOpen(TimeReset["DrawType" .. idx]) then | ||
734 | + pool = poolId | ||
735 | + break | ||
736 | + end | ||
737 | + end | ||
738 | + if type(pool) ~= "number" then | ||
739 | + pool = -1 | ||
740 | + end | ||
741 | + end | ||
731 | end | 742 | end |
743 | + local unitPool = csvdb["build_unitCsv"][pool] | ||
744 | + if not unitPool then return 4 end | ||
732 | 745 | ||
746 | + -- 开始抽 | ||
733 | local resultPool = {} | 747 | local resultPool = {} |
748 | + local function fillDrawPool(fixRare, fixCamp, ssrUp) | ||
749 | + local condition = {"rare", "camp"} | ||
750 | + local values = {fixRare, fixCamp} | ||
751 | + | ||
752 | + for idx, field in ipairs(condition) do | ||
753 | + if not values[idx] then | ||
754 | + local lpool = {} | ||
755 | + local curIdx = 1 | ||
756 | + while unitPool[field .. "_" .. curIdx] do | ||
757 | + lpool[curIdx] = {unitPool[field .. "_" .. curIdx]} | ||
758 | + curIdx = curIdx + 1 | ||
759 | + end | ||
734 | 760 | ||
735 | - local fillPoolFunc = { | ||
736 | - unitRate = function(fixRare, fixCamp, fixJob) | ||
737 | - local condition = {"rare", "camp", "job"} | ||
738 | - local values = randomDrawCondition(csvdb["build_unitCsv"][pool], condition) | ||
739 | - values[1] = fixRare or values[1] | ||
740 | - values[2] = fixCamp or values[2] | ||
741 | - values[3] = fixJob or values[3] | ||
742 | - fillDrawPool(pool, resultPool, function(itemData) | ||
743 | - if itemData.type ~= ItemType.Hero then return end | ||
744 | - local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
745 | - if not heroData then return end | ||
746 | - for idx, field in ipairs(condition) do | ||
747 | - if heroData[field] ~= values[idx] then return end | 761 | + -- 稀有度 ssr up |
762 | + if field == "rare" then | ||
763 | + local all = 0 | ||
764 | + for _, weight in pairs(lpool) do | ||
765 | + all = all + weight[1] | ||
766 | + end | ||
767 | + | ||
768 | + lpool[4][1] = lpool[4][1] + (ssrUp or 0) * all | ||
748 | end | 769 | end |
749 | - return true | ||
750 | - end) | ||
751 | - end, | ||
752 | - fragmentRate = function(fixRare, fixCamp, fixJob) | ||
753 | - local condition = {"rare", "camp", "job"} | ||
754 | - local values = randomDrawCondition(csvdb["build_fragmentCsv"][pool], condition) | ||
755 | - values[1] = fixRare or values[1] | ||
756 | - values[2] = fixCamp or values[2] | ||
757 | - values[3] = fixJob or values[3] | ||
758 | - fillDrawPool(pool, resultPool, function(itemData) | ||
759 | - if itemData.type ~= ItemType.HeroFragment then return end | ||
760 | - local heroData = csvdb["unitCsv"][itemData.id] | ||
761 | - if not heroData then return end | ||
762 | - for idx, field in ipairs(condition) do | ||
763 | - if heroData[field] ~= values[idx] then return end | 770 | + |
771 | + if next(lpool) then | ||
772 | + values[idx] = math.randWeight(lpool, 1) | ||
764 | end | 773 | end |
765 | - return true | ||
766 | - end) | ||
767 | - end, | ||
768 | - itemRate = function() | ||
769 | - fillDrawPool(pool, resultPool, function(itemData) | ||
770 | - if itemData.type == ItemType.HeroFragment or itemData.type == ItemType.Hero then return end | ||
771 | - return true | ||
772 | - end) | ||
773 | - end, | ||
774 | - } | 774 | + end |
775 | + end | ||
775 | 776 | ||
776 | - role:costItems(cost, {log = {desc = "drawHero", short1 = pool}}) | ||
777 | - local floorHeroCount = role:getProperty("floorHero")[pool] or 0 | 777 | + for itemId, oneData in pairs(csvdb["build_poolCsv"]) do |
778 | + if oneData["pool_" .. pool] and oneData["pool_" .. pool] ~= "" then | ||
779 | + local itemData = csvdb["itemCsv"][itemId] | ||
780 | + while itemData do | ||
781 | + if itemData.type ~= ItemType.Hero then break end | ||
782 | + local heroData = csvdb["unitCsv"][itemData.id - ItemStartId.Hero] | ||
783 | + if not heroData then break end | ||
784 | + local ok = true | ||
785 | + for idx, field in ipairs(condition) do | ||
786 | + if heroData[field] ~= values[idx] then ok = false break end | ||
787 | + end | ||
788 | + if not ok then break end | ||
789 | + resultPool[itemId] = {oneData["pool_" .. pool]} -- itemId, count, 概率 | ||
790 | + break | ||
791 | + end | ||
792 | + end | ||
793 | + end | ||
794 | + end | ||
795 | + | ||
796 | + role:costItems(cost, {log = {desc = "drawHero", short1 = btype, int1 = pool}}) | ||
797 | + | ||
798 | + local draw_floor_back_counts = globalCsv.draw_floor_back_counts[btype] | ||
799 | + local draw_ssr_up_count_rate = globalCsv.draw_ssr_up_count_rate[btype] | ||
800 | + local floorHeroCount = role:getProperty("floorHero")[btype] or 0 | ||
801 | + local ssrUpCount = role:getProperty("ssrUp")[btype] or 0 | ||
802 | + | ||
803 | + local newerDrawCount, newerHadSSR | ||
804 | + if btype == 4 then | ||
805 | + newerDrawCount = newerDraw[1] or 0 | ||
806 | + newerHadSSR = newerDraw[2] or 0 | ||
807 | + end | ||
778 | 808 | ||
779 | local ssrCount = 0 | 809 | local ssrCount = 0 |
780 | local reward = {} | 810 | local reward = {} |
781 | for i = 1, drawCount[drawType] do | 811 | for i = 1, drawCount[drawType] do |
782 | floorHeroCount = floorHeroCount + 1 | 812 | floorHeroCount = floorHeroCount + 1 |
813 | + if btype == 4 then | ||
814 | + newerDrawCount = newerDrawCount + 1 | ||
815 | + end | ||
783 | 816 | ||
784 | resultPool = {} | 817 | resultPool = {} |
785 | - local isFloorBack = globalCsv.draw_floor_back_counts[pool] and floorHeroCount >= globalCsv.draw_floor_back_counts[pool] | ||
786 | - while not next(resultPool) do | ||
787 | - local rateType | 818 | + local isFloorBack = draw_floor_back_counts and floorHeroCount >= draw_floor_back_counts |
819 | + local isNewerSSR = btype == 4 and (newerHadSSR == 0 and newerDrawCount >= globalCsv.draw_newer[1]) or false | ||
788 | 820 | ||
789 | - if isFloorBack then | ||
790 | - rateType = 1 --保底英雄 | ||
791 | - else | ||
792 | - rateType = math.randWeight(typePool, 1) | ||
793 | - end | ||
794 | - if not fillPoolFunc[rateTypes[rateType]] then return 4 end | ||
795 | - if isFloorBack then | ||
796 | - fillPoolFunc[rateTypes[rateType]](3) -- 保底 sr 【郑斌】明确 | 821 | + local ssrUp = 0 |
822 | + if draw_ssr_up_count_rate then | ||
823 | + ssrUp = math.floor(ssrUpCount / draw_ssr_up_count_rate[1]) * draw_ssr_up_count_rate[2] / 100 | ||
824 | + end | ||
825 | + while not next(resultPool) do | ||
826 | + if isNewerSSR then | ||
827 | + fillDrawPool(4) -- 新手保底的 ssr | ||
828 | + elseif isFloorBack then | ||
829 | + fillDrawPool(3) -- 保底 sr 【郑斌】明确 | ||
797 | else | 830 | else |
798 | - fillPoolFunc[rateTypes[rateType]]() | 831 | + fillDrawPool(nil, nil, ssrUp) |
799 | end | 832 | end |
800 | end | 833 | end |
801 | 834 | ||
802 | - local idx = math.randWeight(resultPool, 3) | ||
803 | - local temp = resultPool[idx] | ||
804 | - local itemData = csvdb["itemCsv"][temp[1]] | 835 | + local itemId = math.randWeight(resultPool, 1) |
836 | + local itemData = csvdb["itemCsv"][itemId] | ||
805 | 837 | ||
806 | - if itemData.type == ItemType.Hero then | ||
807 | - if itemData.quality == 4 then | ||
808 | - ssrCount = ssrCount + 1 | ||
809 | - elseif itemData.quality == 3 then | ||
810 | - floorHeroCount = 0 | 838 | + if itemData.quality == 4 then |
839 | + ssrCount = ssrCount + 1 | ||
840 | + ssrUpCount = 0 | ||
841 | + | ||
842 | + if btype == 4 then | ||
843 | + newerHadSSR = newerHadSSR + 1 | ||
811 | end | 844 | end |
845 | + elseif itemData.quality == 3 then | ||
846 | + floorHeroCount = 0 | ||
847 | + ssrUpCount = ssrUpCount + 1 | ||
848 | + else | ||
849 | + ssrUpCount = ssrUpCount + 1 | ||
812 | end | 850 | end |
813 | 851 | ||
814 | - if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | 852 | + if role:isHaveHero(itemData.id - ItemStartId.Hero) then |
815 | local fragId = itemData.id - ItemStartId.Hero | 853 | local fragId = itemData.id - ItemStartId.Hero |
816 | local heroData = csvdb["unitCsv"][fragId] | 854 | local heroData = csvdb["unitCsv"][fragId] |
817 | - local count = globalCsv.draw_unit_tofragment[heroData.rare] * temp[2] | ||
818 | - role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = pool}}) | ||
819 | - table.insert(reward, {id = fragId, count = count, from = temp[1], fcount = temp[2]}) | 855 | + local count = globalCsv.draw_unit_tofragment[heroData.rare] |
856 | + role:award({[fragId] = count}, {log = {desc = "drawHero", short1 = btype, int1 = pool}}) | ||
857 | + table.insert(reward, {id = fragId, count = count, from = itemId, fcount = 1}) | ||
820 | else | 858 | else |
821 | - role:award({[temp[1]] = temp[2]}, {log = {desc = "drawHero", short1 = pool}}) | ||
822 | - table.insert(reward, {id = temp[1], count = temp[2]}) | 859 | + role:award({[itemId] = 1}, {log = {desc = "drawHero", short1 = btype, int1 = pool}}) |
860 | + table.insert(reward, {id = itemId, count = 1}) | ||
823 | end | 861 | end |
824 | end | 862 | end |
825 | 863 | ||
826 | - if globalCsv.draw_floor_back_counts[pool] then | 864 | + if draw_floor_back_counts then |
827 | local floorHero = role:getProperty("floorHero") | 865 | local floorHero = role:getProperty("floorHero") |
828 | floorHero[pool] = floorHeroCount | 866 | floorHero[pool] = floorHeroCount |
829 | - role:updateProperty({field = "floorHero", value = floorHero}) | 867 | + role:setProperty("floorHero", floorHero) |
868 | + end | ||
869 | + | ||
870 | + if draw_ssr_up_count_rate then | ||
871 | + local ssrUp = role:getProperty("ssrUp") | ||
872 | + ssrUp[pool] = ssrUpCount | ||
873 | + role:setProperty("ssrUp", ssrUp) | ||
830 | end | 874 | end |
831 | 875 | ||
832 | - if pool == 1 then | ||
833 | - local repayHero = role:getProperty("repayHero") | ||
834 | - repayHero = math.min(globalCsv.draw_super_repay_count, repayHero + drawCount[drawType]) | ||
835 | - role:updateProperty({field = "repayHero", value = repayHero}) | 876 | + if btype == 4 then |
877 | + newerDraw[1] = newerDrawCount | ||
878 | + newerDraw[2] = newerHadSSR | ||
879 | + role:updateProperty({field = "newerDraw", value = newerDraw}) | ||
836 | end | 880 | end |
837 | 881 | ||
882 | + -- if pool == 1 then | ||
883 | + -- local repayHero = role:getProperty("repayHero") | ||
884 | + -- repayHero = math.min(globalCsv.draw_super_repay_count, repayHero + drawCount[drawType]) | ||
885 | + -- role:updateProperty({field = "repayHero", value = repayHero}) | ||
886 | + -- end | ||
887 | + | ||
838 | role:checkTaskEnter("DrawHero", {pool = pool, count = drawCount[drawType]}) | 888 | role:checkTaskEnter("DrawHero", {pool = pool, count = drawCount[drawType]}) |
839 | if ssrCount > 0 then | 889 | if ssrCount > 0 then |
840 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) | 890 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
841 | end | 891 | end |
842 | - role:log("hero_action", {desc = "drawHero", short1 = pool, int1 = drawCount[drawType]}) | 892 | + role:log("hero_action", {desc = "drawHero", short1 = btype, int1 = drawCount[drawType], int2 = pool}) |
843 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 | 893 | SendPacket(actionCodes.Hero_drawHeroRpc, MsgPack.pack({reward = reward})) -- 这个 reward 是数组 |
844 | return true | 894 | return true |
845 | end | 895 | end |
846 | 896 | ||
847 | -function _M.repayHeroRpc(agent, data) | ||
848 | - local role = agent.role | ||
849 | - | ||
850 | - local repayHero = role:getProperty("repayHero") | ||
851 | - if repayHero < globalCsv.draw_super_repay_count then | ||
852 | - return | ||
853 | - end | 897 | +-- function _M.repayHeroRpc(agent, data) |
898 | +-- local role = agent.role | ||
854 | 899 | ||
855 | - role:updateProperty({field = "repayHero", value = 0}) | ||
856 | - local id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | 900 | +-- local repayHero = role:getProperty("repayHero") |
901 | +-- if repayHero < globalCsv.draw_super_repay_count then | ||
902 | +-- return | ||
903 | +-- end | ||
857 | 904 | ||
858 | - local reward = {} | ||
859 | - local itemData = csvdb["itemCsv"][id] | ||
860 | - if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
861 | - local fragId = itemData.id - ItemStartId.Hero | ||
862 | - local heroData = csvdb["unitCsv"][fragId] | ||
863 | - local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
864 | - role:award({[fragId] = count}, {log = {desc = "heroRepay"}}) | ||
865 | - reward = {id = fragId, count = count, from = id, fcount = 1} | ||
866 | - else | ||
867 | - role:award({[id] = 1}, {log = {desc = "heroRepay"}}) | ||
868 | - reward = {id = id, count = 1} | ||
869 | - end | ||
870 | - role:log("hero_action", {desc = "heroRepay"}) | ||
871 | - SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) | ||
872 | - return true | ||
873 | -end | 905 | +-- role:updateProperty({field = "repayHero", value = 0}) |
906 | +-- local id = math.randWeight(csvdb["build_giftCsv"], "pool_1") | ||
907 | + | ||
908 | +-- local reward = {} | ||
909 | +-- local itemData = csvdb["itemCsv"][id] | ||
910 | +-- if itemData.type == ItemType.Hero and role:isHaveHero(itemData.id - ItemStartId.Hero) then | ||
911 | +-- local fragId = itemData.id - ItemStartId.Hero | ||
912 | +-- local heroData = csvdb["unitCsv"][fragId] | ||
913 | +-- local count = globalCsv.draw_unit_tofragment[heroData.rare] | ||
914 | +-- role:award({[fragId] = count}, {log = {desc = "heroRepay"}}) | ||
915 | +-- reward = {id = fragId, count = count, from = id, fcount = 1} | ||
916 | +-- else | ||
917 | +-- role:award({[id] = 1}, {log = {desc = "heroRepay"}}) | ||
918 | +-- reward = {id = id, count = 1} | ||
919 | +-- end | ||
920 | +-- role:log("hero_action", {desc = "heroRepay"}) | ||
921 | +-- SendPacket(actionCodes.Hero_repayHeroRpc, MsgPack.pack({reward = reward})) | ||
922 | +-- return true | ||
923 | +-- end | ||
874 | 924 | ||
875 | return _M | 925 | return _M |
876 | \ No newline at end of file | 926 | \ No newline at end of file |
src/agent.lua
@@ -325,6 +325,15 @@ skynet.start(function() | @@ -325,6 +325,15 @@ skynet.start(function() | ||
325 | end | 325 | end |
326 | end) | 326 | end) |
327 | 327 | ||
328 | + skynet.info_func(function() | ||
329 | + local info = {} | ||
330 | + info.ip = agentInfo.ip | ||
331 | + if agentInfo.role then | ||
332 | + info.roldId = agentInfo.role:getProperty("id") | ||
333 | + end | ||
334 | + return info | ||
335 | + end) | ||
336 | + | ||
328 | redisd = skynet.localname(".redis") | 337 | redisd = skynet.localname(".redis") |
329 | if tonumber(skynet.getenv "logd") == 1 then | 338 | if tonumber(skynet.getenv "logd") == 1 then |
330 | logd = skynet.localname(".log") | 339 | logd = skynet.localname(".log") |
src/models/Role.lua
@@ -144,8 +144,10 @@ Role.schema = { | @@ -144,8 +144,10 @@ Role.schema = { | ||
144 | 144 | ||
145 | emailSync = {"number", 0}, -- 已经同步到的邮件Id | 145 | emailSync = {"number", 0}, -- 已经同步到的邮件Id |
146 | 146 | ||
147 | - repayHero = {"number", 0}, -- 超级招募 回馈 | 147 | + -- repayHero = {"number", 0}, -- 超级招募 回馈 |
148 | floorHero = {"table", {}}, -- 招募保底 -- {[poolId] = count} | 148 | floorHero = {"table", {}}, -- 招募保底 -- {[poolId] = count} |
149 | + ssrUp = {"table", {}}, -- ssr up -- {[poolId] = count} | ||
150 | + newerDraw = {"table", {}}, -- 新手池子 {N, 1} 抽了多少次, 是否出了ssr | ||
149 | } | 151 | } |
150 | 152 | ||
151 | 153 | ||
@@ -349,8 +351,8 @@ function Role:data() | @@ -349,8 +351,8 @@ function Role:data() | ||
349 | dinerS = self:getProperty("dinerS"), | 351 | dinerS = self:getProperty("dinerS"), |
350 | 352 | ||
351 | rmbC = self:getProperty("rmbC"), | 353 | rmbC = self:getProperty("rmbC"), |
352 | - repayHero = self:getProperty("repayHero"), | ||
353 | - floorHero = self:getProperty("floorHero"), | 354 | + -- repayHero = self:getProperty("repayHero"), |
355 | + newerDraw = self:getProperty("newerDraw"), | ||
354 | } | 356 | } |
355 | end | 357 | end |
356 | 358 |
src/models/RolePlugin.lua
@@ -401,10 +401,18 @@ function RolePlugin.bind(Role) | @@ -401,10 +401,18 @@ function RolePlugin.bind(Role) | ||
401 | 401 | ||
402 | redisproxy:sadd(string.format(R_HEROS, roleId), heroId) | 402 | redisproxy:sadd(string.format(R_HEROS, roleId), heroId) |
403 | 403 | ||
404 | + local wakeL = 1 | ||
405 | + if unitData.rare == 3 then | ||
406 | + wakeL = 2 | ||
407 | + elseif unitData.rare == 4 then | ||
408 | + wakeL = 3 | ||
409 | + end | ||
410 | + | ||
404 | local heroInfo = { | 411 | local heroInfo = { |
405 | key = string.format(R_HERO, roleId, heroId), | 412 | key = string.format(R_HERO, roleId, heroId), |
406 | id = heroId, | 413 | id = heroId, |
407 | type= heroType, | 414 | type= heroType, |
415 | + wakeL = wakeL, | ||
408 | } | 416 | } |
409 | 417 | ||
410 | local newHero = require("models.Hero").new(heroInfo) | 418 | local newHero = require("models.Hero").new(heroInfo) |
src/services/watchdog.lua
@@ -51,7 +51,7 @@ local use_logd = tonumber(skynet.getenv "logd") | @@ -51,7 +51,7 @@ local use_logd = tonumber(skynet.getenv "logd") | ||
51 | -- @desc: agent状态定时检测 | 51 | -- @desc: agent状态定时检测 |
52 | function check_agent_status() | 52 | function check_agent_status() |
53 | pcall(agent_ctrl.check_agent_status, agent_ctrl) | 53 | pcall(agent_ctrl.check_agent_status, agent_ctrl) |
54 | - skynet.timeout(1, check_agent_status) | 54 | + skynet.timeout(100, check_agent_status) |
55 | end | 55 | end |
56 | 56 | ||
57 | -- 创建world以及union channel 用于广播 | 57 | -- 创建world以及union channel 用于广播 |