def __UseItem(self, slotIndex): ItemVNum = player.GetItemIndex(slotIndex) item.SelectItem(ItemVNum) if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE): self.questionDialog = uiCommon.QuestionDialog() self.questionDialog.SetText(locale.INVENTORY_REALLY_USE_ITEM) self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept)) self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel)) self.questionDialog.Open() self.questionDialog.slotIndex = slotIndex else: self.__SendUseItemPacket(slotIndex)
def SetContent(self, id, vnum, price): self.id = id self.data = [vnum, price] item.SelectItem(vnum) self.itemName.SetText(item.GetItemName()) self.itemIcon.LoadImage(item.GetIconImageFileName()) self.itemIcon.SetPosition(35, (46, 32, 25)[item.GetItemSize()[1] - 1]) self.itemIcon.SetScale(1, (1, 1, 0.8)[item.GetItemSize()[1] - 1]) self.itemPrice.SetText('Precio: %d %s' % (price, "AP's")) self.itemAmount.KillFocus() if item.IsFlag(4) == 1: self.GetChild("ItemAmountSlot").Show() else: self.GetChild("ItemAmountSlot").Hide() self.toolTip.ClearToolTip() self.toolTip.AddItemData(vnum, [0, 0, 0]) self.toolTip.HideToolTip()