Advertisement
Guest User

Untitled

a guest
Jan 11th, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. def OnSellItem(self, slotPos, count, itemtype):
  2. net.SendShopSellPacketNew(slotPos, count, itemtype)
  3. snd.PlaySound("sound/ui/money.wav")
  4. self.OnCloseQuestionDialog()
  5.  
  6. def SellAttachedItem(self):
  7.  
  8. if shop.IsPrivateShop():
  9. mouseModule.mouseController.DeattachObject()
  10. return
  11.  
  12. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  13. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  14. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  15.  
  16. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  17. #TRY
  18. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  19.  
  20. item.SelectItem(attachedItemIndex)
  21. itemPrice = item.GetISellItemPrice()
  22. itemtype = player.SlotTypeToInvenType(attachedSlotType)
  23.  
  24. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  25. popup = uiCommon.PopupDialog()
  26. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  27. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  28. popup.Open()
  29. self.popup = popup
  30.  
  31. itemtype = player.SlotTypeToInvenType(attachedSlotType)
  32.  
  33. if player.IsValuableItem(itemtype, attachedSlotPos):
  34.  
  35.  
  36. item.SelectItem(attachedItemIndex)
  37.  
  38. if item.Is1GoldItem():
  39. itemPrice = attachedCount / itemPrice / 5
  40. else:
  41. itemPrice = itemPrice * max(1, attachedCount) / 5
  42.  
  43. itemName = item.GetItemName()
  44.  
  45. questionDialog = uiCommon.QuestionDialog()
  46. questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, attachedCount, itemPrice))
  47.  
  48. questionDialog.SetAcceptEvent(lambda arg1=attachedSlotPos, arg2=attachedCount, arg3=itemtype: self.OnSellItem(arg1, arg2, arg3))
  49. questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  50. questionDialog.Open()
  51. self.questionDialog = questionDialog
  52.  
  53. else:
  54. self.OnSellItem(attachedSlotPos, attachedCount, itemtype)
  55.  
  56. else:
  57. snd.PlaySound("sound/ui/loginfail.wav")
  58.  
  59. mouseModule.mouseController.DeattachObject()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement