From Karbust, 3 Years ago, written in Python.
Embed
  1. ### interfaceModule.py ###
  2.  
  3. # 1) Search for: import uiScriptLocale
  4. # 2) Make a new line and under paste this:
  5.  
  6. import uiTicket
  7.  
  8. # 1) Search for:
  9. """
  10.                 self.dlgShop = uiShop.ShopDialog()
  11.                 self.dlgShop.LoadDialog()
  12.                 self.dlgShop.Hide()
  13. """
  14. # on def __MakeDialogs(self):
  15. # 2) Make a new line and under paste this:
  16.  
  17.                 self.wndTicket = uiTicket.TicketWindow()
  18.                 self.wndTicket.Hide()
  19.                
  20. # 1) Search for:
  21. """
  22.                 if self.dlgShop:
  23.                         self.dlgShop.Destroy()
  24. """
  25. # on def Close(self):
  26. # 2) Make a new line and under paste this:
  27.  
  28.                 if self.wndTicket:
  29.                         self.wndTicket.Destroy()
  30.                        
  31. # 1) Search for: del self.wndItemSelect
  32. # 2) Make a new line and under paste this:
  33.  
  34.                 del self.wndTicket
  35.                
  36. ############################
  37. ############################
  38.  
  39. ### constInfo.py ###
  40.  
  41. # 1) Search for: isItemDropQuestionDialog = 0
  42. # 2) Make a new line and under paste this:
  43.  
  44. Tickets = {
  45.         'QID' : 0,
  46.         'QCMD' : '',
  47.         'MY_TICKETS' : [],
  48.         'GLOBAL_TICKETS' : [],
  49.         'ANSWERS' : {},
  50.         'PERMISIONS' : []
  51. }
  52.  
  53. ############################
  54. ############################
  55. ### game.py ###
  56.  
  57. # 1) Search for en el def __ServerCommand_Build
  58. """
  59.                         "mall"                                  : self.__InGameShop_Show,
  60. """
  61. # 2) Make a new line and under paste this:
  62.  
  63.                         "TICKETS"                               : self.ManagerTickets,
  64.                        
  65. # 1) Search for:
  66. """
  67.         def __InGameShop_Show(self, url):
  68.                 if constInfo.IN_GAME_SHOP_ENABLE:
  69.                         self.interface.OpenWebWindow(url)
  70. """
  71. # 2) Make a new line and under paste this:
  72.  
  73.         def ManagerTickets(self, cmd):
  74.                 cmd = cmd.split('#')
  75.                 if cmd[0] == 'QID':
  76.                         constInfo.Tickets['QID'] = int(cmd[1])
  77.                 elif cmd[0] == 'INPUT':
  78.                         constInfo.INPUT_IGNORE = int(cmd[1])
  79.                 elif cmd[0] == 'SEND':
  80.                         net.SendQuestInputLongStringPacket(str(constInfo.Tickets['QCMD']))
  81.                         constInfo.Tickets['QCMD'] = ''
  82.                 elif cmd[0] == 'CLEAR_CONTENT':
  83.                         constInfo.Tickets['MY_TICKETS'] = []
  84.                         constInfo.Tickets['GLOBAL_TICKETS'] = []
  85.                 elif cmd[0] == 'CLEAR_PERMISIONS':
  86.                         constInfo.Tickets['PERMISIONS'] = []
  87.                 elif cmd[0] == 'SET_TICKET':
  88.                         date = cmd[4].split('[_]')
  89.                         constInfo.Tickets['GLOBAL_TICKETS'].append([cmd[1], cmd[2].replace('[_]', ' '), int(cmd[3]), date[0], date[1], int(cmd[5]), cmd[6], cmd[7].replace('[_]', ' '), int(cmd[8])])
  90.                         if cmd[6] == player.GetName():
  91.                                 constInfo.Tickets['MY_TICKETS'].append([cmd[1], cmd[2].replace('[_]', ' '), int(cmd[3]), date[0], date[1], int(cmd[5]), cmd[6], cmd[7].replace('[_]', ' '), int(cmd[8])])
  92.                 elif cmd[0] == 'CREATE_ANSWER':
  93.                         constInfo.Tickets['ANSWERS'][cmd[1]] = []
  94.                 elif cmd[0] == 'SET_ANSWER':
  95.                         date = cmd[3].split('[_]')
  96.                         constInfo.Tickets['ANSWERS'][cmd[1]].append([cmd[2], date[0], date[1], cmd[4].replace('[_]', ' ')])
  97.                 elif cmd[0] == 'SET_PERMISION':
  98.                         constInfo.Tickets['PERMISIONS'].append([cmd[1], int(cmd[2]), int(cmd[3]), int(cmd[4])])
  99.                 elif cmd[0] == 'OPEN':
  100.                         self.interface.wndTicket.Open(int(cmd[1]))
  101.                 elif cmd[0] == 'REFRESH_CONTENT':
  102.                         self.interface.wndTicket.RefreshPage()
  103.  
  104. ############################
  105. ############################
  106.  
  107. ### ui.py ###
  108.  
  109. # 1) Search for:
  110. """
  111. class NumberLine(window):
  112.         ...
  113. """
  114. # after all the class
  115. # 2) Make a new line and under paste this:
  116.  
  117. class CoolButton(Window):
  118.        
  119.         BACKGROUND_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 1.0)
  120.         DARK_COLOR = grp.GenerateColor(0.4, 0.4, 0.4, 1.0)
  121.        
  122.         WHITE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 0.3)
  123.         HALF_WHITE_COLOR = grp.GenerateColor(1.0, 1.0, 1.0, 0.2)
  124.        
  125.         def __init__(self, layer = "UI"):
  126.                 Window.__init__(self, layer)
  127.  
  128.                 self.eventFunc = None
  129.                 self.eventArgs = None
  130.  
  131.                 self.ButtonText = None
  132.                 self.ToolTipText = None
  133.                
  134.                 self.EdgeColor = None
  135.                 self.isOver = FALSE
  136.                 self.isSelected = FALSE
  137.                
  138.                 self.width = 0
  139.                 self.height = 0        
  140.  
  141.         def __del__(self):
  142.                 Window.__del__(self)
  143.  
  144.                 self.eventFunc = None
  145.                 self.eventArgs = None
  146.  
  147.         def SetSize(self, width, height):
  148.                 Window.SetSize(self, width, height)
  149.                 self.width = width
  150.                 self.height = height
  151.                
  152.         def SetEvent(self, func, *args):
  153.                 self.eventFunc = func
  154.                 self.eventArgs = args
  155.  
  156.         def SetTextColor(self, color):
  157.                 if not self.ButtonText:
  158.                         return
  159.                 self.ButtonText.SetPackedFontColor(color)
  160.                
  161.         def SetEdgeColor(self, color):
  162.                 self.EdgeColor = color
  163.  
  164.         def SetText(self, text):
  165.                 if not self.ButtonText:
  166.                         textLine = TextLine()
  167.                         textLine.SetParent(self)
  168.                         textLine.SetPosition(self.GetWidth()/2, self.GetHeight()/2)
  169.                         textLine.SetVerticalAlignCenter()
  170.                         textLine.SetHorizontalAlignCenter()
  171.                         textLine.SetOutline()
  172.                         textLine.Show()
  173.                         self.ButtonText = textLine
  174.  
  175.                 self.ButtonText.SetText(text)
  176.  
  177.         def SetToolTipText(self, text, x=0, y = -19):
  178.                 if not self.ToolTipText:               
  179.                         toolTip=createToolTipWindowDict["TEXT"]()
  180.                         toolTip.SetParent(self)
  181.                         toolTip.SetSize(0, 0)
  182.                         toolTip.SetHorizontalAlignCenter()
  183.                         toolTip.SetOutline()
  184.                         toolTip.Hide()
  185.                         toolTip.SetPosition(x + self.GetWidth()/2, y)
  186.                         self.ToolTipText=toolTip
  187.  
  188.                 self.ToolTipText.SetText(text)
  189.  
  190.         def ShowToolTip(self):
  191.                 if self.ToolTipText:
  192.                         self.ToolTipText.Show()
  193.  
  194.         def HideToolTip(self):
  195.                 if self.ToolTipText:
  196.                         self.ToolTipText.Hide()
  197.                        
  198.         def SetTextPosition(self, width):
  199.                 self.ButtonText.SetPosition(width, self.GetHeight()/2)
  200.                 self.ButtonText.SetHorizontalAlignLeft()
  201.                
  202.         def Enable(self):
  203.                 wndMgr.Enable(self.hWnd)
  204.  
  205.         def Disable(self):
  206.                 wndMgr.Disable(self.hWnd)
  207.                
  208.         def OnMouseLeftButtonDown(self):
  209.                 self.isSelected = TRUE
  210.                
  211.         def OnMouseLeftButtonUp(self):
  212.                 self.isSelected = FALSE
  213.                 if self.eventFunc:
  214.                         apply(self.eventFunc, self.eventArgs)
  215.  
  216.         def OnUpdate(self):
  217.                 if self.IsIn():
  218.                         self.isOver = TRUE
  219.                         self.ShowToolTip()
  220.                 else:
  221.                         self.isOver = FALSE
  222.                         self.HideToolTip()
  223.  
  224.         def OnRender(self):
  225.                 xRender, yRender = self.GetGlobalPosition()
  226.                
  227.                 widthRender = self.width
  228.                 heightRender = self.height
  229.                 grp.SetColor(self.BACKGROUND_COLOR)
  230.                 grp.RenderBar(xRender, yRender, widthRender, heightRender)
  231.                 if self.EdgeColor:
  232.                         grp.SetColor(self.EdgeColor)
  233.                 else:
  234.                         grp.SetColor(self.DARK_COLOR)
  235.                 grp.RenderLine(xRender, yRender, widthRender, 0)
  236.                 grp.RenderLine(xRender, yRender, 0, heightRender)
  237.                 grp.RenderLine(xRender, yRender+heightRender, widthRender, 0)
  238.                 grp.RenderLine(xRender+widthRender, yRender, 0, heightRender)
  239.  
  240.                 if self.isOver:
  241.                         grp.SetColor(self.HALF_WHITE_COLOR)
  242.                         grp.RenderBar(xRender + 2, yRender + 2, self.width - 3, heightRender - 3)
  243.  
  244.                         if self.isSelected:
  245.                                 grp.SetColor(self.WHITE_COLOR)
  246.                                 grp.RenderBar(xRender + 2, yRender + 2, self.width - 3, heightRender - 3)
  247.  
  248. # 1) Search for: class EditLine(TextLine):
  249. #Inside of class EditLine(TextLine):
  250. """
  251.         self.eventKillFocus = None
  252. """
  253. # 2) Make a new line and paste this:
  254.  
  255.                 self.CanClick = None
  256.  
  257. #WARNING! There are 2          
  258. #Continue in class EditLine(TextLine)
  259. # 1) Search for:
  260. """
  261.         def SetTabEvent(self, event):
  262.                 self.eventTab = event
  263. """
  264. # under this def
  265. # 2) Make a new line and paste this:
  266.  
  267.         def CanEdit(self, flag):
  268.                 self.CanClick = flag
  269.  
  270. #Continue in class EditLine(TextLine)
  271. # 1) Search for:
  272. """
  273.         def OnMouseLeftButtonDown(self):
  274.                 ...
  275. """
  276. # Below this:
  277. """
  278.                 if FALSE == self.IsIn():
  279.                         return FALSE
  280. """
  281. # 2) Make a new line and paste this:
  282.                 if FALSE == self.CanClick:
  283.                         return
  284.  
  285. # Should be this under it: self.SetFocus()
  286.  
  287. ############################
  288. ############################
  289.  
  290. # 1) To open the ticket window use this function:
  291.  
  292. def OpenTicketWindow(self):
  293.         constInfo.Tickets['QCMD'] = 'OPEN#'
  294.         event.QuestButtonClick(constInfo.Tickets['QID'])
  295.  
  296.  
  297.