HERAKLES Otomatik Avlı kalıcı sunucu. 19 Haziran'da açılıyor. Atius & Wizard güvencesiyle hemen kayıt ol, ön kayıt ödülleri aktif. HEMEN TIKLA!
Hello..
Today I tried to add Teleport GUI but quest doesnt work with client side.. Someone know what I did wrong? :/
constinfo.py
game.py
warp.py
teleport.quest
Client/sysser
Today I tried to add Teleport GUI but quest doesnt work with client side.. Someone know what I did wrong? :/
constinfo.py
Kod:
WARPSYSTEM = { "index" : 0, "CMD" : "" }
game.py
Kod:
"WARPSYSTEM" : self.__WarpSystem,
def __WarpSystem(self, info):
CMD = info.split("/")
if CMD[0]=="index":
constInfo.WARPSYSTEM["index"] = int(CMD[1])
elif CMD[0]=="input":
net.SendQuestInputStringPacket(str(constInfo.WARPSYSTEM["CMD"]))
warp.py
Kod:
import ui
import app
import chat
import net
import constInfo
import event
class WarpSystem(ui.ScriptWindow):
picture_names = [
{"picture" : "warppictures/shinsoo.tga", "name" : "Shinsso M1"},
{"picture" : "warppictures/jinno.tga", "name" : "Jinno M1"},
{"picture" : "warppictures/shinsoom2.tga", "name" : "Shinsoo M2"},
{"picture" : "warppictures/jinnom2.tga", "name" : "Jinno M2"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.1)"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.1)"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.30)"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.75)"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.95)"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.115)"},
{"picture" : "warppictures/test.tga", "name" : "(Lv.130)"}
]
def __init__(self):
ui.ScriptWindow.__init__(self)
self.Loaded = 0
def BuildWindow(self):
if self.Loaded > 0:
self.Show()
self.board.Show()
return
self.Loaded = 1
self.board = self.CreateBoard(520, 320, 200, 100)
self.board.SetTitleName("Teleportace")
self.board.SetCloseEvent(self.Open)
self.board.SetCenterPosition()
self.gui = {
"scrollbar" : self.CreateScrollbar(self.board,self.board.GetHeight()-50,self.board.GetWidth()-25,35),
"boards" : []
}
board_count = 3
for i in xrange(min(board_count, len(self.picture_names))):
self.gui["boards"].append(ExampleBoard(self.board, 10, 35 + 90 * i))
self.gui["boards"][i].SetBoardInfo(i, self.picture_names[i]["picture"], self.picture_names[i]["name"])
if len(self.picture_names) <= board_count:
self.gui["scrollbar"].Hide()
else:
self.gui["scrollbar"].SetMiddleBarSize(float(board_count) / float(len(self.picture_names)))
self.gui["scrollbar"].Show()
self.gui["scrollbar"].SetScrollEvent(self.__OnScroll)
self.Show()
def __OnScroll(self):
board_count = len(self.gui["boards"])
pos = int(self.gui["scrollbar"].GetPos() * (len(self.picture_names) - board_count))
for i in xrange(board_count):
realPos = i + pos
self.gui["boards"][i].SetBoardInfo(realPos, self.picture_names[realPos]["picture"], self.picture_names[realPos]["name"])
def CreateBoard(self, width, height, x, y):
board = ui.BoardWithTitleBar()
board.SetSize(width, height)
board.SetPosition(x, y)
board.AddFlag("movable")
board.Show()
return board
def CreateScrollbar(self, parent, height, x, y):
scrollbar = ui.ScrollBar()
scrollbar.SetParent(parent)
scrollbar.SetScrollBarSize(height)
scrollbar.SetPosition(x, y)
scrollbar.Show()
return scrollbar
def Open(self):
if self.IsShow():
self.board.Hide()
self.Hide()
return
self.BuildWindow()
def OnPressEscapeKey(self):
self.Close()
return TRUE
class ExampleBoard(ui.ScriptWindow):
def __init__(self, parent, x, y):
ui.ScriptWindow.__init__(self)
self.board = self.CreateBoard(parent, 470, 90, x, y)
self.gui = {
"buttons" : {
"warp" : self.CreateButton(self.board, 30 + 50 * 7, 10 + 20 * 2, "Teleport", self.Warp_func)
},
"textlines" : {
"name": self.CreateTextline(self.board, 10 + 50 * 8, 20 + 20 * 0)
},
"image" : {
"picture": self.CreateImage(self.board, 10 + 50 * 0, 10 + 25 * 0)
},
}
def Warp_func(self):
constInfo.WARPSYSTEM["CMD"] = str(self.index)
event.QuestButtonClick(constInfo.WARPSYSTEM["index"])
#chat.AppendChat(chat.CHAT_TYPE_INFO, "on index %d" % (self.index))
def SetBoardInfo(self, index, picture, name):
self.index = index
self.gui["textlines"]["name"].SetText(name)
self.gui["image"]["picture"].LoadImage(picture)
def CreateTextline(self, parent, x, y):
textline = ui.TextLine()
textline.SetParent(parent)
textline.SetPosition(x,y)
textline.SetHorizontalAlignCenter()
textline.Show()
return textline
def CreateImage(self, parent, x, y):
image = ui.ExpandedImageBox()
image.SetParent(parent)
image.SetPosition(x,y)
image.Show()
return image
def CreateBoard(self, parent, width, height, x, y):
board = ui.Board()
board.SetParent(parent)
board.SetSize(width, height)
board.SetPosition(x, y)
board.SetTop()
board.Show()
return board
def CreateButton(self, parent, x, y, text, event):
button = ui.Button()
button.SetParent(parent)
button.SetPosition(x, y)
button.SetUpVisual("d:/ymir work/ui/public/Middle_Button_01.sub")
button.SetOverVisual("d:/ymir work/ui/public/Middle_Button_02.sub")
button.SetDownVisual("d:/ymir work/ui/public/Middle_Button_03.sub")
button.SetText(text)
button.SetEvent(event)
button.Show()
return button
teleport.quest
Kod:
quest teleport begin
state start begin
when login begin
cmdchat("WARPSYSTEM "..q.getcurrentquestindex())
end
when info or button begin
local i = tonumber(input(cmdchat("Teleport GetInfo")))
if type(i) != "number" then return end
local warp = teleport.warp_kords()
if warp[i] == nil then return end
pc.warp(warp[i][1],warp[i][2])
end
function warp_kords()
return {
{474300,954800}, --Test
{10,10},
{10,10},
{10,10},
{10,10},
{10,10},
{10,10},
{10,10},
{10,10},
{10,10},
{10,10}
}
end
end
end
Client/sysser
Kod:
0919 20:15:15878 :: Unknown Server Command WARPSYSTEM 50 | WARPSYSTEM 50
Son düzenleme:
