import math
import ui
import snd
import shop
import mouseModule
import player
import chr
import net
import uiCommon
import localeInfo
import chat
import item
import systemSetting #±èÁØÈ£
import constInfo
import wndMgr
import uiScriptLocale
import background
import grp
import uiPickMoney
import app
import interfaceModule
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)
def __del__(self):
ui.ListBoxEx.Item.__del__(self)
def GetText(self):
return self.text
def SetSize(self, width, height):
ui.ListBoxEx.Item.SetSize(self, 150, height)
def __CreateTextLine(self, text):
textLine = ui.TextLine()
textLine.SetParent(self)
textLine.SetPosition(79, 0)
textLine.SetHorizontalAlignCenter()
textLine.SetText(text)
textLine.Show()
return textLine
class PrivateShopEditor(ui.ScriptWindow):
dlgPickMoney = None
def __init__(self):
ui.ScriptWindow.__init__(self)
self.offlineInfo = None
self.tooltipItem = None
self.priceInputBoard = None
# self.title = ""
self.itemView = True
# self.previousName = ""
self.interface = None
self.interface = interfaceModule.Interface()
self.NameLine = None
self.NameSlot = None
# self.time_select_pivot_window = 0
self.cur_time_text = None
# self.time_select_button = 0
# self.time_bar = 0
# self.time_listbox = 0
# self.time_scrollbar = 0
self.time_window = 0
# self.id = 0
self.time_gauge = None
self.time_text = None
self.moneyText = None
self.worthText = None
self.questionDialog = None
# self.dlgPickMoney = None
self.OpenShopButton = None
self.ShopDecoButton = None
self.ShopLogButton = None
self.Page1Button = None
self.Page2Button = None
self.BackButton = None
self.RenameButton = None
self.ShopSearchButton = None
self.GoldStashButton = None
self.Log_Page = None
self.Log_Header_Item_Name = None
self.Log_Header_Buy_Time = None
self.Log_Header_Item_Price = None
self.GoldStashWrapper = None
self.Shop_Time_Gauge_Slot = None
self.TeleportBtn = None
# self.type = 0
self.page = 1
# self.priceInputBoard = None
self.list = [None] * 180
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def __LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/PrivateShopEditor.py")
except:
import exception
exception.Abort("PrivateShopEditorWindow.LoadWindow.LoadObject")
try:
GetObject = self.GetChild
self.NameSlot = GetObject("NameSlot")
self.NameLine = GetObject("NameLine")
self.itemSlot = GetObject("ItemSlot")
self.itemSlot2 = GetObject("ItemSlot2")
self.itemSlot3 = GetObject("ItemSlot3")
self.itemSlot4 = GetObject("ItemSlot4")
self.CloseButton = GetObject("CloseButton")
self.titleBar = GetObject("TitleBar")
self.positionInfo = GetObject("Position")
# self.time_select_pivot_window = GetObject("time_select_pivot_window")
self.cur_time_text = GetObject("cur_time_text")
# self.time_select_button = GetObject("time_select_button")
self.time_gauge = GetObject("Shop_Time_Gauge")
self.time_text = GetObject("Shop_Time_Text")
self.time_window = GetObject("time_window")
self.moneyText = GetObject("GoldStashValue")
self.worthText = GetObject("ItemsNetWorthText")
self.OpenShopButton = GetObject("OpenShopButton")
self.ShopDecoButton = GetObject("ShopDecoButton")
self.ShopLogButton = GetObject("ShopLogButton")
self.Page1Button = GetObject("Page1Button")
self.Page2Button = GetObject("Page2Button")
self.BackButton = GetObject("BackButton")
self.RenameButton = GetObject("RenameButton")
# self.ShopSearchButton = GetObject("ShopSearchButton")
self.GoldStashButton = GetObject("GoldStash_Slot")
self.Log_Page = GetObject("Log_Page")
self.Log_Header_Item_Name = GetObject("Log_Header_Item_Name")
self.Log_Header_Buy_Time = GetObject("Log_Header_Buy_Time")
self.Log_Header_Item_Price = GetObject("Log_Header_Item_Price")
self.GoldStashWrapper = GetObject("GoldStashWrapper")
self.Shop_Time_Gauge_Slot = GetObject("Shop_Time_Gauge_Slot")
self.TeleportBtn = GetObject("TeleportBtn")
self.EditorTitleName = GetObject("TitleName")
except:
import exception
exception.Abort("PrivateShopEditorWindow.LoadWindow.BindObject")
self.titleBar.SetCloseEvent(ui.__mem_func__(self.OnClose))
self.CloseButton.SetEvent(ui.__mem_func__(self.OnCloseButton))
self.OpenShopButton.SetEvent(ui.__mem_func__(self.OnOpenShopButton))
self.ShopLogButton.SetEvent(ui.__mem_func__(self.LogOpen), 1)
self.BackButton.SetEvent(ui.__mem_func__(self.LogClose), 1)
self.Page1Button.SetEvent(ui.__mem_func__(self.SetPage), 1)
self.Page2Button.SetEvent(ui.__mem_func__(self.SetPage), 2)
self.RenameButton.SetEvent(ui.__mem_func__(self.AcceptNameChange))
# self.ShopSearchButton.SetEvent(ui.__mem_func__(self.OpenShopSearch))
self.GoldStashButton.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
self.BackButton.Hide()
self.Log_Page.Hide()
self.Page1Button.Down()
self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
self.itemSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
self.itemSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
self.itemSlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot.SetUseSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot2.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
self.itemSlot2.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
self.itemSlot2.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
self.itemSlot2.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
self.itemSlot2.SetUnselectItemSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot2.SetUseSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot3.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
self.itemSlot3.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
self.itemSlot3.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
self.itemSlot3.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
self.itemSlot3.SetUnselectItemSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot3.SetUseSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot4.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
self.itemSlot4.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
self.itemSlot4.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
self.itemSlot4.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
self.itemSlot4.SetUnselectItemSlotEvent(ui.__mem_func__(self.RemoveFromShop))
self.itemSlot4.SetUseSlotEvent(ui.__mem_func__(self.RemoveFromShop))
# self.Page1Button.Hide()
# self.Page2Button.Hide()
self.time_window.Hide()
dlgPickMoney = uiPickMoney.PickMoneyDialog()
dlgPickMoney.LoadDialog()
dlgPickMoney.Hide()
self.dlgPickMoney = dlgPickMoney
def BindInterfaceClass(self, interface):
self.interface = interface
def Destroy(self):
self.ClearDictionary()
self.dlgPickMoney.Destroy()
self.dlgPickMoney = None
self.NameLine = None
self.NameSlot = None
self.itemSlot = None
self.itemSlot2 = None
self.itemSlot3 = None
self.itemSlot4 = None
self.CloseButton = None
self.titleBar = None
self.questionDialog = None
self.time_gauge = None
self.time_text = None
self.time_window = None
self.moneyText = None
self.worthText = None
self.OpenShopButton = None
self.ShopDecoButton = None
self.ShopLogButton = None
self.TeleportBtn = None
self.Page1Button = None
self.Page2Button = None
self.BackButton = None
self.RenameButton = None
self.ShopSearchButton = None
self.GoldStashButton = None
self.Log_Header_Item_Name = None
self.Log_Header_Buy_Time = None
self.Log_Header_Item_Price = None
self.GoldStashWrapper = None
self.Shop_Time_Gauge_Slot = None
# self.priceInputBoard = None
self.list = []
def Open(self):
self.page = 1
self.Page1Button.Down()
self.Page2Button.SetUp()
shop.Open(True, True)
self.SetCenterPosition()
self.Refresh()
self.Show()
def LogOpen(self, i):
self.Log_Page.Show()
self.ShopDecoButton.Hide()
self.itemSlot.Hide()
self.itemSlot2.Hide()
self.itemSlot3.Hide()
self.itemSlot4.Hide()
self.worthText.Hide()
self.positionInfo.Hide()
self.TeleportBtn.Hide()
self.Page1Button.Hide()
self.Page2Button.Hide()
self.NameSlot.Hide()
self.NameLine.Hide()
self.RenameButton.Hide()
self.time_window.Hide()
if i == 0:
self.BackButton.Hide()
self.CloseButton.Hide()
self.OpenShopButton.Show()
self.GoldStashWrapper.Show()
self.Shop_Time_Gauge_Slot.Show()
self.time_text.Show()
self.EditorTitleName.SetText(localeInfo.OFFLINESHOP_EDITOR_LOGOPEN_0)
else:
self.BackButton.Show()
self.CloseButton.Show()
self.OpenShopButton.Hide()
self.GoldStashWrapper.Hide()
self.Shop_Time_Gauge_Slot.Hide()
self.time_text.Hide()
self.EditorTitleName.SetText(localeInfo.OFFLINESHOP_EDITOR_LOGOPEN_1)
self.ShopLogButton.Down()
# net.SendChatPacket("/click_offline_private_shop 7")
def LogClose(self, i):
self.OpenShopButton.Hide()
self.Log_Page.Hide()
self.BackButton.Hide()
self.CloseButton.Show()
self.ShopDecoButton.Show()
if self.page == 1:
self.itemSlot.Show()
self.itemSlot2.Show()
self.itemSlot3.Hide()
self.itemSlot4.Hide()
if self.page == 2:
self.itemSlot.Hide()
self.itemSlot2.Hide()
self.itemSlot3.Show()
self.itemSlot4.Show()
self.worthText.Show()
self.positionInfo.Show()
self.TeleportBtn.Show()
self.time_window.Hide()
self.Page1Button.Show()
self.Page2Button.Show()
self.Shop_Time_Gauge_Slot.Show()
self.time_text.Show()
self.NameSlot.Show()
self.NameLine.Show()
self.RenameButton.Show()
self.GoldStashWrapper.Show()
self.EditorTitleName.SetText(localeInfo.OFFLINESHOP_EDITOR_LOGCLOSE)
self.ShopLogButton.SetUp()
def SetPage(self, i):
self.page = i
if i == 1:
self.Page1Button.Down()
self.Page2Button.SetUp()
elif i == 2:
self.Page2Button.Down()
self.Page1Button.SetUp()
self.Refresh()
def Close(self):
if self.dlgPickMoney:
self.dlgPickMoney.Close()
self.Hide()
def SetItemToolTip(self, tooltipItem):
self.tooltipItem = tooltipItem
def SetItemView(self, newState):
self.itemView = newState
def IsItemView(self):
return self.itemView
def IsPriceDialogOpen(self):
return self.priceInputBoard
def Refresh(self):
getItemID=shop.GetItemID
getItemCount=shop.GetItemCount
getItemPrice=shop.GetItemPrice
setItemSlot=self.itemSlot.SetItemSlot
setItemSlot2=self.itemSlot2.SetItemSlot
setItemSlot3=self.itemSlot3.SetItemSlot
setItemSlot4=self.itemSlot4.SetItemSlot
hasItems = False
itemPrice = 0
if self.page == 1:
self.itemSlot.Show()
self.itemSlot2.Show()
self.itemSlot3.Hide()
self.itemSlot4.Hide()
elif self.page == 2:
self.itemSlot.Hide()
self.itemSlot2.Hide()
self.itemSlot3.Show()
self.itemSlot4.Show()
for i in xrange(shop.SHOP_PAGE_SIZE * 4):
itemPrice += long(getItemPrice(i))
itemCount = long(getItemCount(i))
if itemCount > 0:
hasItems = True
if itemCount <= 1:
itemCount = 0
if i<45:
setItemSlot(i, getItemID(i), itemCount)
elif 44<i<90:
setItemSlot2(i, getItemID(i), itemCount)
elif 89<i<135:
setItemSlot3(i, getItemID(i), itemCount)
else:
setItemSlot4(i, getItemID(i), itemCount)
# asd = 0
# self.page = 0
# # TraceError("Count: %d" % asd)
# z = 1
# j = asd / 45
# if self.page and j:
# if j == 1:
# z = 0
# elif j == 3:
# z = 2
# asd = asd % 45
# self.list = [None] * 180
# for i in xrange(shop.SHOP_SLOT_COUNT):
# slotNumber = self.page * shop.SHOP_SLOT_COUNT + i
# y = i / 10
# x = i % 10
# y2 = asd / 5
# x2 = asd % 5
# var = (y * 10) + (z * 5) + self.page * shop.SHOP_SLOT_COUNT
# if y2 > y and z:
# var += y2 * 10
# if y2 > y and not z:
# var += 5
# if y2 == y:
# var += x2
# if slotNumber >= var or (self.page and z and not j):
# btn = ui.Button()
# btn.SetParent(self.itemSlot)
# btn.SetUpVisual("d:/ymir work/ui/game/shopsearchp2p/padlock.dds")
# btn.SetOverVisual("d:/ymir work/ui/game/shopsearchp2p/padlock.dds")
# btn.SetDownVisual("d:/ymir work/ui/game/shopsearchp2p/padlock.dds")
# btn.SetPosition((x) * 32, (y) * 32)
# btn.SetEvent(lambda : self.UnlockSlot())
# btn.Show()
# self.list[slotNumber] = (btn)
# # TraceError("%d - %d %d %d %d" % (i, slotNumber, var, y2, x2))
# itemCount = long(getItemCount(i))
# if itemCount > 0:
# hasItems = True
# if itemCount <= 1:
# itemCount = 0
# setItemSlot(i, getItemID(i), itemCount)
# # self.list[slotNumber] = 1
# wndMgr.RefreshSlot(self.itemSlot.GetWindowHandle())
self.itemSlot.RefreshSlot()
self.itemSlot2.RefreshSlot()
self.itemSlot3.RefreshSlot()
self.itemSlot4.RefreshSlot()
if shop.IsMyShopOpen() == True and hasItems == True:
self.LogClose(0)
else:
self.LogOpen(0)
# return
# (channel, xPos, yPos) = shop.GetLocation()
# (mapName, xBase, yBase) = background.GlobalPositionToMapInfo(xPos, yPos)
# self.positionInfo.SetText("%s - (%.0f, %.0f)" % (localeInfo.MINIMAP_ZONE_NAME_DICT_BY_IDX[index], x/100, y/100))
## Location:
locationText = ""
(channel, xPos, yPos) = shop.GetLocation()
(mapName, xBase, yBase) = background.GlobalPositionToMapInfo(xPos, yPos)
localeMapName = localeInfo.MINIMAP_ZONE_NAME_DICT.get(mapName, "")
if localeMapName != "":
locationText += localeInfo.TOOLTIP_MEMORIZED_POSITION % (localeMapName, int(xPos-xBase)/100, int(yPos-yBase)/100)
print "Location : %s %s" % (str(int(xPos)), str(int(yPos)))
locationText += " " + "CH" + str(channel) #969600 278400
self.positionInfo.SetText(locationText)
self.NameLine.SetText(shop.GetMyShopName())
# self.cur_time_text.SetText(shop.GetMyShopName())
# offlineMinutes = shop.GetOfflineMinutes() + shop.GetPremiumMinutes()
offlineMinutes = 2880+900+58
offlineSetPercentage = offlineMinutes
offlineHours = math.floor(offlineMinutes/60)
offlineMinutes -= offlineHours*60
offlineDays = math.floor(offlineHours/24)
offlineHours -= offlineDays*24
minuteStr = str(int(offlineMinutes))
hoursStr = str(int(offlineHours))
daysStr = str(int(offlineDays))
#|cffDADADA -> metin2 orjinal font rengi
#|cff00bfff -> cyanımsı
prettyTimeOffline = "|cff00bfff%s |cffDADADA" % (localeInfo.OFFLINESHOP_EDITOR_TIMEOFFLINE % (daysStr, hoursStr, minuteStr))
self.time_gauge.SetPercentage(offlineSetPercentage, 4320) #app.GetGlobalTimeStamp()
self.time_text.SetText(localeInfo.OFFLINESHOP_EDITOR_TIMETEXT % (prettyTimeOffline))
self.TeleportBtn.SetText(localeInfo.OFFLINESHOP_EDITOR_TELEPORTBTN)
moneyText = long(shop.GetStashValue())
self.moneyText.SetText("%s" % localeInfo.NumberToMoneyString(moneyText))
# self.worthText.SetText("Toplam Tutar: %s" % localeInfo.NumberToMoneyString(ops.GetWorth(self.id)))
worthMoney = itemPrice
self.worthText.SetText(localeInfo.OFFLINESHOP_EDITOR_WORTHTEXT % localeInfo.NumberToMoneyString(worthMoney))
def UnlockSlot(self):
# net.SendChatPacket("/click_offline_private_shop 6 %d" % ops.GetVid(self.type, self.id))
return
def OpenPickMoneyDialog(self):
if mouseModule.mouseController.isAttached():
mouseModule.mouseController.DeattachObject()
else:
curMoney = long(shop.GetStashValue())
if curMoney <= 0:
return
self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnClickWithdraw))
self.dlgPickMoney.Open(curMoney)
self.dlgPickMoney.SetMax(13) # Àκ¥Å丮 990000 Á¦ÇÑ ¹ö±× ¼öÁ¤
def OnSelectEmptySlot(self, selectedSlotPos):
isAttached = mouseModule.mouseController.isAttached()
if isAttached:
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
mouseModule.mouseController.DeattachObject()
if player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedSlotType:
return
attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
item.SelectItem(itemVNum)
if item.IsAntiFlag(item.ANTIFLAG_GIVE) or item.IsAntiFlag(item.ANTIFLAG_MYSHOP):
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.PRIVATE_SHOP_CANNOT_SELL_ITEM)
return
priceInputBoard = uiCommon.MoneyInputDialog()
priceInputBoard.SetTitle(localeInfo.PRIVATE_SHOP_INPUT_PRICE_DIALOG_TITLE)
priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
priceInputBoard.Open()
# itemPrice=GetPrivateShopItemPrice(itemVNum)
#if itemPrice>0:
# priceInputBoard.SetValue(itemPrice)
self.priceInputBoard = priceInputBoard
self.priceInputBoard.itemVNum = itemVNum
self.priceInputBoard.sourceWindowType = attachedInvenType
self.priceInputBoard.sourceSlotPos = attachedSlotPos
self.priceInputBoard.targetSlotPos = selectedSlotPos
def OnSelectItemSlot(self, selectedSlotPos):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
isAttached = mouseModule.mouseController.isAttached()
if isAttached:
return
selectedItemID = shop.GetItemID(selectedSlotPos)
itemCount = shop.GetItemCount(selectedSlotPos)
mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_MYSHOP, selectedSlotPos, selectedItemID, itemCount)
mouseModule.mouseController.SetCallBack("INVENTORY", ui.__mem_func__(self.DropToWindow))
snd.PlaySound("sound/ui/pick.wav")
def AcceptInputPrice(self):
if not self.priceInputBoard:
return True
text = self.priceInputBoard.GetText()
if not text:
return True
if not text.isdigit():
return True
if long(text) <= 0:
return True
attachedInvenType = self.priceInputBoard.sourceWindowType
sourceSlotPos = self.priceInputBoard.sourceSlotPos
targetSlotPos = self.priceInputBoard.targetSlotPos
price = long(self.priceInputBoard.GetText())
# Should we?
#if IsPrivateShopItemPriceList():
# SetPrivateShopItemPrice(self.priceInputBoard.itemVNum, price)
net.SendAddItemToMyShop(attachedInvenType, sourceSlotPos, targetSlotPos, long(price))
snd.PlaySound("sound/ui/drop.wav")
self.Refresh()
#####
self.priceInputBoard = None
return True
def CancelInputPrice(self):
self.priceInputBoard = None
return True
def OnClose(self):
self.Close()
def OnPressEscapeKey(self):
self.Close()
return True
def OnOverInItem(self, slotIndex):
if self.tooltipItem:
self.tooltipItem.SetShopItem(slotIndex)
def OnOverOutItem(self):
if self.tooltipItem:
self.tooltipItem.HideToolTip()
def OnClickWithdraw(self, money):
import dbg
dbg.TraceError("Trying to withdraw %d gold" % long(money))
net.SendWithdrawMyShopGold(long(money))
def OnCloseButton(self):
self.Close()
net.SendCloseMyShop();
def OnOpenShopButton(self):
self.Close()
if self.interface.privateShopBuilder.IsShow():
self.interface.privateShopBuilder.Close()
else:
# constInfo.PriceCheck = {}
# net.SendChatPacket("/price_check")
self.interface.privateShopBuilder.Open("")
#def OnOpenShopSearchButton(self):
#net.SendOpenMyShopSearch();
def AcceptNameChange(self):
newName = self.NameLine.GetText()
if shop.GetMyShopName() != newName:
net.SendRenameMyShop(newName)
else:
print "Pazar ismi zaten ayni"
def DropToWindow(self, windowType, target):
if not mouseModule.mouseController.isAttached():
print "DropToWindow: Not attached!"
return
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
self.AskRemoveItem(attachedSlotPos, player.SlotTypeToInvenType(windowType), target)
def RemoveFromShop(self, slotIndex):
itemVnum = shop.GetItemID(slotIndex)
item.SelectItem(itemVnum)
itemType = item.GetItemType()
if itemType != item.ITEM_TYPE_DS:
inventory = player.SLOT_TYPE_INVENTORY
else:
inventory = player.SLOT_TYPE_DRAGON_SOUL_INVENTORY
self.AskRemoveItem(slotIndex, player.SlotTypeToInvenType(inventory), 0)
def AskRemoveItem(self, slotPos, targetWindow, targetPos):
itemIndex = shop.GetItemID(slotPos)
itemPrice = shop.GetItemPrice(slotPos)
itemCount = shop.GetItemCount(slotPos)
item.SelectItem(itemIndex)
itemName = item.GetItemName()
removeQuestion = uiCommon.QuestionDialog()
removeQuestion.SetText(localeInfo.DO_YOU_REMOVE_ITEM_FROM_SHOP % itemName)
removeQuestion.SetAcceptEvent(lambda arg=True: self.AnswerRemoveItem(arg))
removeQuestion.SetCancelEvent(lambda arg=False: self.AnswerRemoveItem(arg))
removeQuestion.Open()
removeQuestion.pos = slotPos
removeQuestion.targetPos = targetPos
removeQuestion.targetWindow = targetWindow
self.removeQuestion = removeQuestion
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
def AnswerRemoveItem(self, arg):
if arg:
slotPos = self.removeQuestion.pos
targetPos = self.removeQuestion.targetPos
targetWindow = self.removeQuestion.targetWindow
print "Requesting removal of "+str(slotPos)+" (Over to "+str(targetPos)+" at "+str(targetWindow)+")"
net.SendRemoveItemFromMyShop(slotPos, targetWindow, targetPos)
self.removeQuestion.Close()
self.removeQuestion = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
# def OnUpdate(self):
# if self.nameLine:
# if self.nameLine.GetText() == shop.GetMyShopName():
# self.nameLine.SetTextColor(grp.GenerateColor(1.0, 1.0, 1.0, 0.8))
# else:
# self.nameLine.SetTextColor(grp.GenerateColor(1.0, 0.54902, 0.0, 1.0))