local ui = {}
local _V = function(v) return SL:GetMetaValue(v) end
local FUNCQUEUE = {}
local TAGOBJ = {}

function ui.init(parent, __data__, __update__)
	if __update__ then return ui.update(__data__) end
	-- Create ImageBG
	local ImageBG = GUI:Image_Create(parent, "ImageBG", 105.00, 40.00, "res/custom/enterDaLu/1DaLu/bg_1.jpg")
	GUI:setContentSize(ImageBG, _V("SCREEN_WIDTH"), _V("SCREEN_HEIGHT"))
	GUI:setIgnoreContentAdaptWithSize(ImageBG, false)
	GUI:setAnchorPoint(ImageBG, 0.00, 0.00)
	GUI:setTouchEnabled(ImageBG, false)
	GUI:setTag(ImageBG, -1)

	-- Create CloseButton
	local CloseButton = GUI:Button_Create(ImageBG, "CloseButton", 1003.00, 517.00, "res/custom/public/btn_close.png")
	GUI:Button_setTitleText(CloseButton, [[]])
	GUI:Button_setTitleColor(CloseButton, "#ffffff")
	GUI:Button_setTitleFontSize(CloseButton, 14)
	GUI:Button_titleEnableOutline(CloseButton, "#000000", 1)
	GUI:setAnchorPoint(CloseButton, 0.00, 0.00)
	GUI:setTouchEnabled(CloseButton, true)
	GUI:setTag(CloseButton, -1)

	-- Create Node_1
	local Node_1 = GUI:Node_Create(ImageBG, "Node_1", 608.00, 363.00)
	GUI:setTag(Node_1, 0)

	-- Create Image_desc
	local Image_desc = GUI:Image_Create(Node_1, "Image_desc", -320.00, 97.00, "res/custom/enterDaLu/2.png")
	GUI:setAnchorPoint(Image_desc, 0.00, 0.00)
	GUI:setTouchEnabled(Image_desc, false)
	GUI:setTag(Image_desc, 0)

	-- Create Panel_Condition
	local Panel_Condition = GUI:Layout_Create(Node_1, "Panel_Condition", -313.00, -180.00, 311, 138, false)
	GUI:setAnchorPoint(Panel_Condition, 0.00, 0.00)
	GUI:setTouchEnabled(Panel_Condition, true)
	GUI:setTag(Panel_Condition, 0)

	-- Create Panel_itemList
	local Panel_itemList = GUI:Layout_Create(Node_1, "Panel_itemList", -234.00, 4.00, 500, 61, false)
	GUI:setAnchorPoint(Panel_itemList, 0.00, 0.00)
	GUI:setTouchEnabled(Panel_itemList, true)
	GUI:setTag(Panel_itemList, 0)

	-- Create Button_1
	local Button_1 = GUI:Button_Create(Node_1, "Button_1", -89.00, -270.00, "res/custom/enterDaLu/btn.png")
	GUI:Button_setTitleText(Button_1, [[]])
	GUI:Button_setTitleColor(Button_1, "#ffffff")
	GUI:Button_setTitleFontSize(Button_1, 16)
	GUI:Button_titleEnableOutline(Button_1, "#000000", 1)
	GUI:setAnchorPoint(Button_1, 0.00, 0.00)
	GUI:setTouchEnabled(Button_1, true)
	GUI:setTag(Button_1, 0)

	ui.update(__data__)
	return ImageBG
end

function ui.update(data)
	for _, func in pairs(FUNCQUEUE) do
		if func then func(data) end
	end
end

return ui
    EnterDaLuOBJ = {}
    EnterDaLuOBJ.__cname = "EnterDaLuOBJ"
    EnterDaLuOBJ.config = ssrRequireCsvCfg("cfg_EnterDaLu")
    -------------------------------↓↓↓ UI操作 ↓↓↓---------------------------------------
    function EnterDaLuOBJ:main(objcfg)
        self.objcfg = objcfg
        ssrMessage:sendmsg(ssrNetMsgCfg.EnterDaLu_OpenUI, objcfg.NPCID)
    end
    
    --请求打开UI
    function EnterDaLuOBJ:OpenUI(arg1, arg2, arg3, data)
        local objcfg = self.objcfg
        self.data = data
        local cfg = self.config[objcfg.NPCID]
        local parent = GUI:Win_Create(self.__cname, 0, 0, 0, 0, false, false, true, true, true, objcfg.NPCID)
        GUI:LoadExport(parent, objcfg.UI_PATH)
        self._parent = parent
        self.ui = GUI:ui_delegate(parent)
        GUI:setTouchEnabled(self.ui.ImageBG, true)
        GUI:setPosition(self.ui.ImageBG, 0, 0)
        GUI:setContentSize(self.ui.ImageBG, ssrConstCfg.width, ssrConstCfg.height)
        GUI:addOnClickEvent(self.ui.ImageBG, function()
            --ssrPrint("我是防点击穿透")
        end)
    
        --关闭按钮
        GUI:addOnClickEvent(self.ui.CloseButton, function()
            GUI:Win_Close(self._parent)
        end)
        GUI:addOnClickEvent(self.ui.Button_1, function()
            ssrMessage:sendmsg(ssrNetMsgCfg.EnterDaLu_Request, objcfg.NPCID)
        end)
        --关闭按钮位置
        GUI:setPosition(self.ui.CloseButton, ssrConstCfg.width - 100, ssrConstCfg.height - 100)
        GUI:setLocalZOrder(self.ui.CloseButton, 100)
        --修改背景
        --SL:dump(cfg.number)
        --SL:Print(cfg.number )
        GUI:Image_loadTexture(self.ui.ImageBG, "res/custom/enterDaLu/" .. cfg.number .. "DaLu/bg_1.jpg")
        local FramesBg = GUI:Frames_Create(self.ui.ImageBG, "Frames_bg", 0, 0, "res/custom/enterDaLu/" .. cfg.number .. "DaLu/bg_", ".jpg", 1, 25, { count = 25, speed = 100, loop = -1, finishhide = 0 })
        GUI:setContentSize(FramesBg, ssrConstCfg.width, ssrConstCfg.height)
        GUI:setLocalZOrder(FramesBg, 10)
        GUI:setPosition(self.ui.Node_1, ssrConstCfg.width / 2, ssrConstCfg.height / 2)
        GUI:setLocalZOrder(self.ui.Node_1, 11)
        --文字描述
        GUI:Image_loadTexture(self.ui.Image_desc, "res/custom/enterDaLu/" .. cfg.number .. ".png")
        local widgets = ssrAddItemListX(self.ui.Panel_itemList, cfg.itemList or {}, "item_")
        for i, v in ipairs(widgets) do
            GUI:setTag(v, i)
        end
        GUI:UserUILayout(self.ui.Panel_itemList, {
            dir = 2,
            addDir = 2,
            interval = 0.15,
            gap = { x = 5 },
            sortfunc = function(lists)
                table.sort(lists, function(a, b)
                    return GUI:getTag(a) > GUI:getTag(b)
                end)
            end
        })
    
    -- 遍历条件数据,动态创建条件显示界面
    for i, v in ipairs(self.data) do
        -- 创建条件背景图片容器
        local Image_Condition = GUI:Image_Create(self.ui.Panel_Condition, "Image_Condition" .. i, 0.00, 91.00, "res/custom/enterDaLu/condition.png")
        
        -- 在条件容器内创建文本背景图片
        local Image_Condition_bg = GUI:Image_Create(Image_Condition, "Image_Condition" .. i, 120.00, 2.00, "res/custom/enterDaLu/conditionBG.png")
        
        -- 设置背景图片的九宫格拉伸参数,使其能够自适应内容大小
        GUI:Image_setScale9Slice(Image_Condition_bg, 8, 8, 8, 8)
        
        -- 设置背景图片的固定尺寸:宽250像素,高40像素
        GUI:setContentSize(Image_Condition_bg, 250, 40)
        
        -- 为条件容器设置标签,用于后续排序识别
        GUI:setTag(Image_Condition, i)
        
        -- 根据条件状态确定文本颜色:满足条件显示绿色,不满足显示红色
        -- v[2] == 1 表示条件已满足,v[2] != 1 表示条件未满足
        local color = v[2] == 1 and "#00FF00" or "#FF0000"
        
        -- 创建富文本显示条件描述
        -- v[1] 是条件描述文本,使用动态颜色显示状态
        GUI:RichText_Create(Image_Condition_bg, "rich" .. i, 6, 8, v[1], 600, 18, color, 5)
    end
    
    -- 对条件面板进行自动布局排列
    GUI:UserUILayout(self.ui.Panel_Condition, {
        dir = 1,        -- 布局方向:1表示垂直排列
        addDir = 1,     -- 添加方向:1表示从上到下添加
        interval = 0,   -- 元素间距:0表示无间距
        gap = { x = 5 },-- 水平间距:5像素
        
        -- 自定义排序函数:按标签值降序排列
        sortfunc = function(lists)
            table.sort(lists, function(a, b)
                -- 标签值大的排在前面,实现倒序排列
                return GUI:getTag(a) > GUI:getTag(b)
            end)
        end
    })
    end
    
    function EnterDaLuOBJ:UpdateUI()
    
    end
    
    -------------------------------↓↓↓ 网络消息 ↓↓↓---------------------------------------
    function EnterDaLuOBJ:SyncResponse(arg1, arg2, arg3, data)
        if GUI:GetWindow(nil, self.__cname) then
            self:UpdateUI()
        end
    end
    return EnterDaLuOBJ
      local config = {
      	[114] = {
      		itemList = {
      			[1] = {
      				[1] = "魔戒·骷髅王(SSSR)",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "太虚古龙领域[完全体]",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "龍族图腾ゞ",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "千年之光",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "〈斩·浪〉",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "被封印的剑灵(SSSR)",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "御风·之力",
      				[2] = 1,
      			},
      		},
      		number = 2,
      		mapId = "天元大陆",
      		x = 122,
      		y = 153,
      	},
      	[204] = {
      		itemList = {
      			[1] = {
      				[1] = "魔戒·骷髅王(SSSR)",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "太虚古龙领域[完全体]",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "龍族图腾ゞ",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "千年之光",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "〈斩·浪〉",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "被封印的剑灵(SSSR)",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "御风·之力",
      				[2] = 1,
      			},
      		},
      		number = 2,
      		mapId = "天元大陆",
      		x = 122,
      		y = 153,
      	},
      	[317] = {
      		itemList = {
      			[1] = {
      				[1] = "天恕",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "鬼焰寒甲(精)",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "神兵·雷神之威",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "降星者",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "一缕神念",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "暮潮",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "金色黎明的圣物箱",
      				[2] = 1,
      			},
      		},
      		number = 3,
      		mapId = "神龙帝国",
      		x = 238,
      		y = 203,
      	},
      	[318] = {
      		itemList = {
      			[1] = {
      				[1] = "灵魂枷锁",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "玄阴〃吊坠",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "纯阴之体",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "阴煞血幡",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "赤木之瞳",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "千年结",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "掌控奥义",
      				[2] = 1,
      			},
      		},
      		number = 4,
      		mapId = "酆都",
      		x = 191,
      		y = 221,
      	},
      	[445] = {
      		itemList = {
      			[1] = {
      				[1] = "屠龙者之刃",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "夜幽之玉",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "格萨拉克·地渊之声",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "时光的沙漏",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "龙魂之力",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "自然之力·元素披风",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "远行的召唤",
      				[2] = 1,
      			},
      		},
      		number = 5,
      		mapId = "极恶大陆",
      		x = 67,
      		y = 24,
      	},
      	[500] = {
      		itemList = {
      			[1] = {
      				[1] = "名刀⊙观世正宗",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "真·霸主战甲SSS",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "罪恶审判×",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "噬伤之力",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "冰河之心",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "一剑开天门",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "死亡假面",
      				[2] = 1,
      			},
      		},
      		number = 6,
      		mapId = "太阳圣城",
      		x = 93,
      		y = 68,
      	},
      	[600] = {
      		itemList = {
      			[1] = {
      				[1] = "红眼面具",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "灵魂洗礼",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "时间之轮·聚变",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "狂意之怒",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "天殇之痕",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "龙之力·不灭光剑!",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "黄昏落幕ぁ",
      				[2] = 1,
      			},
      		},
      		number = 7,
      		mapId = "破晓之境",
      		x = 69,
      		y = 117,
      	},
      	[800] = {
      		itemList = {
      			[1] = {
      				[1] = "新月领域△核心",
      				[2] = 1,
      			},
      			[2] = {
      				[1] = "無上生霊″魂灭生",
      				[2] = 1,
      			},
      			[3] = {
      				[1] = "神之■庇护",
      				[2] = 1,
      			},
      			[4] = {
      				[1] = "群星之怒★★★",
      				[2] = 1,
      			},
      			[5] = {
      				[1] = "御天机",
      				[2] = 1,
      			},
      			[6] = {
      				[1] = "夜风·不败剑意",
      				[2] = 1,
      			},
      			[7] = {
      				[1] = "ζ法相天地ζ",
      				[2] = 1,
      			},
      			[8] = {
      				[1] = "ζ聖●法相天地ζ",
      				[2] = 1,
      			},
      		},
      		number = 8,
      		mapId = "新月神域",
      		x = 87,
      		y = 112,
      	},
      	[900] = {
      		number = 9,
      		mapId = "暮色玄境",
      		x = 87,
      		y = 112,
      	},
      }
      return config
        local EnterDaLu = {}
        local config = include("QuestDiary/cfgcsv/cfg_EnterDaLu.lua") -- 配置信息
        local function checkHaFaXiSiTitle(actor)
            return checktitle(actor, "哈法西斯挑战者Lv3") or checktitle(actor, "哈法西斯挑战者Lv4") or checktitle(actor, "哈法西斯挑战者Lv5")
        end
        
        --判断下大陆的条件
        local function CheckEnter(actor, npcid)
            if npcid == 114 or npcid == 204 then
                local myLevel = getbaseinfo(actor, ConstCfg.gbase.level)
                if myLevel < 100 then
                    Player.sendmsgEx(actor, "[系统提示]#251|你的等级不足|100级#249")
                    return false
                end
            elseif npcid == 317 then
                local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
                if reLevel < 1 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要人物一转#249")
                    return false
                end
            elseif npcid == 318 then
                local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
                if reLevel < 3 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要人物三转#249")
                    return false
                end
            elseif npcid == 445 then
                local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
                local shiLianLevel = getplaydef(actor,VarCfg["U_地藏王的试炼"])
                if reLevel < 4 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要人物四转#249")
                    return false
                elseif shiLianLevel < 2 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要完成[地藏王的二重试炼]#249")
                    return false
                elseif not checktitle(actor,"冥魂引渡人") then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要称号[冥魂引渡人]#249")
                    return false
                end
            --六大陆太阳圣城
            elseif npcid == 500 then
                local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
                if reLevel < 5 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要人物五转#249")
                    return false
                end
                local myLevel = getbaseinfo(actor, ConstCfg.gbase.level)
                if myLevel < 335 then
                    Player.sendmsgEx(actor, "[系统提示]#251|你的等级不足|335级#249")
                    return false
                end
            elseif npcid == 600 then
                local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
                if reLevel < 6 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要人物六转#249")
                    return false
                end
                local myLevel = getbaseinfo(actor, ConstCfg.gbase.level)
                if myLevel < 345 then
                    Player.sendmsgEx(actor, "[系统提示]#251|你的等级不足|345级#249")
                    return false
                end
                if not checkHaFaXiSiTitle(actor) then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要称号[哈法西斯挑战者Lv3]#249")
                    return false
                end
            elseif npcid == 800 then
                local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
                if reLevel < 7 then
                    Player.sendmsgEx(actor, "[系统提示]#251|需要人物七转#249")
                    return false
                end
                local myLevel = getbaseinfo(actor, ConstCfg.gbase.level)
                if myLevel < 355 then
                    Player.sendmsgEx(actor, "[系统提示]#251|你的等级不足|355级#249")
                    return false
                end
            end
            return true
        end
        --显示进入条件
        local function ShowEnterCondition(actor, npcid)
            local result = {}
            local myLevel = getbaseinfo(actor, ConstCfg.gbase.level)
            local reLevel = getbaseinfo(actor,ConstCfg.gbase.renew_level)
        
            if npcid == 114 or npcid == 204 then
                -- 初始化检查标记为空字符串(用于后续可能的状态标识)
                local checkMark = ""
        
                -- 根据玩家当前等级和要求等级获取颜色代码
                -- FGetColor函数比较当前等级(myLevel)与要求等级(100),返回对应的颜色值
                -- 通常:满足条件返回绿色,不满足返回红色
                local color = FGetColor({myLevel,100})
        
                -- 构建等级条件描述字符串
                -- 使用string.format格式化文本,包含:
                -- 1. 固定描述文本:"人物等级100级"
                -- 2. 动态颜色的当前进度显示:"(当前等级/100级)"
                -- 3. 检查标记(当前为空)
                local condition1 = { string.format("人物等级100级     <font color='%s'>(%d/100级)</font>%s",color, myLevel, checkMark)}
        
                -- 将构建好的等级条件添加到结果表中
                -- result表用于收集所有进入大陆的条件信息
                table.insert(result, condition1)
            elseif npcid == 317 then
                local checkMark = ""
                local color = FGetColor({reLevel,1})
                local condition1 = { string.format("人物一转     <font color='%s'>(%d/1转)</font>%s",color, reLevel, checkMark)}
                table.insert(result, condition1)
            --四大陆酆都鬼城
            elseif npcid == 318 then
                local checkMark = ""
                local color = FGetColor({reLevel,3})
                local condition1 = { string.format("人物三转     <font color='%s'>(%d/3转)</font>%s",color, reLevel, checkMark)}
                table.insert(result, condition1)
            --五大陆极恶大陆    
            elseif npcid == 445 then
                local shiLianLevel = getplaydef(actor,VarCfg["U_地藏王的试炼"])
                local checkMark = ""
                local color = FGetColor({reLevel,4})
                local condition1 = { string.format("人物四转     <font color='%s'>(%d/4转)</font>%s",color, reLevel, checkMark)}
                -- local isFinish = 
                color = FGetColor(shiLianLevel >= 2)
                local str = shiLianLevel >= 2 and "(已完成)" or "(未完成)"
                local condition2 = { string.format("完成地藏王的二重试炼   <font color='%s'>%s</font>%s",color, str, checkMark)}
        
                color = FGetColor(checktitle(actor, "冥魂引渡人"))
                str = checktitle(actor, "冥魂引渡人") and "(已获得)" or "(未获得)"
                local condition3 = { string.format("称号[冥魂引渡人]     <font color='%s'>%s</font>%s",color, str, checkMark)}
                table.insert(result, condition3)
                table.insert(result, condition2)
                table.insert(result, condition1)
            elseif npcid == 500 then
                local checkMark = ""
                local color = FGetColor({reLevel,5})
                local condition1 = { string.format("人物五转     <font color='%s'>(%d/5转)</font>%s",color, reLevel, checkMark)}
                color = FGetColor({myLevel,335})
                local condition2 = { string.format("人物等级335级     <font color='%s'>(%d/335级)</font>%s",color, myLevel, checkMark)}
                table.insert(result, condition2)
                table.insert(result, condition1)
            elseif npcid == 600 then
                local checkMark = ""
                local color = FGetColor({reLevel,6})
                local condition1 = { string.format("人物六转     <font color='%s'>(%d/6转)</font>%s",color, reLevel, checkMark)}
                color = FGetColor({myLevel,345})
                local condition2 = { string.format("人物等级345级     <font color='%s'>(%d/345级)</font>%s",color, myLevel, checkMark)}
                color = FGetColor(checkHaFaXiSiTitle(actor))
                local str = checkHaFaXiSiTitle(actor) and "(已获得)" or "(未获得)"
                local condition3 = { string.format("称号[哈法西斯挑战者Lv3]     <font color='%s'>%s</font>%s",color, str, checkMark)}
                table.insert(result, condition3)
                table.insert(result, condition2)
                table.insert(result, condition1)
            elseif npcid == 800 then
                local checkMark = ""
                local color = FGetColor({reLevel,7})
                local condition1 = { string.format("人物七转     <font color='%s'>(%d/7转)</font>%s",color, reLevel, checkMark)}
                color = FGetColor({myLevel,355})
                local condition2 = { string.format("人物等级355级     <font color='%s'>(%d/355级)</font>%s",color, myLevel, checkMark)}
                table.insert(result, condition2)
                table.insert(result, condition1)
            end
            return result
        end
        
        --同步条件信息
        function EnterDaLu.OpenUI(actor, npcid)
            local cfg = config[npcid]
            if not cfg then
                Player.sendmsgEx(actor, "参数错误!")
                return
            end
            local isOk = FCheckNPCRange(actor, npcid, 15)
            if not isOk then
                Player.sendmsgEx(actor, "NPC距离太远")
                return
            end
            local data = ShowEnterCondition(actor, npcid)
        
            Message.sendmsg(actor, ssrNetMsgCfg.EnterDaLu_OpenUI, 0, 0, 0, data)
        end
        
        --进入大陆
        function EnterDaLu.Request(actor, npcid)
            local cfg = config[npcid]
            if not cfg then
                Player.sendmsgEx(actor, "参数错误!")
                return
            end
            local isOk = FCheckNPCRange(actor, npcid, 15)
            if not isOk then
                Player.sendmsgEx(actor, "NPC距离太远")
                return
            end
            if npcid == 900 then
                Player.sendmsgEx(actor, "暂未开放此大陆!#249")
                return
            end
            -- 检查玩家是否满足进入大陆的条件
        local isMeetThenCondition = CheckEnter(actor, npcid)
        
        -- 如果不满足进入条件,直接返回,阻止传送
        if not isMeetThenCondition then
            return
        else
            -- 调试用代码,用于输出传送目标信息(已注释)
            -- release_print(cfg.mapId, cfg.x, cfg.y)
            
            -- 获取玩家当前记录的大陆进度
            local num = getplaydef(actor, VarCfg["U_记录大陆"])
            
            -- 如果当前记录的进度小于配置中的大陆编号,则更新进度
            -- 这确保玩家的大陆解锁进度始终记录最高值
            if num < cfg.number then
                setplaydef(actor, VarCfg["U_记录大陆"], cfg.number)
            end
            
            -- 执行地图传送:将玩家传送到指定大陆的指定坐标
            -- 参数:玩家对象, 目标地图ID, X坐标, Y坐标, 传送类型(1)
            mapmove(actor, cfg.mapId, cfg.x, cfg.y, 1)
        end
        end
        
        local function _onLoginEnd(actor)
            local currDaLu = getplaydef(actor, VarCfg["U_记录大陆"])
            if currDaLu == 0 then
                setplaydef(actor, VarCfg["U_记录大陆"], 1)
            end
        end
        --事件派发
        GameEvent.add(EventCfg.onLoginEnd, _onLoginEnd, EnterDaLu)
        --注册消息
        Message.RegisterNetMsg(ssrNetMsgCfg.EnterDaLu, EnterDaLu)
        
        return EnterDaLu
          撰写回复...