import uvvY2sBNvVcbJz4jvDr6fSWYdmqv9NPQ as pythonApi
app = __import__(pythonApi.GetModuleName("app"))
net = __import__(pythonApi.GetModuleName("net"))
player = __import__(pythonApi.GetModuleName("player"))
chat = __import__(pythonApi.GetModuleName("chat"))
item = __import__(pythonApi.GetModuleName("item"))
ime = __import__(pythonApi.GetModuleName("ime"))
systemSetting = __import__(pythonApi.GetModuleName("systemSetting"))
import ui
import mouseModule
import snd
import wndMgr
import uiScriptLocale
import uiCommon
import uiPrivateShopBuilder
import uiPickMoney
import localeInfo
import uiToolTip
import constInfo
import grp
INVENTORY_PAGE_COUNT = 5
class SpecialStorageWindow(ui.ScriptWindow):
sonbasmaozel = 0
UPGRADE_TYPE = 0
BOOK_TYPE = 1
STONE_TYPE = 2
ATTR_TYPE = 3
FLOWER_TYPE = 4
BLEND_TYPE = 5
SLOT_WINDOW_TYPE = {
UPGRADE_TYPE : {"window" : player.UPGRADE_INVENTORY, "slot" : player.SLOT_TYPE_UPGRADE_INVENTORY},
BOOK_TYPE : {"window" : player.BOOK_INVENTORY, "slot" : player.SLOT_TYPE_BOOK_INVENTORY},
STONE_TYPE : {"window" : player.STONE_INVENTORY, "slot" : player.SLOT_TYPE_STONE_INVENTORY},
ATTR_TYPE : {"window" : player.ATTR_INVENTORY, "slot" : player.SLOT_TYPE_ATTR_INVENTORY},
FLOWER_TYPE : {"window" : player.FLOWER_INVENTORY, "slot" : player.SLOT_TYPE_FLOWER_INVENTORY},
BLEND_TYPE : {"window" : player.BLEND_INVENTORY, "slot" : player.SLOT_TYPE_BLEND_INVENTORY}
}
WINDOW_NAMES = {
UPGRADE_TYPE : localeInfo.EXTEND_INVENTORY_UPGRADE_ITEM_TOOLTIP,
BOOK_TYPE : localeInfo.EXTEND_INVENTORY_SKILL_BOOK_TOOLTIP,
STONE_TYPE : localeInfo.EXTEND_INVENTORY_STONE_TOOLTIP,
ATTR_TYPE : localeInfo.EXTEND_INVENTORY_ATTR_TOOLTIP,
FLOWER_TYPE : localeInfo.EXTEND_INVENTORY_FLOWER_TOOLTIP,
BLEND_TYPE : localeInfo.EXTEND_INVENTORY_ZEN_TOOLTIP
}
def __init__(self):
ui.ScriptWindow.__init__(self)
self.questionDialog = None
self.tooltipItem = None
self.dlgSplitItems = None
self.sellingSlotNumber = -1
self.isLoaded = 0
self.inventoryPageIndex = 0
self.categoryPageIndex = 0
self.SetWindowName("SpecialStorageWindow")
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Show(self):
self.__LoadWindow()
ui.ScriptWindow.Show(self)
def __LoadWindow(self):
if self.isLoaded == 1:
return
self.isLoaded = 1
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/SpecialStorageWindow.py")
except:
import exception
exception.Abort("SpecialStorageWindow.LoadWindow.LoadObject")
try:
wndItem = self.GetChild("ItemSlot")
self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
self.titleName = self.GetChild("TitleName")
self.inventoryTab = []
self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_05"))
self.categoryTab = []
self.categoryTab.append(self.GetChild("Category_Tab_01"))
self.categoryTab.append(self.GetChild("Category_Tab_02"))
self.categoryTab.append(self.GetChild("Category_Tab_03"))
self.categoryTab.append(self.GetChild("Category_Tab_04"))
self.categoryTab.append(self.GetChild("Category_Tab_05"))
self.categoryTab.append(self.GetChild("Category_Tab_06"))
self.MalzemeDeposuInfo = self.GetChild("MalzemeDeposuInfo")
self.SiralaButton = self.GetChild("SiralaButton")
self.inventoryopen = []
self.inventoryopen.append(self.GetChild("inventory_open_on"))
self.inventoryopen.append(self.GetChild("inventory_open_of"))
except:
import exception
exception.Abort("SpecialStorageWindow.LoadWindow.BindObject")
self.tlInfo = uiToolTip.ItemToolTip()
self.tlInfo.Hide()
self.tooltipInfo = [self.tlInfo]*9
self.InformationText = [localeInfo.EXTEND_INVENTORY_TOOLTIP_TITLE,
localeInfo.EXTEND_INVENTORY_TOOLTIP_LINE1,
localeInfo.EXTEND_INVENTORY_TOOLTIP_LINE2,
localeInfo.EXTEND_INVENTORY_TOOLTIP_LINE3,
localeInfo.EXTEND_INVENTORY_TOOLTIP_LINE4,
localeInfo.EXTEND_INVENTORY_TOOLTIP_LINE5,
localeInfo.EXTEND_INVENTORY_TOOLTIP_LINE6
]
for i in xrange(7):
self.tooltipInfo[i].SetFollow(True)
self.tooltipInfo[i].AlignHorizonalCenter()
if i == 0:
TITLE_COLOR = grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)
self.tooltipInfo[i].AutoAppendTextLine(self.InformationText[i], TITLE_COLOR)
else:
self.tooltipInfo[i].AutoAppendTextLine(self.InformationText[i])
self.tooltipInfo[i].Hide()
self.tooltipInfo[i].toolTipWidth += 40
## Item
wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
## Grade button
self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
self.inventoryTab[4].SetEvent(lambda arg=4: self.SetInventoryPage(arg))
self.inventoryTab[0].Down()
self.categoryTab[0].SetEvent(lambda arg=0: self.SetCategoryPage(arg))
self.categoryTab[1].SetEvent(lambda arg=1: self.SetCategoryPage(arg))
self.categoryTab[2].SetEvent(lambda arg=2: self.SetCategoryPage(arg))
self.categoryTab[3].SetEvent(lambda arg=3: self.SetCategoryPage(arg))
self.categoryTab[4].SetEvent(lambda arg=4: self.SetCategoryPage(arg))
self.categoryTab[5].SetEvent(lambda arg=5: self.SetCategoryPage(arg))
self.categoryTab[0].Down()
self.inventoryopen[0].SAFE_SetEvent(self.OpenInventoryK_On)
self.inventoryopen[1].SAFE_SetEvent(self.OpenInventoryK_Of)
if self.SiralaButton:
self.SiralaButton.SetEvent(ui.__mem_func__(self.ClickSirala))
## Etc
self.wndItem = wndItem
self.wndPopupDialog = uiCommon.PopupDialog()
self.dlgSplitItems = uiPickMoney.PickMoneyDialog2()
self.dlgSplitItems.LoadDialog()
self.dlgSplitItems.Hide()
if app.ENABLE_HIGHLIGHT_SYSTEM:
self.listHighlightedUpdateSlot = []
self.listHighlightedBookSlot = []
self.listHighlightedStoneSlot = []
self.listHighlightedAttrSlot = []
self.listHighlightedFlowerSlot = []
self.listHighlightedBlendSlot = []
self.SetInventoryPage(0)
self.SetCategoryPage(0)
self.RefreshItemSlot()
self.RefreshBagSlotWindow()
self.interface = None
def Destroy(self):
self.ClearDictionary()
self.tooltipItem = None
self.wndItem = 0
self.questionDialog = None
self.dlgSplitItems.Destroy()
self.dlgSplitItems = None
self.inventoryTab = []
self.categoryTab = []
self.inventoryopen = []
self.titleName = None
def BindInterface(self, interface):
self.interface = interface
if app.ENABLE_HIGHLIGHT_SYSTEM:
def HighlightSlotUpdate(self, slot):
if systemSetting.IsUsingItemHighlight():
if not slot in self.listHighlightedUpdateSlot:
self.listHighlightedUpdateSlot.append(slot)
def HighlightSlotBook(self, slot):
if systemSetting.IsUsingItemHighlight():
if not slot in self.listHighlightedBookSlot:
self.listHighlightedBookSlot.append(slot)
def HighlightSlotStone(self, slot):
if systemSetting.IsUsingItemHighlight():
if not slot in self.listHighlightedStoneSlot:
self.listHighlightedStoneSlot.append(slot)
def HighlightSlotAttr(self, slot):
if systemSetting.IsUsingItemHighlight():
if not slot in self.listHighlightedAttrSlot:
self.listHighlightedAttrSlot.append(slot)
def HighlightSlotFlower(self, slot):
if systemSetting.IsUsingItemHighlight():
if not slot in self.listHighlightedFlowerSlot:
self.listHighlightedFlowerSlot.append(slot)
def HighlightSlotBlend(self, slot):
if systemSetting.IsUsingItemHighlight():
if not slot in self.listHighlightedBlendSlot:
self.listHighlightedBlendSlot.append(slot)
def Close(self):
if None != self.tooltipItem:
self.tooltipItem.HideToolTip()
self.tlInfo.Hide()
if self.dlgSplitItems:
self.dlgSplitItems.Close()
self.Hide()
def OnUpdate(self):
for i in xrange(6):
if self.MalzemeDeposuInfo.IsIn():
self.tooltipInfo[i].Show()
else:
self.tooltipInfo[i].Hide()
def OpenInventoryK_On(self):
constInfo.KInventorymode = 1
self.inventoryopen[0].Down()
self.inventoryopen[1].SetUp()
def OpenInventoryK_Of(self):
constInfo.KInventorymode = 0
self.inventoryopen[1].Down()
self.inventoryopen[0].SetUp()
def KInventoryOpen_Refresh(self):
if constInfo.KInventorymode == 1:
self.inventoryopen[0].Down()
self.inventoryopen[1].SetUp()
else:
self.inventoryopen[0].SetUp()
self.inventoryopen[1].Down()
def ClickSirala(self):
net.SendChatPacket("/click_sort_special_storage")
def SetInventoryPage(self, page):
self.inventoryTab[self.inventoryPageIndex].SetUp()
self.inventoryPageIndex = page
self.inventoryTab[self.inventoryPageIndex].Down()
#self.RefreshBagSlotWindow()
self.RefreshBagSlotInventoryWindow(page+1)
def SetCategoryPage(self, page):
self.categoryTab[self.categoryPageIndex].SetUp()
self.categoryPageIndex = page
self.categoryTab[self.categoryPageIndex].Down()
self.titleName.SetText(self.WINDOW_NAMES[self.categoryPageIndex])
self.RefreshBagSlotWindow()
def SetItemToolTip(self, tooltipItem):
self.tooltipItem = tooltipItem
def RefreshItemSlot(self):
self.RefreshBagSlotWindow()
def RefreshStatus(self):
self.RefreshItemSlot()
def __InventoryLocalSlotPosToGlobalSlotPos(self, localSlotPos):
return self.inventoryPageIndex * player.SPECIAL_PAGE_SIZE + localSlotPos
def RefreshBagSlotWindow(self):
getItemVNum=player.GetItemIndex
getItemCount=player.GetItemCount
setItemVnum=self.wndItem.SetItemSlot
for i in xrange(player.SPECIAL_PAGE_SIZE*INVENTORY_PAGE_COUNT):
self.wndItem.EnableSlot(i)
slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
itemCount = getItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotNumber)
itemVnum = getItemVNum(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotNumber)
if 0 == itemCount:
self.wndItem.ClearSlot(i)
continue
elif 1 == itemCount:
itemCount = 0
setItemVnum(i, itemVnum, itemCount)
if app.ENABLE_HIGHLIGHT_SYSTEM:
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.UPGRADE_INVENTORY:
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.ActivateSlot(i)
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedFlowerSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBlendSlot:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.BOOK_INVENTORY:
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.ActivateSlot(i)
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.STONE_INVENTORY:
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.ActivateSlot(i)
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.ATTR_INVENTORY:
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.ActivateSlot(i)
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedFlowerSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBlendSlot:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.FLOWER_INVENTORY:
if slotNumber in self.listHighlightedFlowerSlot:
self.wndItem.ActivateSlot(i)
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBlendSlot:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.BLEND_INVENTORY:
if slotNumber in self.listHighlightedBlendSlot:
self.wndItem.ActivateSlot(i)
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.DeactivateSlot(i)
if slotNumber in self.listHighlightedFlowerSlot:
self.wndItem.DeactivateSlot(i)
self.wndItem.RefreshSlot()
def RefreshBagSlotInventoryWindow(self, page):
getItemVNum=player.GetItemIndex
getItemCount=player.GetItemCount
setItemVnum=self.wndItem.SetItemSlot
for i in xrange(player.SPECIAL_PAGE_SIZE*INVENTORY_PAGE_COUNT):
self.wndItem.EnableSlot(i)
slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
itemCount = getItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotNumber)
itemVnum = getItemVNum(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotNumber)
if 0 == itemCount:
self.wndItem.ClearSlot(i)
continue
elif 1 == itemCount:
itemCount = 0
setItemVnum(i, itemVnum, itemCount)
if app.ENABLE_HIGHLIGHT_SYSTEM:
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.UPGRADE_INVENTORY:
if player.SPECIAL_PAGE_SIZE*(page-1) <= slotNumber and\
player.SPECIAL_PAGE_SIZE*page >= slotNumber:
if slotNumber in self.listHighlightedUpdateSlot:
self.wndItem.ActivateSlot(i)
else:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.BOOK_INVENTORY:
if player.SPECIAL_PAGE_SIZE*(page-1) <= slotNumber and\
player.SPECIAL_PAGE_SIZE*page >= slotNumber:
if slotNumber in self.listHighlightedBookSlot:
self.wndItem.ActivateSlot(i)
else:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.STONE_INVENTORY:
if player.SPECIAL_PAGE_SIZE*(page-1) <= slotNumber and\
player.SPECIAL_PAGE_SIZE*page >= slotNumber:
if slotNumber in self.listHighlightedStoneSlot:
self.wndItem.ActivateSlot(i)
else:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.ATTR_INVENTORY:
if player.SPECIAL_PAGE_SIZE*(page-1) <= slotNumber and\
player.SPECIAL_PAGE_SIZE*page >= slotNumber:
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.ActivateSlot(i)
else:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.FLOWER_INVENTORY:
if player.SPECIAL_PAGE_SIZE*(page-1) <= slotNumber and\
player.SPECIAL_PAGE_SIZE*page >= slotNumber:
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.ActivateSlot(i)
else:
self.wndItem.DeactivateSlot(i)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.BLEND_INVENTORY:
if player.SPECIAL_PAGE_SIZE*(page-1) <= slotNumber and\
player.SPECIAL_PAGE_SIZE*page >= slotNumber:
if slotNumber in self.listHighlightedAttrSlot:
self.wndItem.ActivateSlot(i)
else:
self.wndItem.DeactivateSlot(i)
self.wndItem.RefreshSlot()
def ShowToolTip(self, slotIndex):
if None != self.tooltipItem:
self.tooltipItem.SetInventoryItem(slotIndex, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"])
def OnPressEscapeKey(self):
self.Close()
return True
def OnTop(self):
if None != self.tooltipItem:
self.tooltipItem.SetTop()
def OverOutItem(self):
self.wndItem.SetUsableItem(False)
if None != self.tooltipItem:
self.tooltipItem.HideToolTip()
def OverInItem(self, overSlotPos):
overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
self.wndItem.SetUsableItem(False)
if app.ENABLE_HIGHLIGHT_SYSTEM:
if overSlotPosGlobal in self.listHighlightedUpdateSlot:
self.listHighlightedUpdateSlot.remove(overSlotPosGlobal)
self.wndItem.DeactivateSlot(overSlotPos)
if overSlotPosGlobal in self.listHighlightedBookSlot:
self.listHighlightedBookSlot.remove(overSlotPosGlobal)
self.wndItem.DeactivateSlot(overSlotPos)
if overSlotPosGlobal in self.listHighlightedStoneSlot:
self.listHighlightedStoneSlot.remove(overSlotPosGlobal)
self.wndItem.DeactivateSlot(overSlotPos)
if overSlotPosGlobal in self.listHighlightedAttrSlot:
self.listHighlightedAttrSlot.remove(overSlotPosGlobal)
self.wndItem.DeactivateSlot(overSlotPos)
if overSlotPosGlobal in self.listHighlightedFlowerSlot:
self.listHighlightedFlowerSlot.remove(overSlotPosGlobal)
self.wndItem.DeactivateSlot(overSlotPos)
if overSlotPosGlobal in self.listHighlightedBlendSlot:
self.listHighlightedBlendSlot.remove(overSlotPosGlobal)
self.wndItem.DeactivateSlot(overSlotPos)
self.ShowToolTip(overSlotPosGlobal)
def OnPickItem(self, count):
itemSlotIndex = self.dlgSplitItems.itemGlobalSlotIndex
selectedItemVNum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex)
mouseModule.mouseController.AttachObject(self, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["slot"], itemSlotIndex, selectedItemVNum, count)
def SelectItemSlot(self, itemSlotIndex):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
selectedItemVNum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex)
if mouseModule.mouseController.isAttached():
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["slot"] == attachedSlotType:
if attachedItemVID == selectedItemVNum:
self.__DropSrcItemToDestItemInInventory(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex, attachedItemCount)
else:
net.SendItemUseToItemPacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex)
mouseModule.mouseController.DeattachObject()
else:
curCursorNum = app.GetCursor()
if app.SELL == curCursorNum:
self.__SellItem(itemSlotIndex)
elif app.BUY == curCursorNum:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
elif app.IsPressed(app.DIK_LALT):
link = player.GetItemLink(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex)
ime.PasteString(link)
elif app.IsPressed(app.DIK_LSHIFT):
itemCount = player.GetItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex)
if itemCount > 1:
self.dlgSplitItems.SetTitleName(localeInfo.PICK_ITEM_TITLE)
self.dlgSplitItems.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
self.dlgSplitItems.Open(itemCount)
self.dlgSplitItems.itemGlobalSlotIndex = itemSlotIndex
else:
itemCount = player.GetItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotIndex)
mouseModule.mouseController.AttachObject(self, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["slot"], itemSlotIndex, selectedItemVNum, itemCount)
self.wndItem.SetUseMode(False)
snd.PlaySound("sound/ui/pick.wav")
def __SellItem(self, itemSlotPos):
self.sellingSlotNumber = itemSlotPos
itemIndex = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotPos)
itemCount = player.GetItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], itemSlotPos)
item.SelectItem(itemIndex)
if item.IsAntiFlag(item.ANTIFLAG_SELL):
popup = uiCommon.PopupDialog()
popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
popup.SetAcceptEvent(self.__OnClosePopupDialog)
popup.Open()
self.popup = popup
return
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = itemCount / itemPrice / 5
else:
itemPrice = itemPrice * itemCount / 5
item.GetItemName(itemIndex)
itemName = item.GetItemName()
self.questionDialog = uiCommon.QuestionDialog()
self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
self.questionDialog.Open()
self.questionDialog.count = itemCount
def SellItem(self):
net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"])
snd.PlaySound("sound/ui/money.wav")
self.OnCloseQuestionDialog()
def OnCloseQuestionDialog(self):
if self.questionDialog:
self.questionDialog.Close()
self.questionDialog = None
def __OnClosePopupDialog(self):
self.pop = None
if app.ENABLE_FAST_ATTACH_ITEMS_SYSTEM:
def __GetCurrentItemGrid(self):
itemGrid = [[False for slot in xrange(player.SPECIAL_PAGE_SIZE)] for page in xrange(player.INVENTORY_PAGE_COUNT)]
for page in xrange(player.INVENTORY_PAGE_COUNT):
for slot in xrange(player.SPECIAL_PAGE_SIZE):
itemVnum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slot + page * player.SPECIAL_PAGE_SIZE)
if itemVnum <> 0:
(w, h) = item.GetItemSize(item.SelectItem(itemVnum))
for i in xrange(h):
itemGrid[page][slot + i * 5] = True
return itemGrid
def __FindEmptyCellForSize(self, itemGrid, size):
for page in xrange(player.INVENTORY_PAGE_COUNT):
for slot in xrange(player.SPECIAL_PAGE_SIZE):
if itemGrid[page][slot] == False:
possible = True
for i in xrange(size):
p = slot + (i * 5)
try:
if itemGrid[page][p] == True:
possible = False
break
except IndexError:
possible = False
break
if possible:
return slot + page * player.SPECIAL_PAGE_SIZE
return -1
def AttachItemFromSafebox(self, slotIndex, itemIndex):
itemGrid = self.__GetCurrentItemGrid()
if item.GetItemType(item.SelectItem(itemIndex)) == item.ITEM_TYPE_DS:
return
emptySlotIndex = self.__FindEmptyCellForSize(itemGrid, item.GetItemSize()[1])
if emptySlotIndex <> -1:
net.SendSafeboxCheckoutPacket(slotIndex, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], emptySlotIndex)
return True
def AttachItemFromInventory(self, slotWindow, slotIndex):
attachedItemID = player.GetItemIndex(slotWindow, slotIndex)
item.SelectItem(attachedItemID)
if item.GetItemType(attachedItemID) == item.ITEM_TYPE_DS:
return False
itemGrid = self.__GetCurrentItemGrid()
emptySpecialSlot = self.__FindEmptyCellForSize(itemGrid, item.GetItemSize()[1])
if emptySpecialSlot == -1 or item.GetItemType() == item.ITEM_TYPE_ELK:
return False
net.SendSafeboxCheckinPacket(slotWindow, slotIndex, emptySpecialSlot)
return True
def SelectEmptySlot(self, selectedSlotPos):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
if mouseModule.mouseController.isAttached():
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
if player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
mouseModule.mouseController.RunCallBack("INVENTORY")
elif player.SLOT_TYPE_SHOP == attachedSlotType:
net.SendShopBuyPacket(attachedSlotPos)
elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
net.SendSafeboxCheckoutPacket(attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], selectedSlotPos)
elif player.SLOT_TYPE_MALL == attachedSlotType:
net.SendMallCheckoutPacket(attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], selectedSlotPos)
elif player.RESERVED_WINDOW != attachedInvenType or\
player.UPGRADE_INVENTORY == attachedInvenType or\
player.BOOK_INVENTORY == attachedInvenType or\
player.STONE_INVENTORY == attachedInvenType or\
player.ATTR_INVENTORY == attachedInvenType or\
player.FLOWER_INVENTORY == attachedInvenType or\
player.BLEND_INVENTORY == attachedInvenType:
itemCount = player.GetItemCount(attachedInvenType, attachedSlotPos)
attachedCount = mouseModule.mouseController.GetAttachedItemCount()
self.__SendMoveItemPacket(attachedInvenType, attachedSlotPos, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], selectedSlotPos, attachedCount)
mouseModule.mouseController.DeattachObject()
def UseItemSlot(self, slotIndex):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
return
slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
if app.ENABLE_FAST_ATTACH_ITEMS_SYSTEM:
if self.interface and self.interface.AttachInvenItemToOtherWindowSlot(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex):
return
if app.IsPressed(app.DIK_LSHIFT) and app.IsPressed(app.DIK_X):
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.DROP_ITEM_FAILURE_PRIVATE_SHOP)
return
itemCount = player.GetItemCount(slotIndex)
net.SendItemSellPacket(slotIndex, self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"])
snd.PlaySound('sound/ui/money.wav')
return
ItemVNum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex)
item.SelectItem(ItemVNum)
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.FLOWER_INVENTORY:
if app.IsPressed(app.DIK_LCONTROL) and item.GetItemType() == item.ITEM_TYPE_GIFTBOX:
GiftCount = player.GetItemCount(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex)
net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex, GiftCount)
return
if player.GetItemTypeBySlot(player.FLOWER_INVENTORY, slotIndex) == item.ITEM_TYPE_GIFTBOX or player.GetItemTypeBySlot(player.FLOWER_INVENTORY, slotIndex) == item.ITEM_TYPE_GACHA:
if app.ENABLE_SHOW_CHEST_DROP:
if self.interface:
if self.interface.dlgChestDrop:
self.interface.dlgChestDrop.Open(slotIndex,1)
net.SendChestDropInfo(ItemVNum)
return
else:
net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex)
mouseModule.mouseController.DeattachObject()
self.OverOutItem()
elif self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] == player.BOOK_INVENTORY:
if app.IsPressed(app.DIK_LCONTROL) and item.GetItemType() == item.ITEM_TYPE_SKILLBOOK:
skill_index = player.GetItemMetinSocket(player.BOOK_INVENTORY, slotIndex, 0)
skill_level = player.GetSkillLevel(skill_index)
countBook = player.GetItemCount(player.BOOK_INVENTORY, slotIndex)
if self.GetSkillIndex(skill_index) == False:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Bu beceri kitabı size uygun değil.")
return
if (countBook+skill_level) < 40: # burası g'ye kadar kaç seviye ise 40'mı 50mi tam bilmiyorum
net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex, countBook)
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Becerileriniz GrandMaster seviyesindedir.")
return
else:
net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex)
mouseModule.mouseController.DeattachObject()
self.OverOutItem()
else:
#if app.ENABLE_ITEM_COMBINATION_SYSTEM:
#if self.isShowCombinationWindow():
#self.wndSkillBookCombination.AddItemWithoutMouse(slotIndex)
#return
net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex)
mouseModule.mouseController.DeattachObject()
self.OverOutItem()
def GetSkillIndex(self,p):
i = net.GetMainActorSkillGroup()
j = player.GetJob()
if j == 0 or j == 4:
if i==1:
if p >= 1 and p <= 6:
return True
elif i==2:
if p >= 16 and p <= 21:
return True
elif j == 1 or j == 5:
if i ==1:
if p >= 31 and p <= 36:
return True
elif i==2:
if p >= 46 and p <= 51:
return True
elif j == 2 or j == 6:
if i ==1:
if p >= 61 and p <= 66:
return True
elif i==2:
if p >= 76 and p <= 81:
return True
elif j == 3 or j == 7:
if i ==1:
if p >= 91 and p <= 96:
return True
elif i==2:
if p >= 106 and p <= 112:
return True
elif j == 8: # wolf
if i ==1:
if p >= 171 and p <= 176:
return True
#elif j == 9: # elf
#if i ==1:
#if p >= 181 and p <= 186:
#return True
return False
def IsTreasureBox(self, slotIndex):
itemVnum = player.GetItemIndex(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex)
item.SelectItem(itemVnum)
if item.GetItemType() == item.ITEM_TYPE_GIFTBOX:
return True
## you can set own treasures which not have item giftbox type, simply add vnums here
treasures = {
0: 50011,
1: 50024,
2: 50025,
3: 50031,
4: 50032,
}
if itemVnum in treasures.values():
return True
return False
def SendMultipleUseItemPacket(self, slotIndex):
itemCount = player.GetItemCount(player.FLOWER_INVENTORY, slotIndex)
net.SendItemUsePacket(self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"], slotIndex, itemCount)
def __SendMoveItemPacket(self, srcSlotWindow, srcSlotPos, dstSlotWindow, dstSlotPos, srcItemCount):
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
return
if self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] != player.UPGRADE_INVENTORY and\
self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] != player.BOOK_INVENTORY and\
self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] != player.STONE_INVENTORY and\
self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] != player.ATTR_INVENTORY and\
self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] != player.FLOWER_INVENTORY and\
self.SLOT_WINDOW_TYPE[self.categoryPageIndex]["window"] != player.BLEND_INVENTORY:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Bu işlemi gerçekleştiremezsiniz!")
return
net.SendItemMovePacket(srcSlotWindow , srcSlotPos, dstSlotWindow, dstSlotPos, srcItemCount)
def __DropSrcItemToDestItemInInventory(self, veri_1, veri_2, veri_3, veri_4, veri_5):
if veri_2 == veri_4:
return
net.SendItemMovePacket(veri_1, veri_2, veri_3, veri_4, veri_5)