Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def OnSellItem(self, slotPos, count, itemtype):
- net.SendShopSellPacketNew(slotPos, count, itemtype)
- snd.PlaySound("sound/ui/money.wav")
- self.OnCloseQuestionDialog()
- def SellAttachedItem(self):
- if shop.IsPrivateShop():
- mouseModule.mouseController.DeattachObject()
- return
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- attachedCount = mouseModule.mouseController.GetAttachedItemCount()
- attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
- #TRY
- if player.SLOT_TYPE_INVENTORY == attachedSlotType:
- item.SelectItem(attachedItemIndex)
- itemPrice = item.GetISellItemPrice()
- itemtype = player.SlotTypeToInvenType(attachedSlotType)
- 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
- itemtype = player.SlotTypeToInvenType(attachedSlotType)
- if player.IsValuableItem(itemtype, attachedSlotPos):
- item.SelectItem(attachedItemIndex)
- if item.Is1GoldItem():
- itemPrice = attachedCount / itemPrice / 5
- else:
- itemPrice = itemPrice * max(1, attachedCount) / 5
- itemName = item.GetItemName()
- questionDialog = uiCommon.QuestionDialog()
- questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, attachedCount, itemPrice))
- questionDialog.SetAcceptEvent(lambda arg1=attachedSlotPos, arg2=attachedCount, arg3=itemtype: self.OnSellItem(arg1, arg2, arg3))
- questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
- questionDialog.Open()
- self.questionDialog = questionDialog
- else:
- self.OnSellItem(attachedSlotPos, attachedCount, itemtype)
- else:
- snd.PlaySound("sound/ui/loginfail.wav")
- mouseModule.mouseController.DeattachObject()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement