Advertisement
Guest User

dawdawd

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