Jump to content

Looking for a Teleport Quest


Recommended Posts

Hi,

Teleport Quest, with Categories, Item Need, Yang Need, Max and Min Level.

I have this:

-- File: teleport.quest
-- Creation date: 20 October 2016
-- Author: Marius(Exygo)
-- Version: 0.1

quest teleport begin
	state __FUNC__ begin
		function translations()
			return
			{
				["TITLE"] = string.format("%s",item_name(item.vnum)),
				["LEVEL_IS_TO_LOW"] = "Your level is too low for %s",
				["LEVEL_IS_TO_HIGH"] = "Your level is too high for %s",
				["NOT_ENOUGH_YANG"] = "You need %s Yang for %s",
				["NO_ITEM"] = "You need this item for %s",
				["COOLDOWN_NOT_FINISHED"] = "You need to wait %ss to warp again in %s",
			}
			-- ####### HERE YOU CAN TRANSLATE THE ERROR MESSAGE #######
		end

		function settings()
			return
			{
				{
					"Orc valley", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"Test", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"Orc 543alley", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"T34543t", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"3434y", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"T234234t", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"O5345lley", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
				{
					"Te34534st", -- map name
					2560, -- globalX (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					6656, -- globalY (get this from locale/xx/map/map_n_threeway/settings.txt without 00 at the end)
					{1461,83}, -- {localX,localY}, -- Shinsoo
					{144,743}, -- {localX,localY}, -- Chunjo
					{653,1424}, -- {localX,localY}, -- Jinno
					{1,0}, -- {min entry level,max entry level},
					0, -- min yang req
					{0,0}, -- {item vnum,item count}, -- item req for entry
					10, -- entry cooldown for map (seconds)
				},
			}
			-- ####### HERE YOU CAN ADD MORE MAPS #######
		end

		function get_local_pos(l1,l2,l3)
			local tempE = {}
			table.insert(tempE,l1)
			table.insert(tempE,l2)
			table.insert(tempE,l3)
			local e = pc.get_empire()
			return tempE[e]
		end

		function hasLevel(lvl)
			local ret = 0
			local level = pc.get_level()
			local minLvl = lvl[1]
			local maxLvl = lvl[2]

			if level > maxLvl and maxLvl != 0 then
				ret = 2
			end

			if level < minLvl then
				ret = 1
			end

			return ret
		end

		function hasYang(req)
			local yang = pc.get_money()
			if yang < req then
				return false
			end
			return true
		end

		function hasItem(itm)
			local i = itm[1]
			local c = itm[2]

			if i == 0 then return true end

			if pc.count_item(i) >= c then
				return true
			end
			return false
		end

		function display_go_back()
			local b = select("Go back","Nope")

			if b == 2 then return end
			if b == 1 then
				local translations = teleport.translations()
				local settings = teleport.settings()
				teleport.display_list(settings,translations)
			end
		end

		function display_list(tab,translations)
			-- indexes
			local mpN = 1 -- name of the map
			local glX = 2 -- global x pos
			local glY = 3 -- global y pos
			local lc1 = 4 -- local shinsoo pos
			local lc2 = 5 -- local chunjo pos
			local lc3 = 6 -- local jinno pos
			local lvl = 7 -- level req
			local yng = 8 -- yang req
			local itm = 9 -- item req
			local cd = 10 -- cooldown time seconds
			--

			local settings = tab
			local mapNames = {}

			for i in settings do table.insert(mapNames,settings[i][mpN]) end -- put the map names in table
			table.insert(mapNames,"close") -- insert the close button

			local s = select_table(mapNames)
			if s == table.getn(mapNames) then
				return
			else
				glX = settings[s][glX]
				glY = settings[s][glY]
				lc1 = settings[s][lc1]
				lc2 = settings[s][lc2]
				lc3 = settings[s][lc3]
				lvl = settings[s][lvl]
				yng = settings[s][yng]
				itm = settings[s][itm]
				cd = settings[s][cd]
				local hasLvl = teleport.hasLevel(lvl)
				local hasYang = teleport.hasYang(yng)
				local hasItem = teleport.hasItem(itm)
				local lPos = teleport.get_local_pos(lc1,lc2,lc3)

				if hasLvl == 1 then
					say_title(translations["TITLE"])
					say_reward(string.format(translations["LEVEL_IS_TO_LOW"],settings[s][mpN]))
					teleport.display_go_back()
					return
				elseif hasLvl == 2 then
					say_title(translations["TITLE"])
					say_reward(string.format(translations["LEVEL_IS_TO_HIGH"],settings[s][mpN]))
					teleport.display_go_back()
					return
				end

				if hasYang == false then
					say_title(translations["TITLE"])
					say_reward(string.format(translations["NOT_ENOUGH_YANG"],yng,settings[s][mpN]))
					teleport.display_go_back()
					return
				end

				if hasItem == false then
					say_title(translations["TITLE"])
					say_reward(string.format(translations["NO_ITEM"],settings[s][mpN]))
					say_item_vnum(itm[1])
					teleport.display_go_back()
					return
				end

				local cooldown = pc.getqf(string.format("teleport_cooldown_%s",s))
				if get_time() < cooldown then
					say_title(translations["TITLE"])
					say_reward(string.format(translations["COOLDOWN_NOT_FINISHED"],cooldown-get_time(),settings[s][mpN])) -- function for time format(nicer time) is not included in this quest, it displays just seconds
					teleport.display_go_back()
					return
				end

				pc.warp((glX + lPos[1] )* 100, (glY + lPos[2]) * 100)
				if cd != 0 then
					pc.setqf(string.format("teleport_cooldown_%s",s),get_time()+cd)
				end
			end
		end
	end

	state start begin
		when 70007.use or 20377.click begin
			local translations = teleport.translations()
			local settings = teleport.settings()

			teleport.display_list(settings,translations)
		end
	end
end

and this:

--[[
    Inizializes:
        The 'Warp' class.
]]
Warp = {};
--[[
    Returns:
        The full warp config.
    Structure:
        [section_key] = {
            ["section"] = "The section name", 
            ["data"] = {
                {["name"] = "The name of the first map", ["warp"] = {[1] = {x_shinsoo, y_shinsoo}, [2] = {x_chunjo, y_chunjo}, [3] = {x_jinno, y_jinno}}, ["price"] = the warp cost, ["min_level"] = the minimum level to enter the map, ["max_level"] = the maximum level to enter the map},
                {["name"] = "The name of the second map", ["warp"] = {[1] = {x_shinsoo, y_shinsoo}, [2] = {x_chunjo, y_chunjo}, [3] = {x_jinno, y_jinno}}, ["price"] = the warp cost, ["min_level"] = the minimum level to enter the map, ["max_level"] = the maximum level to enter the map},
                ..
            }
        },
]]
Warp.GetConfig = function()
    local config = {
        [1] = {
            ["section"] = "Gelbes Reich", 
            ["data"] = {
                {["name"] = "Chunjo: Joan (Map 1)",            ["warp"] = {[1] = {["x"] = 604,  ["y"] = 1700}, [2] = {["x"] = 604,  ["y"] = 1700}, [3] = {["x"] = 604,  ["y"] = 1700}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Chunjo: Bokjung (Map 2)",         ["warp"] = {[1] = {["x"] = 1424, ["y"] = 2399}, [2] = {["x"] = 1424, ["y"] = 2399}, [3] = {["x"] = 1424, ["y"] = 2399}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Chunjo: Waryong (1. Gildenzone)", ["warp"] = {[1] = {["x"] = 2219, ["y"] = 93},   [2] = {["x"] = 2219, ["y"] = 93},   [3] = {["x"] = 2219, ["y"] = 93}},   ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Chunjo: Songpa (2. Gildenzone)",  ["warp"] = {[1] = {["x"] = 6144, ["y"] = 3840}, [2] = {["x"] = 6144, ["y"] = 3840}, [3] = {["x"] = 6144, ["y"] = 3840}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Kolonie (Lykaner Startgebiet)",   ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500}
            }
        },
        [1] = {
            ["section"] = "Baues Reich", 
            ["data"] = {

                {["name"] = "Jinno: Pyungmoo",                ["warp"] = {[1] = {["x"] = 9529, ["y"] = 2687}, [2] = {["x"] = 9529, ["y"] = 2687}, [3] = {["x"] = 9529, ["y"] = 2687}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Jinno: Bakra",                   ["warp"] = {[1] = {["x"] = 8669, ["y"] = 2447}, [2] = {["x"] = 8669, ["y"] = 2447}, [3] = {["x"] = 8669, ["y"] = 2447}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Jinno: Imha (1. Gildenzone)",    ["warp"] = {[1] = {["x"] = 2718, ["y"] = 130},  [2] = {["x"] = 2718, ["y"] = 130},  [3] = {["x"] = 2718, ["y"] = 130}},  ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Jinno: Daeyami (2. Gildenzone)", ["warp"] = {[1] = {["x"] = 2560, ["y"] = 8192}, [2] = {["x"] = 2560, ["y"] = 8192}, [3] = {["x"] = 2560, ["y"] = 8192}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Kolonie (Lykaner Startgebiet)",  ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500}
            }
        },
        [1] = {
            ["section"] = "Rotes Reich", 
            ["data"] = {
                {["name"] = "Shinsoo: Yongan",                   ["warp"] = {[1] = {["x"] = 4771, ["y"] = 9537}, [2] = {["x"] = 4771, ["y"] = 9537}, [3] = {["x"] = 4771, ["y"] = 9537}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Shinsoo: Jayang",                   ["warp"] = {[1] = {["x"] = 3506, ["y"] = 8806}, [2] = {["x"] = 3506, ["y"] = 8806}, [3] = {["x"] = 3506, ["y"] = 8806}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Shinsoo: Jungrang (1. Gildenzone)", ["warp"] = {[1] = {["x"] = 1356, ["y"] = 43},   [2] = {["x"] = 1356, ["y"] = 43},   [3] = {["x"] = 1356, ["y"] = 43}},   ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Shinsoo: Miryang (2. Gildenzone)",  ["warp"] = {[1] = {["x"] = 2048, ["y"] = 2048}, [2] = {["x"] = 2048, ["y"] = 2048}, [3] = {["x"] = 2048, ["y"] = 2048}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Kolonie (Lykaner Startgebiet)",     ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500}
            }
        },
        [1] = {
            ["section"] = "Neutrale Karten",
            ["data"] = {
                {["name"] = "Tal von Seungryong (Orktal)",     ["warp"] = {[1] = {["x"] = 4021,  ["y"] = 6739},  [2] = {["x"] = 2704,  ["y"] = 7399},  [3] = {["x"] = 3213,  ["y"] = 8080}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Hwang-Tempel",                    ["warp"] = {[1] = {["x"] = 5537,  ["y"] = 1450},  [2] = {["x"] = 5537,  ["y"] = 1450},  [3] = {["x"] = 5537,  ["y"] = 1450}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Grotte der Verbannung (Eingang)", ["warp"] = {[1] = {["x"] = 2843,  ["y"] = 8103},  [2] = {["x"] = 2843,  ["y"] = 8103},  [3] = {["x"] = 2843,  ["y"] = 8103}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Yongbi-Wueste (Große Wueste)",    ["warp"] = {[1] = {["x"] = 2178,  ["y"] = 6272},  [2] = {["x"] = 2219,  ["y"] = 5027},  [3] = {["x"] = 3440,  ["y"] = 5025}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Yongbi-Wueste (Oase)",            ["warp"] = {[1] = {["x"] = 2977,  ["y"] = 5470},  [2] = {["x"] = 2977,  ["y"] = 5470},  [3] = {["x"] = 2977,  ["y"] = 5470}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Berg Sohan (Eisland)",            ["warp"] = {[1] = {["x"] = 4342,  ["y"] = 2906},  [2] = {["x"] = 3752,  ["y"] = 1749},  [3] = {["x"] = 4918,  ["y"] = 1736}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Doyyumhwan (Feuerland)",          ["warp"] = {[1] = {["x"] = 5994,  ["y"] = 7563},  [2] = {["x"] = 5978,  ["y"] = 6222},  [3] = {["x"] = 7307,  ["y"] = 6898}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Lungsam (Geisterwald)",           ["warp"] = {[1] = {["x"] = 2887,  ["y"] = 57},    [2] = {["x"] = 2887,  ["y"] = 57},    [3] = {["x"] = 2887,  ["y"] = 57}},    ["price"] = 12000,     ["min_level"] = 60, ["max_level"] = 500},
                {["name"] = "Lungsam (Roter Wald)",            ["warp"] = {[1] = {["x"] = 11196, ["y"] = 700},   [2] = {["x"] = 11196, ["y"] = 700},   [3] = {["x"] = 11196, ["y"] = 700}},   ["price"] = 12000,     ["min_level"] = 60, ["max_level"] = 500},
                {["name"] = "Schlangenfeld",                   ["warp"] = {[1] = {["x"] = 10590, ["y"] = 7267},  [2] = {["x"] = 10590, ["y"] = 7267},  [3] = {["x"] = 10590, ["y"] = 7267}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Land der Riesen",                 ["warp"] = {[1] = {["x"] = 8283,  ["y"] = 7635},  [2] = {["x"] = 8283,  ["y"] = 7635},  [3] = {["x"] = 8283,  ["y"] = 7635}},  ["price"] = 1000,      ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Donnerberge",                     ["warp"] = {[1] = {["x"] = 11345, ["y"] = 16548}, [2] = {["x"] = 11345, ["y"] = 16548}, [3] = {["x"] = 11345, ["y"] = 16548}}, ["price"] = 18000,     ["min_level"] = 90, ["max_level"] = 500},
                {["name"] = "Gautamakliff",                    ["warp"] = {[1] = {["x"] = 12263, ["y"] = 16811}, [2] = {["x"] = 12263, ["y"] = 16811}, [3] = {["x"] = 12263, ["y"] = 16811}}, ["price"] = 18000,     ["min_level"] = 90, ["max_level"] = 500},
                {["name"] = "Tempel der Ochao (Eingang)",      ["warp"] = {[1] = {["x"] = 13450, ["y"] = 17011}, [2] = {["x"] = 13450, ["y"] = 17011}, [3] = {["x"] = 13450, ["y"] = 17011}}, ["price"] = 10000,     ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Kap des Drachenfeuers",           ["warp"] = {[1] = {["x"] = 10849, ["y"] = 17843}, [2] = {["x"] = 10849, ["y"] = 17843}, [3] = {["x"] = 10849, ["y"] = 17843}}, ["price"] = 18000,     ["min_level"] = 90, ["max_level"] = 500},
                {["name"] = "Nephritbucht",                    ["warp"] = {[1] = {["x"] = 10496, ["y"] = 15104}, [2] = {["x"] = 10496, ["y"] = 15104}, [3] = {["x"] = 10496, ["y"] = 15104}}, ["price"] = 18000,     ["min_level"] = 90, ["max_level"] = 500},
                {["name"] = "Hafen",                           ["warp"] = {[1] = {["x"] = 0000,  ["y"] = 0000},  [2] = {["x"] = 0000,  ["y"] = 0000},  [3] = {["x"] = 0000,  ["y"] = 0000}},  ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500}
            }
        },
        [2] = {
            ["section"] = "Dungeons",
            ["data"] = {
                {["name"] = "Affendungeon (Hasun Don) leicht",    ["warp"] = {[1] = {["x"] = 4061, ["y"] = 8757}, [2] = {["x"] = 4061, ["y"] = 8757}, [3] = {["x"] = 4061, ["y"] = 8757}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Affendungeon (Jungsun Dong) normal", ["warp"] = {[1] = {["x"] = 3062, ["y"] = 6203}, [2] = {["x"] = 3062, ["y"] = 6203}, [3] = {["x"] = 3062, ["y"] = 6203}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Affendungeon (Sangsun Dong) schwer", ["warp"] = {[1] = {["x"] = 2880, ["y"] = 5407}, [2] = {["x"] = 2880, ["y"] = 5407}, [3] = {["x"] = 2880, ["y"] = 5407}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Spinnendungeon (Eingang)",           ["warp"] = {[1] = {["x"] = 3447, ["y"] = 6304}, [2] = {["x"] = 3447, ["y"] = 6304}, [3] = {["x"] = 3447, ["y"] = 6304}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500},
                {["name"] = "Daemonenturm (Eingang)",             ["warp"] = {[1] = {["x"] = 5906, ["y"] = 1110}, [2] = {["x"] = 5906, ["y"] = 1110}, [3] = {["x"] = 5906, ["y"] = 1110}}, ["price"] = 1000, ["min_level"] = 1, ["max_level"] = 500}
            }
        },
        [2] = {
            ["section"] = "Gesperrt",
            ["data"] = {
                {["name"] = "Spinnendungeon 2",               ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Spinnendungeon 3",               ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Rotdrachen-Festung",             ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 20000, ["min_level"] = 100,  ["max_level"] = 500},
                {["name"] = "Bruthoehle der Spinnenbaroness", ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 10000, ["min_level"] = 50,  ["max_level"] = 500},
                {["name"] = "Erebos (Bossraum)",              ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 19000, ["min_level"] = 95,  ["max_level"] = 500},
                {["name"] = "Zodiak-Tempel",                  ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 4000,      ["min_level"] = 20, ["max_level"] = 500},
                {["name"] = "Nemeres Warte",                  ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 20000, ["min_level"] = 100, ["max_level"] = 500},
                {["name"] = "Verwunschener Wald",             ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 19000, ["min_level"] = 95,  ["max_level"] = 500},
                {["name"] = "The Devil's Catacomb",           ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 15000, ["min_level"] = 75,  ["max_level"] = 500},
                {["name"] = "Drachenraum",                    ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 15000, ["min_level"] = 75,  ["max_level"] = 500},
                {["name"] = "Meleys Hort",                    ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 18000,     ["min_level"] = 90,  ["max_level"] = 500},
                {["name"] = "Schiffsverteidigung",            ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 18000, ["min_level"] = 90,  ["max_level"] = 500},
                {["name"] = "Palast des Drachenkoenig",       ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Anderwelt",                      ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 18000, ["min_level"] = 90,  ["max_level"] = 500},
                {["name"] = "Erloesung",                      ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Nordwindhort",                   ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Nordwind-Abstieg",               ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Nordwindtiefen",                 ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Mysterioeser Dungeon",           ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Sung Mahis Hoellenturm",         ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Schlangentempel",                ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Gnollhoehlen",                   ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500},
                {["name"] = "Anderwelt",                      ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 18000, ["min_level"] = 90,  ["max_level"] = 500},
                {["name"] = "Erloesung",                      ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000},  [2] = {["x"] = 0000, ["y"] = 0000},  [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 999999999, ["min_level"] = 1,  ["max_level"] = 500}
            }
        },
        [2] = {
            ["section"] = "Yohara",
            ["data"] = {
                {["name"] = "Verlassene Feste",       ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 24000, ["min_level"] = 120, ["max_level"] = 500},
                {["name"] = "Seoganoedland",          ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500},
                {["name"] = "Yilad-Pass",             ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500},
                {["name"] = "Nordwindschlucht",       ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500},
                {["name"] = "Donganebene",            ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500},
                {["name"] = "Namgankluft",            ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500},
                {["name"] = "Schlangentempel Ebene1", ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500},
                {["name"] = "Seelenklamm",            ["warp"] = {[1] = {["x"] = 0000, ["y"] = 0000}, [2] = {["x"] = 0000, ["y"] = 0000}, [3] = {["x"] = 0000, ["y"] = 0000}}, ["price"] = 1000,  ["min_level"] = 1,   ["max_level"] = 500}
            }
        }
    };
    return config;
end -- function
--[[
    Returns:
        An array containing all the existent Warp.GetConfigs' ["section"].
]]
Warp.GetSection = function()
    local section = {};
    local config = Warp.GetConfig();
    for _, data in ipairs(config) do
        table.insert(section, data["section"]);
    end -- for
    return section;
end -- function
--[[
    Returns:
        name, coordinates, price and minimum level of the selected map.
    Explanation:
        The selected map is given by the number inserted in the 'section' argument
        which gets the section_key from the Warp.GetConfig array. (see the Warp.GetConfigs' structure)
]]
Warp.GetBuildSection = function(section)
    local names, warp, price, min_level, max_level = {}, {}, {}, {}, {};
    local data = Warp.GetConfig()[section]["data"];
    for _, subdata in ipairs(data) do
        table.insert(names, subdata["name"]);
        table.insert(warp,  subdata["warp"][pc.get_empire()]);
        table.insert(price, subdata["price"]);
        table.insert(min_level, subdata["min_level"]);
        table.insert(max_level, subdata["max_level"]);
    end -- for
    return names, warp, price, min_level, max_level;
end -- function

+

quest warp begin
    state start begin
        when 70007.use or 20377.click begin
            if (not pc.can_warp()) then
                return syschat("Du musst 10 Sekunden warten, da du kuerzlich ein Schaufenster geschlossen haben[ENTER]");
            end -- if
            local section = Warp.GetSection();
            table.insert(section, "Schliessen");
            say_title("Teleporter:[ENTER]")
            say("Wo wuerdest du gerne hingehen?[ENTER]")
            local select_section = select_table(section);
            if (select_section == table.getn(section)) then
                return;
            end -- if
            local names, warp, price, min_level, max_level = Warp.GetBuildSection(select_section);
            table.insert(names, "Schliessen");
            local selection = select_table(names);
            if (selection == table.getn(names)) then
                return;
            end -- if
            say_title("Teleporter:[ENTER]")
            say(string.format("Required Level: Min %d, Max: %d.", min_level[selection], max_level[selection]))
            say(string.format("Required Gold: %d.[ENTER]", price[selection]))
            if (pc.get_level() < min_level[selection]) then
                say_reward("Dein Level ist zu niedrig")
                say_reward("Du darfst diese Karte nicht betreten[ENTER]")
                return;
            elseif (pc.get_level() > max_level[selection]) then
                say_reward("Dein level ist zu hoch")
                say_reward("Du darfst diese Karte nicht betreten[ENTER]")
                return;
            elseif (pc.get_gold() < price[selection]) then
                say_reward("Dein Gold reicht nicht aus")
                say_reward("Du darfst diese Karte nicht betreten[ENTER]")
                return;
            end -- if/elseif
            say("Bist du sicher, dass du dorthin willst?[ENTER]")
            if (select("Ja, sicher", "Nein, danke") == 1) then
                pc.change_gold(-price[selection]);
                pc.warp(warp[selection]["x"]*100, warp[selection]["y"]*100);
            end -- if
        end -- when
    end -- state
end -- quest

First, no categories, second have a bug...

thx

Edited by I bims 1 WLAN
  • Lmao 1
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.