require("Envir/Market_Def/wza.lua") -- 个人封装函数 local CONST = { PAGE1_UI_TEMPLATE = [[ ]], PAGE2_UI_TEMPLATE = [[ ]], ITEM_START_X = 296.0, -- 第一个物品X坐标 ITEM_SPACING = 65.0, -- 物品之间的间距 ITEM_Y = 353.0, -- 物品Y坐标(固定) PAGE2_MIN_ZSLEVEL = 50 } local mapConfig = { [1] = { showRule = {[1]=2, [2]=3, [3]=4, [4]=5, [5]=6, [6]=7, [7]=8, [8]=9, [9]=nil}, -- 满足n显n+1 layerOrder = {1,3,2,4,5,6,7,8,9}, -- 层级顺序(2在3上) [1] = {mapId="dl1", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, level=1, mapX=330, mapY=330, btnMsg=''}, [3] = {mapId="dl3", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=21,mapX=70, mapY=101, btnMsg=''}, [2] = {mapId="dl2", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=9, mapX=90, mapY=96, btnMsg=''}, [4] = {mapId="dl4", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=27,mapX=259, mapY=320, btnMsg=''}, [5] = {mapId="dl5", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=33,mapX=109, mapY=105, btnMsg=''}, [6] = {mapId="dl6", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=39,mapX=82, mapY=98, btnMsg=''}, [7] = {mapId="dl7", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=45,mapX=36, mapY=29, btnMsg=''}, [8] = {mapId="dl8", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=48,mapX=68, mapY=53, btnMsg=''}, [9] = {mapId="dl9", showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=50,mapX=59, mapY=65, btnMsg=''}, }, [2] = { showRule = {[10]=11, [11]=12, [12]=13, [13]=14, [14]=15, [15]=16, [16]=nil}, -- 满足n显n+1 layerOrder = {10,11,12,13,14,15,16}, -- 层级顺序 [10] = {mapId="dl10",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=52,mapX=28, mapY=26, btnMsg=''}, [11] = {mapId="dl11",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=53,mapX=149, mapY=124, btnMsg=''}, [12] = {mapId="dl12",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=62,mapX=25, mapY=41, btnMsg=''}, [13] = {mapId="dl13",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=65,mapX=107, mapY=105, btnMsg=''}, [14] = {mapId="dl14",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=68,mapX=78, mapY=75, btnMsg=''}, [15] = {mapId="dl15",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=69,mapX=79, mapY=127, btnMsg=''}, [16] = {mapId="dl16",showitems={"神兔项链(刺)","神兔刺靴","神兔刺勋","神兔腰带(刺)","神兔腰带(刺)"}, zsLevel=75,mapX=19, mapY=21, btnMsg=''}, } } local dalu_map_t = { ["dl1"]={1,1}, ["ptdt1"]={1,1},["ptdt2"]={1,1},["ptdt3"]={1,1},["ptdt4"]={1,1},["ptdt5"]={1,1},["ptdt6"]={1,1},["ptdt7"]={1,1},["ptdt8"]={1,1},["ptdt9"]={1,1}, ["ptdt10"]={1,1},["ptdt11"]={1,1},["ptdt12"]={1,1},["ptdt13"]={1,1},["ptdt14"]={1,1},["ptdt15"]={1,1},["ptdt16"]={1,1},["ptdt17"]={1,1},["ptdt18"]={1,1}, --2大陆 ["dl2"]={2,1}, ["ptdt21"]={2,1},["ptdt22"]={2,1},["ptdt23"]={2,1},["ptdt24"]={2,1},["ptdt25"]={2,1},["ptdt26"]={2,1},["ptdt27"]={2,1},["ptdt28"]={2,1},["ptdt29"]={2,1}, --3大陆 ["dl3"]={3,1}, ["ptdt31"]={3,1},["ptdt32"]={3,1},["ptdt33"]={3,1},["ptdt34"]={3,1},["ptdt35"]={3,1},["ptdt36"]={3,1},["ptdt37"]={3,1},["ptdt38"]={3,1},["ptdt39"]={3,1}, --4大陆 ["dl4"]={4,1}, ["ptdt41"]={4,1},["ptdt42"]={4,1},["ptdt43"]={4,1},["ptdt44"]={4,1},["ptdt45"]={4,1},["ptdt46"]={4,1},["ptdt47"]={4,1},["ptdt48"]={4,1},["ptdt49"]={4,1}, --5大陆 ["dl5"]={5,1}, ["ptdt51"]={5,1},["ptdt52"]={5,1},["ptdt53"]={5,1},["ptdt54"]={5,1},["ptdt55"]={5,1},["ptdt56"]={5,1},["ptdt57"]={5,1},["ptdt58"]={5,1},["ptdt59"]={5,1}, --6大陆 ["dl6"]={6,1}, ["ptdt61"]={6,1},["ptdt62"]={6,1},["ptdt63"]={6,1},["ptdt64"]={6,1},["ptdt65"]={6,1},["ptdt66"]={6,1},["ptdt67"]={6,1},["ptdt68"]={6,1},["ptdt69"]={6,1}, --7大陆 ["dl7"]={7,1}, ["ptdt71"]={7,1},["ptdt72"]={7,1},["ptdt73"]={7,1},["ptdt74"]={7,1},["ptdt75"]={7,1},["ptdt76"]={7,1},["ptdt77"]={7,1},["ptdt78"]={7,1},["ptdt79"]={7,1}, --8大陆 ["dl8"]={8,1}, ["ptdt81"]={8,1},["ptdt82"]={8,1},["ptdt83"]={8,1},["ptdt84"]={8,1},["ptdt85"]={8,1},["ptdt86"]={8,1},["ptdt87"]={8,1},["ptdt88"]={8,1},["ptdt89"]={8,1}, --9大陆 ["dl9"]={9,1}, ["ptdt91"]={9,1},["ptdt92"]={9,1},["ptdt93"]={9,1},["ptdt94"]={9,1},["ptdt95"]={9,1}, --10大陆 ["dl10"]={10,2}, ["ptdt101"]={10,2},["ptdt102"]={10,2},["ptdt103"]={10,2},["ptdt104"]={10,2},["ptdt105"]={10,2}, --11大陆 ["dl11"]={11,2}, ["ptdt111"]={11,2},["ptdt112"]={11,2},["ptdt113"]={11,2},["ptdt114"]={11,2},["ptdt115"]={11,2},["ptdt116"]={11,2},["ptdt117"]={11,2},["ptdt118"]={11,2},["ptdt119"]={11,2}, --12大陆 ["dl12"]={12,2}, ["ptdt121"]={12,2},["ptdt122"]={12,2},["ptdt123"]={12,2},["ptdt124"]={12,2},["ptdt125"]={12,2},["ptdt126"]={12,2},["ptdt127"]={12,2},["ptdt128"]={12,2},["ptdt129"]={12,2}, --13大陆 ["dl13"]={13,2}, ["ptdt131"]={13,2},["ptdt132"]={13,2},["ptdt133"]={13,2},["ptdt134"]={13,2},["ptdt135"]={13,2},["ptdt136"]={13,2},["ptdt137"]={13,2},["ptdt138"]={13,2},["ptdt139"]={13,2}, --14大陆 ["dl14"]={14,2}, ["ptdt141"]={14,2},["ptdt142"]={14,2},["ptdt143"]={14,2},["ptdt144"]={14,2},["ptdt145"]={14,2},["ptdt146"]={14,2},["ptdt147"]={14,2},["ptdt148"]={14,2},["ptdt149"]={14,2}, --15大陆 ["dl15"]={15,2}, ["ptdt151"]={15,2},["ptdt152"]={15,2},["ptdt153"]={15,2},["ptdt154"]={15,2},["ptdt155"]={15,2},["ptdt156"]={15,2},["ptdt157"]={15,2},["ptdt158"]={15,2},["ptdt159"]={15,2}, --16大陆 ["dl16"]={16,2}, ["ptdt161"]={16,2},["ptdt162"]={16,2},["ptdt163"]={16,2},["ptdt164"]={16,2},["ptdt165"]={16,2},["ptdt166"]={16,2},["ptdt167"]={16,2},["ptdt168"]={16,2},["ptdt169"]={16,2}, } local cur_dalu_pos = { [1]={x=437,y=307},[2]={x=362,y=249},[3]={x=255,y=243},[4]={x=178,y=202},[5]={x=235,y=137},[6]={x=480,y=228}, [7]={x=573,y=189},[8]={x=420,y=153},[9]={x=416,y=95},[10]={x=151,y=139},[11]={x=231,y=291},[12]={x=327,y=183}, [13]={x=421,y=148},[14]={x=554,y=129},[15]={x=463,y=257},[16]={x=583,y=268}, } local function checkPlayerCondition(actor, config) local playerZsLevel = getzslevel(actor) local playerLevel = getlevel(actor) if config.zsLevel ~= nil and config.level ~= nil then return (playerZsLevel >= config.zsLevel) and (playerLevel >= config.level) end if config.zsLevel ~= nil then return playerZsLevel >= config.zsLevel end if config.level ~= nil then return playerLevel >= config.level end -- 兜底:无任何等级配置时,默认满足条件(避免配置缺失导致功能失效) return true end function daluchuansongui(actor, page, mapIdx, showDetail, from9) page = tonumber(page) or 1 mapIdx = tonumber(mapIdx) or 1 showDetail = tonumber(showDetail) or 0 from9 = tonumber(from9) or 0 local playerZsLevel = getzslevel(actor) local cfg = mapConfig[page] if not cfg then return end local msg = "" if page == 1 then msg = msg .. CONST.PAGE1_UI_TEMPLATE if playerZsLevel >= CONST.PAGE2_MIN_ZSLEVEL then msg = msg .. '' end elseif page == 2 then msg = msg .. CONST.PAGE2_UI_TEMPLATE msg = msg .. '' end local showSet = {} local maxTrigger = 0 -- 找当前页最靠后满足的大陆 for k in pairs(cfg.showRule) do if checkPlayerCondition(actor, cfg[k]) and k > maxTrigger then maxTrigger = k end end -- 加入1到maxTrigger之间所有满足的大陆 for k = 1, maxTrigger do if cfg[k] and checkPlayerCondition(actor, cfg[k]) then showSet[k] = true end end -- 加入maxTrigger的下一个(n+1) local nextK = cfg.showRule[maxTrigger] if nextK then showSet[nextK] = true end -- 关键:page=2时强制显示10(因为能进入page=2的玩家满足9) if page == 2 then showSet[10] = true -- 无论10自身条件如何,必显 end -- 3. 按层级顺序拼接按钮(保证层级正确) for _, k in ipairs(cfg.layerOrder) do if cfg[k] and showSet[k] then msg = msg .. cfg[k].btnMsg end end local cur_map = getmap(actor) if dalu_map_t[cur_map] and dalu_map_t[cur_map][2] == page then local pos_t = cur_dalu_pos[dalu_map_t[cur_map][1]] msg = msg .. '' end if showDetail == 1 then local targetMapCfg = mapConfig[page][mapIdx] if not targetMapCfg then return end -- msg = msg .. '' msg = msg .. [[ ]] msg = msg .. string.format('', targetMapCfg.mapId) msg = msg .. string.format('', targetMapCfg.mapId) msg = msg .. '' -- 进图条件文本(复用判断逻辑的配置) local conditionText = targetMapCfg.zsLevel and (targetMapCfg.zsLevel .. "转") or (targetMapCfg.level .. "级") msg = msg .. string.format('', conditionText) for i, itemName in ipairs(targetMapCfg.showitems) do local itemX = CONST.ITEM_START_X + (i - 1) * CONST.ITEM_SPACING msg = msg .. string.format('', itemX, CONST.ITEM_Y) msg = msg .. string.format('', itemX - 2, getidbyname(itemName)) end msg = msg .. '' end say(actor, msg) end local function xiatupanduan(actor) local playerZsLevel = getzslevel(actor) if playerZsLevel < CONST.PAGE2_MIN_ZSLEVEL then sendmsg9(actor, string.format("%d转后才可前往", CONST.PAGE2_MIN_ZSLEVEL)) end end function jindalu(actor, page, mapIdx) page = tonumber(page) mapIdx = tonumber(mapIdx) local targetMapCfg = mapConfig[page][mapIdx] if not targetMapCfg then return end if checkPlayerCondition(actor, targetMapCfg) then mapmove(actor, targetMapCfg.mapId, targetMapCfg.mapX, targetMapCfg.mapY) else sendmsg9(actor, "条件不足,无法进入") end end