import player
import item
import ui
import net
import localeInfo as locale
import chat
import chr
import constInfo
class Edit2(ui.EditLine):
def __init__(self,main = "",ml = 99):
ui.EditLine.__init__(self)
self.SetText(main)
self.main = main
self.SetMax(ml)
self.SetUserMax(ml)
def __del__(self):
ui.EditLine.__del__(self)
def OnSetFocus(self):
ui.EditLine.OnSetFocus(self)
if self.GetText() == self.main:
self.SetText("")
def OnKillFocus(self):
ui.EditLine.OnKillFocus(self)
if self.GetText() == "":
self.SetText(self.main)
class Board (ui.BoardWithTitleBar):
def __init__(self,gm = 0):
ui.BoardWithTitleBar.__init__(self)
self.AddFlag("movable")
self.AddFlag("float")
if gm == 1:
self.SetTitleName("Support-System")
self.SetSize(420,460)
self.ActUser = ui.TextLine()
self.ActUser.SetText("Aktueller Nutzer: ")
self.ActUser.SetParent(self)
self.ActUser.SetPosition(25,40)
self.ActUser.Show()
self.aubg = ui.Bar("UI")
self.aubg.SetParent(self)
self.aubg.SetSize(200,20)
self.aubg.SetColor(0xC0000000)
self.aubg.SetPosition(110,38)
self.aubg.Show()
self.Input = Edit2("Kein Nutzer ausgewählt")
self.Input.SetParent(self.aubg)
self.Input.SetPosition(2,2)
self.Input.SetSize(200-6,20-6)
self.Input.Show()
self.Kill = ui.Button()
self.Kill.SetParent(self)
self.Kill.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.Kill.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.Kill.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.Kill.SetPosition(30,70)
self.Kill.SetText("Töten!")
self.Kill.SetEvent(lambda: self.Pre(lambda: self.kill(self.Input.GetText())))
self.Kill.Show()
self.Kick = ui.Button()
self.Kick.SetParent(self)
self.Kick.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.Kick.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.Kick.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.Kick.SetPosition(130,70)
self.Kick.SetText("Kicken!")
self.Kick.SetEvent(lambda: self.Pre(lambda: self.disconnect(self.Input.GetText())))
self.Kick.Show()
self.Stun = ui.Button()
self.Stun.SetParent(self)
self.Stun.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.Stun.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.Stun.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.Stun.SetPosition(230,70)
self.Stun.SetText("Ohnmacht!")
self.Stun.SetEvent(lambda: self.Pre(lambda: self.stun(self.Input.GetText())))
self.Stun.Show()
self.CB1 = ui.Button()
self.CB1.SetParent(self)
self.CB1.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.CB1.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.CB1.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.CB1.SetPosition(30,100)
self.CB1.SetText("Chatblock(1h)")
self.CB1.SetEvent(lambda: self.Pre(lambda: self.cb(self.Input.GetText(),60*60)))
self.CB1.Show()
self.banT = ui.Button()
self.banT.SetParent(self)
self.banT.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.banT.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.banT.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.banT.SetPosition(130,100)
self.banT.SetText("Bann(kurzzeitig)")
self.banT.SetEvent(lambda: self.Pre(lambda: self.BanTemp(self.Input.GetText())))
self.banT.Show()
self.banP = ui.Button()
self.banP.SetParent(self)
self.banP.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.banP.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.banP.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.banP.SetPosition(230,100)
self.banP.SetText("Bann(perma)")
self.banP.SetEvent(lambda: self.Pre(lambda: self.BanPerm(self.Input.GetText())))
self.banP.Show()
self.warteText = ui.TextLine()
self.warteText.SetText("Verfügbare Chats:")
self.warteText.SetParent(self)
self.warteText.SetPosition(25,210-100+15+10+10)
self.warteText.Show()
self.chatL = ui.ThinBoard()
self.chatL.SetParent(self)
self.chatL.SetPosition(25,150+15+5)
self.chatL.SetSize(400-15*2,400/2-15-30+60)
self.chatL.Show()
self.chats = warteliste()
self.chats.SetParent(self.chatL)
self.chats.SetPosition(5,5)
self.chats.SetSize(400-15*3,400/2-15*2-30)
self.chats.Show()
self.updt = ui.Button()
self.updt.SetParent(self)
self.updt.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.updt.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.updt.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.updt.SetPosition(285,206-100+15+10+10)
self.updt.SetText("Update!")
self.updt.SetEvent(lambda: self.ExecuteString("gmchat","update"))
self.updt.Show()
else:
self.SetTitleName("Support-System")
self.SetSize(400,180)
self.descr = ui.TextLine()
self.descr.SetParent(self)
self.descr.SetPosition(25,35)
self.descr.SetMultiLine()
self.descr.SetLimitWidth(350)
self.descr.SetText("Du kannst hier GM's anfragen. Sie werden dir schnellstmöglich antworten. Sollten die GM's dir einmal nicht Zeitnah antworten, so warte bitte.")
self.descr.Show()
self.contact = ui.Button()
self.contact.SetParent(self)
self.contact.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.contact.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.contact.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.contact.SetPosition(155,80)
self.contact.SetText("Anfragen")
self.contact.SetEvent(lambda: self.ExecuteString("gmchat","request"))
self.contact.Show()
def Show(self):
ui.BoardWithTitleBar.Show(self)
constInfo.gmbShown = 1
def Hide(self):
ui.BoardWithTitleBar.Hide(self)
constInfo.gmbShown = 0
def Pre(self,func):
if self.Input.GetText() == "Kein Nutzer ausgewählt":
chat.AppendChat(3,"Es wurde kein Benutzer ausgewählt")
else:
func()
def Clear(self):
self.vid = 0
self.name = ""
def SetCharByVID(self,vid):
self.vid = vid
self.name = chr.GetNameByVID(vid)
self.Input.SetText(self.name)
def cb(self,name,zeit):
net.SendChatPacket("/block_chat " + name+ " "+str(zeit))
def disconnect(self,name):
net.SendChatPacket("/dc " + name)
def stun(self,name):
net.SendChatPacket("/stun " + name)
def slow(self,name):
net.SendChatPacket("/slow " + name)
def kill(self,name):
net.SendChatPacket("/kill " + str(name))
def BanPerm(self, name):
self.ExecuteString("gmchat","BanPerm#"+name)
def BanTemp(self,name):
plt = ui.BoardWithTitleBar()
plt.AddFlag("movable")
plt.AddFlag("float")
plt.SetSize(300,80)
plt.SetTitleName(name+" temporär bannen")
plt.uText = ui.TextLine()
plt.uText.SetParent(plt)
plt.uText.SetText("Gib hier die Zeit in Stunden an:")
plt.uText.SetPosition(30,33)
plt.uText.Show()
plt.aubg = ui.Bar("UI")
plt.aubg.SetParent(plt)
plt.aubg.SetSize(90,20)
plt.aubg.SetColor(0xC0000000)
plt.aubg.SetPosition(30,50)
plt.aubg.Show()
plt.Input = Edit2("0")
plt.Input.SetParent(plt.aubg)
plt.Input.SetPosition(2,2)
plt.Input.SetSize(90-4,20-4)
# plt.Input.SetNumberMode()
plt.Input.Show()
plt.ipBu = ui.Button()
plt.ipBu.SetParent(plt)
plt.ipBu.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
plt.ipBu.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
plt.ipBu.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
plt.ipBu.SetText("Bannen!")
plt.ipBu.SetPosition(30+100,50)
plt.ipBu.Show()
plt.Show()
def doit():
plt.Hide()
if int(plt.Input.GetText()) > 24*60*60*60*6000:
self.ExecuteString("gmchat","BanTemp#"+name+"#"+st r(24*60*60))
chat.AppendChat(3,name+" wurde für 24h gebannt.")
else:
chat.AppendChat(3,name+" wurde für "+str(plt.Input.GetText())+" Stunden gebannt.")
self.ExecuteString("gmchat","BanTemp#"+name+"#"+st r(plt.Input.GetText()))
plt.ipBu.SetEvent(lambda: doit())
# def BanPerm(self,name):
# self.ExecuteString("gmchat","BanPerm#"+name)
# self.disconnect(name)
def SendStringToQuest(self,stry):
import event
locale.shtxt = stry
locale.shqw = 1
event.QuestButtonClick(locale.shid)
def ExecuteString(self,typ,stry):
self.SendStringToQuest(typ+"||"+stry)
last = 0
def OnUpdate(self):
self.last+=1
if self.last == 400:
self.ExecuteString("gmchat","autoupdate")
self.last = 0
# net.SendChatPacket("SendChatPacket#1")
def __del__(self):
ui.BoardWithTitleBar.__del__(self)
def SetParent(self,par):
self.Board.SetParent(par)
class warteliste(ui.ListBoxEx):
itemHeight = 70
itemStep = 160
itemWidth = 400-15*5
class Item(ui.ListBoxEx.Item):
def __init__(self,parent,who,status):
ui.ListBoxEx.Item.__init__(self)
self.OnMouseLeftButtonDown = None
self.whoT = ui.TextLine()
self.whoT.SetParent(self)
self.whoT.SetText(str(who)+" ("+str(status)+")")
self.whoT.SetPosition(3,11)
self.whoT.Show()
self.Answer = ui.Button()
self.Answer.SetUpVisual("d:/ymir work/ui/public/xlarge_button_01.sub")
self.Answer.SetOverVisual("d:/ymir work/ui/public/xlarge_button_02.sub")
self.Answer.SetDownVisual("d:/ymir work/ui/public/xlarge_button_03.sub")
self.Answer.SetParent(self)
self.Answer.SetText("Annehmen")
self.Answer.SetPosition(250,10)
self.Answer.SetEvent(lambda l = who: self.AC(l))
self.Answer.Show()
def __del__(self):
self.Hide()
ui.ListBoxEx.Item.__del__(self)
def AC(self,who):
self.ExecuteString("gmchat","__"+who)
try:
constInfo.currentacceptedusers[len(constInfo.currentacceptedusers)] = who
except:
constInfo.currentacceptedusers = {}
constInfo.currentacceptedusers[len(constInfo.currentacceptedusers)] = who
def SendStringToQuest(self,stry):
import event
locale.shtxt = stry
locale.shqw = 1
event.QuestButtonClick(locale.shid)
def ExecuteString(self,typ,stry):
self.SendStringToQuest(typ+"||"+stry)
def __init__(self):
ui.ListBoxEx.__init__(self)
self.SetViewItemCount(6)
self.SetSelectEvent(self.Empty)
self.itemWidth = 400-15*4
self.itemHeight = 22
self.itemStep = 25
self.ScrollBar = ui.ScrollBar()
self.scrollBar = self.ScrollBar
self.ScrollBar.SetParent(self)
self.ScrollBar.SetPosition(340,4)
self.ScrollBar.SetScrollBarSize(150-10+100-15-10-10-10)
self.ScrollBar.Show()
self.SetScrollBar(self.ScrollBar)
def DelAll(self):
for x in self.itemList:
x.whoT.Hide()
x.Answer.Hide()
self.itemList=[]
def Empty(self):
pass
def AddItem(self,who = 0,status = "unbeantwortet"):
self.AppendItem(self.Item(self,who,status))
def UpdateScroll(self):
if len(self.itemList) > 6:
self.ScrollBar.SetMiddleBarSize(6.0/len(self.itemList))
else:
self.ScrollBar.SetMiddleBarSize(1.0)
# yp = Board()
# yp.Show()