da ich lange nicht´s mehr mit euch geteilt habe möchte ich euch
nun mal eine kleine Arbeit hier bereitstellen für die ich nun keine
Verwendung mehr habe. (Der Pythoncode ist schlecht aber auch schon
älter ). Weiteres muss ich sagen, dass die Quest dazu von unserem
BabaBoZZ im Questen/Lua stammt (MIJAGO).
Hier einmal der Pythonteil:
PHP Code:
import ui
import wndMgr
import urllib
import locale
import constInfo
import net
class Erkundung(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.Load()
def Load(self):
self.Board = ui.Board()
self.Board.SetSize(300, 500)
self.Board.SetPosition(wndMgr.GetScreenWidth()-300,wndMgr.GetScreenHeight()-500-200)
self.Board.AddFlag("float")
self.LoadLines()
self.LoadImage()
self.exit = ui.Button()
self.exit.SetParent(self.Board)
self.exit.SetUpVisual("d:/ymir work/ui/public/XLarge_Button_01.sub")
self.exit.SetOverVisual("d:/ymir work/ui/public/XLarge_Button_02.sub")
self.exit.SetDownVisual("d:/ymir work/ui/public/XLarge_Button_03.sub")
self.exit.SetPosition((300/2)-90, 500 - 25 -10)
self.exit.SetEvent(ui.__mem_func__(self.Close))
self.exit.SetText("Hide")
def LoadImage(self):
self.Header = ui.ImageBox()
self.Header.SetParent(self.Board)
self.Header.AddFlag("not_pick")
self.Header.SetPosition(0, 0)
self.Header.LoadImage("d:/ymir work/ui/erkundungssys/"+constInfo.AktuelleID+".tga") ## Bild zum Ort
def LoadLines(self):
try:
a = urllib.urlopen("http://webspace.de/erkundungssys/"+constInfo.AktuelleID+".txt") ## Beschreibung
b = a.readlines()
x = 160
x1 = 0
self.NewsLine = {}
for c in b:
self.NewsLine[x1] = ui.TextLine()
self.NewsLine[x1].SetParent(self.Board)
self.NewsLine[x1].SetPosition(20, x)
self.NewsLine[x1].SetText(b[x1])
self.NewsLine[x1].Show()
x1 = x1+1
x = x + 10
except:
self.ErrorLine = ui.TextLine()
self.ErrorLine.SetParent(self.Board)
self.ErrorLine.SetPosition(20, 160)
self.ErrorLine.SetText("Cant load any informations!")
self.ErrorLine.Show()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Destroy(self):
self.Hide()
return TRUE
def Show(self):
self.Board.Show()
self.Header.Show()
self.exit.Show()
def Close(self):
self.Destroy()
self.Board.Hide()
(Etwas umständlich ).
Und hier die Quest (by Mijago):
PHP Code:
quest illi_erkundungssystem begin
-- by Mijago
state start begin
when login begin
-- [[
-- Die Zahl kann angepasst werden.
-- Bei Großen Arealen, die man nicht unter 5 Sekunden durchqueren kann, sind 5~8 Sekunden Optimal.
-- Bei kleineren.. Nunja, dann eben 2 oder 1.5 :)
--]]
loop_timer("check_me",5)
end
when check_me.timer begin
local coords = {
-- {X1,Y1,X2,Y2,ID,item,exp}
--{100,100,150,150,"Test01",nil,3e6}, -- 50x50 nur ep, kein item
--{100,100,150,150,"Test02",19}, -- 50x50
{100,100,150,150,"IceOracle",{19,3}}, -- Für mehrere Items.(Test ICEMAP)
}
for _,l in pairs(coords) do
if illi_erkundungssystem.is_in(l) then
pc.setqf(l[5],1)
cmdchat("erk_pos "..l[5])
if type(l[6]) == "table" then
pc.give_item2(l[6][1],l[6][2])
elseif type(l[6]) == "number" then
pc.give_item2(l[6],1)
end
if l[7] then
pc.give_exp2(l[7])
end
end
end
end
function is_in(tab)
local me = {["x"] = pc.get_local_x(),["y"] = pc.get_local_y()}
if me.x > tab[1] and me.x < tab[3] and
me.y > tab[2] and me.y < tab[4] and
pc.getqf(tab[5]) ~= 1 then
return true
else
return false
end
end
end
end
LG .Raicon