Advertisement
Guest User

Untitled

a guest
Jun 8th, 2019
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. ## find:
  2. import emotion
  3.  
  4. ## remove:
  5. import uiCommon
  6.  
  7.  
  8. ## find
  9. def ChooseCountPlusStat(self, statusKey):
  10. inputDialog = uiCommon.InputDialog()
  11. inputDialog.SetTitle("Podaj ilość punktów")
  12. inputDialog.SetMaxLength(2)
  13. inputDialog.SetNumberMode()
  14. inputDialog.SetFocus()
  15. inputDialog.SetAcceptEvent(lambda arg1=statusKey: self.ChooseCountPlusStatConfirm(arg1))
  16. inputDialog.SetCancelEvent(self.ChooseCountPlusStatHide)
  17. inputDialog.Open()
  18. self.inputDialog = inputDialog
  19.  
  20. def ChooseCountPlusStatHide(self):
  21. self.inputDialog.Hide()
  22.  
  23. def ChooseCountPlusStatConfirm(self, statusKey):
  24. self.ChooseCountPlusStatHide()
  25. statusPlusCommand=self.statusPlusCommandDict[statusKey]
  26. try:
  27. count = int(self.inputDialog.GetText())
  28. if count <= 0:
  29. chat.AppendChat(chat.CHAT_TYPE_INFO, "Podano błędną wartość.")
  30. return
  31. if count > 30:
  32. chat.AppendChat(chat.CHAT_TYPE_INFO, "Możesz dodać maksymalnie 30 punktów jednocześnie.")
  33. return
  34. if count > 1:
  35. for i in xrange(count):
  36. net.SendChatPacket(statusPlusCommand)
  37. else:
  38. net.SendChatPacket(statusPlusCommand)
  39.  
  40. except ValueError:
  41. chat.AppendChat(chat.CHAT_TYPE_INFO, "Podano błędną wartość.")
  42.  
  43. def __OnClickStatusPlusButton(self, statusKey):
  44. try:
  45. statusPlusPoint=player.GetStatus(player.STAT)
  46. if statusPlusPoint > 4:
  47. self.ChooseCountPlusStat(statusKey)
  48. else:
  49. statusPlusCommand=self.statusPlusCommandDict[statusKey]
  50. net.SendChatPacket(statusPlusCommand)
  51.  
  52. except KeyError, msg:
  53. dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)
  54.  
  55.  
  56. ## : replace with this
  57.  
  58. def __OnClickStatusPlusButton(self, statusKey):
  59. try:
  60. statusPlusCommand=self.statusPlusCommandDict[statusKey]
  61. net.SendChatPacket(statusPlusCommand)
  62. except KeyError, msg:
  63. dbg.TraceError("CharacterWindow.__OnClickStatusPlusButton KeyError: %s", msg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement