Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import event
- import net
- import player
- import item
- import ui
- import uiToolTip
- import mouseModule
- import constInfo
- import chat
- import snd
- import wndMgr
- import app
- import igshop_lang
- from igshop_lang import trans, posArranger
- class IngameShop(ui.Window):
- maximumBonusValue = 30000
- minimumBonusValue = -30000
- maximumApplyNum = 7
- maximumStoneNum = 3
- #maximumStoneNumReal = 3
- oldselected = ""
- slot1 = 0
- slot2 = 0
- slot3 = 0
- slot4 = 0
- slot5 = 0
- page = 0
- maxpage = 0
- count1 = 0
- count2 = 0
- count3 = 0
- count4 = 0
- count5 = 0
- currse = 0
- currgold = 0
- icprice = 0
- icid = 0
- icslot = 0
- ictype = 0
- icmaxcount = 0
- oldstep = ""
- vnumb = 0
- itembs = {"socket" : {}, "attr" : {}}
- countb = 0
- oldprice1 = 0
- oldprice2 = 0
- def __init__(self, enableTradeSys = False, lang = 0):
- ui.Window.__init__(self)
- self.enableTradeSys = enableTradeSys
- if lang < 0 or lang > len(igshop_lang.igshopLangTable)-1:
- lang = 0
- self.lang = lang
- igshop_lang.language = lang
- self.toolTip = uiToolTip.ItemToolTip()
- self.BuildWindow()
- if self.enableTradeSys:
- self.SetPosition(wndMgr.GetScreenWidth()/2 - 950/2, 5)
- else:
- self.SetPosition(wndMgr.GetScreenWidth()/2 - 863/2, 5)
- self.__BuildKeyDict()
- def __del__(self):
- ui.Window.__del__(self)
- def BuildWindow(self):
- if self.enableTradeSys:
- self.SetPosition(wndMgr.GetScreenWidth()/2 - 950/2, wndMgr.GetScreenHeight()/2 - 600/2)
- self.SetSize(950, 600)
- self.AddFlag('movable')
- self.AddFlag('float')
- self.comp = Component()
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(950, 600)
- self.Board.SetPosition(0,0)
- self.Board.SetTitleName(trans(0))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.tradeDiag = TradeDialog(self)
- self.sellTradeDiag = ExchangeSellDialog(self)
- self.getTradeDiag = GetTradeItemDialog(self)
- else:
- self.SetPosition(wndMgr.GetScreenWidth()/2 - 863/2, wndMgr.GetScreenHeight()/2 - 600/2)
- self.SetSize(863, 600)
- self.AddFlag('movable')
- self.AddFlag('float')
- self.comp = Component()
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(863, 600)
- self.Board.SetPosition(0,0)
- self.Board.SetTitleName(trans(0))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- if self.enableTradeSys:
- self.NextPage = self.comp.Button(self.Board, '>', '', 760+87, 512+49, self.NextPage_func, 'd:/ymir work/ui/public/minimize_button_01.sub', 'd:/ymir work/ui/public/minimize_button_02.sub', 'd:/ymir work/ui/public/minimize_button_03.sub')
- else:
- self.NextPage = self.comp.Button(self.Board, '>', '', 760, 512+49, self.NextPage_func, 'd:/ymir work/ui/public/minimize_button_01.sub', 'd:/ymir work/ui/public/minimize_button_02.sub', 'd:/ymir work/ui/public/minimize_button_03.sub')
- self.PrevPage = self.comp.Button(self.Board, '<', '', 240, 512+49, self.PrevPage_func, 'd:/ymir work/ui/public/minimize_button_01.sub', 'd:/ymir work/ui/public/minimize_button_02.sub', 'd:/ymir work/ui/public/minimize_button_03.sub')
- self.SBuy1 = self.comp.Button(self.Board, trans(1), '', 624, 67+35+25, self.SBuy1_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.SBuy2 = self.comp.Button(self.Board, trans(1), '', 624, 163+35+25, self.SBuy2_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.SBuy3 = self.comp.Button(self.Board, trans(1), '', 624, 259+35+25, self.SBuy3_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.SBuy4 = self.comp.Button(self.Board, trans(1), '', 624, 355+35+25, self.SBuy4_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.SBuy5 = self.comp.Button(self.Board, trans(1), '', 624, 451+35+25, self.SBuy5_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.YBuy1 = self.comp.Button(self.Board, trans(1), '', 727, 67+25, self.YBuy1_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.YBuy2 = self.comp.Button(self.Board, trans(1), '', 727, 163+25, self.YBuy2_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.YBuy3 = self.comp.Button(self.Board, trans(1), '', 727, 259+25, self.YBuy3_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.YBuy4 = self.comp.Button(self.Board, trans(1), '', 727, 355+25, self.YBuy4_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.YBuy5 = self.comp.Button(self.Board, trans(1), '', 727, 451+25, self.YBuy5_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- if self.enableTradeSys:
- self.TBuy1 = self.comp.Button(self.Board, trans(2), '', 850, 67+35, self.TBuy1_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.TBuy2 = self.comp.Button(self.Board, trans(2), '', 850, 163+35, self.TBuy2_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.TBuy3 = self.comp.Button(self.Board, trans(2), '', 850, 259+35, self.TBuy3_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.TBuy4 = self.comp.Button(self.Board, trans(2), '', 850, 355+35, self.TBuy4_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.TBuy5 = self.comp.Button(self.Board, trans(2), '', 850, 451+35, self.TBuy5_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.Refresh = self.comp.Button(self.Board, trans(3), '', 647, 512+49, self.Refresh_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.ItemText1 = self.comp.TextLine(self.Board, "", 338, 67+25, self.comp.RGB(255, 255, 255))
- self.ItemText2 = self.comp.TextLine(self.Board, "", 338, 163+25, self.comp.RGB(255, 255, 255))
- self.ItemText3 = self.comp.TextLine(self.Board, "", 338, 259+25, self.comp.RGB(255, 255, 255))
- self.ItemText4 = self.comp.TextLine(self.Board, "", 338, 355+25, self.comp.RGB(255, 255, 255))
- self.ItemText5 = self.comp.TextLine(self.Board, "", 338, 451+25, self.comp.RGB(255, 255, 255))
- self.TipText2 = self.comp.TextLine(self.Board, trans(4), 338, 33, self.comp.RGB(0, 167, 255))
- self.TipText1 = self.comp.TextLine(self.Board, trans(5), 238, 33, self.comp.RGB(0, 167, 255))
- self.TipText3 = self.comp.TextLine(self.Board, trans(6), 499, 33, self.comp.RGB(0, 167, 255))
- self.TipText4 = self.comp.TextLine(self.Board, trans(7), 624, 33, self.comp.RGB(0, 167, 255))
- self.TipText5 = self.comp.TextLine(self.Board, trans(8), 624, 33, self.comp.RGB(0, 167, 255))
- if self.enableTradeSys:
- self.TipText6 = self.comp.TextLine(self.Board, trans(25), 850, 33, self.comp.RGB(0, 167, 255))
- self.Owner1 = self.comp.TextLine(self.Board, '', 499, 67+25, self.comp.RGB(255, 255, 255))
- self.Owner2 = self.comp.TextLine(self.Board, '', 499, 163+25, self.comp.RGB(255, 255, 255))
- self.Owner3 = self.comp.TextLine(self.Board, '', 499, 259+25, self.comp.RGB(255, 255, 255))
- self.Owner4 = self.comp.TextLine(self.Board, '', 499, 355+25, self.comp.RGB(255, 255, 255))
- self.Owner5 = self.comp.TextLine(self.Board, '', 499, 451+25, self.comp.RGB(255, 255, 255))
- self.SEPrice1 = self.comp.TextLine(self.Board, '', 624, 67+25, self.comp.RGB(0, 255, 255))
- self.SEPrice2 = self.comp.TextLine(self.Board, '', 624, 163+25, self.comp.RGB(0, 255, 255))
- self.SEPrice3 = self.comp.TextLine(self.Board, '', 624, 259+25, self.comp.RGB(0, 255, 255))
- self.SEPrice4 = self.comp.TextLine(self.Board, '', 624, 355+25, self.comp.RGB(0, 255, 255))
- self.SEPrice5 = self.comp.TextLine(self.Board, '', 624, 451+25, self.comp.RGB(0, 255, 255))
- self.YangPrice1 = self.comp.TextLine(self.Board, '', 624, 67+25, self.comp.RGB(255, 255, 0))
- self.YangPrice2 = self.comp.TextLine(self.Board, '', 624, 163+25, self.comp.RGB(255, 255, 0))
- self.YangPrice3 = self.comp.TextLine(self.Board, '', 624, 259+25, self.comp.RGB(255, 255, 0))
- self.YangPrice4 = self.comp.TextLine(self.Board, '', 624, 355+25, self.comp.RGB(255, 255, 0))
- self.YangPrice5 = self.comp.TextLine(self.Board, '', 624, 451+25, self.comp.RGB(255, 255, 0))
- self.TooltipSE = self.comp.TextLine(self.Board, trans(10), 358-42-7, 512+49, self.comp.RGB(255, 255, 255))
- self.SE = self.comp.TextLine(self.Board, '0', 382, 512+49, self.comp.RGB(0, 255, 255))
- self.Gold = self.comp.TextLine(self.Board, '0', 507, 512+49, self.comp.RGB(255, 255, 0))
- self.TooltipYang = self.comp.TextLine(self.Board, trans(11), 472, 512+49, self.comp.RGB(255, 255, 255))
- self.bar_List, self.list_List = self.comp.ListBoxEx(self.Board, 6, 28, 172, 539+26)
- self.img1 = self.comp.ExpandedImage(self.Board, 238, 67, 'd:/ymir work/ui/public/middle_button_01.sub')
- self.img2 = self.comp.ExpandedImage(self.Board, 238, 163, 'd:/ymir work/ui/public/middle_button_01.sub')
- self.img3 = self.comp.ExpandedImage(self.Board, 238, 259, 'd:/ymir work/ui/public/middle_button_01.sub')
- self.img4 = self.comp.ExpandedImage(self.Board, 238, 355, 'd:/ymir work/ui/public/middle_button_01.sub')
- self.img5 = self.comp.ExpandedImage(self.Board, 238, 451, 'd:/ymir work/ui/public/middle_button_01.sub')
- self.c1 = self.comp.TextLine(self.img1, '', 30, 25, self.comp.RGB(255, 255, 255))
- self.c2 = self.comp.TextLine(self.img2, '', 30, 25, self.comp.RGB(255, 255, 255))
- self.c3 = self.comp.TextLine(self.img3, '', 30, 25, self.comp.RGB(255, 255, 255))
- self.c4 = self.comp.TextLine(self.img4, '', 30, 25, self.comp.RGB(255, 255, 255))
- self.c5 = self.comp.TextLine(self.img5, '', 30, 25, self.comp.RGB(255, 255, 255))
- self.TipFrom = self.comp.TextLine(self.Board, trans(12), 499, 33, self.comp.RGB(0, 167, 255))
- self.OldOwner1 = self.comp.TextLine(self.Board, '', 499, 66+25, self.comp.RGB(255, 255, 255))
- self.OldOwner2 = self.comp.TextLine(self.Board, '', 499, 155+25, self.comp.RGB(255, 255, 255))
- self.OldOwner3 = self.comp.TextLine(self.Board, '', 499, 249+25, self.comp.RGB(255, 255, 255))
- self.OldOwner4 = self.comp.TextLine(self.Board, '', 499, 348+25, self.comp.RGB(255, 255, 255))
- self.OldOwner5 = self.comp.TextLine(self.Board, '', 499, 435+25, self.comp.RGB(255, 255, 255))
- self.ClaimItem1 = self.comp.Button(self.Board, trans(13), '', 672, 98, self.ClaimItem1_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.ClaimItem2 = self.comp.Button(self.Board, trans(13), '', 672, 192, self.ClaimItem2_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.ClaimItem3 = self.comp.Button(self.Board, trans(13), '', 672, 286, self.ClaimItem3_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.ClaimItem4 = self.comp.Button(self.Board, trans(13), '', 672, 371, self.ClaimItem4_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.ClaimItem5 = self.comp.Button(self.Board, trans(13), '', 672, 468, self.ClaimItem5_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- ##Put items to buy board
- self.Slots = ui.GridSlotWindow()
- self.Slots.SetParent(self.Board)
- self.Slots.SetPosition(495, 40)
- self.Slots.ArrangeSlot(1, 1, 3, 32, 32, 0, 0)
- self.Slots.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.Slots.Hide()
- if self.enableTradeSys:
- self.tradeTo = self.comp.Button(self.Board, trans(14), '', 471, 474, self.tradeTo_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.ToSale = self.comp.Button(self.Board, trans(15), '', 471, 474+40, self.ToSale_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- else:
- self.ToSale = self.comp.Button(self.Board, trans(15), '', 471, 474, self.ToSale_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.slotbar_InputS, self.InputS = self.comp.EditLine(self.Board, '0', 327, 477, 70, 15, 12)
- self.slotbar_InputS.Hide()
- self.InputS.SetNumberMode()
- self.InputS.Hide()
- self.slotbar_InputY, self.InputY = self.comp.EditLine(self.Board, '0', 715, 477, 70, 15, 12)
- self.slotbar_InputY.Hide()
- self.InputY.SetNumberMode()
- self.InputY.Hide()
- self.Stone1 = self.comp.TextLine(self.Board, '', 513, 187, self.comp.RGB(255, 146, 68))
- self.Stone2 = self.comp.TextLine(self.Board, '', 513, 212, self.comp.RGB(255, 146, 68))
- self.Stone3 = self.comp.TextLine(self.Board, '', 513, 237, self.comp.RGB(255, 146, 68))
- self.Stone4 = self.comp.TextLine(self.Board, '', 513, 262, self.comp.RGB(255, 146, 68))
- self.Stone5 = self.comp.TextLine(self.Board, '', 513, 287, self.comp.RGB(255, 146, 68))
- self.Stone6 = self.comp.TextLine(self.Board, '', 513, 312, self.comp.RGB(255, 146, 68))
- self.Stone7 = self.comp.TextLine(self.Board, '', 513, 337, self.comp.RGB(255, 146, 68))
- self.Stone8 = self.comp.TextLine(self.Board, '', 513, 362, self.comp.RGB(255, 146, 68))
- self.Stone9 = self.comp.TextLine(self.Board, '', 513, 387, self.comp.RGB(255, 146, 68))
- self.Stone10 = self.comp.TextLine(self.Board, '', 513, 412, self.comp.RGB(255, 146, 68))
- self.PriceS = self.comp.TextLine(self.Board, trans(16), 239, 478, self.comp.RGB(255, 255, 255))
- self.PriceY = self.comp.TextLine(self.Board, trans(17) , 621, 478, self.comp.RGB(255, 255, 255))
- self.Previ1 = self.comp.TextLine(self.Board, trans(18), 207+38, 448, self.comp.RGB(255, 255, 255))
- self.Previ2 = self.comp.TextLine(self.Board, trans(18), 583+38, 448, self.comp.RGB(255, 255, 255))
- self.PreviS = self.comp.TextLine(self.Board, '0', 281+38+21, 449-1, self.comp.RGB(198, 0, 0))
- self.PreviY = self.comp.TextLine(self.Board, '0', 657+38+21, 449-1, self.comp.RGB(255, 255, 0))
- self.TipX1 = self.comp.TextLine(self.Board, trans(19), 311, 89, self.comp.RGB(255, 255, 0))
- self.TipX2 = self.comp.TextLine(self.Board, trans(20), 619, 89, self.comp.RGB(255, 255, 0))
- self.Slots.SetUsableItem(True)
- self.Slots.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
- self.Slots.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
- self.Slots.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.Slots.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
- self.Stone1.SetHorizontalAlignCenter()
- self.Stone2.SetHorizontalAlignCenter()
- self.Stone3.SetHorizontalAlignCenter()
- self.Stone4.SetHorizontalAlignCenter()
- self.Stone5.SetHorizontalAlignCenter()
- self.Stone6.SetHorizontalAlignCenter()
- self.Stone7.SetHorizontalAlignCenter()
- self.Stone8.SetHorizontalAlignCenter()
- self.Stone9.SetHorizontalAlignCenter()
- self.Stone10.SetHorizontalAlignCenter()
- ##End of put items to buy board
- self.GetMoneyBut = self.comp.Button(self.Board, trans(21), '', 417, 507+49, self.GetMoneyBut_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.slotbar_GetMoney, self.GetMoney = self.comp.EditLine(self.Board, '0', 336, 510+49, 70, 15, 12)
- self.GetMoney.SetNumberMode()
- self.slotbar_GetMoney.Hide()
- self.GetMoney.Hide()
- #example: self.list_xxx.AppendItem(Item('text 1'))
- self.list_List.InsertItem(1, igshop_lang.weaponGroup[self.lang])
- self.list_List.InsertItem(2, igshop_lang.armorGroup[self.lang])
- self.list_List.InsertItem(3, igshop_lang.helmetGroup[self.lang])
- self.list_List.InsertItem(4, igshop_lang.shieldGroup[self.lang])
- self.list_List.InsertItem(5, igshop_lang.braceletGroup[self.lang])
- self.list_List.InsertItem(6, igshop_lang.shoeGroup[self.lang])
- self.list_List.InsertItem(7, igshop_lang.necklaceGroup[self.lang])
- self.list_List.InsertItem(8, igshop_lang.earringGroup[self.lang])
- self.list_List.InsertItem(9, igshop_lang.costumeGroup[self.lang])
- self.list_List.InsertItem(10, igshop_lang.miscellaneousGroup[self.lang])
- self.list_List.InsertItem(11, "")
- self.list_List.InsertItem(12, igshop_lang.mysalesGroup[self.lang])
- self.list_List.InsertItem(13, igshop_lang.purchasesGroup[self.lang])
- if self.enableTradeSys:
- self.list_List.InsertItem(13, igshop_lang.get_trade_itemsGroup[self.lang])
- self.list_List.InsertItem(14, "")
- self.list_List.InsertItem(15, igshop_lang.sellGroup[self.lang])
- self.list_List.InsertItem(16, "")
- self.list_List.InsertItem(17, igshop_lang.searchGroup[self.lang])
- self.img1.OnMouseOverIn = ui.__mem_func__(self.img1OverIn)
- self.img1.OnMouseOverOut = ui.__mem_func__(self.img1OverOut)
- self.img2.OnMouseOverIn = ui.__mem_func__(self.img2OverIn)
- self.img2.OnMouseOverOut = ui.__mem_func__(self.img2OverOut)
- self.img3.OnMouseOverIn = ui.__mem_func__(self.img3OverIn)
- self.img3.OnMouseOverOut = ui.__mem_func__(self.img3OverOut)
- self.img4.OnMouseOverIn = ui.__mem_func__(self.img4OverIn)
- self.img4.OnMouseOverOut = ui.__mem_func__(self.img4OverOut)
- self.img5.OnMouseOverIn = ui.__mem_func__(self.img5OverIn)
- self.img5.OnMouseOverOut = ui.__mem_func__(self.img5OverOut)
- ## item count board
- self.ICBoard = SelectItemCountBoard(self)
- ##end item count board
- ## search board
- self.FBoard = SearchBoardDialog(self)
- ##end of search board
- self.langDiag = LanguageSelector(self)
- self.Hide()
- def changeLang(self):
- self.langDiag.Open()
- def replaceLUAMagicalCharacters(self, text):
- return text.replace("+","%+").replace(".","%.").replace("(","%(").replace(")","%)").replace("-","%-").replace("*","%*").replace("?","%?").replace("[","%[").replace("^","%^").replace("$","%$")
- def tradeTo_func(self):
- self.ICBoard.Close()
- self.FBoard.Close()
- self.sellTradeDiag.Open()
- def TBuy1_func(self):
- self.ICBoard.Close()
- self.FBoard.Close()
- self.QuestCMD("trade.RequestTrade#"+str(self.slot1)+"#"+str(self.page)+"#1#"+self.oldselected)
- def TBuy2_func(self):
- self.ICBoard.Close()
- self.FBoard.Close()
- self.QuestCMD("trade.RequestTrade#"+str(self.slot2)+"#"+str(self.page)+"#2#"+self.oldselected)
- def TBuy3_func(self):
- self.ICBoard.Close()
- self.FBoard.Close()
- self.QuestCMD("trade.RequestTrade#"+str(self.slot3)+"#"+str(self.page)+"#3#"+self.oldselected)
- def TBuy4_func(self):
- self.ICBoard.Close()
- self.FBoard.Close()
- self.QuestCMD("trade.RequestTrade#"+str(self.slot4)+"#"+str(self.page)+"#4#"+self.oldselected)
- def TBuy5_func(self):
- self.ICBoard.Close()
- self.FBoard.Close()
- self.QuestCMD("trade.RequestTrade#"+str(self.slot5)+"#"+str(self.page)+"#5#"+self.oldselected)
- def NumberToMoneyString(self, n, cucc = 0):
- if n <= 0 :
- if cucc == 0:
- return "0 %s" % (trans(22))
- else:
- return "0"
- if cucc == 0:
- return "%s %s" % ('.'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]), trans(22))
- elif cucc == 777:
- return "%s" % ('|'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]))
- else:
- return "%s" % ('.'.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]))
- def UnselectItemSlot(self, selectedSlotPos):
- self.Slots.ClearSlot(1)
- self.Slots.ClearSlot(2)
- self.Slots.ClearSlot(3)
- self.Slots.RefreshSlot()
- self.HideItems()
- self.Slots.Show()
- self.TipX2.Show()
- self.TipX1.Show()
- if self.enableTradeSys:
- self.sellTradeDiag.Close(2)
- self.QuestCMD("trade.ClearAllArraySell")
- def SelectEmptySlot(self, selectedSlotPos):
- if mouseModule.mouseController.isAttached():
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- if attachedSlotType == player.SLOT_TYPE_INVENTORY:
- self.QuestCMD("SELLITEM#"+str(selectedSlotPos)+"#"+str(attachedSlotPos))
- mouseModule.mouseController.DeattachObject()
- def OverInItem(self, index):
- self.toolTip.ClearToolTip()
- self.toolTip.AddItemData(self.vnumb,self.itembs["socket"],self.itembs["attr"])
- def OverOutItem(self):
- self.toolTip.Hide()
- def GetMoneyBut_func(self):
- self.QuestCMD("GETMONEY#"+str(self.NumberToMoneyString(long(self.GetMoney.GetText()),777)))
- def SetBuypageTexts(self):
- if self.itembs["socket"][0] > 0:
- item.SelectItem(self.itembs["socket"][0])
- if item.GetItemType() == 10:
- self.Stone1.SetText(str(item.GetItemName()))
- self.Stone1.Show()
- if self.itembs["socket"][1] > 0:
- item.SelectItem(self.itembs["socket"][1])
- if item.GetItemType() == 10:
- self.Stone2.SetText(str(item.GetItemName()))
- self.Stone2.Show()
- if self.itembs["socket"][2] > 0:
- item.SelectItem(self.itembs["socket"][2])
- if item.GetItemType() == 10:
- self.Stone3.SetText(str(item.GetItemName()))
- self.Stone3.Show()
- if self.itembs["attr"][0][0] > 0:
- self.Stone4.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][0][0]](self.itembs["attr"][0][1])))
- self.Stone4.Show()
- if self.itembs["attr"][1][0] > 0:
- self.Stone5.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][1][0]](self.itembs["attr"][1][1])))
- self.Stone5.Show()
- if self.itembs["attr"][2][0] > 0:
- self.Stone6.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][2][0]](self.itembs["attr"][2][1])))
- self.Stone6.Show()
- if self.itembs["attr"][3][0] > 0:
- self.Stone7.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][3][0]](self.itembs["attr"][3][1])))
- self.Stone7.Show()
- if self.itembs["attr"][4][0] > 0:
- self.Stone8.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][4][0]](self.itembs["attr"][4][1])))
- self.Stone8.Show()
- if self.itembs["attr"][5][0] > 0:
- self.Stone9.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][5][0]](self.itembs["attr"][5][1])))
- self.Stone9.Show()
- if self.itembs["attr"][6][0] > 0:
- self.Stone10.SetText(str(self.toolTip.AFFECT_DICT[self.itembs["attr"][6][0]](self.itembs["attr"][6][1])))
- self.Stone10.Show()
- def ShowForSell(self):
- self.TipX2.Hide()
- #self.TipX1.Hide()
- self.PreviY.Show()
- #self.PreviS.Show()
- #self.Previ1.Show()
- self.Previ2.Show()
- #self.TipY.Show()
- #self.TipS.Show()
- self.PriceY.Show()
- #self.PriceS.Show()
- self.ToSale.Show()
- if self.enableTradeSys:
- self.tradeTo.Show()
- #self.slotbar_InputS.Show()
- self.slotbar_InputY.Show()
- #self.InputS.Show()
- self.InputY.Show()
- self.InputY.SetText("0")
- #self.InputS.SetText("0")
- def ToSale_func(self):
- if long(str(self.InputS.GetText()) or 0) <= 0 or self.InputS.GetText() == "":
- self.QuestCMD("FINISHSALE#"+self.InputY.GetText()+"#0")
- else:
- self.QuestCMD("FINISHSALE#"+self.InputY.GetText()+"#"+self.InputS.GetText())
- def RecvFinisSale(self):
- self.Slots.ClearSlot(1)
- self.Slots.ClearSlot(2)
- self.Slots.ClearSlot(3)
- self.Slots.RefreshSlot()
- self.HideItems()
- self.Slots.Show()
- self.TipX2.Show()
- self.TipX1.Show()
- def ClaimItem1_func(self):
- if self.oldselected == "my_sales":
- self.QuestCMD("CLAIMMYITEM#"+str(self.slot1)+"#"+str(self.page)+"#1")
- else:
- self.QuestCMD("CLAIMITEM#"+str(self.slot1)+"#"+str(self.page)+"#1")
- def ClaimItem2_func(self):
- if self.oldselected == "my_sales":
- self.QuestCMD("CLAIMMYITEM#"+str(self.slot2)+"#"+str(self.page)+"#2")
- else:
- self.QuestCMD("CLAIMITEM#"+str(self.slot2)+"#"+str(self.page)+"#2")
- def ClaimItem3_func(self):
- if self.oldselected == "my_sales":
- self.QuestCMD("CLAIMMYITEM#"+str(self.slot3)+"#"+str(self.page)+"#3")
- else:
- self.QuestCMD("CLAIMITEM#"+str(self.slot3)+"#"+str(self.page)+"#3")
- def ClaimItem4_func(self):
- if self.oldselected == "my_sales":
- self.QuestCMD("CLAIMMYITEM#"+str(self.slot4)+"#"+str(self.page)+"#4")
- else:
- self.QuestCMD("CLAIMITEM#"+str(self.slot4)+"#"+str(self.page)+"#4")
- def ClaimItem5_func(self):
- if self.oldselected == "my_sales":
- self.QuestCMD("CLAIMMYITEM#"+str(self.slot5)+"#"+str(self.page)+"#5")
- else:
- self.QuestCMD("CLAIMITEM#"+str(self.slot5)+"#"+str(self.page)+"#5")
- def NextPage_func(self):
- if self.enableTradeSys:
- self.tradeDiag.Close()
- self.getTradeDiag.Close()
- self.HideItems()
- if self.oldselected == "Kereses":
- self.QuestCMD("SEARCH#"+self.FBoard.IFOwner.GetText().replace("#", "")+"#"+self.replaceLUAMagicalCharacters(self.FBoard.IFItem.GetText())+"#"+str(self.page + 1))
- else:
- self.QuestCMD("SWITCHPAGE#"+self.oldselected+"#"+str(self.page + 1))
- def PrevPage_func(self):
- if self.enableTradeSys:
- self.tradeDiag.Close()
- self.getTradeDiag.Close()
- self.HideItems()
- if self.oldselected == "Kereses":
- self.QuestCMD("SEARCH#"+self.FBoard.IFOwner.GetText().replace("#", "")+"#"+self.replaceLUAMagicalCharacters(self.FBoard.IFItem.GetText())+"#"+str(self.page - 1))
- else:
- self.QuestCMD("SWITCHPAGE#"+self.oldselected+"#"+str(self.page - 1))
- def SBuy1_func(self):
- if self.count1 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy1.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count1,2,long(self.SEPrice1.GetText()), 1, self.slot1, isTradeItem)
- else:
- if self.currse >= long(self.SEPrice1.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot1)+"#CASH#"+str(self.page)+"#1#1#"+str(self.currse)+"#"+self.oldselected)
- ## #1#1# first: slot second: count
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(23))
- def SBuy2_func(self):
- if self.count2 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy2.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count2,2,long(self.SEPrice2.GetText()), 2, self.slot2, isTradeItem)
- else:
- if self.currse >= long(self.SEPrice2.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot2)+"#CASH#"+str(self.page)+"#2#1#"+str(self.currse)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(23))
- def SBuy3_func(self):
- if self.count3 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy3.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count3,2,long(self.SEPrice3.GetText()), 3, self.slot3, isTradeItem)
- else:
- if self.currse >= long(self.SEPrice3.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot3)+"#CASH#"+str(self.page)+"#3#1#"+str(self.currse)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(23))
- def SBuy4_func(self):
- if self.count4 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy4.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count4,2,long(self.SEPrice4.GetText()), 4, self.slot4, isTradeItem)
- else:
- if self.currse >= long(self.SEPrice4.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot4)+"#CASH#"+str(self.page)+"#4#1#"+str(self.currse)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(23))
- def SBuy5_func(self):
- if self.count5 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy5.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count5,2,long(self.SEPrice5.GetText()), 5, self.slot5, isTradeItem)
- else:
- if self.currse >= long(self.SEPrice5.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot5)+"#CASH#"+str(self.page)+"#5#1#"+str(self.currse)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(23))
- def YBuy1_func(self):
- if self.count1 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy1.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count1,1,long(self.YangPrice1.GetText()), 1, self.slot1, isTradeItem)
- else:
- if self.currgold >= long(self.YangPrice1.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot1)+"#GOLD#"+str(self.page)+"#1#1#"+str(self.currgold)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(24))
- def YBuy2_func(self):
- if self.count2 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy2.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count2,1,long(self.YangPrice2.GetText()), 2, self.slot2, isTradeItem)
- else:
- if self.currgold >= long(self.YangPrice2.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot2)+"#GOLD#"+str(self.page)+"#2#1#"+str(self.currgold)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(24))
- def YBuy3_func(self):
- if self.count3 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy3.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count3,1,long(self.YangPrice3.GetText()), 3, self.slot3, isTradeItem)
- else:
- if self.currgold >= long(self.YangPrice3.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot3)+"#GOLD#"+str(self.page)+"#3#1#"+str(self.currgold)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(24))
- def YBuy4_func(self):
- if self.count4 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy4.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count4, 1,long(self.YangPrice4.GetText()), 4, self.slot4, isTradeItem)
- else:
- if self.currgold >= long(self.YangPrice4.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot4)+"#GOLD#"+str(self.page)+"#4#1#"+str(self.currgold)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(24))
- def YBuy5_func(self):
- if self.count5 > 1:
- isTradeItem = False
- if self.enableTradeSys:
- if self.TBuy5.IsShow():
- isTradeItem = True
- self.OpenCounter(self.count5, 1,long(self.YangPrice5.GetText()), 5, self.slot5, isTradeItem)
- else:
- if self.currgold >= long(self.YangPrice5.GetText()):
- self.QuestCMD("BUYITEM#"+str(self.slot5)+"#GOLD#"+str(self.page)+"#5#1#"+str(self.currgold)+"#"+self.oldselected)
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(24))
- def OpenCounter(self, count, type, price, slot, id, isTradeItem):
- ## types: 1 yang, 2 coin
- self.ICBoard.Close()
- self.icid = id
- self.icslot = slot
- self.icprice = price
- self.ictype = type
- self.icmaxcount = count
- fix = ""
- if type == 1:
- fix = " "+trans(22)
- else:
- fix = " "+trans(10)
- self.ICBoard.CCountper.SetText(str(self.NumberToMoneyString(price, 1)+fix+trans(75)))
- self.ICBoard.ImputCount.SetText("0")
- self.ICBoard.ToBuyp.SetText("0"+fix)
- self.ICBoard.SliderBarC.SetSliderPos(0.0 / count)
- self.ICBoard.isTradeItem = isTradeItem
- self.ICBoard.Show()
- def Refresh_func(self):
- if self.enableTradeSys:
- self.tradeDiag.Close()
- self.getTradeDiag.Close()
- if self.oldselected != "sell_item":
- self.HideItems()
- if self.oldselected == "Kereses":
- text = str(self.FBoard.IFItem.GetText())
- self.QuestCMD("SEARCH#"+self.FBoard.IFOwner.GetText().replace("#", "")+"#"+self.replaceLUAMagicalCharacters(text)+"#1")
- else:
- self.QuestCMD("SWITCHPAGE#"+self.oldselected+"#"+str(self.page))
- def img1OverIn(self):
- self.toolTip.ClearToolTip()
- self.toolTip.AddItemData(constInfo.IGShop["vnum1"],constInfo.IGShop["slot1"]["socket"],constInfo.IGShop["slot1"]["attr"])
- def img1OverOut(self):
- self.toolTip.Hide()
- def img2OverIn(self):
- self.toolTip.ClearToolTip()
- self.toolTip.AddItemData(constInfo.IGShop["vnum2"],constInfo.IGShop["slot2"]["socket"],constInfo.IGShop["slot2"]["attr"])
- def img2OverOut(self):
- self.toolTip.Hide()
- def img3OverIn(self):
- self.toolTip.ClearToolTip()
- self.toolTip.AddItemData(constInfo.IGShop["vnum3"],constInfo.IGShop["slot3"]["socket"],constInfo.IGShop["slot3"]["attr"])
- def img3OverOut(self):
- self.toolTip.Hide()
- def img4OverIn(self):
- self.toolTip.ClearToolTip()
- self.toolTip.AddItemData(constInfo.IGShop["vnum4"],constInfo.IGShop["slot4"]["socket"],constInfo.IGShop["slot4"]["attr"])
- def img4OverOut(self):
- self.toolTip.Hide()
- def img5OverIn(self):
- self.toolTip.ClearToolTip()
- self.toolTip.AddItemData(constInfo.IGShop["vnum5"],constInfo.IGShop["slot5"]["socket"],constInfo.IGShop["slot5"]["attr"])
- def img5OverOut(self):
- self.toolTip.Hide()
- def __BuildKeyDict(self):
- onPressKeyDict = {}
- onPressKeyDict[app.DIK_F5] = lambda : self.Refresh_func()
- self.onPressKeyDict = onPressKeyDict
- def OnPressEscapeKey(self):
- self.Close()
- return True
- def OnKeyDown(self, key):
- try:
- self.onPressKeyDict[key]()
- except KeyError:
- pass
- except:
- raise
- return True
- def OpenWindow(self):
- if self.IsShow():
- self.Close()
- else:
- self.Show()
- def Open(self):
- self.Show()
- def Close(self):
- self.UnselectItemSlot(1)
- if self.oldselected != "sell_item":
- self.Slots.Hide()
- self.TipX2.Hide()
- self.TipX1.Hide()
- if self.enableTradeSys:
- self.sellTradeDiag.ClearAllSlots()
- self.QuestCMD("trade.ClearAllArraySell")
- self.Hide()
- def SetSE(self,se):
- self.SE.SetText(self.NumberToMoneyString(long(se), 1))
- self.currse = long(se)
- def SetGold(self,gold):
- self.Gold.SetText(self.NumberToMoneyString(long(gold), 1))
- self.currgold = long(gold)
- def OnUpdate(self):
- #csicskasag = self.list_List.GetSelectedItem()
- SelectedIndex = self.list_List.GetSelectedItemText()
- if str(SelectedIndex) in igshop_lang.weaponGroup:
- SelectedIndex = "Fegyverek"
- elif str(SelectedIndex) in igshop_lang.armorGroup:
- SelectedIndex = "Vertek"
- elif str(SelectedIndex) in igshop_lang.helmetGroup:
- SelectedIndex = "Sisakok"
- elif str(SelectedIndex) in igshop_lang.shieldGroup:
- SelectedIndex = "Pajzsok"
- elif str(SelectedIndex) in igshop_lang.earringGroup:
- SelectedIndex = "Fulbevalok"
- elif str(SelectedIndex) in igshop_lang.braceletGroup:
- SelectedIndex = "Karkotok"
- elif str(SelectedIndex) in igshop_lang.costumeGroup:
- SelectedIndex = "Kosztumok"
- elif str(SelectedIndex) in igshop_lang.shoeGroup:
- SelectedIndex = "Cipok"
- elif str(SelectedIndex) in igshop_lang.necklaceGroup:
- SelectedIndex = "Nyaklancok"
- elif str(SelectedIndex) in igshop_lang.searchGroup:
- SelectedIndex = "Kereses"
- elif str(SelectedIndex) in igshop_lang.get_trade_itemsGroup:
- SelectedIndex = "get_trade_items"
- elif str(SelectedIndex) in igshop_lang.purchasesGroup:
- SelectedIndex = "my_buys"
- elif str(SelectedIndex) in igshop_lang.mysalesGroup:
- SelectedIndex = "my_sales"
- elif str(SelectedIndex) in igshop_lang.sellGroup:
- SelectedIndex = "sell_item"
- elif str(SelectedIndex) in igshop_lang.miscellaneousGroup:
- SelectedIndex = "Egyebek"
- if str(self.oldselected) != str(SelectedIndex):
- if self.enableTradeSys:
- self.tradeDiag.Close()
- self.getTradeDiag.Close()
- self.sellTradeDiag.Close(2)
- self.HideItems()
- self.FBoard.Close()
- passAction = False
- if str(self.oldselected) == "get_trade_items":
- self.TipText2.SetText(trans(4))
- self.TipText3.SetText(trans(6))
- self.TipText6.SetText(trans(25))
- if str(SelectedIndex) == "":
- self.Refresh.Hide()
- self.SE.Hide()
- self.Gold.Hide()
- self.TooltipYang.Hide()
- self.TooltipSE.Hide()
- passAction = True
- if str(SelectedIndex) == "my_buys":
- self.TooltipYang.Hide()
- self.TooltipSE.Hide()
- self.SE.Hide()
- self.Gold.Hide()
- self.Refresh.Show()
- self.TipText1.Show()
- self.TipText2.Show()
- self.TipText3.Hide()
- self.TipText4.Hide()
- self.TipText5.Hide()
- if self.enableTradeSys:
- self.TipText6.Show()
- self.TipFrom.SetText(trans(12))
- self.TipFrom.Show()
- self.ClaimItem1.SetText(trans(13))
- self.ClaimItem2.SetText(trans(13))
- self.ClaimItem3.SetText(trans(13))
- self.ClaimItem4.SetText(trans(13))
- self.ClaimItem5.SetText(trans(13))
- elif str(SelectedIndex) == "my_sales":
- self.TooltipSE.Hide()
- self.SE.Hide()
- self.TooltipYang.Show()
- self.Gold.Show()
- self.Refresh.Show()
- self.TipText1.Show()
- self.TipText2.Show()
- self.TipText3.Hide()
- self.TipText4.Hide()
- self.TipText5.Hide()
- if self.enableTradeSys:
- self.TipText6.Show()
- self.TipFrom.SetText(trans(26))
- self.TipFrom.Hide()
- self.ClaimItem1.SetText(trans(27))
- self.ClaimItem2.SetText(trans(27))
- self.ClaimItem3.SetText(trans(27))
- self.ClaimItem4.SetText(trans(27))
- self.ClaimItem5.SetText(trans(27))
- self.slotbar_GetMoney.Show()
- self.GetMoney.Show()
- self.GetMoneyBut.Show()
- elif str(SelectedIndex) == "sell_item":
- self.Slots.Show()
- self.TipX2.Show()
- self.TipX1.Show()
- self.TipFrom.Hide()
- self.TooltipYang.Hide()
- self.TooltipSE.Hide()
- self.SE.Hide()
- self.Gold.Hide()
- self.Refresh.Hide()
- self.TipText1.Hide()
- self.TipText2.Hide()
- self.TipText3.Hide()
- self.TipText4.Hide()
- self.TipText5.Hide()
- if self.enableTradeSys:
- self.TipText6.Hide()
- elif str(SelectedIndex) == "Kereses":
- self.FBoard.Show()
- self.TipFrom.Hide()
- self.TooltipYang.Show()
- self.TooltipSE.Show()
- self.SE.Show()
- self.Gold.Show()
- self.Refresh.Show()
- self.TipText1.Show()
- self.TipText2.Show()
- self.TipText3.Show()
- self.TipText4.Show()
- self.TipText5.Show()
- if self.enableTradeSys:
- self.TipText6.Show()
- elif str(SelectedIndex) == "get_trade_items":
- self.Refresh.Show()
- self.SE.Hide()
- self.Gold.Hide()
- self.TooltipYang.Hide()
- self.TooltipSE.Hide()
- self.TipText1.Hide()
- self.TipText2.Show()
- self.TipText2.SetText(trans(28))
- self.TipText3.Show()
- self.TipText3.SetText(trans(29))
- self.TipText4.Hide()
- self.TipText5.Hide()
- self.TipText6.Show()
- self.TipFrom.Hide()
- self.TipText6.SetText(trans(30))
- elif not passAction:
- self.TipFrom.Hide()
- self.TooltipYang.Show()
- self.TooltipSE.Show()
- self.SE.Show()
- self.Gold.Show()
- self.Refresh.Show()
- self.TipText1.Show()
- self.TipText2.Show()
- self.TipText3.Show()
- self.TipText4.Show()
- self.TipText5.Show()
- if self.enableTradeSys:
- self.TipText6.Show()
- self.oldselected = SelectedIndex
- if not passAction:
- if str(SelectedIndex) != "sell_item" and str(SelectedIndex) != "Kereses":
- self.QuestCMD("GROUP#"+str(SelectedIndex)+"#0")
- if long(str(self.InputS.GetText()) or 0) != self.oldprice1 and self.InputS.GetText() != "":
- self.oldprice1 = long(str(self.InputS.GetText()) or 0)
- self.PreviS.SetText(str(self.NumberToMoneyString(long(str(self.InputS.GetText()) or 0), 1))+" "+trans(75))
- if long(str(self.InputY.GetText()) or 0) != self.oldprice2 and self.InputY.GetText() != "":
- self.oldprice2 = long(str(self.InputY.GetText()) or 0)
- self.PreviY.SetText(str(self.NumberToMoneyString(long(str(self.InputY.GetText()) or 0), 1))+" "+trans(75))
- if self.oldselected == "my_sales" and not self.GetMoney.IsShow():
- self.slotbar_GetMoney.Show()
- self.GetMoney.Show()
- self.GetMoneyBut.Show()
- def QuestCMD(self, command):
- constInfo.IGShop["questCMD"] = command
- event.QuestButtonClick(int(constInfo.IGShop["qID"]))
- def HideItems(self):
- #Hide items 1
- self.ItemText1.Hide()
- self.SEPrice1.Hide()
- self.YangPrice1.Hide()
- self.Owner1.Hide()
- self.img1.Hide()
- self.c1.Hide()
- self.YBuy1.Hide()
- self.SBuy1.Hide()
- if self.enableTradeSys:
- self.TBuy1.Hide()
- #Hide items 2
- self.ItemText2.Hide()
- self.SEPrice2.Hide()
- self.YangPrice2.Hide()
- self.Owner2.Hide()
- self.img2.Hide()
- self.c2.Hide()
- self.YBuy2.Hide()
- self.SBuy2.Hide()
- if self.enableTradeSys:
- self.TBuy2.Hide()
- #Hide items 3
- self.ItemText3.Hide()
- self.SEPrice3.Hide()
- self.YangPrice3.Hide()
- self.Owner3.Hide()
- self.img3.Hide()
- self.c3.Hide()
- self.YBuy3.Hide()
- self.SBuy3.Hide()
- if self.enableTradeSys:
- self.TBuy3.Hide()
- #Hide items 4
- self.ItemText4.Hide()
- self.SEPrice4.Hide()
- self.YangPrice4.Hide()
- self.Owner4.Hide()
- self.img4.Hide()
- self.c4.Hide()
- self.YBuy4.Hide()
- self.SBuy4.Hide()
- if self.enableTradeSys:
- self.TBuy4.Hide()
- #Hide items 5
- self.ItemText5.Hide()
- self.SEPrice5.Hide()
- self.YangPrice5.Hide()
- self.Owner5.Hide()
- self.img5.Hide()
- self.c5.Hide()
- self.YBuy5.Hide()
- self.SBuy5.Hide()
- if self.enableTradeSys:
- self.TBuy5.Hide()
- #Hide pageswitch buttons
- self.NextPage.Hide()
- self.PrevPage.Hide()
- #Hide my bought items objects
- self.OldOwner1.Hide()
- self.OldOwner2.Hide()
- self.OldOwner3.Hide()
- self.OldOwner4.Hide()
- self.OldOwner5.Hide()
- self.ClaimItem1.Hide()
- self.ClaimItem2.Hide()
- self.ClaimItem3.Hide()
- self.ClaimItem4.Hide()
- self.ClaimItem5.Hide()
- #Hide count board
- self.ICBoard.Close()
- #Hide add item board
- self.Slots.Hide()
- self.TipX2.Hide()
- self.TipX1.Hide()
- self.PreviY.Hide()
- self.PreviS.Hide()
- self.Previ1.Hide()
- self.Previ2.Hide()
- self.InputS.SetText("0")
- self.InputY.SetText("0")
- #self.TipY.Hide()
- #self.TipS.Hide()
- self.PriceY.Hide()
- self.PriceS.Hide()
- self.Stone1.Hide()
- self.Stone2.Hide()
- self.Stone3.Hide()
- self.Stone4.Hide()
- self.Stone5.Hide()
- self.Stone6.Hide()
- self.Stone7.Hide()
- self.Stone8.Hide()
- self.Stone9.Hide()
- self.Stone10.Hide()
- self.ToSale.Hide()
- if self.enableTradeSys:
- self.tradeTo.Hide()
- self.slotbar_InputS.Hide()
- self.slotbar_InputY.Hide()
- self.InputS.Hide()
- self.InputY.Hide()
- self.Slots.ClearSlot(1)
- self.Slots.ClearSlot(2)
- self.Slots.ClearSlot(3)
- self.Slots.RefreshSlot()
- self.slotbar_GetMoney.Hide()
- self.GetMoney.Hide()
- self.GetMoneyBut.Hide()
- def AddItemToTradeItem(self, pos, vnum, count, buyer_name, itemID):
- item.SelectItem(vnum)
- table = [[self.TBuy1, self.Owner1, self.img1, self.ItemText1], [self.TBuy2, self.Owner2, self.img2, self.ItemText2],[self.TBuy3, self.Owner3, self.img3, self.ItemText3],[self.TBuy4, self.Owner4, self.img4, self.ItemText4],[self.TBuy5, self.Owner5, self.img5, self.ItemText5]]
- table[pos-1][0].Show()
- table[pos-1][1].SetText(buyer_name)
- table[pos-1][1].Show()
- table[pos-1][2].LoadImage(item.GetIconImageFileName())
- table[pos-1][2].Show()
- table[pos-1][3].SetText(item.GetItemName())
- table[pos-1][3].Show()
- if pos == 1:
- self.slot1 = itemID
- elif pos == 2:
- self.slot2 = itemID
- elif pos == 3:
- self.slot3 = itemID
- elif pos == 4:
- self.slot4 = itemID
- elif pos == 5:
- self.slot5 = itemID
- def AddItem(self, slot, id, vnum, item_name, count, owner_name, price_se, price_yang, isTradeItem):
- item.SelectItem(vnum)
- if slot == 1:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy1.Show()
- else:
- self.TBuy1.Hide()
- self.slot1 = id
- self.ItemText1.SetText(item_name)
- self.Owner1.SetText(owner_name)
- self.ItemText1.Show()
- self.Owner1.Show()
- self.img1.LoadImage(item.GetIconImageFileName())
- self.img1.Show()
- self.count1 = int(count)
- if int(count) > 1:
- self.c1.SetText(count)
- self.c1.Show()
- #self.YBuy1.Show()
- if int(price_yang) > 0:
- self.YBuy1.Show()
- self.YangPrice1.SetText(price_yang)
- self.YangPrice1.Show()
- if int(price_se) > 0:
- self.SBuy1.Show()
- self.SEPrice1.SetText(price_se)
- self.SEPrice1.Show()
- elif slot == 2:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy2.Show()
- else:
- self.TBuy2.Hide()
- self.slot2 = id
- self.ItemText2.SetText(item_name)
- self.Owner2.SetText(owner_name)
- self.ItemText2.Show()
- self.Owner2.Show()
- self.img2.LoadImage(item.GetIconImageFileName())
- self.img2.Show()
- self.count2 = int(count)
- if int(count) > 1:
- self.c2.SetText(count)
- self.c2.Show()
- if int(price_yang) > 0:
- self.YBuy2.Show()
- self.YangPrice2.SetText(price_yang)
- self.YangPrice2.Show()
- if int(price_se) > 0:
- self.SBuy2.Show()
- self.SEPrice2.SetText(price_se)
- self.SEPrice2.Show()
- elif slot == 3:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy3.Show()
- else:
- self.TBuy3.Hide()
- self.slot3 = id
- self.ItemText3.SetText(item_name)
- self.Owner3.SetText(owner_name)
- self.ItemText3.Show()
- self.Owner3.Show()
- self.img3.LoadImage(item.GetIconImageFileName())
- self.img3.Show()
- self.count3 = int(count)
- if int(count) > 1:
- self.c3.SetText(count)
- self.c3.Show()
- if int(price_yang) > 0:
- self.YBuy3.Show()
- self.YangPrice3.SetText(price_yang)
- self.YangPrice3.Show()
- if int(price_se) > 0:
- self.SBuy3.Show()
- self.SEPrice3.SetText(price_se)
- self.SEPrice3.Show()
- elif slot == 4:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy4.Show()
- else:
- self.TBuy4.Hide()
- self.slot4 = id
- self.ItemText4.SetText(item_name)
- self.Owner4.SetText(owner_name)
- self.ItemText4.Show()
- self.Owner4.Show()
- self.img4.LoadImage(item.GetIconImageFileName())
- self.img4.Show()
- self.count4 = int(count)
- if int(count) > 1:
- self.c4.SetText(count)
- self.c4.Show()
- if int(price_yang) > 0:
- self.YBuy4.Show()
- self.YangPrice4.SetText(price_yang)
- self.YangPrice4.Show()
- if int(price_se) > 0:
- self.SBuy4.Show()
- self.SEPrice4.SetText(price_se)
- self.SEPrice4.Show()
- elif slot == 5:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy5.Show()
- else:
- self.TBuy5.Hide()
- self.slot5 = id
- self.ItemText5.SetText(item_name)
- self.Owner5.SetText(owner_name)
- self.ItemText5.Show()
- self.YangPrice5.Show()
- self.Owner5.Show()
- self.img5.LoadImage(item.GetIconImageFileName())
- self.img5.Show()
- self.count5 = int(count)
- if int(count) > 1:
- self.c5.SetText(count)
- self.c5.Show()
- if int(price_yang) > 0:
- self.YBuy5.Show()
- self.YangPrice5.SetText(price_yang)
- self.YangPrice5.Show()
- if int(price_se) > 0:
- self.SBuy5.Show()
- self.SEPrice5.SetText(price_se)
- self.SEPrice5.Show()
- def AddItemToBoughtItems(self, slot, id, vnum, item_name, count, owner_name, isTradeItem):
- item.SelectItem(vnum)
- if slot == 1:
- self.slot1 = id
- self.ItemText1.SetText(item_name)
- self.OldOwner1.SetText(owner_name)
- self.ItemText1.Show()
- self.OldOwner1.Show()
- self.ClaimItem1.Show()
- self.img1.LoadImage(item.GetIconImageFileName())
- self.img1.Show()
- self.count1 = int(count)
- if int(count) > 1:
- self.c1.SetText(count)
- self.c1.Show()
- elif slot == 2:
- self.slot2 = id
- self.ItemText2.SetText(item_name)
- self.OldOwner2.SetText(owner_name)
- self.ItemText2.Show()
- self.OldOwner2.Show()
- self.ClaimItem2.Show()
- self.img2.LoadImage(item.GetIconImageFileName())
- self.img2.Show()
- self.count2 = int(count)
- if int(count) > 1:
- self.c2.SetText(count)
- self.c2.Show()
- elif slot == 3:
- self.slot3 = id
- self.ItemText3.SetText(item_name)
- self.OldOwner3.SetText(owner_name)
- self.ItemText3.Show()
- self.OldOwner3.Show()
- self.ClaimItem3.Show()
- self.img3.LoadImage(item.GetIconImageFileName())
- self.img3.Show()
- self.count3 = int(count)
- if int(count) > 1:
- self.c3.SetText(count)
- self.c3.Show()
- elif slot == 4:
- self.slot4 = id
- self.ItemText4.SetText(item_name)
- self.OldOwner4.SetText(owner_name)
- self.ItemText4.Show()
- self.OldOwner4.Show()
- self.ClaimItem4.Show()
- self.img4.LoadImage(item.GetIconImageFileName())
- self.img4.Show()
- self.count4 = int(count)
- if int(count) > 1:
- self.c4.SetText(count)
- self.c4.Show()
- elif slot == 5:
- self.slot5 = id
- self.ItemText5.SetText(item_name)
- self.OldOwner5.SetText(owner_name)
- self.ItemText5.Show()
- self.OldOwner5.Show()
- self.ClaimItem5.Show()
- self.img5.LoadImage(item.GetIconImageFileName())
- self.img5.Show()
- self.count5 = int(count)
- if int(count) > 1:
- self.c5.SetText(count)
- self.c5.Show()
- def AddItemToMyItems(self, slot, id, vnum, item_name, count, istate, isTradeItem):
- item.SelectItem(vnum)
- if slot == 1:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy1.Show()
- else:
- self.TBuy1.Hide()
- self.slot1 = id
- self.ItemText1.SetText(item_name)
- """if istate <= 0:
- self.OldOwner1.Show()
- self.OldOwner1.SetText("A tárgy lejárt")"""
- self.ItemText1.Show()
- self.ClaimItem1.Show()
- self.img1.LoadImage(item.GetIconImageFileName())
- self.img1.Show()
- self.count1 = int(count)
- if int(count) > 1:
- self.c1.SetText(count)
- self.c1.Show()
- elif slot == 2:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy2.Show()
- else:
- self.TBuy2.Hide()
- self.slot2 = id
- self.ItemText2.SetText(item_name)
- """if istate <= 0:
- self.OldOwner2.Show()
- self.OldOwner2.SetText("A tárgy lejárt")"""
- self.ItemText2.Show()
- self.ClaimItem2.Show()
- self.img2.LoadImage(item.GetIconImageFileName())
- self.img2.Show()
- self.count2 = int(count)
- if int(count) > 1:
- self.c2.SetText(count)
- self.c2.Show()
- elif slot == 3:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy3.Show()
- else:
- self.TBuy3.Hide()
- self.slot3 = id
- self.ItemText3.SetText(item_name)
- """if istate <= 0:
- self.OldOwner3.Show()
- self.OldOwner3.SetText("A tárgy lejárt")"""
- self.ItemText3.Show()
- self.ClaimItem3.Show()
- self.img3.LoadImage(item.GetIconImageFileName())
- self.img3.Show()
- self.count3 = int(count)
- if int(count) > 1:
- self.c3.SetText(count)
- self.c3.Show()
- elif slot == 4:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy4.Show()
- else:
- self.TBuy4.Hide()
- self.slot4 = id
- self.ItemText4.SetText(item_name)
- """if istate <= 0:
- self.OldOwner4.Show()
- self.OldOwner4.SetText("A tárgy lejárt")"""
- self.ItemText4.Show()
- self.ClaimItem4.Show()
- self.img4.LoadImage(item.GetIconImageFileName())
- self.img4.Show()
- self.count4 = int(count)
- if int(count) > 1:
- self.c4.SetText(count)
- self.c4.Show()
- elif slot == 5:
- if self.enableTradeSys:
- if isTradeItem == 1:
- self.TBuy5.Show()
- else:
- self.TBuy5.Hide()
- self.slot5 = id
- self.ItemText5.SetText(item_name)
- """if istate <= 0:
- self.OldOwner5.Show()
- self.OldOwner5.SetText("A tárgy lejárt")"""
- self.ItemText5.Show()
- self.ClaimItem5.Show()
- self.img5.LoadImage(item.GetIconImageFileName())
- self.img5.Show()
- self.count5 = int(count)
- if int(count) > 1:
- self.c5.SetText(count)
- self.c5.Show()
- def ManagePageButtons(self, maxpage, page):
- if page < maxpage:
- self.NextPage.Show()
- if page > 1:
- self.PrevPage.Show()
- self.page = page
- self.maxpage = maxpage
- class Component:
- def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual, DisableVisual = ""):
- button = ui.Button()
- if parent != None:
- button.SetParent(parent)
- button.SetPosition(x, y)
- button.SetUpVisual(UpVisual)
- button.SetOverVisual(OverVisual)
- button.SetDownVisual(DownVisual)
- if DisableVisual != "":
- button.SetDisableVisual(DisableVisual)
- button.SetText(buttonName)
- button.SetToolTipText(tooltipText)
- button.Hide()
- button.SetEvent(func)
- return button
- def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
- button = ui.ToggleButton()
- if parent != None:
- button.SetParent(parent)
- button.SetPosition(x, y)
- button.SetUpVisual(UpVisual)
- button.SetOverVisual(OverVisual)
- button.SetDownVisual(DownVisual)
- button.SetText(buttonName)
- button.SetToolTipText(tooltipText)
- button.Show()
- button.SetToggleUpEvent(funcUp)
- button.SetToggleDownEvent(funcDown)
- return button
- def EditLine(self, parent, editlineText, x, y, width, heigh, max):
- SlotBar = ui.SlotBar()
- if parent != None:
- SlotBar.SetParent(parent)
- SlotBar.SetSize(width, heigh)
- SlotBar.SetPosition(x, y)
- SlotBar.Show()
- Value = ui.EditLine()
- Value.SetParent(SlotBar)
- Value.SetSize(width, heigh)
- Value.SetPosition(1, 1)
- Value.SetMax(max)
- Value.SetLimitWidth(width)
- Value.SetMultiLine()
- Value.SetText(editlineText)
- Value.Show()
- return SlotBar, Value
- def TextLine(self, parent, textlineText, x, y, color):
- textline = ui.TextLine()
- if parent != None:
- textline.SetParent(parent)
- textline.SetPosition(x, y)
- if color != None:
- textline.SetFontColor(color[0], color[1], color[2])
- textline.SetText(textlineText)
- textline.Hide()
- return textline
- def RGB(self, r, g, b):
- return (r*255, g*255, b*255)
- def SliderBar(self, parent, sliderPos, func, x, y):
- Slider = ui.SliderBar()
- if parent != None:
- Slider.SetParent(parent)
- Slider.SetPosition(x, y)
- Slider.SetSliderPos(sliderPos / 100)
- Slider.Show()
- Slider.SetEvent(func)
- return Slider
- def ExpandedImage(self, parent, x, y, img):
- image = ui.ExpandedImageBox()
- if parent != None:
- image.SetParent(parent)
- image.SetPosition(x, y)
- image.LoadImage(img)
- image.Hide()
- return image
- def ComboBox(self, parent, text, x, y, width):
- combo = ui.ComboBox()
- if parent != None:
- combo.SetParent(parent)
- combo.SetPosition(x, y)
- combo.SetSize(width, 15)
- combo.SetCurrentItem(text)
- combo.Show()
- return combo
- def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
- thin = ui.ThinBoard()
- if parent != None:
- thin.SetParent(parent)
- if moveable == True:
- thin.AddFlag('movable')
- thin.AddFlag('float')
- thin.SetSize(width, heigh)
- thin.SetPosition(x, y)
- if center == True:
- thin.SetCenterPosition()
- thin.Show()
- return thin
- def Gauge(self, parent, width, color, x, y):
- gauge = ui.Gauge()
- if parent != None:
- gauge.SetParent(parent)
- gauge.SetPosition(x, y)
- gauge.MakeGauge(width, color)
- gauge.Show()
- return gauge
- def ListBoxEx(self, parent, x, y, width, heigh):
- bar = ui.Bar()
- if parent != None:
- bar.SetParent(parent)
- bar.SetPosition(x, y)
- bar.SetSize(width, heigh)
- bar.SetColor(0x77000000)
- bar.Show()
- ListBox=ui.IgShopListBox("UI",True)
- ListBox.SetParent(bar)
- ListBox.SetPosition(0, 0)
- ListBox.SetSize(width, heigh)
- ListBox.Show()
- """scroll = ui.ScrollBar()
- scroll.SetParent(ListBox)
- scroll.SetPosition(width-15, 0)
- scroll.SetScrollBarSize(heigh)
- scroll.Hide()
- ListBox.SetScrollBar(scroll)"""
- return bar, ListBox
- 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[:50])
- def __del__(self):
- ui.ListBoxEx.Item.__del__(self)
- def GetText(self):
- return self.text
- def SetSize(self, width, height):
- ui.ListBoxEx.Item.SetSize(self, 7*len(self.textLine.GetText()) + 4, height)
- def __CreateTextLine(self, text):
- textLine=ui.TextLine()
- textLine.SetParent(self)
- textLine.SetPosition(0, 0)
- textLine.SetText(text)
- textLine.Show()
- return textLine
- class TradeDialog(ui.Window):
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.maxSlotNum = 7*6
- self.tempContainer = []
- self.representedSlots = []
- self.maxRecords = 0
- self.oldNumber = -1
- self.masterWindow = masterWindow
- self.BuildWindow()
- self.SetCenterPosition()
- self.Close()
- def __del__(self):
- ui.Window.__del__(self)
- def BuildWindow(self):
- self.SetCenterPosition()
- self.SetSize(473+32, 263+30)
- self.AddFlag('float')
- self.AddFlag('movable')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(477+33, 263+30)
- self.Board.SetTitleName(trans(31))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- self.TradeToText = self.comp.TextLine(self.Board, trans(32), 94, 28, self.comp.RGB(255, 255, 255))
- self.TradeToText.Show()
- self.YourItems = self.comp.TextLine(self.Board, trans(33), 338, 28, self.comp.RGB(255, 255, 255))
- self.YourItems.Show()
- self.wants = ui.GridSlotWindow()
- self.wants.SetParent(self.Board)
- self.wants.SetPosition(10, 50)
- self.wants.ArrangeSlot(1, 7, 6, 32, 32, 0, 0)
- self.wants.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.wants.Show()
- self.gives = ui.GridSlotWindow()
- self.gives.SetParent(self.Board)
- self.gives.SetPosition(10+224+40, 50)
- self.gives.ArrangeSlot(1, 7, 6, 32, 32, 0, 0)
- self.gives.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.gives.Show()
- self.DoItButton = self.comp.Button(self.Board, trans(34), '', 255-45, 50+32*6+15, self.DoIt, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.DoItButton.Show()
- self.wants.SetOverInItemEvent(ui.__mem_func__(self.OverInItemWants))
- self.wants.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.gives.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
- self.gives.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
- self.gives.SetOverInItemEvent(ui.__mem_func__(self.OverInItemGives))
- self.gives.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- def DoIt(self):
- if self.maxRecords <= len(self.representedSlots) and self.maxRecords > 0:
- self.masterWindow.QuestCMD("trade.ApplyTrade")
- def OnPressEscapeKey(self):
- self.Close()
- def OnUpdate(self):
- if not self.masterWindow.IsShow():
- self.Close()
- if self.oldNumber != len(self.representedSlots):
- if self.maxRecords <= len(self.representedSlots) and self.maxRecords > 0:
- self.DoItButton.Enable()
- else:
- self.DoItButton.Disable()
- self.oldNumber = len(self.representedSlots)
- def Open(self):
- self.ClearAllSlots()
- self.Show()
- def Close(self):
- self.ClearAllSlots()
- self.Hide()
- def ClearAllSlots(self):
- self.slotArray = []
- self.givesArray = []
- self.applyedSlots = []
- self.representedSlots = []
- self.maxRecords = 0
- for i in xrange(1, self.maxSlotNum+1):
- self.wants.ClearSlot(i)
- self.gives.ClearSlot(i)
- self.slotArray.append([])
- self.givesArray.append([])
- self.slotArray.append([])
- self.givesArray.append([])
- self.wants.RefreshSlot()
- self.gives.RefreshSlot()
- def AppendWantsItem(self, pos, vnum, count, socketContainer, attrContainer):
- if count <= 1:
- count = 0
- self.wants.SetItemSlot(pos, vnum, count)
- self.wants.RefreshSlot()
- self.slotArray[pos].append(vnum)
- self.slotArray[pos].append(count)
- self.slotArray[pos].append(socketContainer)
- self.slotArray[pos].append(attrContainer)
- self.maxRecords += 1
- def OverInItemWants(self, slotNum):
- self.masterWindow.toolTip.ClearToolTip()
- if len(self.slotArray[slotNum]) > 0:
- self.masterWindow.toolTip.AddItemData(self.slotArray[slotNum][0],self.slotArray[slotNum][2],self.slotArray[slotNum][3])
- def OverInItemGives(self, slotNum):
- self.masterWindow.toolTip.ClearToolTip()
- if len(self.givesArray[slotNum]) > 0:
- self.masterWindow.toolTip.AddItemData(self.givesArray[slotNum][0],self.givesArray[slotNum][2],self.givesArray[slotNum][3])
- def OverOutItem(self):
- self.masterWindow.toolTip.Hide()
- def SelectEmptySlot(self, itemSlotIndex):
- if mouseModule.mouseController.isAttached():
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- if attachedSlotType == player.SLOT_TYPE_INVENTORY:
- """itemVnum = player.GetItemIndex(player.SLOT_TYPE_INVENTORY, attachedSlotPos)
- chat.AppendChat(chat.CHAT_TYPE_INFO, str(itemVnum))"""
- self.CheckTradeItem(attachedSlotPos, itemSlotIndex, mouseModule.mouseController.GetAttachedItemCount())
- mouseModule.mouseController.DeattachObject()
- def UnselectItemSlot(self, itemSlotIndex):
- self.givesArray[itemSlotIndex] = []
- self.gives.ClearSlot(itemSlotIndex)
- self.gives.RefreshSlot()
- self.tempContainer = []
- for i in self.applyedSlots:
- if i[1] == itemSlotIndex:
- self.representedSlots.remove(i[0])
- self.applyedSlots.remove(i)
- break
- self.masterWindow.QuestCMD("trade.RemoveGivesSlot#" + str(itemSlotIndex))
- def SuccessAppend(self, pos):
- count = self.tempContainer[1]
- if count <= 1:
- count = 0
- self.gives.SetItemSlot(pos, self.tempContainer[0], count)
- self.gives.RefreshSlot()
- self.givesArray[pos] = []
- self.givesArray[pos].append(self.tempContainer[0])
- self.givesArray[pos].append(self.tempContainer[1])
- self.givesArray[pos].append(self.tempContainer[2])
- self.givesArray[pos].append(self.tempContainer[3])
- self.tempContainer = []
- def CheckTradeItem(self, inventoryPos, myPos, count):
- itemVnum = player.GetItemIndex(player.SLOT_TYPE_INVENTORY, inventoryPos)
- if itemVnum <= 0:
- return
- if self.maxRecords <= len(self.representedSlots):
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(35))
- return
- stoneContainer = [0,0,0]
- applyContainer = []
- for i in xrange(0, self.masterWindow.maximumStoneNum):
- stoneContainer[i] = player.GetItemMetinSocket(player.SLOT_TYPE_INVENTORY, inventoryPos, i)
- for i in xrange(0, self.masterWindow.maximumApplyNum):
- applyContainer.append(player.GetItemAttribute(player.SLOT_TYPE_INVENTORY, inventoryPos, i))
- posibilities = []
- for i in xrange(1, self.maxSlotNum+1):
- s_found = False
- for m_Pos in self.applyedSlots:
- if i == m_Pos[0]:
- s_found = True
- break
- if s_found:
- continue
- if len(self.slotArray[i]) <= 0:
- continue
- if self.slotArray[i][0] != itemVnum:
- continue
- countFix = self.slotArray[i][1]
- if countFix <= 0:
- countFix = 1
- if countFix != count:
- continue
- m_found = True
- for y in self.slotArray[i][2]:
- if y == 1:
- this_pos = self.slotArray[i][2].index(y)
- if stoneContainer[this_pos] < 1:
- m_found = False
- break
- elif y > 1 and y != 28960:
- found = False
- for z in stoneContainer:
- if y == z:
- found = True
- break
- if not found:
- m_found = False
- break
- m_found = True
- if not m_found:
- continue
- m_found = True
- for y in xrange(0, self.masterWindow.maximumApplyNum):
- if self.slotArray[i][3][y][0] <= 0:
- continue
- if y < 5:
- found = False
- for z in xrange(0, 5):
- if applyContainer[z][0] == self.slotArray[i][3][y][0]:
- if self.slotArray[i][3][y][1] <= applyContainer[z][1]:
- found = True
- break
- if not found:
- m_found = False
- break
- m_found = True
- else:
- found = False
- for z in xrange(5, 7):
- if applyContainer[z][0] == self.slotArray[i][3][y][0]:
- if self.slotArray[i][3][y][1] <= applyContainer[z][1]:
- found = True
- break
- if not found:
- m_found = False
- break
- m_found = True
- if not m_found:
- continue
- posibilities.append(i)
- if len(posibilities) > 0:
- self.applyedSlots.append([posibilities[0], myPos, posibilities]) # which item from the wantsList represented by this one; position in givesList; which items could be represeted by this one
- self.representedSlots.append(posibilities[0])
- self.tempContainer = []
- self.tempContainer = [itemVnum, count, stoneContainer[:], applyContainer[:]]
- self.masterWindow.QuestCMD("trade.CheckTradeItem#"+str(posibilities[0])+"#"+str(inventoryPos)+"#"+str(len(self.applyedSlots)-1)+"#"+str(myPos))
- return
- else:
- secondAvailability = []
- secondAvailabilityIDs = []
- for trys in self.applyedSlots:
- if len(trys[2]) > 1:
- if self.SecondChance(trys[0],stoneContainer, applyContainer, itemVnum, count):
- secondAvailability.append(trys)
- secondAvailabilityIDs.append(trys[0])
- if len(secondAvailability) > 0:
- my_ID = 0
- old_myPos = 0
- old_newID = 0
- for k in secondAvailability:
- for j in k[2]:
- if j in self.representedSlots:
- continue
- else:
- my_ID = k[0]
- k[0] = j
- old_myPos = k[1]
- old_newID = j
- self.representedSlots.append(j)
- break
- if my_ID > 0:
- break
- if my_ID > 0:
- self.applyedSlots.append([my_ID, myPos, secondAvailabilityIDs])
- self.tempContainer = []
- self.tempContainer = [itemVnum, count, stoneContainer[:], applyContainer[:]]
- self.masterWindow.QuestCMD("trade.SecondWave#"+str(old_newID)+"#"+str(old_myPos)+"#"+str(my_ID)+"#"+str(myPos)+"#"+str(inventoryPos))
- return
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(36))
- def SecondChance(self, pos, stoneContainer, applyContainer, itemVnum, count):
- if len(self.slotArray[pos]) <= 0:
- return False
- if self.slotArray[pos][0] != itemVnum:
- return False
- countFix = self.slotArray[pos][1]
- if countFix <= 0:
- countFix = 1
- if countFix != count:
- return False
- m_found = True
- for y in self.slotArray[pos][2]:
- if y == 1:
- this_pos = self.slotArray[pos][2].index(y)
- if stoneContainer[this_pos] < 1:
- m_found = False
- break
- elif y > 1 and y != 28960:
- found = False
- for z in stoneContainer:
- if y == z:
- found = True
- break
- if not found:
- m_found = False
- break
- m_found = True
- if not m_found:
- return False
- m_found = True
- for y in xrange(0, self.masterWindow.maximumApplyNum):
- if self.slotArray[pos][3][y][0] <= 0:
- continue
- if y < 5:
- found = False
- for z in xrange(0, 5):
- if applyContainer[z][0] == self.slotArray[pos][3][y][0]:
- if self.slotArray[pos][3][y][1] <= applyContainer[z][1]:
- found = True
- break
- if not found:
- m_found = False
- break
- m_found = True
- else:
- found = False
- for z in xrange(5, 7):
- if applyContainer[z][0] == self.slotArray[pos][3][y][0]:
- if self.slotArray[pos][3][y][1] <= applyContainer[z][1]:
- found = True
- break
- if not found:
- m_found = False
- break
- m_found = True
- if not m_found:
- return False
- return True
- class ExchangeSellDialog(ui.Window):
- class EnchantmentsMenu(ui.Window):
- class FileListDialog(ui.ThinBoard):
- def __init__(self, masterWindow):
- ui.ThinBoard.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.lastX = 0
- self.lastY = 0
- self.realApplyNum = []
- self.LoadUI()
- self.UpdateFileList()
- self.Hide()
- def __del__(self):
- ui.ThinBoard.__del__(self)
- def OnUpdate(self):
- x,y = self.masterWindow.masterWindow.GetGlobalPosition()
- if x != self.lastX or y != self.lastY:
- self.SetPosition(x+ self.masterWindow.masterWindow.GetWidth(), y)
- self.lastX = x
- self.lastY = y
- def Open(self):
- self.Show()
- #self.UpdateFileList()
- def Close(self):
- self.Hide()
- def OnPressEscapeKey(self):
- self.Close()
- def LoadUI(self):
- self.SetCenterPosition()
- self.SetSize(300, 263+30)
- self.AddFlag("float")
- self.fileListBox = ui.ListBoxEx()
- self.fileListBox.SetParent(self)
- self.fileListBox.SetPosition(15, 50 - 12)
- self.fileListBox.Show()
- self.ScrollBar = ui.ScrollBar()
- self.ScrollBar.SetParent(self)
- self.ScrollBar.SetPosition(140+130, 40 - 12)
- self.ScrollBar.SetScrollBarSize(220)
- self.ScrollBar.Show()
- self.selectBonusText = ui.TextLine()
- self.selectBonusText.SetParent(self)
- self.selectBonusText.SetDefaultFontName()
- self.selectBonusText.SetPosition(150, 29 - 12)
- self.selectBonusText.SetFeather()
- self.selectBonusText.SetText(trans(37))
- self.selectBonusText.SetHorizontalAlignCenter()
- self.selectBonusText.SetFontColor(0.2, 0.2, 1.0)
- self.selectBonusText.SetOutline()
- self.selectBonusText.Show()
- self.fileListBox.SetScrollBar(self.ScrollBar)
- self.SelectBonus = ui.Button()
- self.SelectBonus.SetParent(self)
- self.SelectBonus.SetPosition(19, 265 - 12)
- self.SelectBonus.SetUpVisual("d:/ymir work/ui/public/Middle_Button_01.sub")
- self.SelectBonus.SetOverVisual("d:/ymir work/ui/public/Middle_Button_02.sub")
- self.SelectBonus.SetDownVisual("d:/ymir work/ui/public/Middle_Button_03.sub")
- self.SelectBonus.SetText(trans(38))
- self.SelectBonus.SetEvent(ui.__mem_func__(self.SetBonis))
- self.SelectBonus.Show()
- self.CancelBonus = ui.Button()
- self.CancelBonus.SetParent(self)
- self.CancelBonus.SetPosition(89+130, 265 - 12)
- self.CancelBonus.SetUpVisual("d:/ymir work/ui/public/Middle_Button_01.sub")
- self.CancelBonus.SetOverVisual("d:/ymir work/ui/public/Middle_Button_02.sub")
- self.CancelBonus.SetDownVisual("d:/ymir work/ui/public/Middle_Button_03.sub")
- self.CancelBonus.SetText(trans(39))
- self.CancelBonus.SetEvent(ui.__mem_func__(self.Close))
- self.CancelBonus.Show()
- def UpdateFileList(self):
- self.fileListBox.RemoveAllItems()
- for BonusType in xrange(1, max(self.masterWindow.masterWindow.masterWindow.toolTip.AFFECT_DICT)+1):
- try:
- self.fileListBox.AppendItem(Item(self.masterWindow.masterWindow.masterWindow.toolTip.AFFECT_DICT[BonusType](0)))
- self.realApplyNum.append(BonusType)
- except:
- pass
- #chat.AppendChat(chat.CHAT_TYPE_INFO, str(BonusIDListe[BonusType]))
- def SetBonis(self):
- if len(self.realApplyNum) <= 0:
- return
- idx = self.fileListBox.GetItemIndex(self.fileListBox.GetSelectedItem())
- idx = self.realApplyNum[idx]
- #chat.AppendChat(chat.CHAT_TYPE_INFO, str(idx))
- self.masterWindow.RegisterBonusType(idx)
- self.Close()
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.listDialog = self.FileListDialog(self)
- self.lastX = 0
- self.lastY = 0
- self.selectedType = 0
- self.oldValue = 0
- self.pos = 0
- self.LoadUI()
- self.Hide()
- def __del__(self):
- ui.Window.__del__(self)
- def LoadUI(self):
- self.SetCenterPosition()
- self.SetSize(477+33-250, 263+30-200+25)
- self.AddFlag('float')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(477+33-250, 263+30-200+25)
- self.Board.SetTitleName(trans(40))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- ## bonus board
- self.applyTextHelp = self.comp.TextLine(self.Board, trans(41), 340+25+16-250, 154 + 75-200, self.comp.RGB(255, 255, 255))
- self.applyTextHelp.SetHorizontalAlignCenter()
- self.applyTextHelp.Show()
- self.applyText = self.comp.TextLine(self.Board, trans(42), 340+25+16-250, 230 + 15-200, self.comp.RGB(255, 154, 0))
- self.applyText.SetHorizontalAlignCenter()
- self.applyText.Show()
- self.setApplyType = self.comp.Button(self.Board, trans(38), '', 340 - 60-250, 245 + 15-200, self.SetApplyType_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- #self.setApplyType1.SetWindowHorizontalAlignCenter()
- self.setApplyType.Show()
- self.setApplyValue = self.comp.Button(self.Board, trans(43), '', 340 +100-250 + 3, 245 + 15-200, self.SetApplyValue_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.setApplyValue.Show()
- self.delApplyValue = self.comp.Button(self.Board, trans(44), '', (477+33-250)/2 - 43/2, 245 + 15-200+25, self.DelApplyValue_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.delApplyValue.Show()
- self.slotbar_inputApplyValue, self.inputApplyValue = self.comp.EditLine(self.Board, '0', 340 +65-250, 245 + 15+2-200, 33, 15, 6)
- self.inputApplyValueText = self.comp.TextLine(self.Board, trans(45), 340 +63-250, 245 + 15+4-200, self.comp.RGB(255, 255, 255))
- self.inputApplyValueText.SetHorizontalAlignRight()
- self.inputApplyValueText.Show()
- ##bonus board end
- def DelApplyValue_func(self):
- self.selectedType = 0
- self.oldValue = 0
- self.inputApplyValue.SetText("0")
- self.applyText.SetText(trans(42))
- self.masterWindow.SetApply(self.pos, self.selectedType, self.oldValue)
- def RegisterBonusType(self, id):
- if id == 48 or id == 49 or id == 50:
- self.HideItemsWhenNoValue()
- else:
- self.ShowItemsWhenNoValue()
- self.selectedType = id
- self.applyText.SetText(self.masterWindow.masterWindow.toolTip.AFFECT_DICT[id](self.oldValue))
- def Open(self, pos, id = 0, value = 0):
- if id <= 0:
- self.applyText.SetText(trans(42))
- self.ShowItemsWhenNoValue()
- elif id == 48 or id == 49 or id == 50:
- self.HideItemsWhenNoValue()
- else:
- self.ShowItemsWhenNoValue()
- self.applyText.SetText(self.masterWindow.masterWindow.toolTip.AFFECT_DICT[id](value))
- self.inputApplyValue.SetText(str(value))
- self.selectedType = id
- self.oldValue = value
- self.applyTextHelp.SetText(posArranger(str(pos), 46))
- self.pos = pos
- self.Show()
- def SetApplyType_func(self):
- if self.listDialog.IsShow():
- self.listDialog.Close()
- else:
- self.listDialog.Open()
- def SetApplyValue_func(self):
- if self.selectedType <= 0:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(47))
- return
- if self.selectedType == 48 or self.selectedType == 49 or self.selectedType == 50:
- self.inputApplyValue.SetText("1")
- self.oldValue = 1
- if self.oldValue == 0:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(48))
- return
- if self.pos < 6:
- for i in xrange(0, 5):
- if self.masterWindow.bonusContainer[i][0] == self.selectedType and i != self.pos -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(49))
- return
- else:
- for i in xrange(5, 7):
- if self.masterWindow.bonusContainer[i][0] == self.selectedType and i != self.pos -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(49))
- return
- self.masterWindow.SetApply(self.pos, self.selectedType, self.oldValue)
- def HideItemsWhenNoValue(self):
- self.inputApplyValue.Hide()
- self.slotbar_inputApplyValue.Hide()
- self.inputApplyValueText.Hide()
- def ShowItemsWhenNoValue(self):
- self.inputApplyValue.Show()
- self.slotbar_inputApplyValue.Show()
- self.inputApplyValueText.Show()
- def Close(self):
- self.listDialog.Close()
- self.ShowItemsWhenNoValue()
- self.Hide()
- def OnUpdate(self):
- x,y = self.masterWindow.GetGlobalPosition()
- if x != self.lastX or y != self.lastY:
- self.SetPosition(x+ self.masterWindow.GetWidth()- self.GetWidth(), y-(263+30-200+25))
- self.lastX = x
- self.lastY = y
- if self.inputApplyValue.GetText() != "" and self.selectedType > 0:
- value = 0
- try:
- value = int(self.inputApplyValue.GetText())
- except:
- return
- if value > self.masterWindow.masterWindow.maximumBonusValue:
- value = self.masterWindow.masterWindow.maximumBonusValue
- self.inputApplyValue.SetText(str(value))
- if value < self.masterWindow.masterWindow.minimumBonusValue:
- value = self.masterWindow.masterWindow.minimumBonusValue
- self.inputApplyValue.SetText(str(value))
- if self.oldValue != value:
- self.applyText.SetText(self.masterWindow.masterWindow.toolTip.AFFECT_DICT[self.selectedType](value))
- self.oldValue = value
- def OnPressEscapeKey(self):
- self.Close()
- class StoneManagerWindow(ui.Window):
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.lastX = 0
- self.lastY = 0
- self.oldText = ""
- self.oldStone = 0
- self.pos = 0
- self.LoadUI()
- self.Hide()
- def __del__(self):
- ui.Window.__del__(self)
- def LoadUI(self):
- self.SetCenterPosition()
- self.SetSize(477+33-250, 263+30-200+25)
- self.AddFlag('float')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(477+33-250, 263+30-200+25)
- self.Board.SetTitleName(trans(50))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- self.stoneTextHelp = self.comp.TextLine(self.Board, trans(51), 340+25+16-250, 154 + 75-200, self.comp.RGB(255, 255, 255))
- self.stoneTextHelp.SetHorizontalAlignCenter()
- self.stoneTextHelp.Show()
- self.stoneText = self.comp.TextLine(self.Board, trans(42), 340+25+16-250, 230 + 15-200, self.comp.RGB(255, 154, 0))
- self.stoneText.SetHorizontalAlignCenter()
- self.stoneText.Show()
- self.setStone = self.comp.Button(self.Board, trans(38), '', 477+33-250-85, 245 + 15-200+25, self.SetStone_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.setStone.Show()
- self.delStone = self.comp.Button(self.Board, trans(44), '', 340 - 60-250, 245 + 15-200+25, self.DelStone_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.delStone.Show()
- self.slotbar_inputSetStone, self.inputSetStone = self.comp.EditLine(self.Board, '', (477+33-250-200)/2, 245 + 15+2-200, 200, 15, 24)
- def Open(self, pos, stoneVnum = 0):
- self.oldStone = stoneVnum
- if stoneVnum > 1:
- item.SelectItem(int(stoneVnum))
- self.stoneText.SetText(item.GetItemName())
- else:
- self.stoneText.SetText(trans(42))
- self.inputSetStone.SetText("")
- self.stoneTextHelp.SetText(posArranger(str(pos), 52))
- self.pos = pos
- self.Show()
- def DelStone_func(self):
- if self.pos < 3:
- if self.masterWindow.stoneContainer[self.pos] > 1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(53)+posArranger(str(self.pos+1), 54))
- return
- self.stoneText.SetText(trans(42))
- self.oldStone = 0
- self.oldText = ""
- self.inputSetStone.SetText("")
- self.masterWindow.stoneContainer[self.pos-1] = 1
- self.masterWindow.masterWindow.QuestCMD("trade.RemoveSocket#"+str(self.pos))
- def SetStone_func(self):
- mText = self.inputSetStone.GetText()
- if mText == self.oldText:
- return
- if len(mText) < 2:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(56))
- return
- if self.pos > 1:
- if self.masterWindow.stoneContainer[self.pos-2] <= 1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(79)+posArranger(str(self.pos-1), 55))
- return
- self.oldText = mText
- self.masterWindow.masterWindow.QuestCMD("trade.AppendSocket#"+ str(self.pos)+ "#"+self.masterWindow.masterWindow.replaceLUAMagicalCharacters(mText))
- def Close(self):
- self.inputSetStone.SetText("")
- self.stoneText.SetText(trans(42))
- self.oldText = ""
- self.oldStone = 0
- self.Hide()
- def OnUpdate(self):
- x,y = self.masterWindow.GetGlobalPosition()
- if x != self.lastX or y != self.lastY:
- self.SetPosition(x+ self.masterWindow.GetWidth()- self.GetWidth(), y+self.masterWindow.GetHeight())
- self.lastX = x
- self.lastY = y
- def OnPressEscapeKey(self):
- self.Close()
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.countCounter = False
- self.oldText = ""
- self.oldcount = 1
- self.latestAppendSlot = 0
- self.search_itemVnum = 0
- self.search_slot = 1
- self.search_isStackable = False
- self.maxSlotNum = 7*6
- self.maxSocket = 0
- self.slotArray = []
- self.savedSlotArray = []
- for i in xrange(0, self.maxSlotNum+1):
- self.slotArray.append([])
- self.savedSlotArray.append([])
- self.ClearContainers()
- self.enchantMenu = self.EnchantmentsMenu(self)
- self.stoneManager = self.StoneManagerWindow(self)
- self.BuildWindow()
- self.SetCenterPosition()
- self.HideCount()
- self.Hide()
- def __del__(self):
- ui.Window.__del__(self)
- def BuildWindow(self):
- self.SetCenterPosition()
- self.SetSize(477+33, 263+30+40)
- self.AddFlag('float')
- self.AddFlag('movable')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(477+33, 263+30+40)
- self.Board.SetTitleName(trans(57))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- self.TradeToText = self.comp.TextLine(self.Board, trans(58), 50+75, 28, self.comp.RGB(255, 255, 255))
- self.TradeToText.Show()
- self.TradeToText.SetHorizontalAlignCenter()
- self.selectText = self.comp.TextLine(self.Board, trans(59), 338 + 40, 28, self.comp.RGB(255, 255, 255))
- self.selectText.Show()
- self.selectText.SetHorizontalAlignCenter()
- self.wants = ui.GridSlotWindow()
- self.wants.SetParent(self.Board)
- self.wants.SetPosition(10, 50)
- self.wants.ArrangeSlot(1, 7, 6, 32, 32, 0, 0)
- self.wants.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.wants.Show()
- self.wants.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
- self.wants.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
- self.wants.SetOverInItemEvent(ui.__mem_func__(self.OverInItemWants))
- self.wants.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.preview = ui.GridSlotWindow()
- self.preview.SetParent(self.Board)
- self.preview.SetPosition(340+25, 50)
- self.preview.ArrangeSlot(1, 1, 3, 32, 32, 0, 0)
- self.preview.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.preview.Show()
- self.preview.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
- self.preview.SetOverInItemEvent(ui.__mem_func__(self.OverInItemPreview))
- self.preview.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.itemNameText = self.comp.TextLine(self.Board, trans(4)+":", 340+25+16, 50+32*3+8, self.comp.RGB(255, 255, 255))
- self.itemNameText.SetHorizontalAlignCenter()
- self.itemNameText.Show()
- self.slotbar_findItem, self.findItem = self.comp.EditLine(self.Board, '', 340-60, 50+32*3+28, 200, 15, 24)
- self.DoItButton = self.comp.Button(self.Board, trans(60), '', 255/2-45, 50+32*6+15+20, self.DoIt, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.DoItButton.Show()
- self.applySearch = self.comp.Button(self.Board, trans(61), '', 340+15, 50+32*3+28+20, self.applySearch_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.applySearch.Show()
- self.itemCountText = self.comp.TextLine(self.Board, trans(62), 340+25+32*2+25/2, 50+32+16-15, self.comp.RGB(255, 255, 255))
- self.itemCountText.SetHorizontalAlignCenter()
- self.itemCountText.Show()
- self.slotbar_InputCount, self.InputCount = self.comp.EditLine(self.Board, '1', 340+25+32*2, 50+32+16, 25, 15, 3)
- self.InputCount.SetNumberMode()
- self.bonusesText = self.comp.TextLine(self.Board, trans(63), 340+25+16, 50+32*3+28+20+24, self.comp.RGB(255, 255, 255))
- self.bonusesText.SetHorizontalAlignCenter()
- self.bonusesText.Show()
- self.applyBut1 = self.comp.Button(self.Board, '1.', '', 340-60 - 15, 50+32*3+28+20+24+18, self.applyBut1_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut1.Show()
- self.applyBut2 = self.comp.Button(self.Board, '2.', '', 340-60+43+5 - 15, 50+32*3+28+20+24+18, self.applyBut2_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut2.Show()
- self.applyBut3 = self.comp.Button(self.Board, '3.', '', 340-60+(43+5)*2 - 15, 50+32*3+28+20+24+18, self.applyBut3_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut3.Show()
- self.applyBut4 = self.comp.Button(self.Board, '4.', '', 340-60+(43+5)*3 - 15, 50+32*3+28+20+24+18, self.applyBut4_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut4.Show()
- self.applyBut5 = self.comp.Button(self.Board, '5.', '', 340-60+(43+5)*4 - 15, 50+32*3+28+20+24+18, self.applyBut5_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut5.Show()
- self.applyBut6 = self.comp.Button(self.Board, '6.', '', 340-60+(43+5)*2 - 15 -24, 50+32*3+28+20+24+18+25, self.applyBut6_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut6.Show()
- self.applyBut7 = self.comp.Button(self.Board, '7.', '', 340-60+(43+5)*2 - 15 -24 + 43+5, 50+32*3+28+20+24+18+25, self.applyBut7_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.applyBut7.Show()
- self.HideCount()
- self.HideApplyBonus()
- self.stonesText = self.comp.TextLine(self.Board, trans(64), 340+25+16, 50+32*3+28+20+24+18+25 + 18+2, self.comp.RGB(255, 255, 255))
- self.stonesText.SetHorizontalAlignCenter()
- self.stonesText.Show()
- self.stoneBut1 = self.comp.Button(self.Board, '1.', '', 340-60+(43+5)*2 - 15 - 43 - 15, 50+32*3+28+20+24+18+25 + 18*2+2, self.stoneBut1_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.stoneBut1.Show()
- self.stoneBut2 = self.comp.Button(self.Board, '2.', '', 340-60+(43+5)*2 - 15, 50+32*3+28+20+24+18+25 + 18*2+2, self.stoneBut2_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.stoneBut2.Show()
- self.stoneBut3 = self.comp.Button(self.Board, '3.', '', 340-60+(43+5)*2 +43, 50+32*3+28+20+24+18+25 + 18*2+2, self.stoneBut3_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.stoneBut3.Show()
- #self.ExpandWhenAddOn()
- def stoneBut1_func(self):
- self.stoneManager.Open(1, self.stoneContainer[0])
- def stoneBut2_func(self):
- self.stoneManager.Open(2, self.stoneContainer[1])
- def stoneBut3_func(self):
- self.stoneManager.Open(3, self.stoneContainer[2])
- def ClearContainers(self):
- self.bonusContainer = []
- self.stoneContainer = []
- for i in xrange(0, self.masterWindow.maximumApplyNum):
- self.bonusContainer.append([])
- self.bonusContainer[i].append(0)
- self.bonusContainer[i].append(0)
- for i in xrange(0, self.masterWindow.maximumStoneNum):
- self.stoneContainer.append(0)
- def SetApply(self, pos, applyType, applyValue):
- self.bonusContainer[pos-1][0] = applyType
- self.bonusContainer[pos-1][1] = applyValue
- def applyBut1_func(self):
- self.enchantMenu.Open(1, self.bonusContainer[0][0], self.bonusContainer[0][1])
- def applyBut2_func(self):
- self.enchantMenu.Open(2, self.bonusContainer[1][0], self.bonusContainer[1][1])
- def applyBut3_func(self):
- self.enchantMenu.Open(3, self.bonusContainer[2][0], self.bonusContainer[2][1])
- def applyBut4_func(self):
- self.enchantMenu.Open(4, self.bonusContainer[3][0], self.bonusContainer[3][1])
- def applyBut5_func(self):
- self.enchantMenu.Open(5, self.bonusContainer[4][0], self.bonusContainer[4][1])
- def applyBut6_func(self):
- self.enchantMenu.Open(6, self.bonusContainer[5][0], self.bonusContainer[5][1])
- def applyBut7_func(self):
- self.enchantMenu.Open(7, self.bonusContainer[6][0], self.bonusContainer[6][1])
- def OverOutItem(self):
- self.masterWindow.toolTip.Hide()
- def OverInItemPreview(self, slotNum):
- self.masterWindow.toolTip.ClearToolTip()
- self.masterWindow.toolTip.AddItemData(self.search_itemVnum,self.stoneContainer,self.bonusContainer)
- def OverInItemWants(self, slotNum):
- self.masterWindow.toolTip.ClearToolTip()
- if len(self.slotArray[slotNum]) > 0:
- self.masterWindow.toolTip.AddItemData(self.slotArray[slotNum][0],self.slotArray[slotNum][2],self.slotArray[slotNum][3])
- def UnselectItemSlot(self, selectedSlotPos):
- self.wants.ClearSlot(selectedSlotPos)
- self.wants.RefreshSlot()
- self.slotArray[selectedSlotPos] = []
- self.masterWindow.QuestCMD("trade.RemoveFromTempSell#" + str(selectedSlotPos))
- def ApplySocket(self, pos, vnum):
- self.stoneContainer[pos-1] = vnum
- self.stoneManager.Open(pos, vnum)
- def Open(self):
- self.AppendSavedSlots()
- self.Show()
- def SelectEmptySlot(self, itemSlotIndex):
- if mouseModule.mouseController.isAttached():
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- if attachedSlotType == 777:
- self.latestAppendSlot = itemSlotIndex
- if not self.search_isStackable:
- self.oldcount = 1
- self.masterWindow.QuestCMD("trade.ApplyWantsItem#"+str(itemSlotIndex)+"#"+str(self.search_itemVnum)+"#"+str(self.oldcount)+"#"+str(self.bonusContainer[0][0])+"#"+str(self.bonusContainer[0][1])+"#"+str(self.bonusContainer[1][0])+"#"+str(self.bonusContainer[1][1])+"#"+str(self.bonusContainer[2][0])+"#"+str(self.bonusContainer[2][1])+"#"+str(self.bonusContainer[3][0])+"#"+str(self.bonusContainer[3][1])+"#"+str(self.bonusContainer[4][0])+"#"+str(self.bonusContainer[4][1])+"#"+str(self.bonusContainer[5][0])+"#"+str(self.bonusContainer[5][1])+"#"+str(self.bonusContainer[6][0])+"#"+str(self.bonusContainer[6][1]))
- mouseModule.mouseController.DeattachObject()
- def SelectItemSlot(self, itemSlotIndex):
- #itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
- if mouseModule.mouseController.isAttached():
- mouseModule.mouseController.DeattachObject()
- else:
- count = self.oldcount
- if not self.InputCount.IsShow():
- count = 1
- mouseModule.mouseController.AttachObject(self, 777, itemSlotIndex, self.search_itemVnum, count)
- self.wants.SetUseMode(False)
- snd.PlaySound("sound/ui/pick.wav")
- def RecvAppendItemCommand(self):
- if self.latestAppendSlot <= 0:
- return
- count = 0
- if self.oldcount > 1:
- count = self.oldcount
- self.wants.SetItemSlot(self.latestAppendSlot, self.search_itemVnum, count)
- self.wants.RefreshSlot()
- tempContainer1 = []
- for i in xrange(0, len(self.stoneContainer)):
- tempContainer1.append(self.stoneContainer[i])
- tempContainer2 = []
- for i in xrange(0, len(self.bonusContainer)):
- tempContainer2.append([])
- tempContainer2[i].append(self.bonusContainer[i][0])
- tempContainer2[i].append(self.bonusContainer[i][1])
- self.slotArray[self.latestAppendSlot] = [self.search_itemVnum, self.oldcount, tempContainer1, tempContainer2]
- self.latestAppendSlot = 0
- def DoIt(self):
- self.Close(1)
- def OnPressEscapeKey(self):
- self.Close()
- def OnUpdate(self):
- if not self.masterWindow.IsShow():
- self.Close(2)
- if self.InputCount.IsShow() and self.InputCount.GetText() != "":
- count = int(self.InputCount.GetText())
- if count > 200:
- self.InputCount.SetText("200")
- if self.oldcount != count:
- self.oldcount = count
- if self.countCounter and self.search_itemVnum != 0:
- self.preview.SetSlotCount(self.search_slot, count)
- self.preview.RefreshSlot()
- def applySearch_func(self):
- if self.oldText == self.findItem.GetText():
- return
- self.oldText = self.findItem.GetText()
- if self.findItem.GetText() != "":
- if len(self.findItem.GetText()) < 2:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(65))
- return
- self.masterWindow.QuestCMD("trade.FindItemAndPut#"+str(self.findItem.GetText())+"#1")
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(66))
- def Close(self, saveState = 0):
- self.preview.ClearSlot(1)
- self.preview.ClearSlot(2)
- self.preview.ClearSlot(3)
- self.preview.RefreshSlot()
- self.findItem.SetText("")
- self.oldText = ""
- self.ClearContainers()
- self.HideCount()
- self.HideApplyBonus()
- self.HideStoneBonus()
- if saveState == 0:
- self.ClearWantsSlots()
- self.masterWindow.QuestCMD("trade.RestoreFromSavedSell")
- elif saveState == 1:
- self.SaveWantsSlots()
- elif saveState == 2:
- self.ClearAllSlots()
- elif saveState == 3:
- self.ClearWantsSlots()
- self.enchantMenu.Close()
- self.stoneManager.Close()
- self.Hide()
- def ClearAllSlots(self):
- for i in xrange(1, self.maxSlotNum+1):
- self.wants.ClearSlot(i)
- self.slotArray[i] = []
- self.savedSlotArray[i] = []
- self.wants.RefreshSlot()
- def SaveWantsSlots(self):
- for i in xrange(1, self.maxSlotNum+1):
- self.wants.ClearSlot(i)
- self.savedSlotArray[i] = []
- if len(self.slotArray[i]) > 0:
- for x in xrange(0, len(self.slotArray[i])):
- self.savedSlotArray[i].append(self.slotArray[i][x])
- #self.savedSlotArray[i] = self.slotArray[i]
- self.slotArray[i] = []
- self.wants.RefreshSlot()
- self.masterWindow.QuestCMD("trade.SaveFromTempSlotSell")
- def ClearWantsSlots(self):
- for i in xrange(1, self.maxSlotNum+1):
- self.wants.ClearSlot(i)
- self.slotArray[i] = []
- self.wants.RefreshSlot()
- def AppendSavedSlots(self):
- for i in xrange(1, self.maxSlotNum+1):
- self.slotArray[i] = []
- if len(self.savedSlotArray[i]) > 0:
- count = 0
- if self.savedSlotArray[i][1] > 1:
- count = self.savedSlotArray[i][1]
- self.wants.SetItemSlot(i, self.savedSlotArray[i][0], count)
- for x in xrange(0, len(self.savedSlotArray[i])):
- self.slotArray[i].append(self.savedSlotArray[i][x])
- self.wants.RefreshSlot()
- def HideCount(self):
- self.countCounter = False
- self.itemCountText.Hide()
- self.slotbar_InputCount.Hide()
- self.InputCount.Hide()
- def ShowCount(self):
- self.countCounter = True
- self.itemCountText.Show()
- self.slotbar_InputCount.Show()
- self.InputCount.Show()
- def ExpandWhenAddOn(self):
- self.SetSize(473+32, 263+30 + 15)
- self.Board.SetSize(473+32, 263+30 + 15)
- self.SetCenterPosition()
- def HideApplyBonus(self):
- self.bonusesText.Hide()
- self.applyBut1.Hide()
- self.applyBut2.Hide()
- self.applyBut3.Hide()
- self.applyBut4.Hide()
- self.applyBut5.Hide()
- self.applyBut6.Hide()
- self.applyBut7.Hide()
- def HideStoneBonus(self):
- self.stonesText.Hide()
- self.stoneBut1.Hide()
- self.stoneBut2.Hide()
- self.stoneBut3.Hide()
- def ShowStoneBonus(self):
- self.HideStoneBonus()
- self.stonesText.Show()
- if self.maxSocket >= 1:
- self.stoneBut1.Show()
- if self.maxSocket >= 2:
- self.stoneBut2.Show()
- if self.maxSocket >= 3:
- self.stoneBut3.Show()
- def ShowApplyBonus(self):
- self.bonusesText.Show()
- self.applyBut1.Show()
- self.applyBut2.Show()
- self.applyBut3.Show()
- self.applyBut4.Show()
- self.applyBut5.Show()
- self.applyBut6.Show()
- self.applyBut7.Show()
- def SetSearchSlots(self, itemVnum, slot, isStackable, addOnType, maxSocket):
- self.ClearContainers()
- self.enchantMenu.Close()
- self.stoneManager.Close()
- self.maxSocket = maxSocket
- if addOnType == 0:
- self.HideApplyBonus()
- self.HideStoneBonus()
- elif addOnType == 1 or addOnType == 3:
- self.ShowApplyBonus()
- self.HideStoneBonus()
- else:
- for i in xrange(0, maxSocket):
- self.stoneContainer[i] = 1
- self.ShowApplyBonus()
- self.ShowStoneBonus()
- count = 0
- if isStackable:
- count = self.oldcount
- self.ShowCount()
- else:
- self.HideCount()
- self.search_itemVnum = int(itemVnum)
- self.search_slot = int(slot)
- self.search_isStackable = isStackable
- self.preview.ClearSlot(1)
- self.preview.ClearSlot(2)
- self.preview.ClearSlot(3)
- self.preview.SetItemSlot(int(slot), int(itemVnum), count)
- self.preview.RefreshSlot()
- class SearchBoardDialog(ui.Window):
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.loadDialog()
- self.SetCenterPosition()
- self.Close()
- def __del__(self):
- ui.Window.__del__(self)
- def loadDialog(self):
- self.SetCenterPosition()
- self.SetSize(509, 100)
- self.AddFlag('float')
- self.AddFlag('movable')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(509, 100)
- self.Board.SetTitleName(trans(67))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- self.BFSearch = self.comp.Button(self.Board, trans(68), '', 294, 56, self.BFSearch_func, 'd:/ymir work/ui/public/large_button_01.sub', 'd:/ymir work/ui/public/large_button_02.sub', 'd:/ymir work/ui/public/large_button_03.sub')
- self.slotbar_IFOwner, self.IFOwner = self.comp.EditLine(self.Board, '', 57, 35, 70, 15, 12)
- self.slotbar_IFItem, self.IFItem = self.comp.EditLine(self.Board, '', 214, 34, 260, 15, 50)
- self.FOwner = self.comp.TextLine(self.Board, trans(69), 24, 36, self.comp.RGB(255, 255, 255))
- self.FItem = self.comp.TextLine(self.Board, trans(4)+":", 152, 36, self.comp.RGB(255, 255, 255))
- self.FTip = self.comp.TextLine(self.Board, trans(70), 34, 57, self.comp.RGB(255, 255, 255))
- self.BFSearch.Show()
- self.FOwner.Show()
- self.FItem.Show()
- self.FTip.Show()
- def OnPressEscapeKey(self):
- self.Close()
- def Close(self):
- self.Hide()
- def OnUpdate(self):
- if not self.masterWindow.IsShow():
- self.Close()
- def BFSearch_func(self):
- self.masterWindow.HideItems()
- text = str(self.IFItem.GetText())
- self.masterWindow.QuestCMD("SEARCH#"+self.IFOwner.GetText().replace("#", "")+"#"+self.masterWindow.replaceLUAMagicalCharacters(text)+"#1")
- self.Close()
- class SelectItemCountBoard(ui.Window):
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.isTradeItem = False
- self.loadDialog()
- self.SetCenterPosition()
- self.Close()
- def __del__(self):
- ui.Window.__del__(self)
- def loadDialog(self):
- self.SetCenterPosition()
- self.SetSize(509, 100)
- self.AddFlag('float')
- self.AddFlag('movable')
- self.ICBoard = ui.Board()
- self.ICBoard.SetParent(self)
- self.ICBoard.SetSize(300, 112)
- self.ICBoard.AddFlag('attach')
- self.ICBoard.Show()
- self.comp = Component()
- self.BuyButton = self.comp.Button(self.ICBoard, trans(71), '', 242, 80, self.BuyButton_func, 'd:/ymir work/ui/public/small_button_01.sub', 'd:/ymir work/ui/public/small_button_02.sub', 'd:/ymir work/ui/public/small_button_03.sub')
- self.CloseB = self.comp.Button(self.ICBoard, '', '', 279, 6, self.Close, 'd:/ymir work/ui/public/close_button_01.sub', 'd:/ymir work/ui/public/close_button_02.sub', 'd:/ymir work/ui/public/close_button_03.sub')
- self.slotbar_ImputCount, self.ImputCount = self.comp.EditLine(self.ICBoard, '', 197, 82, 25, 15, 3)
- self.TextTipB = self.comp.TextLine(self.ICBoard, trans(72), 86, 9, self.comp.RGB(255, 255, 255))
- self.CCount = self.comp.TextLine(self.ICBoard, trans(73), 16, 41, self.comp.RGB(255, 255, 255))
- self.CCountper = self.comp.TextLine(self.ICBoard, '0/db', 62, 41, self.comp.RGB(255, 255, 255))
- self.ToBuyp = self.comp.TextLine(self.ICBoard, '0', 207, 42, self.comp.RGB(255, 255, 255))
- self.ToBuy = self.comp.TextLine(self.ICBoard, trans(74), 142, 40, self.comp.RGB(255, 255, 255))
- self.SliderBarC = self.comp.SliderBar(self.ICBoard, 0.0, self.SliderBar_func, 14, 86)
- self.BuyButton.Show()
- self.CloseB.Show()
- self.TextTipB.Show()
- self.CCount.Show()
- self.CCountper.Show()
- self.ToBuyp.Show()
- self.ToBuy.Show()
- self.ImputCount.SetNumberMode()
- def OnPressEscapeKey(self):
- self.Close()
- def Close(self):
- self.Hide()
- def OnUpdate(self):
- if not self.masterWindow.IsShow():
- self.Close()
- if self.isTradeItem:
- if self.masterWindow.ictype == 1:
- fix = " "+trans(22)
- else:
- fix = " "+trans(10)
- self.SliderBarC.SetSliderPos(1.0)
- number = int(self.SliderBarC.GetSliderPos() * self.masterWindow.icmaxcount) * self.masterWindow.icprice
- self.ToBuyp.SetText(str(self.masterWindow.NumberToMoneyString(long(number), 1)+fix))
- self.ImputCount.SetText(str(self.masterWindow.icmaxcount))
- return
- if self.masterWindow.oldstep != self.ImputCount.GetText():
- fix = ""
- if self.masterWindow.ictype == 1:
- fix = " "+trans(22)
- else:
- fix = " "+trans(10)
- if self.ImputCount.GetText() == "" or int(self.ImputCount.GetText()) == 0:
- self.SliderBarC.SetSliderPos((0.0) / self.masterWindow.icmaxcount)
- self.masterWindow.oldstep = str(self.SliderBarC.GetSliderPos())
- self.ToBuyp.SetText("0"+fix)
- else:
- self.SliderBarC.SetSliderPos((0.0+int(self.ImputCount.GetText())) / self.masterWindow.icmaxcount)
- self.masterWindow.oldstep = str(int(self.SliderBarC.GetSliderPos()*self.masterWindow.icmaxcount))
- number = int(self.SliderBarC.GetSliderPos() * self.masterWindow.icmaxcount) * self.masterWindow.icprice
- self.ToBuyp.SetText(str(self.masterWindow.NumberToMoneyString(long(number), 1)+fix))
- def BuyButton_func(self):
- if self.ImputCount.GetText() == "" or int(self.ImputCount.GetText()) == 0:
- pass
- else:
- if self.masterWindow.ictype == 1:
- if int(self.ImputCount.GetText())*self.masterWindow.icprice > self.masterWindow.currgold:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(24))
- else:
- self.masterWindow.QuestCMD("BUYITEM#"+str(self.masterWindow.icid)+"#GOLD#"+str(self.masterWindow.page)+"#"+str(self.masterWindow.icslot)+"#"+self.ImputCount.GetText()+"#"+str(self.masterWindow.currgold)+"#"+self.masterWindow.oldselected)
- else:
- if int(self.ImputCount.GetText())*self.masterWindow.icprice > self.masterWindow.currse:
- chat.AppendChat(chat.CHAT_TYPE_INFO, trans(23))
- else:
- self.masterWindow.QuestCMD("BUYITEM#"+str(self.masterWindow.icid)+"#CASH#"+str(self.masterWindow.page)+"#"+str(self.masterWindow.icslot)+"#"+self.ImputCount.GetText()+"#"+str(self.masterWindow.currse)+"#"+self.masterWindow.oldselected)
- def SliderBar_func(self):
- fix = ""
- if self.masterWindow.ictype == 1:
- fix = " "+trans(22)
- else:
- fix = " "+trans(10)
- self.masterWindow.oldstep = str(int(self.SliderBarC.GetSliderPos()*self.masterWindow.icmaxcount))
- self.ImputCount.SetText(str(int(self.SliderBarC.GetSliderPos()*self.masterWindow.icmaxcount)))
- self.ToBuyp.SetText(str(self.masterWindow.NumberToMoneyString((int(self.SliderBarC.GetSliderPos()*self.masterWindow.icmaxcount)*self.masterWindow.icprice), 1)+fix))
- class GetTradeItemDialog(ui.Window):
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.maxSlotNum = 7*6
- self.itemID = 0
- self.page = 0
- self.slot = 0
- self.isPreview = False
- self.masterWindow = masterWindow
- self.BuildWindow()
- self.SetCenterPosition()
- self.Close()
- def __del__(self):
- ui.Window.__del__(self)
- def BuildWindow(self):
- self.SetCenterPosition()
- self.SetSize((473+32)/2 - 7, 263 - 8)
- self.AddFlag('float')
- self.AddFlag('movable')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize((473+32)/2 - 7, 263 - 8)
- self.Board.SetTitleName(trans(76))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- self.TradeToText = self.comp.TextLine(self.Board, trans(77), 94+30, 28, self.comp.RGB(255, 255, 255))
- self.TradeToText.SetHorizontalAlignCenter()
- self.TradeToText.Show()
- self.wants = ui.GridSlotWindow()
- self.wants.SetParent(self.Board)
- self.wants.SetPosition(10, 50)
- self.wants.ArrangeSlot(1, 7, 6, 32, 32, 0, 0)
- self.wants.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.wants.Show()
- self.wants.SetOverInItemEvent(ui.__mem_func__(self.OverInItemWants))
- self.wants.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.wants.SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
- def OnPressEscapeKey(self):
- self.Close()
- def OnUpdate(self):
- if not self.masterWindow.IsShow():
- self.Close()
- def Open(self, itemID, page, slot, isPreview):
- self.itemID = itemID
- self.page = page
- self.slot = slot
- self.isPreview = isPreview
- if isPreview:
- self.TradeToText.Hide()
- self.Board.SetTitleName(trans(78))
- else:
- self.TradeToText.Show()
- self.Board.SetTitleName(trans(76))
- self.ClearAllSlots()
- self.Show()
- def Close(self):
- self.ClearAllSlots()
- self.Hide()
- def ClearAllSlots(self):
- self.slotArray = []
- for i in xrange(1, self.maxSlotNum+1):
- self.wants.ClearSlot(i)
- self.slotArray.append([])
- self.slotArray.append([])
- self.wants.RefreshSlot()
- def OverInItemWants(self, slotNum):
- self.masterWindow.toolTip.ClearToolTip()
- if len(self.slotArray[slotNum]) > 0:
- self.masterWindow.toolTip.AddItemData(self.slotArray[slotNum][0],self.slotArray[slotNum][2],self.slotArray[slotNum][3])
- def OverOutItem(self):
- self.masterWindow.toolTip.Hide()
- def UnselectItemSlot(self, itemPos):
- if self.isPreview:
- return
- self.wants.ClearSlot(itemPos)
- self.wants.RefreshSlot()
- self.slotArray[itemPos] = []
- self.masterWindow.QuestCMD("trade.ClaimTradeItem#"+str(self.itemID)+"#"+str(self.page)+"#"+str(self.slot)+"#"+str(itemPos))
- def AppendItem(self, pos, vnum, count, socketContainer, attrContainer):
- if count <= 1:
- count = 0
- self.wants.SetItemSlot(pos, vnum, count)
- self.wants.RefreshSlot()
- self.slotArray[pos].append(vnum)
- self.slotArray[pos].append(count)
- self.slotArray[pos].append(socketContainer)
- self.slotArray[pos].append(attrContainer)
- class LanguageSelector(ui.Window):
- def __init__(self, masterWindow):
- ui.Window.__init__(self, "TOP_MOST")
- self.masterWindow = masterWindow
- self.BuildWindow()
- self.SetCenterPosition()
- self.Close()
- def __del__(self):
- ui.Window.__del__(self)
- def BuildWindow(self):
- self.SetCenterPosition()
- self.SetSize(200, 305)
- self.AddFlag('float')
- self.AddFlag('movable')
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetParent(self)
- self.Board.SetSize(200, 305)
- self.Board.SetTitleName(trans(80))
- self.Board.SetCloseEvent(self.Close)
- self.Board.Show()
- self.comp = Component()
- self.bar_List, self.list_List = self.comp.ListBoxEx(self.Board, 16, 32, 200, 235)
- for i in igshop_lang.langList:
- self.list_List.InsertItem(igshop_lang.langList.index(i)+1, i)
- self.selectLangBut = self.comp.Button(self.Board, trans(38), '', 100-28, 235 + 32+5, self.selectLang, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
- self.selectLangBut.Show()
- def selectLang(self):
- SelectedIndex = self.list_List.GetSelectedItemText()
- if SelectedIndex == "":
- return
- if igshop_lang.langList.index(SelectedIndex) != self.masterWindow.lang:
- self.masterWindow.Close()
- self.masterWindow.QuestCMD("ChangeLang#"+str(igshop_lang.langList.index(SelectedIndex)))
- def OnPressEscapeKey(self):
- self.Close()
- def OnUpdate(self):
- if not self.masterWindow.IsShow():
- self.Close()
- def Open(self):
- self.Show()
- def Close(self):
- self.Hide()
Add Comment
Please, Sign In to add comment