Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Thanks to ProfessorEnte (ScriptVorlage mit Scrollbar)
- # By Kilroy
- import ui
- import app
- import chat
- import net
- import constInfo
- import item
- import uiToolTip
- import event
- import localeInfo
- import time
- import mouseModule
- import uiAttachMetin
- import uiScriptLocale
- import player
- class Handelscenter(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.Hide()
- self.YangInGui = 0
- self.ButtonText = "ITEMS"
- self.ItemTable = [-1,-1,-1]
- self.tooltipItem = uiToolTip.ItemToolTip()
- self.tooltipItem.Hide()
- def BuildWindow(self):
- constInfo.HANDELSCENTER_CONFIG["ITEMS"] = []
- constInfo.HANDELSCENTER_CONFIG["OWN_ITEMS"] = []
- self.ButtonText = "ITEMS"
- self.gui = None
- self.LogsDialog = None
- self.ItemBoard = None
- self.MoneyManager = GuildStorageMoneyManager()
- self.board = self.CreateBoard(750, 550, 200, 100)
- self.board.SetTitleName("Handelscenter")
- self.board.SetCloseEvent(self.Open)
- self.board.SetCenterPosition()
- self.Button1 = self.CreateButton(self.board, 530, 30, "Startseite", 0, self.__ChangeButton, "large_Button_")
- self.Button2 = self.CreateButton(self.board, 620, 30, "Im Verkauf", 1, self.__ChangeButton, "large_Button_")
- self.Button5 = self.CreateButton(self.board, 300, 33, "Logs", 0, self.__Logs, "small_Button_")
- self.Editline = self.CreateMoneyEditLine(self.board, 50, 35, "", self.OpenManager)
- self.Button6 = self.CreateButton(self.board, 350, 33, "Add Item", 2, self.__AddItem, "middle_Button_")
- self.PercentText = self.CreateTextline(self.board, 300, 300)
- self.PercentText.SetFontName("Arial:25")
- self.Editline.SetText("0 Yang")
- # Kategorie
- self.Kategorie = ui.ThinBoard()
- self.Kategorie.SetParent(self.board)
- self.Kategorie.SetSize(120, 465)
- self.Kategorie.SetPosition(30, 65)
- self.Kategorie.Show()
- self.GUI = []
- self.buttons = ["Schwerter", "Zweihänder", "Dolche", "Glocke", "Fächer", "Bögen", "Rüstungen", "Helme", "Schilder", "Armbänder", "Ohrringe", "Halsketten", "Schuhe", "Gürtel", "Kostüme", "Frisuren", "Steine", "Sonstiges"]
- a = 10
- for i in xrange(len(self.buttons)):
- button = self.CreateButton(self.Kategorie, 17, a, self.buttons[i], self.buttons[i], self.__Kategorie, "large_Button_")
- a = a + 25
- self.GUI.append(button)
- self.Show()
- def SetPercantage(self, m1, m2):
- per = int(float(m2)/float(m1)*100)
- self.PercentText.Show()
- self.PercentText.SetText("Loading " + str(per) + "%")
- def NoLogs(self):
- self.__ButtonControl(2, 2)
- def __ButtonControl(self, arg, logs=1):
- if arg==2:
- for i in xrange(len(self.GUI)):
- self.GUI[i].SetEvent(ui.__mem_func__(self.__Kategorie), self.buttons[i])
- self.Button1.SetEvent(ui.__mem_func__(self.__ChangeButton), 0)
- self.Button2.SetEvent(ui.__mem_func__(self.__ChangeButton), 1)
- self.Button5.SetEvent(ui.__mem_func__(self.__Logs), 0)
- elif arg==1:
- if logs==1:
- if self.gui:
- for i in xrange(len(self.gui["boards"])):
- self.gui["boards"][i].Close()
- self.gui = None
- for i in xrange(len(self.GUI)):
- self.GUI[i].SetEvent(ui.__mem_func__(self.__Bug), 0)
- self.Button1.SetEvent(ui.__mem_func__(self.__Bug), 0)
- self.Button2.SetEvent(ui.__mem_func__(self.__Bug), 0)
- self.Button5.SetEvent(ui.__mem_func__(self.__Bug), 0)
- def __Bug(self, arg):
- pass
- def Scrollbar(self):
- self.__ButtonControl(2)
- if self.gui:
- for i in xrange(len(self.gui["boards"])):
- self.gui["boards"][i].Close()
- del self.gui
- self.PercentText.Hide()
- self.PercentText.SetText("Loading 0%")
- board_count = 7
- self.gui = {
- "scrollbar" : self.CreateScrollbar(self.board, self.board.GetHeight()-110,self.board.GetWidth()-30,70),
- "boards" : []
- }
- for i in xrange(min(board_count, len(constInfo.HANDELSCENTER_CONFIG[self.ButtonText]))):
- self.gui["boards"].append(ExampleBoard(self.board, 160, 80 + 61 * i))
- self.gui["boards"][i].SetBoardInfo(i, constInfo.HANDELSCENTER_CONFIG[self.ButtonText][i]["vnum"], constInfo.HANDELSCENTER_CONFIG[self.ButtonText][i]["yang"], constInfo.HANDELSCENTER_CONFIG[self.ButtonText][i]["anzahl"], constInfo.HANDELSCENTER_CONFIG[self.ButtonText][i]["owner"], self.ButtonText)
- if len(constInfo.HANDELSCENTER_CONFIG[self.ButtonText]) <= board_count:
- self.gui["scrollbar"].Hide()
- else:
- self.gui["scrollbar"].SetMiddleBarSize(float(board_count) / float(len(constInfo.HANDELSCENTER_CONFIG[self.ButtonText])))
- self.gui["scrollbar"].Show()
- self.gui["scrollbar"].SetScrollEvent(self.__OnScroll)
- def __Kategorie(self, arg):
- self.__ButtonControl(1)
- constInfo.HANDELSCENTER_CONFIG["ITEMS"] = []
- constInfo.HANDELSCENTER_CONFIG["OWN_ITEMS"] = []
- self.ButtonText = "ITEMS"
- constInfo.HANDELSCENTER_CONFIG["CMD"] = "kategorie/" + arg
- event.QuestButtonClick(constInfo.HANDELSCENTER_CONFIG["index"])
- def __ChangeButton(self, arg):
- self.__ButtonControl(1)
- constInfo.HANDELSCENTER_CONFIG["ITEMS"] = []
- constInfo.HANDELSCENTER_CONFIG["OWN_ITEMS"] = []
- self.ButtonText = ["ITEMS", "OWN_ITEMS"][arg]
- constInfo.HANDELSCENTER_CONFIG["CMD"] = "change_button/" + self.ButtonText
- event.QuestButtonClick(constInfo.HANDELSCENTER_CONFIG["index"])
- def __Logs(self, arg):
- if self.LogsDialog and self.LogsDialog.IsShow():
- self.CloseMe()
- return
- self.__ButtonControl(1, 2)
- constInfo.HANDELSCENTER_CONFIG["LOGS"] = []
- constInfo.HANDELSCENTER_CONFIG["CMD"] = "logs/0"
- event.QuestButtonClick(constInfo.HANDELSCENTER_CONFIG["index"])
- self.LogsDialog = self.CreateBoard(500, 200, 200, 100)
- self.LogsDialog.SetTitleName("Logs")
- self.LogsDialog.SetCloseEvent(self.CloseMe)
- self.LogsDialog.SetCenterPosition()
- self.list_1, self.ListBox1 = self.ListBoxEx(self.LogsDialog, 20, 40, 460, 140, 7)
- self.ListBox1.RemoveAllItems()
- def AddToLog(self):
- self.__ButtonControl(2)
- for i in xrange(len(constInfo.HANDELSCENTER_CONFIG["LOGS"])):
- item.SelectItem(int(constInfo.HANDELSCENTER_CONFIG["LOGS"][i]["vnum"]))
- itemName = item.GetItemName()
- self.ListBox1.AppendItem(Item((constInfo.HANDELSCENTER_CONFIG["LOGS"][i]["date"].replace("$", " ") + " " + constInfo.HANDELSCENTER_CONFIG["LOGS"][i]["buyer"] + " hast/hat " + constInfo.HANDELSCENTER_CONFIG["LOGS"][i]["count"] + "x " + itemName + " von " + constInfo.HANDELSCENTER_CONFIG["LOGS"][i]["owner"] + " für " + self.NumberToMoneyString(constInfo.HANDELSCENTER_CONFIG["LOGS"][i]["preis"]) + " Yang gekauft.")))
- def CloseMe(self):
- self.LogsDialog.Hide()
- def OnUpdate(self):
- self.Editline.SetText(self.NumberToMoneyString(int(constInfo.HANDELSCENTER_CONFIG["YANG"])) + " Yang")
- if self.ItemBoard:
- if self.ItemBoard.IsShow():
- self.TextBox.SetText(self.NumberToMoneyString(self.Value.GetText()) + " Yang")
- if player.GetItemIndex(self.ItemTable[0])!=self.ItemTable[1]:
- self.SlotD.SetItemSlot(0, 0, 0)
- self.ItemTable = [-1,-1,-1]
- def __OnScroll(self):
- board_count = len(self.gui["boards"])
- pos = int(self.gui["scrollbar"].GetPos() * (len(constInfo.HANDELSCENTER_CONFIG[self.ButtonText]) - board_count))
- for i in xrange(board_count):
- realPos = i + pos
- self.gui["boards"][i].SetBoardInfo(realPos, constInfo.HANDELSCENTER_CONFIG[self.ButtonText][realPos]["vnum"], constInfo.HANDELSCENTER_CONFIG[self.ButtonText][realPos]["yang"], constInfo.HANDELSCENTER_CONFIG[self.ButtonText][realPos]["anzahl"], constInfo.HANDELSCENTER_CONFIG[self.ButtonText][realPos]["owner"], self.ButtonText)
- ####### Item Add Function Board
- def __AddItem(self, arg):
- if arg==2:
- self.ItemTable = [-1,-1,-1]
- self.ItemBoard = ui.BoardWithTitleBar()
- self.ItemBoard.SetSize(195, 210)
- self.ItemBoard.SetCenterPosition()
- self.ItemBoard.SetTitleName("Handelscenter")
- self.ItemBoard.AddFlag("movable")
- self.ItemBoard.AddFlag("float")
- self.ItemBoard.SetCloseEvent(self.CloseItemBoard)
- self.ItemBoard.Show()
- self.Slot = ui.ExpandedImageBox()
- self.Slot.SetParent(self.ItemBoard)
- self.Slot.SetPosition(35, 45)
- self.Slot.LoadImage("handelscenter/slot.tga")
- self.Slot.Show()
- self.SlotBar1 = ui.SlotBar()
- self.SlotBar1.SetParent(self.ItemBoard)
- self.SlotBar1.SetSize(130, 17)
- self.SlotBar1.SetPosition(15, 175)
- self.SlotBar1.Show()
- self.Button7 = self.CreateButton(self.ItemBoard, 120, 33, "Put In", 3, self.__AddItem, "middle_Button_")
- self.Value = ui.EditLine()
- self.Value.SetParent(self.SlotBar1)
- self.Value.SetSize(130, 17)
- self.Value.SetPosition(5, 2)
- self.Value.SetMax(14)
- self.Value.SetLimitWidth(130)
- self.Value.SetMultiLine()
- self.Value.SetText("")
- self.Value.Show()
- self.TextBox = self.CreateTextline(self.ItemBoard, 75, 160)
- self.TextBox.SetText("Yang")
- self.SlotD = ui.SlotWindow()
- self.SlotD.SetParent(self.ItemBoard)
- self.SlotD.SetPosition(35, 45)
- self.SlotD.SetSize(32, 96)
- self.SlotD.AppendSlot(0, 0, 0, 32, 96)
- self.SlotD.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectItemSlot))
- self.SlotD.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
- self.SlotD.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
- self.SlotD.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
- self.SlotD.Show()
- elif arg==3:
- if self.ItemTable[0]!=-1 and self.ItemTable[1]!=-1 and self.ItemTable[2]!=-1:
- if self.IsInteger(self.Value.GetText()):
- self.Button7.SetEvent(ui.__mem_func__(self.__Bug), 0)
- #chat.AppendChat(1, str(self.ItemTable[0]) + " " + str(self.ItemTable[1]))
- constInfo.HANDELSCENTER_CONFIG["CMD"] = ("additem/" + str(self.ItemTable[0]) + "/" + str(self.ItemTable[1]) + "/" + self.Value.GetText())
- event.QuestButtonClick(constInfo.HANDELSCENTER_CONFIG["index"])
- self.CloseItemBoard()
- else:
- chat.AppendChat(1, "Du musst schon eine Zahl eingeben!")
- else:
- chat.AppendChat(1, "Du musst schon ein Item in den Slot packen!")
- def OverInItem(self, slotNumber):
- if self.tooltipItem:
- if self.ItemTable[0]!=-1:
- self.tooltipItem.SetInventoryItem(self.ItemTable[0])
- def OnOverOutItem(self):
- if self.tooltipItem:
- self.tooltipItem.HideToolTip()
- def SelectItemSlot(self, itemSlotIndex):
- isAttached = mouseModule.mouseController.isAttached()
- if isAttached:
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- itemIndex = player.GetItemIndex(attachedSlotPos)
- itemCount = player.GetItemCount(attachedSlotPos)
- mouseModule.mouseController.DeattachObject()
- item.SelectItem(itemIndex)
- self.SlotD.SetItemSlot(itemSlotIndex, itemIndex, itemCount)
- self.ItemTable = [int(attachedSlotPos), itemIndex, itemCount]
- else:
- self.SlotD.SetItemSlot(itemSlotIndex, 0, 0)
- self.ItemTable = [-1,-1,-1]
- def CloseItemBoard(self):
- self.ItemBoard.Hide()
- def IsInteger(self, n):
- try:
- int(n)
- return 1
- except ValueError:
- return 0
- ######## Item Add Function Board End
- 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 CreateMoneyEditLine(self, parent, x, y, text, func):
- button = ui.Button()
- button.SetParent(parent)
- button.SetPosition(x, y)
- button.SetUpVisual("d:/ymir work/ui/public/parameter_slot_05.sub")
- button.SetOverVisual("d:/ymir work/ui/public/parameter_slot_05.sub")
- button.SetDownVisual("d:/ymir work/ui/public/parameter_slot_05.sub")
- button.SetText(text)
- button.SetEvent(func)
- button.Show()
- return button
- def OpenManager(self):
- self.MoneyManager.Open()
- def CreateButton(self, parent, x, y, text, event, tbutton, sub):
- button = ui.Button()
- button.SetParent(parent)
- button.SetPosition(x, y)
- button.SetUpVisual("d:/ymir work/ui/public/" + sub + "01.sub")
- button.SetOverVisual("d:/ymir work/ui/public/" + sub+ "02.sub")
- button.SetDownVisual("d:/ymir work/ui/public/" + sub+ "03.sub")
- button.SetText(text)
- button.SetEvent(ui.__mem_func__(tbutton), event)
- button.Show()
- return button
- 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 CreateTextline(self, parent, x, y):
- textline = ui.TextLine()
- textline.SetParent(parent)
- textline.SetPosition(x,y)
- textline.SetHorizontalAlignCenter()
- textline.Show()
- return textline
- def ListBoxEx(self, parent, x, y, width, heigh, count):
- bar = ui.Bar()
- if parent != None:
- bar.SetParent(parent)
- bar.SetPosition(x, y)
- bar.SetSize(width, heigh)
- bar.SetColor(0x77000000)
- bar.Show()
- ListBox=ui.ListBoxEx()
- ListBox.SetParent(bar)
- ListBox.SetPosition(3, 0)
- ListBox.SetSize(width, heigh)
- ListBox.SetViewItemCount(count)
- ListBox.Show()
- scroll = ui.ScrollBar()
- scroll.SetParent(ListBox)
- scroll.SetPosition(width-15, 0)
- scroll.SetScrollBarSize(heigh)
- scroll.Show()
- ListBox.SetScrollBar(scroll)
- return bar, ListBox
- def NumberToMoneyString(self, money):
- sourceText = str(money)
- if len(sourceText) <= 3:
- return sourceText
- return self.NumberToMoneyString(sourceText[:-3]) + "." + sourceText[-3:]
- def Open(self):
- if self.IsShow():
- if self.LogsDialog:
- self.LogsDialog.Hide()
- if self.ItemBoard:
- self.CloseItemBoard()
- self.board.Hide()
- self.Hide()
- return
- self.BuildWindow()
- class ExampleBoard(ui.ScriptWindow):
- boni = {
- item.APPLY_MAX_HP : localeInfo.TOOLTIP_MAX_HP,
- item.APPLY_MAX_SP : localeInfo.TOOLTIP_MAX_SP,
- item.APPLY_CON : localeInfo.TOOLTIP_CON,
- item.APPLY_INT : localeInfo.TOOLTIP_INT,
- item.APPLY_STR : localeInfo.TOOLTIP_STR,
- item.APPLY_DEX : localeInfo.TOOLTIP_DEX,
- item.APPLY_ATT_SPEED : localeInfo.TOOLTIP_ATT_SPEED,
- item.APPLY_MOV_SPEED : localeInfo.TOOLTIP_MOV_SPEED,
- item.APPLY_CAST_SPEED : localeInfo.TOOLTIP_CAST_SPEED,
- item.APPLY_HP_REGEN : localeInfo.TOOLTIP_HP_REGEN,
- item.APPLY_SP_REGEN : localeInfo.TOOLTIP_SP_REGEN,
- item.APPLY_POISON_PCT : localeInfo.TOOLTIP_APPLY_POISON_PCT,
- item.APPLY_STUN_PCT : localeInfo.TOOLTIP_APPLY_STUN_PCT,
- item.APPLY_SLOW_PCT : localeInfo.TOOLTIP_APPLY_SLOW_PCT,
- item.APPLY_CRITICAL_PCT : localeInfo.TOOLTIP_APPLY_CRITICAL_PCT,
- item.APPLY_PENETRATE_PCT : localeInfo.TOOLTIP_APPLY_PENETRATE_PCT,
- item.APPLY_ATTBONUS_WARRIOR : localeInfo.TOOLTIP_APPLY_ATTBONUS_WARRIOR,
- item.APPLY_ATTBONUS_ASSASSIN : localeInfo.TOOLTIP_APPLY_ATTBONUS_ASSASSIN,
- item.APPLY_ATTBONUS_SURA : localeInfo.TOOLTIP_APPLY_ATTBONUS_SURA,
- item.APPLY_ATTBONUS_SHAMAN : localeInfo.TOOLTIP_APPLY_ATTBONUS_SHAMAN,
- item.APPLY_ATTBONUS_MONSTER : localeInfo.TOOLTIP_APPLY_ATTBONUS_MONSTER,
- item.APPLY_ATTBONUS_HUMAN : localeInfo.TOOLTIP_APPLY_ATTBONUS_HUMAN,
- item.APPLY_ATTBONUS_ANIMAL : localeInfo.TOOLTIP_APPLY_ATTBONUS_ANIMAL,
- item.APPLY_ATTBONUS_ORC : localeInfo.TOOLTIP_APPLY_ATTBONUS_ORC,
- item.APPLY_ATTBONUS_MILGYO : localeInfo.TOOLTIP_APPLY_ATTBONUS_MILGYO,
- item.APPLY_ATTBONUS_UNDEAD : localeInfo.TOOLTIP_APPLY_ATTBONUS_UNDEAD,
- item.APPLY_ATTBONUS_DEVIL : localeInfo.TOOLTIP_APPLY_ATTBONUS_DEVIL,
- item.APPLY_STEAL_HP : localeInfo.TOOLTIP_APPLY_STEAL_HP,
- item.APPLY_STEAL_SP : localeInfo.TOOLTIP_APPLY_STEAL_SP,
- item.APPLY_MANA_BURN_PCT : localeInfo.TOOLTIP_APPLY_MANA_BURN_PCT,
- item.APPLY_DAMAGE_SP_RECOVER : localeInfo.TOOLTIP_APPLY_DAMAGE_SP_RECOVER,
- item.APPLY_BLOCK : localeInfo.TOOLTIP_APPLY_BLOCK,
- item.APPLY_DODGE : localeInfo.TOOLTIP_APPLY_DODGE,
- item.APPLY_RESIST_SWORD : localeInfo.TOOLTIP_APPLY_RESIST_SWORD,
- item.APPLY_RESIST_TWOHAND : localeInfo.TOOLTIP_APPLY_RESIST_TWOHAND,
- item.APPLY_RESIST_DAGGER : localeInfo.TOOLTIP_APPLY_RESIST_DAGGER,
- item.APPLY_RESIST_BELL : localeInfo.TOOLTIP_APPLY_RESIST_BELL,
- item.APPLY_RESIST_FAN : localeInfo.TOOLTIP_APPLY_RESIST_FAN,
- item.APPLY_RESIST_BOW : localeInfo.TOOLTIP_RESIST_BOW,
- item.APPLY_RESIST_FIRE : localeInfo.TOOLTIP_RESIST_FIRE,
- item.APPLY_RESIST_ELEC : localeInfo.TOOLTIP_RESIST_ELEC,
- item.APPLY_RESIST_MAGIC : localeInfo.TOOLTIP_RESIST_MAGIC,
- item.APPLY_RESIST_WIND : localeInfo.TOOLTIP_APPLY_RESIST_WIND,
- item.APPLY_REFLECT_MELEE : localeInfo.TOOLTIP_APPLY_REFLECT_MELEE,
- item.APPLY_REFLECT_CURSE : localeInfo.TOOLTIP_APPLY_REFLECT_CURSE,
- item.APPLY_POISON_REDUCE : localeInfo.TOOLTIP_APPLY_POISON_REDUCE,
- item.APPLY_KILL_SP_RECOVER : localeInfo.TOOLTIP_APPLY_KILL_SP_RECOVER,
- item.APPLY_EXP_DOUBLE_BONUS : localeInfo.TOOLTIP_APPLY_EXP_DOUBLE_BONUS,
- item.APPLY_GOLD_DOUBLE_BONUS : localeInfo.TOOLTIP_APPLY_GOLD_DOUBLE_BONUS,
- item.APPLY_ITEM_DROP_BONUS : localeInfo.TOOLTIP_APPLY_ITEM_DROP_BONUS,
- item.APPLY_POTION_BONUS : localeInfo.TOOLTIP_APPLY_POTION_BONUS,
- item.APPLY_KILL_HP_RECOVER : localeInfo.TOOLTIP_APPLY_KILL_HP_RECOVER,
- item.APPLY_IMMUNE_STUN : localeInfo.TOOLTIP_APPLY_IMMUNE_STUN,
- item.APPLY_IMMUNE_SLOW : localeInfo.TOOLTIP_APPLY_IMMUNE_SLOW,
- item.APPLY_IMMUNE_FALL : localeInfo.TOOLTIP_APPLY_IMMUNE_FALL,
- item.APPLY_BOW_DISTANCE : localeInfo.TOOLTIP_BOW_DISTANCE,
- item.APPLY_DEF_GRADE_BONUS : localeInfo.TOOLTIP_DEF_GRADE,
- item.APPLY_ATT_GRADE_BONUS : localeInfo.TOOLTIP_ATT_GRADE,
- item.APPLY_MAGIC_ATT_GRADE : localeInfo.TOOLTIP_MAGIC_ATT_GRADE,
- item.APPLY_MAGIC_DEF_GRADE : localeInfo.TOOLTIP_MAGIC_DEF_GRADE,
- item.APPLY_MAX_STAMINA : localeInfo.TOOLTIP_MAX_STAMINA,
- item.APPLY_MALL_ATTBONUS : localeInfo.TOOLTIP_MALL_ATTBONUS,
- item.APPLY_MALL_DEFBONUS : localeInfo.TOOLTIP_MALL_DEFBONUS,
- item.APPLY_MALL_EXPBONUS : localeInfo.TOOLTIP_MALL_EXPBONUS,
- item.APPLY_MALL_ITEMBONUS : localeInfo.TOOLTIP_MALL_ITEMBONUS,
- item.APPLY_MALL_GOLDBONUS : localeInfo.TOOLTIP_MALL_GOLDBONUS,
- item.APPLY_SKILL_DAMAGE_BONUS : localeInfo.TOOLTIP_SKILL_DAMAGE_BONUS,
- item.APPLY_NORMAL_HIT_DAMAGE_BONUS : localeInfo.TOOLTIP_NORMAL_HIT_DAMAGE_BONUS,
- item.APPLY_SKILL_DEFEND_BONUS : localeInfo.TOOLTIP_SKILL_DEFEND_BONUS,
- item.APPLY_NORMAL_HIT_DEFEND_BONUS : localeInfo.TOOLTIP_NORMAL_HIT_DEFEND_BONUS,
- item.APPLY_PC_BANG_EXP_BONUS : localeInfo.TOOLTIP_MALL_EXPBONUS_P_STATIC,
- item.APPLY_PC_BANG_DROP_BONUS : localeInfo.TOOLTIP_MALL_ITEMBONUS_P_STATIC,
- item.APPLY_RESIST_WARRIOR : localeInfo.TOOLTIP_APPLY_RESIST_WARRIOR,
- item.APPLY_RESIST_ASSASSIN : localeInfo.TOOLTIP_APPLY_RESIST_ASSASSIN,
- item.APPLY_RESIST_SURA : localeInfo.TOOLTIP_APPLY_RESIST_SURA,
- item.APPLY_RESIST_SHAMAN : localeInfo.TOOLTIP_APPLY_RESIST_SHAMAN,
- item.APPLY_MAX_HP_PCT : localeInfo.TOOLTIP_APPLY_MAX_HP_PCT,
- item.APPLY_MAX_SP_PCT : localeInfo.TOOLTIP_APPLY_MAX_SP_PCT,
- item.APPLY_ENERGY : localeInfo.TOOLTIP_ENERGY,
- item.APPLY_COSTUME_ATTR_BONUS : localeInfo.TOOLTIP_COSTUME_ATTR_BONUS,
- item.APPLY_MAGIC_ATTBONUS_PER : localeInfo.TOOLTIP_MAGIC_ATTBONUS_PER,
- item.APPLY_MELEE_MAGIC_ATTBONUS_PER : localeInfo.TOOLTIP_MELEE_MAGIC_ATTBONUS_PER,
- item.APPLY_RESIST_ICE : localeInfo.TOOLTIP_RESIST_ICE,
- item.APPLY_RESIST_EARTH : localeInfo.TOOLTIP_RESIST_EARTH,
- item.APPLY_RESIST_DARK : localeInfo.TOOLTIP_RESIST_DARK,
- item.APPLY_ANTI_CRITICAL_PCT : localeInfo.TOOLTIP_ANTI_CRITICAL_PCT,
- item.APPLY_ANTI_PENETRATE_PCT : localeInfo.TOOLTIP_ANTI_PENETRATE_PCT,
- }
- def __init__(self, parent, x, y):
- ui.ScriptWindow.__init__(self)
- self.tooltipItem = uiToolTip.ItemToolTip()
- self.tooltipItem.Hide()
- self.ButtonText = "ITEMS"
- self.board = self.CreateBoard(parent, 550, 60, x, y)
- self.gui = {
- "buttons" : {
- "thebutton" : self.CreateButton(self.board, 30 + 50 * 9, 11 + 10 * 1, "", self.Button_func)
- },
- "textlines" : {
- "name": self.CreateTextline(self.board, 10 + 50 * 2, 23 + 20 * 0),
- "yang": self.CreateTextline(self.board, 40 + 50 * 4, 23 + 20 * 0),
- "anzahl": self.CreateTextline(self.board, 40 + 50 * 6, 23 + 20 * 0),
- "owner": self.CreateTextline(self.board, 10 + 50 * 8, 23 + 20 * 0)
- },
- "image": {
- "picture": self.CreateImage(self.board, 10 + 50 * 0, 10 + 20* 0)
- }
- }
- self.Show()
- def OnUpdate(self):
- if self.gui["image"]["picture"].IsIn():
- self.tooltipItem.ClearToolTip()
- self.tooltipItem.AddItemData(self.itemid, self.metinSlot, self.attrSlot)
- else:
- self.tooltipItem.HideToolTip()
- def Button_func(self):
- constInfo.HANDELSCENTER_CONFIG["CMD"] = "buyrem_button/" + self.ButtonText + "/" + str(constInfo.HANDELSCENTER_CONFIG[self.ButtonText][self.index]["id"]) + "/" + str(self.index)
- event.QuestButtonClick(constInfo.HANDELSCENTER_CONFIG["index"])
- def NumberToMoneyString(self, money):
- sourceText = str(money)
- if len(sourceText) <= 3:
- return sourceText
- return self.NumberToMoneyString(sourceText[:-3]) + "." + sourceText[-3:]
- def SetBoardInfo(self, index, id, yang, anzahl, owner, button):
- self.ButtonText = button
- self.index = index
- self.itemid = id
- self.metinSlot = [constInfo.HANDELSCENTER_CONFIG[button][self.index]["socket0"],constInfo.HANDELSCENTER_CONFIG[button][self.index]["socket1"],constInfo.HANDELSCENTER_CONFIG[button][self.index]["socket2"],constInfo.HANDELSCENTER_CONFIG[button][self.index]["socket3"],constInfo.HANDELSCENTER_CONFIG[button][self.index]["socket4"],constInfo.HANDELSCENTER_CONFIG[button][self.index]["socket5"]]
- self.attrSlot = [constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni1"], constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni2"], constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni3"], constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni4"], constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni5"], constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni6"], constInfo.HANDELSCENTER_CONFIG[button][self.index]["boni7"]]
- self.gui["buttons"]["thebutton"].SetText({"ITEMS": "Kaufen", "OWN_ITEMS":"Remove"}[button])
- item.SelectItem(id)
- itemIcon = item.GetIconImageFileName()
- itemName = item.GetItemName()
- self.gui["textlines"]["name"].SetText(itemName)
- self.gui["textlines"]["yang"].SetText(self.NumberToMoneyString(yang) + " Yang")
- self.gui["textlines"]["anzahl"].SetText(str(anzahl))
- self.gui["textlines"]["owner"].SetText(owner)
- self.gui["image"]["picture"].LoadImage(itemIcon)
- if self.gui["image"]["picture"].GetHeight()==32:
- self.gui["image"]["picture"].SetScale(1,1)
- if self.gui["image"]["picture"].GetHeight()==64:
- self.gui["image"]["picture"].SetScale(1,0.7)
- if self.gui["image"]["picture"].GetHeight()==96:
- self.gui["image"]["picture"].SetScale(1,0.5)
- def Close(self):
- self.board.Hide()
- self.tooltipItem.HideToolTip()
- self.Hide()
- 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
- class Item(ui.ListBoxEx.Item):
- def __init__(self, text):
- ui.ListBoxEx.Item.__init__(self)
- self.canLoad=0
- self.text=text
- self.textLine=self.__CreateTextLine(text[:100])
- def __del__(self):
- ui.ListBoxEx.Item.__del__(self)
- def GetText(self):
- return self.text
- def SetSize(self, width, height):
- pass
- def __CreateTextLine(self, text):
- textLine=ui.TextLine()
- textLine.SetParent(self)
- textLine.SetPosition(0, 0)
- textLine.SetText(text)
- textLine.Show()
- return textLine
- class GuildStorageMoneyManager(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.__Initialize()
- self.isLoaded = FALSE
- def __Initialize(self):
- self.children = []
- self.xGuildStorageStart = 0
- self.yGuildStorageStart = 0
- def __LoadScript(self):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, "GuildStorageMoneyManager.py")
- except:
- import exception
- exception.Abort("test.__LoadScript.LoadObject")
- try:
- self.board = self.GetChild("Board")
- self.titleBar = self.GetChild("TitleBar")
- self.GetChild("CashInButton").SetEvent(self.CashInButton)
- self.GetChild("CashOutButton").SetEvent(self.CashOutButton)
- self.amountInput = self.GetChild("AmountInput")
- except:
- import exception
- exception.Abort("test.__LoadScript.BindObject")
- self.amountInput.SetNumberMode()
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.isLoaded = TRUE
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def Destroy(self):
- self.Close()
- def Open(self):
- if FALSE == self.isLoaded:
- self.__LoadScript()
- self.__Initialize()
- self.SetTop()
- self.Show()
- (self.xGuildStorageStart, self.yGuildStorageStart, z) = player.GetMainCharacterPosition()
- self.amountInput.SetText("1")
- def CashOutButton(self):
- money = self.amountInput.GetText()
- if money == "":
- self.amountInput.SetText("1")
- return
- self.QuestCMD("yangabheben/"+str(money))
- self.amountInput.SetText("1")
- self.Close()
- def CashInButton(self):
- money = self.amountInput.GetText()
- if money == "":
- self.amountInput.SetText("1")
- return
- self.QuestCMD("yangabgeben/"+str(money))
- self.amountInput.SetText("1")
- self.Close()
- def SendSystemChat(self, text):
- chat.AppendChat(chat.CHAT_TYPE_INFO, "<System>: "+str(text))
- def QuestCMD(self, command):
- constInfo.HANDELSCENTER_CONFIG["CMD"] = command
- event.QuestButtonClick(int(constInfo.HANDELSCENTER_CONFIG["index"]))
- def Close(self):
- self.Hide()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- def OnPressExitKey(self):
- self.Close()
- return TRUE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement