hILFE

04/21/2012 19:34 Stylo@Magic-mt3#1
hILFE BITTE :(

PHP Code:
quest warptest begin
    state start begin
        when 70042.
use begin
            local warptab 
= {
                --[[ 
Möglich:
                 
empire
                 minlvl
                 maxlvl
                 minalign
                 maxalign
                 is_gm 
(true)
                 
eventflag
                
]]
                [
"Reiche"] = {
                    [
"subs"] = {
                        [
"Map 1"] = {
                            [
"subs"] = {
                                [
"Shinsoo"] = {["x"] = 4096+646, ["y"] = 8960+585},
                                [
"Chunjo"] = {["x"] = 0+635, ["y"] = 1024+640},
                                [
"Jinno"] = {["x"] = 9216+382, ["y"] = 2048+643},
                            },
                        },
                        [
"Map 2"] = {
                            [
"subs"] = {
                                [
"Shinsoo"] = {["x"] = 3072, ["y"] = 8192},
                                [
"Chunjo"] = {["x"] = 1024+430, ["y"] = 2048+351},
                                [
"Jinno"] = {["x"] = 8192, ["y"] = 2048},
                            },
                        },
                        [
"Gildenmap#1"] = {["x"] = 1285, ["y"] = 10, ["empire"] = 1},
                        [
"Gildenmap#2"] = {["x"] = 1795, ["y"] = 10, ["empire"] = 2},
                        [
"Gildenmap#3"] = {["x"] = 2718, ["y"] = 130, ["empire"] = 3},
                    },
                },
                [
"Standardmaps"] = {
                    [
"subs"] = {
                        [
"Farmmap"] = {["x"] = 26431, ["y"] = 26943,
                        [
"Lvlmap"] = {["x"] = 9772, ["y"] = 1850,
                        [
"Handelsmap"] = {["x"] = 9551, ["y"] = 9551,
                        
                        [
"Tal von Seungryong#1"] = {["x"] = 4021, ["y"] = 6739, ["empire"] = 1},
                        [
"Tal von Seungryong#2"] = {["x"] = 2704, ["y"] = 7399, ["empire"] = 2},
                        [
"Tal von Seungryong#3"] = {["x"] = 3213, ["y"] = 8080, ["empire"] = 3},
                        
                        [
"Wueste#1"] = {["x"] = 2718, ["y"] = 6272, ["empire"] = 1},
                        [
"Wueste#2"] = {["x"] = 2219, ["y"] = 5027, ["empire"] = 2},
                        [
"Wueste#3"] = {["x"] = 3440, ["y"] = 5025, ["empire"] = 3},
                        
                        [
"Berg Sohan#1"] = {["x"] = 4342, ["y"] = 2906, ["empire"] = 1},
                        [
"Berg Sohan#2"] = {["x"] = 3752, ["y"] = 1749, ["empire"] = 2},
                        [
"Berg Sohan#3"] = {["x"] = 4918, ["y"] = 1736, ["empire"] = 3},
                    },
                },
                [
"Dungeons"] = {
                    [
"minlvl"] = 40,
                    [
"subs"] = {
                        [
"Doyyumhwaji#1"] = {["x"] = 5994, ["y"] = 7563, ["empire"] = 1},
                        [
"Doyyumhwaji#2"] = {["x"] = 5978, ["y"] = 6222, ["empire"] = 2},
                        [
"Doyyumhwaji#3"] = {["x"] = 7307, ["y"] = 6898, ["empire"] = 3},                        
                        [
"Geisterwald"] = {["x"] = 2887, ["y"] = 57, ["minlvl"] = 60},
                        [
"Roter Wald"] = {["x"] = 11199, ["y"] = 708, ["minlvl"] = 80},
                        [
"Land der Riesen"] = {["x"] = 8451, ["y"] = 7459},
                        [
"Daemonenturm"] = {["x"] = 5905, ["y"] = 1105, ["empire"] = 3},
                        [
"Spinnendungeon"] = {["x"] = 600, ["y"] = 4960},
                    },
                },
            }
            -- 
Ab hier nichts mehr Ändern.
            
local wp = {}
            -- 
Kategorien
            local 
function create_list(nm,index)
                
table.foreach((index or warptab),
                    function(
i,l)
                        
local x = (nm or '')..'#/'..i
                        
--print(i,x)
                        if 
l.subs ~= nil then
                            create_list
(x,l.subs)
                            
wp[x] = {["type"] = "kat"}
                        else
                            
wp[x] = l
                            wp
[x]["type"] = "warp"
                            
wp[x]["kat"] = (nm or '')
                        
end
                    end
                
)
            
end
            
--Erstelle Liste der vorhandenen Warps
            create_list
()
            
local function show_menu(id,kat)
                
local index id or 1
                
-- Funktionen START
                local 
function count(str,del)
                    
local out 0
                    
for i in string.gfind(str,del) do
                        
out out+1
                    end
                    
return out
                end
                local 
function trim(str)
                    
str string.gsub(str,'.-#/','',index)
                    return 
str
                end
                
-- Funktionen ENDE
                
                
-- Erstellen der Warpliste f??elect2
                local wl
,co = {
                    [
"list"] = {},
                    [
"data"] = {},
                },
1
                table
.sort(wp)
                
table.foreach(wp,
                    function(
i,l)
                        if 
count(i,'.-#/') == index then
                            local 
function cc()
                                -- 
Da es viele If's sind, nicht extra eingerückt
                                if l.empire == nil or l.empire == pc.get_empire() then
                                if l.maxlvl == nil or pc.get_level() <= 255.maxlvl then
                                if l.minlvl == nil or pc.get_level() >= l.minlvl then
                                if l.minalign == nil or pc.get_real_alignment() >= l.minalign then
                                if l.maxalign == nil or pc.get_real_alignment() <= l.maxalign then
                                if l.eventflag == nil or game.get_event_flag(l.eventflag) == 1 then
                                if l.is_gm == nil or pc.is_gm() == l.is_gm then
                                    if l.type == "kat" then
                                        local str = '
'..(string.gsub(trim(i),'#%d+',''))..' <'
                                        
wl.list[co] = str
                                        wl
.data[str] = l
                                        wl
.data[str]["name"] = i
                                    
else
                                        
local str = (string.gsub(trim(i),'#%d+',''))
                                        
wl.list[co] = str
                                        wl
.data[str] = l
                                    end
                                    co 
co+1
                                end 
-- gamemaster
                                end 
-- eventflag
                                end 
-- maxalign
                                end 
-- minalign
                                end 
-- minlvl
                                end 
-- maxlvl
                                end 
-- empire
                                
-- if Block ende
                            end
                            
if index == 1 then
                                cc
()
                            elseif 
kat ~= nil and string.sub(i,1,string.len(kat)) == kat then
                                cc
()
                            
end
                        end
                    end
                
)
                -- 
Ausgabe
                table
.sort(wl.list)
                
table.insert(wl.list,1,8)
                if 
index ~= 1 then
                    table
.insert(wl.list,'Zurück')
                
end
                table
.insert(wl.list,'Abbrechen')
                
local sel select2(wl.list)
                if 
sel == table.getn(wl.list) then return end
                
if index ~= and sel == table.getn(wl.list)-1 then
                    local nextkat 
= function()
                        
local t,out split(kat,'#/'),''
                        
table.foreach(t,
                            function(
i,l)
                                if 
table.getn(t) and 1 then
                                    out 
out..'#/'..l
                                end
                            end
                        
)
                        return 
out
                    end
                    show_menu
(index-1,nextkat())
                    return
                
end
                
if wl.data[wl.list[sel]]["type"] == "kat" then 
                    show_menu
(index+1wl.data[wl.list[sel]]["name"],kat or nil)
                    return
                else
                    
pc.warp(wl.data[wl.list[sel]]["x"]*100,wl.data[wl.list[sel]]["y"]*100)
                
end
            end
            show_menu
()
        
end
    end
end 
[Only registered and activated users can see links. Click Here To Register...]
what ist faltsch i flipp aus :(