فهرست منبع

提交无限高抽

SCFC 7 ماه پیش
والد
کامیت
d599c55963

+ 2 - 0
script/common/LogDefine.lua

@@ -268,6 +268,8 @@ DEFINE = {
 	CommonActShop			= 272,			 -- 通用节日活动-节日商店
 	CommonActCharge			= 273,			 -- 通用节日活动-节日累充
 	CommonActFindTreasure	= 274,			 -- 通用节日活动-限时寻宝
+	UnlimitDrawCard			= 275,			 -- 无限高抽
+	OpenServerGiftPackage   = 276,			 -- 开服礼包
 
 	abs_totalReach          = 500,           -- 周期性活动累计
     abs_singleReach         = 501,           -- 周期性活动单次

+ 10 - 7
script/common/ProtoID.lua

@@ -1642,12 +1642,12 @@ _ENV[1681]="GC_AREABATTLE_REWARD_QUERY"
 
 _ENV[1682]="GC_SKIN_DATA_QUERY"
 
--- _ENV[1683]="CG_UNLIMITDRAW_QUERY"
--- _ENV[1684]="GC_UNLIMITDRAW_QUERY"
--- _ENV[1685]="CG_UNLIMITDRAW_DO"
--- _ENV[1686]="GC_UNLIMITDRAW_DO"
--- _ENV[1687]="CG_UNLIMITDRAW_ABANDON"
--- _ENV[1688]="CG_UNLIMITDRAW_GET"
+_ENV[1683]="CG_UNLIMITDRAW_QUERY"
+_ENV[1684]="GC_UNLIMITDRAW_QUERY"
+_ENV[1685]="CG_UNLIMITDRAW_DO"
+_ENV[1686]="GC_UNLIMITDRAW_DO"
+_ENV[1687]="CG_UNLIMITDRAW_ABANDON"
+_ENV[1688]="CG_UNLIMITDRAW_GET"
 
 _ENV[1689]="CG_COMMON_HUMAN_INFO"       -- 玩家通用的一些数据请求(是否首充等)
 _ENV[1690]="GC_COMMON_HUMAN_INFO"
@@ -1656,4 +1656,7 @@ _ENV[1690]="GC_COMMON_HUMAN_INFO"
 -- _ENV[1692]="GC_HEROSEED_QUERY_ALL"
 -- _ENV[1693]="CG_HEROSEED_QUERY_SINGLE"
 -- _ENV[1694]="GC_HEROSEED_QUERY_SINGLE"
--- _ENV[1695]="CG_HEROSEED_UPGRADE"
+-- _ENV[1695]="CG_HEROSEED_UPGRADE"
+
+-- _ENV[1697]="CG_OPENSERVER_GIFTPACKAGE_QUERY"
+-- _ENV[1698]="GC_OPENSERVER_GIFTPACKAGE_QUERY"

+ 4 - 0
script/core/commonOperate.lua

@@ -1,6 +1,7 @@
 local Util = require("common.Util")
 local OneKillGiftLogic = require("present.OneKillGift")
 local WarOrder = require("shop.WarOrder")
+local UnlimitDrawLogic = require("drawCard.UnlimitDrawLogic")
 
 function onZero()
     OneKillGiftLogic.onZero()
@@ -8,6 +9,7 @@ end
 
 function onLogin(human)
     OneKillGiftLogic.onLogin(human)
+    UnlimitDrawLogic.onLogin(human)
 end
 
 function LvChange(human, nOldeLv, nNewLv)
@@ -17,4 +19,6 @@ function LvChange(human, nOldeLv, nNewLv)
 
     local nCnt = nNewLv - nOldeLv
     WarOrder.trigger(human, 6, nCnt) -- 等级战令
+
+    UnlimitDrawLogic.onLvUp(human, nNewLv)
 end

+ 17 - 0
script/module/drawCard/Handler.lua

@@ -1,5 +1,6 @@
 local DrawCardLogic = require("drawCard.DrawCardLogic")
 local RecommendLineup = require("drawCard.RecommendLineup")
+local UnlimitDrawLogic = require("drawCard.UnlimitDrawLogic")
 
 function CG_DRAWCARD_QUERY(human,msg)
 	DrawCardLogic.query(human)
@@ -19,4 +20,20 @@ end
 
 function CG_DRAWCARD_SKIP_HEROSHOW(human, msg)
 	DrawCardLogic.SetHeroSkip(human, msg.bOperate)
+end
+
+function CG_UNLIMITDRAW_QUERY(human, msg)
+	UnlimitDrawLogic.UnlimitDrawLogic_Query(human)
+end
+
+function CG_UNLIMITDRAW_DO(human, msg)
+	UnlimitDrawLogic.UnlimitDrawLogic_Do(human)
+end
+
+function CG_UNLIMITDRAW_ABANDON(human, msg)
+	UnlimitDrawLogic.UnlimitDrawLogic_Abandon(human)
+end
+
+function CG_UNLIMITDRAW_GET(human, msg)
+	UnlimitDrawLogic.UnlimitDrawLogic_Get(human)
 end

+ 24 - 1
script/module/drawCard/Proto.lua

@@ -71,4 +71,27 @@ CG_DRAWCARD_GET_RECOMMEND_LINEUP = {}
 GC_DRAWCARD_GET_RECOMMEND_LINEUP = {
 	{"bIsEnd",   1,		"byte"},		
 	{"list",  35, RecommendLineup}
-}
+}
+
+-- 获取无限高抽数据
+CG_UNLIMITDRAW_QUERY = {}
+
+-- 回复无限高抽数
+GC_UNLIMITDRAW_QUERY = {
+	{"nNowNum",		1,		"byte"},		-- 当前抽取次数
+	{"tGetInfo",	4,		"byte"},		-- 获得记录 1已获得,0 未获得
+}
+
+-- 进行抽取
+CG_UNLIMITDRAW_DO = {}
+
+-- 抽取回复
+GC_UNLIMITDRAW_DO = {
+	{"tHeros",			10,		HeroNiceNet},	-- 召唤获得英雄
+}
+
+-- 放弃
+CG_UNLIMITDRAW_ABANDON = {}
+
+-- 领取英雄
+CG_UNLIMITDRAW_GET = {}

+ 277 - 0
script/module/drawCard/UnlimitDrawLogic.lua

@@ -0,0 +1,277 @@
+--------------------------------
+-- 文件名       :  UnlimitDrawLogic.lua
+-- 文件说明     :  无限高抽
+-- 创建时间     :   2025/09/29
+-- 创建人       :   FC
+--------------------------------
+local Util = require("common.Util")
+local Lang = require("common.Lang")
+local Msg = require("core.Msg")
+local Grid = require("bag.Grid")
+local HeroGrid = require("hero.HeroGrid")
+local HeroLogic = require("hero.HeroLogic")
+local BagLogic = require("bag.BagLogic")
+local Log = require("common.Log")
+local Broadcast = require("broadcast.Broadcast")
+local DrawCardExcel = require("excel.drawCard").drawCard
+local RandomLogic = require("common.RandomLogic")
+local HeroDefine = require("hero.HeroDefine")
+local HeroExcel = require("excel.hero").hero
+local HeroBook = require("hero.HeroBook")
+
+-- local DrawCardLogic = require("drawCard.DrawCardLogic")
+
+local UNLIMIT_CARD_ID = 12
+local UNLIMIT_CARD_LV = 25
+
+----------------------------------------- 内部处理开始 -------------------------------------
+local function UnlimitDraw_CreateDB(human)
+    human.db.UnlimitDraw = {
+        nNowNum = 0,
+        bLogin = false,
+        bLv = false,
+        nFirstLoginTime = 0,
+        bNextLogin = false,
+        tChacheHero = nil,
+    }
+end
+
+local function UnlimitDraw_CheckDB(human)
+    if not human.db.UnlimitDraw then
+        UnlimitDraw_CreateDB(human)
+    end
+end
+
+local function UnlimitDraw_GetNum(human)
+    return human.db.UnlimitDraw.nNowNum
+end
+
+local function UnlimitDraw_SetNum(human, nValue)
+    human.db.UnlimitDraw.nNowNum = human.db.UnlimitDraw.nNowNum + nValue
+    if human.db.UnlimitDraw.nNowNum < 0 then
+        human.db.UnlimitDraw.nNowNum = 0
+    end
+end
+
+local function UnlimitDraw_GetLogin(human)
+    return human.db.UnlimitDraw.bLogin
+end
+
+local function UnlimitDraw_SetLogin(human, bValue)
+    human.db.UnlimitDraw.bLogin = bValue
+end
+
+local function UnlimitDraw_GetLoginTime(human)
+    return human.db.UnlimitDraw.nFirstLoginTime
+end
+
+local function UnlimitDraw_SetLoginTime(human, nValue)
+    human.db.UnlimitDraw.nFirstLoginTime = nValue
+end
+
+local function UnlimitDraw_GetLv(human)
+    return human.db.UnlimitDraw.bLv
+end
+
+local function UnlimitDraw_SetLv(human, bValue)
+    human.db.UnlimitDraw.bLv = bValue
+end
+
+local function UnlimitDraw_GetNextLogin(human)
+    return human.db.UnlimitDraw.bNextLogin
+end
+
+local function UnlimitDraw_SetNextLogin(human, bValue)
+    human.db.UnlimitDraw.bNextLogin = bValue
+end
+
+local function UnlimitDraw_SetCacheHero(human, tHeroInfo)
+    human.db.UnlimitDraw.tChacheHero = tHeroInfo
+end
+
+local function UnlimitDraw_GetCacheHero(human)
+    return human.db.UnlimitDraw.tChacheHero
+end
+
+local function UnlimitDraw_ClearCacheHero(human)
+    human.db.UnlimitDraw.tChacheHero = nil
+end
+
+local function UnlimitDraw_randHeroID(human, config, randomIndex)
+    local heroID = nil
+    local rindex = RandomLogic.getRandom1(config.weight, nil, 2)
+    local rconf = config.weight[rindex]
+    local weightLv = rconf[1]
+
+    heroID = heroID or HeroDefine.getRandHeroByWeightLv(weightLv)
+    return heroID
+end
+
+
+----------------------------------------- 客户端请求 -------------------------------------
+function UnlimitDrawLogic_Query(human)
+    UnlimitDraw_CheckDB(human)
+
+    local tMsgData = Msg.gc.GC_UNLIMITDRAW_QUERY
+
+    tMsgData.nNowNum = UnlimitDraw_GetNum(human)
+    tMsgData.tGetInfo[0] = 3
+    tMsgData.tGetInfo[1] = UnlimitDraw_GetLogin(human) and 1 or 0
+    tMsgData.tGetInfo[2] = UnlimitDraw_GetLv(human) and 1 or 0
+    tMsgData.tGetInfo[3] = UnlimitDraw_GetNextLogin(human) and 1 or 0
+
+    Msg.send(tMsgData, human.fd)
+end
+
+function UnlimitDrawLogic_Do(human)
+    local nNowNum = UnlimitDraw_GetNum(human)
+    if 0 >= nNowNum then
+        return
+    end
+
+    local nDoNum = 10
+    local config = DrawCardExcel[UNLIMIT_CARD_ID]
+
+    if HeroLogic.getEmptyCnt(human) < nDoNum then
+        return Broadcast.sendErr(human, Lang.HERO_BAG_FULL)
+    end
+
+    UnlimitDraw_ClearCacheHero(human)
+
+    local heroLen = 0
+    local heroList = {}
+    local heroNewList = {}
+    local heroIndexList = {}
+    local fenjielist = {}
+    local heroIDs = nil
+
+    local randomMin = math.random(1, nDoNum)
+    for i = 1, nDoNum, 1 do
+        local nHeroID = UnlimitDraw_randHeroID(human, config, randomMin)
+        if nHeroID then
+            local heroConfig = HeroExcel[nHeroID]
+            local star = heroConfig.star
+            local name = heroConfig.name
+            local grade = heroConfig.grade
+            local isNew = not HeroBook.isGet(human, heroConfig.id, heroConfig.star)
+            -- local heroIndex, fjlist = HeroLogic.addHero(human, nHeroID, nil, 1, "draw_card")
+
+            heroLen = heroLen + 1
+            heroList[heroLen] = nHeroID
+            heroNewList[heroLen] = isNew
+
+            if not heroIDs then
+                heroIDs = nHeroID
+            else
+                heroIDs = heroIDs .. "|" .. nHeroID
+            end
+        else
+            print("[UnlimitDrawLogic_Do] 生成英雄失败直接返回")
+            return
+        end
+    end
+
+    local tMsgData = Msg.gc.GC_UNLIMITDRAW_DO
+    tMsgData.tHeros[0] = nDoNum
+    for i = 1, heroLen do
+        local heroID = heroList[i]
+        local isNew = heroNewList and heroNewList[i]
+        -- local index = heroIndexList and heroIndexList[i]
+        HeroGrid.makeHeroNice(tMsgData.tHeros[i], heroID, 1, isNew)
+    end
+
+    UnlimitDraw_SetCacheHero(human, heroList)
+    Msg.send(tMsgData, human.fd)
+end
+
+function UnlimitDrawLogic_Abandon(human)
+    UnlimitDraw_ClearCacheHero(human)
+end
+
+function UnlimitDrawLogic_Get(human)
+    local tHeroInfo = UnlimitDraw_GetCacheHero(human)
+    if not tHeroInfo then
+        return
+    end
+
+    local heroIndexList = {}
+    local fenjielist = {}
+    for _, nID in ipairs(tHeroInfo) do
+        local heroIndex, fjlist = HeroLogic.addHero(human, nID,nil, 1, "UnlimitDrawCard")
+        if fjlist and type(fjlist) == "table" then
+            for fjItemID, fjItemCnt in pairs(fjlist) do
+                fenjielist[fjItemID] = (fenjielist[fjItemID] or 0) + fjItemCnt
+            end
+        end
+
+        table.insert(heroIndexList, heroIndex)
+    end
+
+    if nil ~= _G.next(fenjielist) then
+        local tItem = {}
+        for key, value in pairs(fenjielist) do
+            table.insert(tItem, {key, value})
+        end
+        BagLogic.sendItemGetList(human, tItem, "UnlimitDrawCard")
+    end
+
+    UnlimitDraw_SetNum(human, -1)
+    UnlimitDrawLogic_Query(human)
+end
+
+function onLogin(human)
+    UnlimitDraw_CheckDB(human)
+
+    local bLogin = UnlimitDraw_GetLogin(human)
+    if false == bLogin then
+        UnlimitDraw_SetLogin(human, true)
+        UnlimitDraw_SetLoginTime(human, os.time())
+        UnlimitDraw_SetNum(human, 1)
+    else
+        local nLastTime = UnlimitDraw_GetLoginTime(human)
+        local bNextLogin = UnlimitDraw_GetNextLogin(human)
+        if not Util.isSameDay(nLastTime) and false == bNextLogin then
+            UnlimitDraw_SetNextLogin(human, true)
+            UnlimitDraw_SetNum(human, 1)
+        end
+    end
+
+    local bLv = UnlimitDraw_GetLv(human)
+    if false == bLv and human.db.lv >= UNLIMIT_CARD_LV then
+        UnlimitDraw_SetLv(human, true)
+        UnlimitDraw_SetNum(human, 1)
+    end
+end
+
+function onLvUp(human, nNewLv)
+    local bLv = UnlimitDraw_GetLv(human)
+    if false == bLv and nNewLv >= UNLIMIT_CARD_LV then
+        UnlimitDraw_SetLv(human, true)
+        UnlimitDraw_SetNum(human, 1)
+    end
+end
+
+function ModuleisOpen(human)
+    UnlimitDraw_CheckDB(human)
+
+    if true == UnlimitDraw_GetLogin(human) and UnlimitDraw_GetLv(human) == true 
+        and true == UnlimitDraw_GetNextLogin(human) then
+        if UnlimitDraw_GetNum(human) > 0 then
+            return true
+        else 
+            return false
+        end
+    end
+
+    return true
+end
+
+function isDot(human)
+    UnlimitDraw_CheckDB(human)
+
+    if true == ModuleisOpen(human) then
+        return UnlimitDraw_GetNum(human) > 0 and true or false
+    end
+
+    return false
+end

+ 8 - 1
script/module/roleSystem/RoleSystemLogic.lua

@@ -81,8 +81,15 @@ function isOpen(human, id, sendErr)
 		if not res then
 			return false, config
 		end
+	else
+		if config.module and config.module.ModuleisOpen then
+			local bOpen = config.module.ModuleisOpen(human)
+			if not bOpen then
+				return false, config
+			end
+		end
 	end
-	
+
 	return true, config
 end