SHARE
TWEET

Untitled

a guest Nov 14th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- MEU OVO KKK
  2. EMOTICONS = {
  3. [":)"] = 'blush',
  4. ["(like)"] = 'like',
  5. ["(bear)"] = 'bear',
  6. ["(!)"] = 'att',
  7. ["(n)"] = '-1',
  8. ["(y)"] = '+1',
  9. ["o:)"] = 'angel',
  10. ["(angry)"] = 'angry',
  11. ["(bike)"] = 'bike',
  12. ["(birthday)"] = 'birthday',
  13. ["</3"] = 'broken_heart',
  14. ["(book)"] = 'closed_book',
  15. ["(pc)"] = 'computer',
  16. [":/"] = 'confused',
  17. ["(love)"] = 'couple_with_heart',
  18. ["(ghost)"] = 'ghost',
  19. ["(inlove)"] = 'heart_eyes',
  20. ["<3"] = 'heart',
  21. ["(kiss)"] = 'kiss',
  22. [":*"] = 'kissing_face',
  23. [";*"] = 'kissing_heart',
  24. ["(sick)"] = 'mask',
  25. ["\\m/"] = 'metal',
  26. [":l"] = 'neutral_face',
  27. ["(stop)"] = 'no_good',
  28. ["(ok)"] = 'ok_hand',
  29. ["(pizza)"] = 'pizza',
  30. ["(poop)"] = 'poop',
  31. ["(pray)"] = 'pray',
  32. ["(punch)"] = 'punch',
  33. ["(rage)"] = 'rage',
  34. ["(ring)"] = 'ring',
  35. ["(rose)"] = 'rose',
  36. ["(santa)"] = 'santa',
  37. [":o"] = 'scream',
  38. [":D"] = 'smiley',
  39. ["(smirk)"] = 'smirk',
  40. [":,("] = 'sob',
  41. [";p"] = 'stuck_out_tongue_winking_eye',
  42. ["B)"] = 'sunglasses',
  43. ["(sweat)"] = 'sweat',
  44. ["(trollface)"] = 'trollface',
  45. ["(18+)"] = 'underage',
  46. ["(v)"] = 'v',
  47. [";)"] = 'wink',
  48. [":("] = 'worried',
  49. [":p"] = 'yum',
  50. ["(zzz)"] = 'zzz',
  51. }
  52.  
  53. Eoptions = {ignore=false;}
  54. function findEmoticons(text)
  55.     if Eoptions.ignore then
  56.         return {};
  57.     end
  58.     --local text = "oie blz {eu tenho} muita :-) batata pra vc {com} :-) leite :)  AEAEAEAEA =]"
  59.     local tmpData = {}
  60.     --[[for b,i in pairs(EMOTICONS) do
  61.         b = b:gsub('%-',"%%%-")
  62.         b = b:gsub('%)',"%%%)")
  63.         b = b:gsub('%(',"%%%(")
  64.         while string.find(text,b,(tmpData[#tmpData] or {})[2]) do
  65.             local x,y,z = string.find(text,b,(tmpData[#tmpData] or {})[2])
  66.             tmpData[#tmpData+1] = {x,y,b}
  67.             print("Located:",b)
  68.         end
  69.     end]]
  70.     for i=1,#text do
  71.         for b,name in pairs(EMOTICONS) do
  72.             local find = true;
  73.             local params = {}
  74.             local ended = 0
  75.             for e=1,b:len() do
  76.                 --[[if b:sub(e,e) == '&' and text:sub(i+(e-1),i+(e-1)) ~= '*'  then
  77.                     if string.byte(text:sub(i+(e-1),i+(e-1))) <= '0' and
  78.                     params[#params+1] = text:sub(i+(e-1),i+(e-1))
  79.                 elseif b:sub(e,e) == '*'  and b:sub(e+1,e+1) == "*" then
  80.                     print("ext")
  81.                     local ext = ""
  82.                     local thisE = e;
  83.                     e = e+1
  84.                     print(text:sub(i+(e-1),i+(e-1)) )
  85.                     while text:sub(i+(e-1),i+(e-1)) ~= '*' and i+(e-1) <= #text do
  86.                         ext  = ext..text:sub(i+(e-1),i+(e-1));
  87.                         e = e+1
  88.                         print(ext,e)
  89.                     end
  90.                     ended = e;
  91.                     params[#params+1] = ext
  92.                     break
  93.                 else]]
  94.                 if text:sub(i+(e-1),i+(e-1)) ~= b:sub(e,e) then
  95.                     find = false
  96.  
  97.                     break
  98.                 end
  99.                 ended = e;
  100.             end
  101.             if find then
  102.                 tmpData[#tmpData+1] = {i,i+ended-1,name,unpack(params)}
  103.             end
  104.         end
  105.     end
  106.     return tmpData
  107. end
  108.  
  109.  
  110.  
  111.  
  112. -- SpeakTypesSettings = {
  113.   -- none = {},
  114.   -- say = { speakType = MessageModes.Say, color = '#FFFF00' },
  115.   -- whisper = { speakType = MessageModes.Whisper, color = '#FFFF00' },
  116.   -- yell = { speakType = MessageModes.Yell, color = '#FFFF00' },
  117.   -- broadcast = { speakType = MessageModes.GamemasterPrivateFrom, color = '#F55E5E' },
  118.   -- private = { speakType = MessageModes.PrivateTo, color = '#5FF7F7', private = true },
  119.   -- privateRed = { speakType = MessageModes.GamemasterTo, color = '#F55E5E', private = true },
  120.   -- privatePlayerToPlayer = { speakType = MessageModes.PrivateTo, color = '#9F9DFD', private = true },
  121.   -- privatePlayerToNpc = { speakType = MessageModes.NpcTo, color = '#9F9DFD', private = true, npcChat = true },
  122.   -- privateNpcToPlayer = { speakType = MessageModes.NpcFrom, color = '#5FF7F7', private = true, npcChat = true },
  123.   -- channelYellow = { speakType = MessageModes.Channel, color = '#FFFF00' },
  124.   -- channelWhite = { speakType = MessageModes.ChannelManagement, color = '#FFFFFF' },
  125.   -- channelRed = { speakType = MessageModes.GamemasterChannel, color = '#F55E5E' },
  126.   -- channelOrange = { speakType = MessageModes.ChannelHighlight, color = '#FE6500' },
  127.   -- monsterSay = { speakType = MessageModes.MonsterSay, color = '#FE6500', hideInConsole = true},
  128.   -- monsterYell = { speakType = MessageModes.MonsterYell, color = '#FE6500', hideInConsole = true},
  129.   -- rvrAnswerFrom = { speakType = MessageModes.RVRAnswer, color = '#FE6500' },
  130.   -- rvrAnswerTo = { speakType = MessageModes.RVRAnswer, color = '#FE6500' },
  131.   -- rvrContinue = { speakType = MessageModes.RVRContinue, color = '#FFFF00' },
  132. -- }
  133.  
  134. -- SpeakTypes = {
  135.   -- [MessageModes.Say] = SpeakTypesSettings.say,
  136.   -- [MessageModes.Whisper] = SpeakTypesSettings.whisper,
  137.   -- [MessageModes.Yell] = SpeakTypesSettings.yell,
  138.   -- [MessageModes.GamemasterBroadcast] = SpeakTypesSettings.broadcast,
  139.   -- [MessageModes.PrivateFrom] = SpeakTypesSettings.private,
  140.   -- [MessageModes.GamemasterPrivateFrom] = SpeakTypesSettings.privateRed,
  141.   -- [MessageModes.NpcTo] = SpeakTypesSettings.privatePlayerToNpc,
  142.   -- [MessageModes.NpcFrom] = SpeakTypesSettings.privateNpcToPlayer,
  143.   -- [MessageModes.Channel] = SpeakTypesSettings.channelYellow,
  144.   -- [MessageModes.ChannelManagement] = SpeakTypesSettings.channelWhite,
  145.   -- [MessageModes.GamemasterChannel] = SpeakTypesSettings.channelRed,
  146.   -- [MessageModes.ChannelHighlight] = SpeakTypesSettings.channelOrange,
  147.   -- [MessageModes.MonsterSay] = SpeakTypesSettings.monsterSay,
  148.   -- [MessageModes.MonsterYell] = SpeakTypesSettings.monsterYell,
  149.   -- [MessageModes.RVRChannel] = SpeakTypesSettings.channelWhite,
  150.   -- [MessageModes.RVRContinue] = SpeakTypesSettings.rvrContinue,
  151.   -- [MessageModes.RVRAnswer] = SpeakTypesSettings.rvrAnswerFrom,
  152.  
  153.   -- ignored types
  154.   -- [MessageModes.Spell] = SpeakTypesSettings.none,
  155.   -- [MessageModes.BarkLow] = SpeakTypesSettings.none,
  156.   -- [MessageModes.BarkLoud] = SpeakTypesSettings.none,
  157. -- }
  158.  
  159. -- SayModes = {
  160.   -- [1] = { speakTypeDesc = 'whisper', icon = '/images/game/console/whisper' },
  161.   -- [2] = { speakTypeDesc = 'say', icon = '/images/game/console/say' },
  162.   -- [3] = { speakTypeDesc = 'yell', icon = '/images/game/console/yell' }
  163. -- }
  164. -- filters = {}
  165.  
  166. -- MAX_HISTORY = 7100
  167. -- MAX_LINES = 7000
  168. -- opacity = 1.0
  169. -- HELP_CHANNEL = 9
  170. -- IGNOREPM = false;
  171. -- consolePanel = nil
  172. -- consoleContentPanel = nil
  173. -- consoleTabBar = nil
  174. -- consoleTextEdit = nil
  175. -- channels = nil
  176. -- channelsWindow = nil
  177. -- ownPrivateName = nil
  178. -- EmojiW = nil
  179. -- messageHistory = {}
  180. -- currentMessageIndex = 0
  181. -- ignoreNpcMessages = false
  182. -- defaultTab = nil
  183. -- serverTab = nil
  184. -- loadedList = {{255,"Go to..."}}
  185. -- loadedOnce = false
  186. --dexhere
  187. -- pokedex_UI = nil
  188. -- topButton = nil
  189. --rep
  190. -- REPORTS = {}
  191. -- Rep_window = nil
  192. -- itemWidget = nil
  193. pokeinfowindow = nil
  194. topButton2 = nil
  195. -- consoleToggleChat = nil
  196.  
  197. hided = false;
  198. -- function hideChat(f)
  199.     -- if f == true then
  200.         -- hided = true
  201.     -- end
  202.     -- if not hided and modules.game_interface.currentViewMode == 2 then
  203.         -- consolePanel:setVisible(false)
  204.         -- modules.game_interface.getBottomPanel():setVisible(false)
  205.         -- modules.game_interface.getBottomSplitter():setVisible(false)
  206.         -- modules.game_interface.getHideButton():setVisible(true)
  207.         -- hided = true
  208.         -- disableChat()
  209.         -- modules.game_pokewindow.drag(self,0)
  210.     -- else
  211.         -- consolePanel:setVisible(true)
  212.         -- modules.game_interface.getBottomPanel():setVisible(true)
  213.         -- modules.game_interface.getBottomSplitter():setVisible(true)
  214.         -- modules.game_interface.getHideButton():setVisible(false)
  215.         -- hided = false
  216.         -- enableChat()
  217.         -- modules.game_pokewindow.drag(self,0)
  218.     -- end
  219.  
  220. -- end
  221. function changeSize()
  222.     if not modules.game_pokewindow.PRESSED then
  223.         modules.game_pokewindow.drag(self)
  224.     end
  225. end
  226.  
  227. function changeOpacity()
  228.     opacity = opacity or 1.0
  229.     opacity = opacity - 0.1
  230.     if (opacity <= 0.1) then
  231.         opacity = 1.0
  232.     end
  233.     consolePanel:setOpacity(opacity)
  234.  
  235.     g_settings.setNode('asdfchannel',{[1] = opacity})
  236. end
  237. function init()
  238.  
  239.   connect(g_game, {
  240.   -- onTalk = onTalk,
  241.   -- onEditText = onGameEditText,
  242.   -- onWalk = onWalk,
  243.                     -- onChannelList = onChannelList,
  244.                     -- onOpenChannel = onOpenChannel,
  245.                     -- onOpenPrivateChannel = onOpenPrivateChannel,
  246.                     -- onOpenOwnPrivateChannel = onOpenOwnPrivateChannel,
  247.                     -- onCloseChannel = onCloseChannel,
  248.                     onGameStart = online,
  249.                     onGameEnd = offline})
  250.   -- topButton = modules.client_topmenu.addRightGameToggleButton('Pokedex',tr('Open pokedex'), 'dexicon.png', callpokedex)
  251.  
  252.  
  253.   topButton2 =  modules.client_otpmenu.addRightGameButton('Pokemon', tr('Pokemon Information'), callpokedata)
  254.  
  255.  
  256.  
  257.  
  258.   -- consolePanel = g_ui.loadUI('console.otui', modules.game_interface.getBottomPanel())
  259.  
  260.   --consolePanel:setVisible(false)
  261.   -- modules.game_interface.getBottomPanel():setVisible(true)
  262.  
  263.  
  264.  
  265.   -- consoleTextEdit = consolePanel:getChildById('consoleTextEdit')
  266.   -- consoleContentPanel = consolePanel:getChildById('consoleContentPanel')
  267.   -- consoleTabBar = consolePanel:getChildById('consoleTabBar')
  268.   -- consoleTabBar:setContentWidget(consoleContentPanel)
  269.  
  270.  
  271.     --consoleContentPanel:setVisible(false)
  272.  
  273.   -- channels = {}
  274.   -- opacity = (g_settings.getNode('asdfchannel') or {[1]=1.0})
  275.   -- opacity = opacity[1] or 1.0
  276.  
  277.   -- consolePanel:setOpacity(opacity)
  278.  
  279.   -- defaultTab = addTab(tr('Default'), true,true)
  280.   -- serverTab = addTab(tr('Server Log'), false,true)
  281.  
  282.   -- g_keyboard.bindKeyPress('Shift+Up', function() navigateMessageHistory(1) end, consolePanel)
  283.  
  284.   -- g_keyboard.bindKeyPress('Shift+Down', function() navigateMessageHistory(-1) end, consolePanel)
  285.   -- g_keyboard.bindKeyPress('Tab', function() consoleTabBar:selectNextTab() end, consolePanel)
  286.   -- g_keyboard.bindKeyPress('Shift+Tab', function() consoleTabBar:selectPrevTab() end, consolePanel)
  287.   -- g_keyboard.bindKeyDown('Enter', sendCurrentMessage, consolePanel)
  288.  
  289.  
  290.   -- apply buttom functions after loaded
  291.   -- consolePanel:getChildById('nextChannelButton').onClick = function() consoleTabBar:selectNextTab() end
  292.   -- consolePanel:getChildById('prevChannelButton').onClick = function() consoleTabBar:selectPrevTab() end
  293.   -- consoleTabBar.onTabChange = onTabChange
  294.  
  295.  
  296.  
  297.   -- tibia like hotkeys
  298.   -- g_keyboard.bindKeyDown('Ctrl+O', g_game.requestChannels)
  299.   -- g_keyboard.bindKeyDown('Ctrl+E', removeCurrentTab)
  300.   -- g_keyboard.bindKeyDown('Ctrl+H', openHelp)
  301.  
  302.  
  303.    g_keyboard.bindKeyPress('Ctrl+C',
  304.     function()
  305.  
  306.         local buffer = consoleTabBar:getTabPanel(getCurrentTab()):getChildById('consoleBuffer')
  307.         local count = buffer:getChildCount()
  308.         for i=1,count do
  309.             local c = buffer:getChildById('consoleLabel'..i)
  310.             if c:hasSelection() then
  311.                 g_window.setClipboardText(c:getSelection())
  312.                 return true
  313.             end
  314.         end
  315.                 --[[label:setId('consoleLabel' .. )
  316.                 if not buffer:hasSelection() then return false end
  317.                 --g_window.buffer(label:getSelection())
  318.                 print("aee")]]
  319.                 return true
  320.     end,consolePanel)
  321.  
  322.  
  323.     -- Eoptions = g_settings.getNode('EmojiOptions') or{ignore=false}
  324.  
  325.   REPORTS = {}
  326.  
  327.         -- consoleToggleChat = consolePanel:getChildById('toggleChat')
  328.  
  329.     itemWidget = g_ui.createWidget('UIItem')
  330.   itemWidget:setVirtual(true)
  331.   itemWidget:setVisible(false)
  332.   itemWidget:setFocusable(false)
  333.   setPokeHP(0,1)
  334.   -- toggleHeal(false)
  335.   -- IGNORED= g_settings.getNode('IGNOREDSTUFF') or {}
  336.   -- IGNOREPM= g_settings.getNode('IGNOREPM')
  337.  
  338.  
  339.     -- table.sort(IGNORED)
  340.  
  341.  
  342.  
  343. end
  344.  
  345. -- function toggleChat()
  346.   -- if consoleToggleChat:isChecked() then
  347.     -- disableChat()
  348.   -- else
  349.     -- enableChat()
  350.   -- end
  351. -- end
  352.  
  353. -- function enableChat()
  354.   -- local gameInterface = modules.game_interface
  355.  
  356.   -- consoleTextEdit:setVisible(true)
  357.   -- consoleTextEdit:setText("")
  358.  
  359.   -- g_keyboard.unbindKeyUp("Space")
  360.   -- g_keyboard.unbindKeyUp("Enter")
  361.  
  362.   -- gameInterface.unbindWalkKey("W")
  363.   -- gameInterface.unbindWalkKey("D")
  364.   -- gameInterface.unbindWalkKey("S")
  365.   -- gameInterface.unbindWalkKey("A")
  366.  
  367.   -- consoleToggleChat:setTooltip(tr("Disable chat mode, allow to walk using ASDW"))
  368. -- end
  369.  
  370. -- function disableChat()
  371.   -- local gameInterface = modules.game_interface
  372.  
  373.   -- consoleTextEdit:setVisible(false)
  374.   -- consoleTextEdit:setText("")
  375.  
  376.   -- local quickFunc = function()
  377.     -- if consoleToggleChat:isChecked() then
  378.       -- consoleToggleChat:setChecked(false)
  379.     -- end
  380.     -- enableChat()
  381.   -- end
  382.   -- g_keyboard.bindKeyUp("Space", quickFunc)
  383.   -- g_keyboard.bindKeyUp("Enter", quickFunc)
  384.  
  385.   -- gameInterface.bindWalkKey("W", North)
  386.   -- gameInterface.bindWalkKey("D", East)
  387.   -- gameInterface.bindWalkKey("S", South)
  388.   -- gameInterface.bindWalkKey("A", West)
  389.  
  390.   -- consoleToggleChat:setTooltip(tr("Enable chat mode"))
  391. -- end
  392.  
  393.  
  394. BLOCKWID = nil
  395. LESELECTED = nil
  396. -- function onClickIgnoreButton()
  397.     -- if not BLOCKWID then
  398.         -- BLOCKWID = g_ui.displayUI('blockeds.otui')
  399.         -- local list = BLOCKWID:getChildById('listoza')
  400.  
  401.         -- for i,b in pairs(IGNORED) do
  402.             -- local label = g_ui.createWidget('ReprList', list)
  403.             -- label:setId("RP"..i)
  404.             -- label:setColor("#ff0000")
  405.             -- label:setText(i)
  406.  
  407.         -- end
  408.         -- local label = g_ui.createWidget('ReprList', list)
  409.         -- label:setId("RP6669")
  410.         -- label:setColor("#ffffff")
  411.         -- label:setText("--End--")
  412.         -- LESELECTED = label
  413.  
  414.         -- local k = BLOCKWID:recursiveGetChildById('PMBAN')
  415.  
  416.  
  417.         -- k:setChecked(IGNOREPM)
  418.  
  419.  
  420.         -- connect(list, { onChildFocusChange =  function (self, focusedChild,old) LESELECTED = focusedChild end } )
  421.     -- end
  422.  
  423.  
  424. -- end
  425. -- function toggleBan()
  426.     -- if BLOCKWID then
  427.         -- local k = BLOCKWID:recursiveGetChildById('PMBAN')
  428.         -- IGNOREPM = not IGNOREPM
  429.         -- k:setChecked(IGNOREPM)
  430.         -- g_settings.setNode('IGNOREPM', IGNOREPM)
  431.     -- end
  432. -- end
  433. -- function removeSelected()
  434.     -- if LESELECTED:getText() ~= '--End--' then
  435.         -- IGNORED[LESELECTED:getText()] = nil
  436.         -- LESELECTED:destroy()
  437.  
  438.     -- end
  439.     -- table.sort(IGNORED)
  440. -- end
  441. -- function deleteMe()
  442.     -- if BLOCKWID then
  443.         -- BLOCKWID:destroy()
  444.         -- BLOCKWID = nil
  445.     -- end
  446. -- end
  447. function toggleHeal(t)
  448.     if pokeinfowindow then
  449.         local buttom = pokeinfowindow:recursiveGetChildById('reala')
  450.  
  451.         buttom:setEnabled(t)
  452.  
  453.  
  454.     end
  455. end
  456. function pressB(i)
  457.     if i == 'b' then
  458.         g_game.talk("77PIN")
  459.     elseif i == 'c' then
  460.         g_game.talk("correr")
  461.  
  462.     elseif i == 'h' then
  463.         g_game.talk("hi")
  464.  
  465.     else
  466.  
  467.     itemWidget:setItemId(3453)
  468.     modules.game_interface.startUseWith(itemWidget:getItem())
  469.  
  470.     end
  471. end
  472.  
  473. function newClient()
  474. g_game.talk("77CLI")
  475. end
  476.  
  477. function pressA(i)
  478.     g_game.talk("a"..i)
  479. end
  480. function togglebutton(i)
  481.     if pokeinfowindow then
  482.         if i then
  483.             pokeinfowindow:recursiveGetChildById('locka'):setText("Call")
  484.         else
  485.             pokeinfowindow:recursiveGetChildById('locka'):setText("Call")
  486.  
  487.         end
  488.     end
  489. end
  490. CURRENT_POKE = {' - ','-',0,0,100,0,7746,0,0,100,attr={}}
  491. ATTRIBUTTES = {
  492.     ["RDI"]={self=1,"Use Ride",on=true},
  493.     ["TPR"]={"Teleport",callMenu=1,on=true},
  494.     ["LGT"]={"Use Flash",on=true,f=function() g_game.getProtocolGame():sendExtendedOpcode(5, "77FLSHPLS") end},
  495.     ["CUT"]={"Use cut",on=true},
  496.     ["DIG"]={"Use dig",on=true},
  497.     ["FLY"]={self=1,"Use fly",on=true},
  498.     ["RSM"]={"Use rock smash",on=true},
  499.     ["SRF"]={wait=1,"Use surf",on=false},
  500.     ["BLK"]={"Blink",on=true},
  501. }
  502. function removePokeAttr()
  503.     CURRENT_POKE.attr = {}
  504.     updateAttr()
  505. end
  506.  
  507. function setPokeAttribute(var)
  508.     CURRENT_POKE.attr[var] = true;
  509.  
  510.     updateAttr()
  511. end
  512. function setAttributeOnOff(var,bool)
  513.     ATTRIBUTTES[var].on = bool
  514.     updateAttr()
  515. end
  516. function updateAttr()
  517.     if not pokeinfowindow then
  518.         return
  519.     end
  520.     local content = pokeinfowindow:recursiveGetChildById('conditionPanel')
  521.     for b,i in pairs(ATTRIBUTTES ) do
  522.         local icon = content:getChildById(b)
  523.         if icon then
  524.             icon:destroy()
  525.         end
  526.         if CURRENT_POKE.attr[b] then
  527.  
  528.             local icon = g_ui.createWidget('ConditionWidget', content)
  529.             icon:setId(b)
  530.  
  531.             if i.on then
  532.                 icon:setImageSource("special/"..b..".png")
  533.             else
  534.                 icon:setImageSource("special/"..b.."of.png")
  535.  
  536.             end
  537.  
  538.             if i.on then
  539.                 icon:setTooltip(tr(i[1]))
  540.                 icon.onClick = function()
  541.                     if i.f then
  542.                         i.f();
  543.                     elseif i.self and i.on then
  544.  
  545.                         g_game.useInventoryItemWith(3453, g_game.getLocalPlayer())
  546.                     elseif not i.wait and not i.callMenu then
  547.                         itemWidget:setItemId(3453)
  548.                         modules.game_interface.startUseWith(itemWidget:getItem())
  549.                     elseif i.wait and i.on then
  550.                         modules.game_interface.callSurfAuto()
  551.                     elseif i.callMenu then
  552.                         local menu = g_ui.createWidget('PopupMenu')
  553.  
  554.                         -- for i,b in pairs(modules.client_extended.GLOBAL_CITY) do
  555.                             -- menu:addOption(i:sub(1,1):upper()..i:sub(2,-1), function() g_game.talk("!teleport \""..i:sub(1,1):upper()..i:sub(2,-1)) end)
  556.                             menu:addOption("House", function() g_game.talk("!house \house") end)
  557.                             menu:addOption("Azalea", function() g_game.talk("!teleport \azalea") end)
  558.                             menu:addOption("Battle City", function() g_game.talk("!teleport \battle City") end)
  559.                             menu:addOption("Blackthorn", function() g_game.talk("!teleport \Blackthorn") end)
  560.                             menu:addOption("Black City", function() g_game.talk("!teleport \Black City") end)
  561.                             menu:addOption("Celadon", function() g_game.talk("!teleport \celadon") end)
  562.                             menu:addOption("Cerulean", function() g_game.talk("!teleport \cerulean") end)
  563.                             menu:addOption("Cinnabar", function() g_game.talk("!teleport \cinnabar") end)
  564.                             menu:addOption("Cherrygrove", function() g_game.talk("!teleport \cherrygrove") end)
  565.                             menu:addOption("Cianwood", function() g_game.talk("!teleport \Cianwood") end)
  566.                             menu:addOption("Canavale", function() g_game.talk("!teleport \canavale") end)
  567.                             menu:addOption("Ecruteak", function() g_game.talk("!teleport \ecruteak") end)
  568.                             menu:addOption("Fuchsia", function() g_game.talk("!teleport \fuchsia") end)
  569.                             menu:addOption("Goldenrod", function() g_game.talk("!teleport \goldenrod") end)
  570.                             menu:addOption("Hunter Village", function() g_game.talk("!teleport \hunter village") end)
  571.                             menu:addOption("Join Avenue", function() g_game.talk("!teleport \join avenue") end)
  572.                             menu:addOption("Larosse", function() g_game.talk("!teleport \larosse") end)
  573.                             menu:addOption("Lavender", function() g_game.talk("!teleport \lavender") end)
  574.                             menu:addOption("Mahogany", function() g_game.talk("!teleport \mahogany") end)
  575.                             menu:addOption("New Bark", function() g_game.talk("!teleport \new Bank") end)
  576.                             menu:addOption("Number City", function() g_game.talk("!teleport \Number City") end)
  577.                             menu:addOption("Olivine", function() g_game.talk("!teleport \olivine") end)
  578.                             menu:addOption("Orre", function() g_game.talk("!teleport \orre") end)
  579.                             menu:addOption("Pacifidlog", function() g_game.talk("!teleport \Pacifidlog") end)
  580.                             menu:addOption("Pallet", function() g_game.talk("!teleport \pallet") end)
  581.                             menu:addOption("Pewter", function() g_game.talk("!teleport \pewter") end)
  582.                             menu:addOption("Saffron", function() g_game.talk("!teleport \saffron") end)
  583.                             menu:addOption("Singer", function() g_game.talk("!teleport \singer") end)
  584.                             menu:addOption("Small City", function() g_game.talk("!teleport \Small City") end)
  585.                             menu:addOption("Sunshine", function() g_game.talk("!teleport \sunshine") end)
  586.                             menu:addOption("Vermilion", function() g_game.talk("!teleport \vermilion") end)
  587.                             menu:addOption("Viridian", function() g_game.talk("!teleport \viridian") end)
  588.                             menu:addOption("Violet", function() g_game.talk("!teleport \violet") end)
  589.                         -- end
  590.                         menu:display(mousePos)
  591.  
  592.                     end
  593.                 end
  594.             else
  595.                 -- icon:setTooltip(tr("You cannot").." "..tr(i[1]).." "..tr("right now"))
  596.             end
  597.         end
  598.     end
  599. end
  600.  
  601. -- function onWalk(dir,dash)
  602.     -- if modules.game_interface.isSurfAble(dir) then
  603.         -- modules.game_interface.showSurf();
  604.     -- else
  605.         -- modules.game_interface.hideSurf()
  606.     -- end
  607. -- end
  608.  
  609. function leCloseButton()
  610.     topButton2:setOn(false)
  611. end
  612.  
  613. function callpokedata(id)
  614.     if topButton2:isOn() and id ~= 4 or id == 5 then
  615.         if not pokeinfowindow then
  616.             pokeinfowindow = g_ui.loadUI('pokeinfo.otui',modules.game_interface.getRightPanel());
  617.             pokeinfowindow:disableResize()
  618.             pokeinfowindow:setup()
  619.         end
  620.         pokeinfowindow:close()
  621.         topButton2:setOn(false)
  622.     else
  623.         if pokeinfowindow == nil then
  624.             pokeinfowindow = g_ui.loadUI('pokeinfo.otui',modules.game_interface.getRightPanel());
  625.             pokeinfowindow:disableResize()
  626.             pokeinfowindow:setup()
  627.  
  628.         else
  629.             pokeinfowindow:open()
  630.         end
  631.         setPokeInfo(unpack(CURRENT_POKE))
  632.         topButton2:setOn(true)
  633.     end
  634. end
  635.  
  636.  
  637.  
  638. -- function callpokedex()
  639.     -- if pokedex_UI then
  640.         -- pokedex_UI:destroy()
  641.         -- pokedex_UI = nil
  642.         -- topButton:setOn(false)
  643.     -- else
  644.         -- doOpenDex()
  645.     -- openDex(data)
  646.     -- g_game.talk("*s*% ")
  647.     -- g_game.getProtocolGame():sendExtendedOpcode(5, "77D")
  648.     -- end
  649.     -- if pokedex_UI then
  650.         -- local loc= modules.client_locales.getCurrentLocale().name
  651.  
  652.         -- pokedex_UI:getChildById('lecloselol'):setImageSource(loc..".png")
  653.     -- end
  654. -- end
  655.  
  656. function terminate()
  657.  
  658.  
  659.  
  660.   disconnect(g_game, {
  661.   -- onTalk = onTalk,
  662.   -- onEditText = onGameEditText,
  663.     -- onWalk = onWalk,
  664.                        -- onChannelList = onChannelList,
  665.                        -- onOpenChannel = onOpenChannel,
  666.                        -- onOpenPrivateChannel = onOpenPrivateChannel,
  667.                        -- onOpenOwnPrivateChannel = onOpenPrivateChannel,
  668.                        -- onCloseChannel = onCloseChannel,
  669.                        onGameStart = online,
  670.                        onGameEnd = offline })
  671.  
  672.   if g_game.isOnline() then offline() end
  673.  
  674.   -- g_keyboard.unbindKeyDown('Ctrl+O')
  675.   -- g_keyboard.unbindKeyDown('Ctrl+E')
  676.   -- g_keyboard.unbindKeyDown('Ctrl+H')
  677.    itemWidget:destroy()
  678.    if BLOCKWID then
  679.     BLOCKWID:destroy()
  680.    end
  681.  
  682.   if channelsWindow then
  683.     channelsWindow:destroy()
  684.     channelsWindow = nil
  685.   end
  686.     -- if pokedex_UI then
  687.         -- pokedex_UI:destroy()
  688.         -- pokedex_UI = nil
  689.         -- topButton:setOn(false)
  690.     -- end
  691.     if Rep_window then
  692.         Rep_window:destroy()
  693.         Rep_window = nil
  694.     end
  695.     if EmojiW then
  696.         EmojiW:destroy()
  697.         EmojiW = nil
  698.     end
  699.   consolePanel:destroy()
  700.   topButton:destroy()
  701.   topButton2:destroy()
  702.   topButton = nil
  703.   topButton2 = nil
  704.   consolePanel = nil
  705.   consoleTextEdit = nil
  706.   consoleContentPanel = nil
  707.   consoleTabBar = nil
  708.     if LEFIND then
  709.         LEFIND:destroy();
  710.         LEFIND = nil
  711.     end
  712.   ownPrivateName = nil
  713.  
  714.   Console = nil
  715. end
  716. local function tabBlink(tab)
  717.   if not tab.blinking then return end
  718.   tab:setOn(not tab:isOn())
  719.   tab:setColor("#ff5555")
  720.   tab.blinkEvent = scheduleEvent(function() tabBlink(tab) end, 500)
  721. end
  722.  
  723. function blinkTab(tab)
  724.  
  725.  
  726.  
  727.   if tab:isChecked() or tab.blinking then return end
  728.   tab.blinking = true
  729.   tabBlink(tab)
  730. end
  731.  
  732. function setPokeExp(lvl,exp,next,naw)
  733.     if not pokeinfowindow then
  734.         return
  735.     end
  736.     CURRENT_POKE[9] = lvl;
  737.     CURRENT_POKE[10] = exp;
  738.     CURRENT_POKE[11] = next;
  739.     CURRENT_POKE[12] = naw;
  740.     if exp == next then
  741.         pokeinfowindow:recursiveGetChildById('portrait'):setTooltip(tr("Exp: %d/%d",exp,next))
  742.     else
  743.         pokeinfowindow:recursiveGetChildById('portrait'):setTooltip(tr("Exp: %d/%d you need %d to go.",exp,next,(next-exp)))
  744.     end
  745.     pokeinfowindow:recursiveGetChildById('pokeHealthBar'):setPercent(((exp-naw)/(next-naw))*100)
  746.     pokeinfowindow:recursiveGetChildById('pokeHealthBar'):setText(exp.."/"..next)
  747.     pokeinfowindow:recursiveGetChildById('pokeHealthBar'):setTooltip(tr("Exp: %d/%d you need %d to go.",exp,next,(next-exp)))
  748. end
  749.  
  750.  
  751. function setPokeHP(hp,max)
  752.     CURRENT_POKE[4] = hp;
  753.     CURRENT_POKE[5] = max;
  754.     if not pokeinfowindow then
  755.         return
  756.     end
  757.     if max == 0 then
  758.         max = 1
  759.         hp = 1
  760.     end
  761.     pokeinfowindow:recursiveGetChildById('healthBar'):setPercent((hp/max)*100)
  762.     pokeinfowindow:recursiveGetChildById('healthBar'):setText(string.format("%.2f",((hp/max)*100)).."%")
  763.     pokeinfowindow:recursiveGetChildById('healthBar'):setTooltip(hp.."/"..max)
  764. end
  765.  
  766. function setPokeInfo(name,nick,boost,hp,max,addons,port,level,exp,next,naw,port2)
  767.  
  768.     if (name ~= CURRENT_POKE[1]) then
  769.         CURRENT_POKE = {name,nick,boost,hp,max,addons,port,level,exp,next,naw,attr={}}
  770.     end
  771.     if not pokeinfowindow then
  772.         return
  773.     end
  774.  
  775.     if max == 0 then
  776.         max = 1
  777.         hp = 1
  778.     end
  779.     naw = naw or 0
  780.     if exp == next then
  781.         pokeinfowindow:recursiveGetChildById('portrait'):setTooltip(tr("Exp: %d/%d",exp,next))
  782.     else
  783.         pokeinfowindow:recursiveGetChildById('portrait'):setTooltip(tr("Exp: %d/%d you need %d to go.",exp,next,(next-exp)))
  784.     end
  785.  
  786.     pokename = nick
  787.    
  788.    
  789.     local image = "/modules/game_console/pokes/"..pokename..".png"
  790.    
  791.     pokeinfowindow:recursiveGetChildById('portrait'):setItemId(tonumber(port2))
  792.     pokeinfowindow:recursiveGetChildById('healthBar'):setText(string.format("%.1d",((hp/max)*100)).."%")
  793.     pokeinfowindow:recursiveGetChildById('healthBar'):setPercent((hp/max)*100)
  794.     pokeinfowindow:recursiveGetChildById('healthBar'):setTooltip(hp.."/"..max)
  795.     pokeinfowindow:recursiveGetChildById('pokeHealthBar'):setPercent(((exp)/(next))*100)
  796.     pokeinfowindow:recursiveGetChildById('pokeHealthBar'):setText(string.format("%.1d",((exp/next)*100)).."%")
  797.     pokeinfowindow:recursiveGetChildById('lblPokeName'):setText(string.format("%s",(nick ~='-' and nick:sub(1,1):upper()..nick:sub(2,-1) or name:sub(1,1):upper()..name:sub(2,-1)) ) )
  798.     pokeinfowindow:recursiveGetChildById('pokeHealthBar'):setTooltip(tr("Exp: %d/%d you need %d to go.",exp,next,(next-exp)))
  799. end
  800.  
  801. function ignoreEmojis(self)
  802.     self:setChecked(not self:isChecked())
  803.     Eoptions.ignore = EmojiW:getChildById('ignore'):isChecked()
  804.     g_settings.setNode('EmojiOptions',Eoptions)
  805. end
  806. function emoticons()
  807.     if EmojiW then
  808.         EmojiW:destroy()
  809.     end
  810.     EmojiW = g_ui.displayUI('showemo.otui')
  811.     if not EmojiW then
  812.         return
  813.     end
  814.  
  815.  
  816.     img = EmojiW:getChildById('img')
  817.     for i,b in pairs(EMOTICONS) do
  818.         local questLabel = g_ui.createWidget('UIItem', img)
  819.         questLabel:setImageSource('emoticons/'..b..'.png')
  820.         questLabel:setHeight(14)
  821.         questLabel:setWidth(14)
  822.         questLabel.itemName = i
  823.         questLabel:setId("C"..i)
  824.  
  825.         --[[questLabel:getChildById("jaaj"):setItemId(b['2'])
  826.         questLabel.onMouseRelease = function(self, mousePos, mouseButton)
  827.             leMeni(self, mousePos, mouseButton,questLabel,i)
  828.         end]]
  829.     end
  830.     name = EmojiW:getChildById('name')
  831.     for i,b in pairs(EMOTICONS) do
  832.         local questLabel = g_ui.createWidget('UIItem', name)
  833.         questLabel:setText(i)
  834.         questLabel:setHeight(14)
  835.  
  836.         --[[questLabel:getChildById("jaaj"):setItemId(b['2'])
  837.         questLabel.onMouseRelease = function(self, mousePos, mouseButton)
  838.             leMeni(self, mousePos, mouseButton,questLabel,i)
  839.         end]]
  840.     end
  841.  
  842.  
  843.     EmojiW.onDestroy = function()
  844.         lootWindow = nil
  845.     end
  846.     EmojiW:getChildById('ignore'):setChecked(Eoptions.ignore )
  847.  
  848. end
  849.  
  850. function onTabChange(tabBar, tab)
  851.   if tab == defaultTab or tab == serverTab then
  852.     consolePanel:getChildById('closeChannelButton'):disable()
  853.     consolePanel:getChildById('saveChannel'):disable()
  854.   else
  855.     consolePanel:getChildById('saveChannel'):enable()
  856.     consolePanel:getChildById('closeChannelButton'):enable()
  857.   end
  858. end
  859.  
  860. function offline()
  861.   if pokeinfowindow then
  862.     pokeinfowindow:destroy()
  863.     pokeinfowindow = nil
  864.   end
  865.   -- save last open channels
  866.   -- if pokedex_UI then
  867.         -- pokedex_UI:destroy()
  868.         -- pokedex_UI = nil
  869.         -- topButton:setOn(false)
  870.     -- end
  871.         if Rep_window then
  872.         Rep_window:destroy()
  873.         Rep_window = nil
  874.     end
  875.   local lastChannelsOpen = g_settings.getNode('lastChannelsOpen') or {}
  876.   local char = g_game.getLocalPlayer():getName() --g_game.getLocalPlayer():setStatus(2)
  877.   local savedChannels = {}
  878.   local set = false
  879.   --for channelId, channelName in pairs(channels) do
  880.     --if type(channelId) == 'number' then
  881.       --savedChannels[channelName] = channelId
  882.       --set = true
  883.     --end
  884.   --end
  885.   if set then
  886.     lastChannelsOpen[char] = savedChannels
  887.   else
  888.     lastChannelsOpen[char] = nil
  889.   end
  890.   g_settings.setNode('lastChannelsOpen', lastChannelsOpen)
  891.  
  892.   -- close channels
  893.   --for _, channelName in pairs(channels) do
  894.     --local tab = consoleTabBar:getTab(channelName)
  895.     --consoleTabBar:removeTab(tab)
  896.   --end
  897.   channels = {}
  898.  
  899.   --serverTab.tabPanel:getChildById('consoleBuffer'):destroyChildren()
  900.  
  901.   --local npcTab = consoleTabBar:getTab('NPCs')
  902.   if npcTab then
  903.     --consoleTabBar:removeTab(npcTab)
  904.   end
  905.  
  906.   --consoleTextEdit:clearText()
  907.  
  908.   if channelsWindow then
  909.     channelsWindow:destroy()
  910.     channelsWindow = nil
  911.   end
  912. end
  913.  
  914.  
  915. function setTextEditText(text)
  916.   consoleTextEdit:setText(text)
  917.   for i=1,#text do
  918.         consoleTextEdit:moveCursorHorizontally(true)
  919.   end
  920.  
  921. end
  922.  
  923. function openHelp()
  924.   g_game.joinChannel(HELP_CHANNEL)
  925. end
  926.  
  927. function addTab(name, focus,notClose)
  928.   -- local tab = getTab(name)
  929.   if(tab) then -- is channel already open
  930.     if(not focus) then focus = true end
  931.   else
  932.     -- tab = consoleTabBar:addTab(name)
  933.   end
  934.   if focus then
  935.     consoleTabBar:selectTab(tab)
  936.   elseif not serverTab or name ~= serverTab:getText() then
  937.     consoleTabBar:blinkTab(tab)
  938.   end
  939.   --tab:setWidth(math.min(130,tab:getWidth()));
  940.   tab.notclose = notClose
  941.   return tab
  942. end
  943.  
  944. function removeCurrentTab()
  945.   local tab = consoleTabBar:getCurrentTab()
  946.   if tab == defaultTab or tab == serverTab then return end
  947.  
  948.   -- notificate the server that we are leaving the channel
  949.   if tab.channelId then
  950.     for k, v in pairs(channels) do
  951.       if (k == tab.channelId) then channels[k] = nil end
  952.     end
  953.     g_game.leaveChannel(tab.channelId)
  954.   elseif tab:getText() == "NPCs" then
  955.     g_game.closeNpcChannel()
  956.   end
  957.  
  958.   consoleTabBar:removeTab(tab)
  959. end
  960.  
  961. function saveChannels()
  962.   local tab = consoleTabBar:getCurrentTab()
  963.   if tab == defaultTab or tab == serverTab then return end
  964.   local name = tab:getText()
  965.   if MSGS[name] then
  966.     local f = io.open(name.." "..os.date("%d-%m-%y-%H-%M-%S",os.time()).. "- Save.txt",'a+')
  967.     if f then
  968.         modules.game_textmessage.displayMessage(MessageModes.Login, "Saved on file ".."saves\\" ..(name.." - Save.txt").."")
  969.         f:write(os.date("Saved at: %d/%m/%y  %H:%M:%S\n",os.time()))
  970.         for i,b in pairs(MSGS[name]) do
  971.             f:write(b..'\n')
  972.         end
  973.         f:write("End\n")
  974.         f:close()
  975.     end
  976.   end
  977.  
  978.  
  979. end
  980.  
  981.  
  982. function getTab(name)
  983.   -- return consoleTabBar:getTab(name)
  984. end
  985.  
  986. function getCurrentTab()
  987.   return consoleTabBar:getCurrentTab()
  988. end
  989.  
  990. function addChannel(name, id)
  991.   channels[id] = name
  992.   local tab = addTab(name, true)
  993.   tab.channelId = id
  994.   return tab
  995. end
  996.  
  997. function addPrivateChannel(receiver)
  998.   channels[receiver] = receiver
  999.   return addTab(receiver, true)
  1000. end
  1001.  
  1002. function addPrivateText(text, speaktype, name, isPrivateCommand, creatureName)
  1003.   local focus = false
  1004.   if speaktype.npcChat then
  1005.     name = 'NPCs'
  1006.     focus = true
  1007.   end
  1008.   local privateTab = getTab(name)
  1009.   if privateTab == nil then
  1010.     if (modules.client_options.getOption('showPrivateMessagesInConsole') and not focus) or (isPrivateCommand and not privateTab) then
  1011.       privateTab = defaultTab
  1012.     else
  1013.       privateTab = addTab(name, focus)
  1014.       channels[name] = name
  1015.     end
  1016.     privateTab.npcChat = speaktype.npcChat
  1017.   elseif focus then
  1018.     consoleTabBar:selectTab(privateTab)
  1019.   end
  1020.   if not MSGS[name] then
  1021.     MSGS[name] = {}
  1022.   end
  1023.   MSGS[name][#MSGS[name]+1] = os.date('%H:%M')..' '..text
  1024.   addTabText(text, speaktype, privateTab, creatureName)
  1025. end
  1026.  
  1027. MSGS={}
  1028. function addText(text, speaktype, tabName, creatureName)
  1029.   local tab = getTab(tabName)
  1030.   if tab ~= nil then
  1031.  
  1032.     if not MSGS[tabName] then
  1033.         MSGS[tabName] = {}
  1034.     end
  1035.     MSGS[tabName][#MSGS[tabName]+1] = os.date('%H:%M')..' '..text
  1036.     if IGNORED[creatureName] then
  1037.  
  1038.         return --ignored
  1039.     end
  1040.     addTabText(text, speaktype, tab, creatureName)
  1041.   end
  1042. end
  1043.  
  1044.  
  1045. local letterWidth = {  -- New line (10) and Space (32) have width 1 because they are printed and not replaced with spacer
  1046.   [10] = 1, [32] = 1, [33] = 3, [34] = 6, [35] = 8, [36] = 7, [37] = 13, [38] = 9, [39] = 3, [40] = 5, [41] = 5, [42] = 6, [43] = 8, [44] = 4, [45] = 5, [46] = 3, [47] = 8,
  1047.   [48] = 7, [49] = 6, [50] = 7, [51] = 7, [52] = 7, [53] = 7, [54] = 7, [55] = 7, [56] = 7, [57] = 7, [58] = 3, [59] = 4, [60] = 8, [61] = 8, [62] = 8, [63] = 6,
  1048.   [64] = 10, [65] = 9, [66] = 7, [67] = 7, [68] = 8, [69] = 7, [70] = 7, [71] = 8, [72] = 8, [73] = 5, [74] = 5, [75] = 7, [76] = 7, [77] = 9, [78] = 8, [79] = 8,
  1049.   [80] = 7, [81] = 8, [82] = 8, [83] = 7, [84] = 8, [85] = 8, [86] = 8, [87] = 12, [88] = 8, [89] = 8, [90] = 7, [91] = 5, [92] = 8, [93] = 5, [94] = 9, [95] = 8,
  1050.   [96] = 5, [97] = 7, [98] = 7, [99] = 6, [100] = 7, [101] = 7, [102] = 5, [103] = 7, [104] = 7, [105] = 3, [106] = 4, [107] = 7, [108] = 3, [109] = 11, [110] = 7,
  1051.   [111] = 7, [112] = 7, [113] = 7, [114] = 6, [115] = 6, [116] = 5, [117] = 7, [118] = 8, [119] = 10, [120] = 8, [121] = 8, [122] = 6, [123] = 7, [124] = 4, [125] = 7, [126] = 8,
  1052.   [127] = 1, [128] = 7, [129] = 6, [130] = 3, [131] = 7, [132] = 6, [133] = 11, [134] = 7, [135] = 7, [136] = 7, [137] = 13, [138] = 7, [139] = 4, [140] = 11, [141] = 6, [142] = 6,
  1053.   [143] = 6, [144] = 6, [145] = 4, [146] = 3, [147] = 7, [148] = 6, [149] = 6, [150] = 7, [151] = 10, [152] = 7, [153] = 10, [154] = 6, [155] = 5, [156] = 11, [157] = 6, [158] = 6,
  1054.   [159] = 8, [160] = 4, [161] = 3, [162] = 7, [163] = 7, [164] = 7, [165] = 8, [166] = 4, [167] = 7, [168] = 6, [169] = 10, [170] = 6, [171] = 8, [172] = 8, [173] = 16, [174] = 10,
  1055.   [175] = 8, [176] = 5, [177] = 8, [178] = 5, [179] = 5, [180] = 6, [181] = 7, [182] = 7, [183] = 3, [184] = 5, [185] = 6, [186] = 6, [187] = 8, [188] = 12, [189] = 12, [190] = 12,
  1056.   [191] = 6, [192] = 9, [193] = 9, [194] = 9, [195] = 9, [196] = 9, [197] = 9, [198] = 11, [199] = 7, [200] = 7, [201] = 7, [202] = 7, [203] = 7, [204] = 5, [205] = 5, [206] = 6,
  1057.   [207] = 5, [208] = 8, [209] = 8, [210] = 8, [211] = 8, [212] = 8, [213] = 8, [214] = 8, [215] = 8, [216] = 8, [217] = 8, [218] = 8, [219] = 8, [220] = 8, [221] = 8, [222] = 7,
  1058.   [223] = 7, [224] = 7, [225] = 7, [226] = 7, [227] = 7, [228] = 7, [229] = 7, [230] = 11, [231] = 6, [232] = 7, [233] = 7, [234] = 7, [235] = 7, [236] = 3, [237] = 4, [238] = 4,
  1059.   [239] = 4, [240] = 7, [241] = 7, [242] = 7, [243] = 7, [244] = 7, [245] = 7, [246] = 7, [247] = 9, [248] = 7, [249] = 7, [250] = 7, [251] = 7, [252] = 7, [253] = 8, [254] = 7, [255] = 8
  1060. }
  1061.  
  1062. function getHighlightedText(text)
  1063.   local tmpData = {}
  1064.  
  1065.   repeat
  1066.     local tmp = {string.find(text, "{([^}]+)}", tmpData[#tmpData-1])}
  1067.     for _, v in pairs(tmp) do
  1068.       table.insert(tmpData, v)
  1069.     end
  1070.   until not(string.find(text, "{([^}]+)}", tmpData[#tmpData-1]))
  1071.  
  1072.   return tmpData
  1073. end
  1074.  
  1075.  
  1076. function addTabText(text, speaktype, tab, creatureName)
  1077.  
  1078.   if not tab or tab.locked or not text or #text == 0 then return end
  1079.  
  1080.   if modules.client_options.getOption('showTimestampsInConsole') then
  1081.     text = os.date('%H:%M') .. ' ' .. text
  1082.   end
  1083.  
  1084.  
  1085.  
  1086.   local panel = consoleTabBar:getTabPanel(tab)
  1087.   local consoleBuffer = panel:getChildById('consoleBuffer')
  1088.   local label = g_ui.createWidget('ConsoleLabel', consoleBuffer)
  1089.   label:setId('consoleLabel' .. (consoleBuffer:getChildCount()-1))
  1090.  
  1091.   label:setColor(speaktype.color)
  1092.     label.tex = text
  1093.   blinkTab(tab)
  1094.  
  1095.  
  1096.   -- Overlay for consoleBuffer which shows highlighted words only
  1097.  
  1098.     if speaktype.npcChat and (g_game.getLocalPlayer():getName() ~= creatureName or g_game.getLocalPlayer():getName() == 'Account Manager') then
  1099.         local highlightData = getHighlightedText(text)
  1100.         if #highlightData > 0 then
  1101.             local labelHighlight = g_ui.createWidget('ConsolePhantomLabel', label)
  1102.             labelHighlight:fill('parent')
  1103.             labelHighlight:setId('consoleLabelHighlight' .. consoleBuffer:getChildCount())
  1104.             labelHighlight:setColor("#1f9ffe")
  1105.  
  1106.             -- Remove the curly braces
  1107.             for i = 1, #highlightData / 3 do
  1108.                 local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] }
  1109.                 text = text:gsub("%{(.-)%}", dataBlock.words, 1)
  1110.  
  1111.                 -- Recalculate positions as braces are removed
  1112.                 highlightData[(i-1)*3+1] = dataBlock._start - ((i-1) * 2)
  1113.                 highlightData[(i-1)*3+2] = dataBlock._end - (1 + (i-1) * 2)
  1114.             end
  1115.             label:setText(text)
  1116.  
  1117.             -- Calculate the positions of the highlighted text and fill with string.char(127) [Width: 1]
  1118.             local drawText = label:getDrawText()
  1119.             local tmpText = ""
  1120.             for i = 1, #highlightData / 3 do
  1121.                 local dataBlock = { _start = highlightData[(i-1)*3+1], _end = highlightData[(i-1)*3+2], words = highlightData[(i-1)*3+3] }
  1122.                 local lastBlockEnd = (highlightData[(i-2)*3+2] or 1)
  1123.  
  1124.                 for letter = lastBlockEnd, dataBlock._start-1 do
  1125.                 local tmpChar = string.byte(drawText:sub(letter, letter))
  1126.                 local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127)
  1127.  
  1128.                 tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar])
  1129.             end
  1130.             tmpText = tmpText .. dataBlock.words
  1131.         end
  1132.  
  1133.         -- Fill the highlight label to the same size as default label
  1134.         local finalBlockEnd = (highlightData[(#highlightData/3-1)*3+2] or 1)
  1135.         for letter = finalBlockEnd, drawText:len() do
  1136.             local tmpChar = string.byte(drawText:sub(letter, letter))
  1137.             local fillChar = (tmpChar == 10 or tmpChar == 32) and string.char(tmpChar) or string.char(127)
  1138.             tmpText = tmpText .. string.rep(fillChar, letterWidth[tmpChar])
  1139.         end
  1140.  
  1141.         labelHighlight:setText(tmpText)
  1142.         --[[labelHighlight.onMouseRelease = function (self, mousePos, mouseButton)
  1143.                 local speaktype = SpeakTypesSettings['privatePlayerToNpc']
  1144.                 local player = g_game.getLocalPlayer()
  1145.                 g_game.talkPrivate(11, "NPCs", tmpText)
  1146.                 local panel = consoleTabBar:getTabPanel(tab)
  1147.                 local consoleBuffer = panel:getChildById('consoleBuffer')
  1148.                 local labela = g_ui.createWidget('ConsoleLabel2', consoleBuffer)
  1149.                 local label = g_ui.createWidget('ConsoleLabel', labela)
  1150.                 label:setText(os.date('%H:%M') .. ' ' .. tmpText)
  1151.                 label:setColor(speaktype.color)
  1152.             end]]
  1153.         else
  1154.             label:setText(text)
  1155.         end
  1156.     else
  1157.  
  1158.         local f = findEmoticons(text);
  1159.  
  1160.         if #f == 0 then
  1161.  
  1162.             label:setText(text)
  1163.         else
  1164.             --Insert emoticons
  1165.             local fisrt = true;
  1166.             for i,b in pairs(f) do
  1167.                 local child = g_ui.createWidget('ConsolePhantomLabelEmoticon', label)
  1168.                 child:setId('consoleLabel' .. label:getChildCount())
  1169.                 child:setColor(speaktype.color)
  1170.                 child:setText(text:sub((fisrt and 0 or f[i-1][2])+1,b[1]-1))
  1171.                 fisrt = false
  1172.  
  1173.                 if b[6] then
  1174.                     local child2 = g_ui.createWidget('ConsolePhantomLabelEmoticon', label)
  1175.                     child2:setId('consoleLabel' .. label:getChildCount())
  1176.                     child2:setColor("#"..b[4]..b[5]..b[6]..b[7]..b[8]..b[9])
  1177.                     child2:setText(b[10])
  1178.  
  1179.                 else
  1180.                     local child2 = g_ui.createWidget('ConsolePhantomLabelEmoticonImg', label)
  1181.                     child2:setId('consoleLabel' .. label:getChildCount())
  1182.                     --child2:setText(text:sub(b[1],b[2]))
  1183.  
  1184.  
  1185.                     child2:setImageSource('emoticons/'..EMOTICONS[text:sub(b[1],b[2])]..'.png')
  1186.                 end
  1187.  
  1188.  
  1189.             end
  1190.             if f[#f][2] < text:len() then
  1191.                 local child2 = g_ui.createWidget('ConsolePhantomLabelEmoticon', label)
  1192.                 child2:setId('consoleLabel' .. label:getChildCount())
  1193.                 child2:setColor(speaktype.color)
  1194.                 child2:setText(text:sub(f[#f][2]+1,-1))
  1195.             end
  1196.  
  1197.         end
  1198.  
  1199.  end
  1200.  
  1201. label:clearMultiColorAttr()
  1202.  
  1203.   if speaktype.consoleTab == "Server Log" and speaktype.screenTarget and speaktype.screenTarget == "highCenterLabel" then
  1204.     local isMultiColor = false
  1205.  
  1206.     local initPos = {}
  1207.     local lastPos = {}
  1208.     local item = {}
  1209.     local color = {}
  1210.  
  1211.     if label:getText():match("You see") then
  1212.       if not text:match("You see yourself") then
  1213.         item[1] = label:getText():match("You see ([%d%w%s+-%p\'\{\}]*)")
  1214.         if item[1] then
  1215.           isMultiColor = true
  1216.           initPos[1], lastPos[1] = label:getText():find(item[1])
  1217.           color[1] = modules.game_textmessage.getColorByItemName(item[1])
  1218.         end
  1219.       end
  1220.     elseif label:getText():lower():match("loot of") then
  1221.       for k,v in pairs(modules.game_textmessage.getItemsFromLootString(label:getText())) do
  1222.         table.insert(item, v)
  1223.       end
  1224.  
  1225.       if #item > 0 then
  1226.         isMultiColor = true
  1227.       end
  1228.  
  1229.       for k,v in pairs(item) do
  1230.         initPos[k], lastPos[k] = label:getText():find(v)
  1231.         color[k] = modules.game_textmessage.getColorByItemName(item[k])
  1232.       end
  1233.     end
  1234.  
  1235.    
  1236.    
  1237.     if isMultiColor and #item > 0 then  
  1238.       label:setMultiColor(isMultiColor)
  1239.     end
  1240.  
  1241.     if isMultiColor then
  1242.       for i=1, #item do
  1243.         if initPos[i] and item[i] and color[i] then
  1244.           label:addMultiColorTextPosition(initPos[i]-1)
  1245.           label:addMultiColorTextLength(item[i]:len())
  1246.           label:addColor(color[i])
  1247.         end
  1248.       end
  1249.     end
  1250.   end
  1251.  
  1252.   label.name = creatureName
  1253.   label.onMouseRelease = function (self, mousePos, mouseButton)
  1254.     processMessageMenu(mousePos, mouseButton, creatureName, text, self, tab)
  1255.   end
  1256.  
  1257.    --g_window.setClipboardText(label:hasSelection()) moq
  1258.  
  1259.   if consoleBuffer:getChildCount() > MAX_LINES then
  1260.     consoleBuffer:getFirstChild():destroy()
  1261.   end
  1262. end
  1263.  
  1264. function addTabTextNpc(text, speaktype, tab, creatureName)
  1265.     local panel = consoleTabBar:getTabPanel(tab)
  1266.     local consoleBuffer = panel:getChildById('consoleBuffer')
  1267.     local txt2= ''
  1268.     local kk = 6
  1269.     if text:len() >math.floor(consoleBuffer:getWidth()/kk) then
  1270.         txt2 = text:sub(math.floor(consoleBuffer:getWidth()/kk),text:len())
  1271.         text = text:sub(1,math.floor(consoleBuffer:getWidth()/kk))..'-'
  1272.     end
  1273.  
  1274.   if modules.client_options.getOption('showTimestampsInConsole') then
  1275.     text = os.date('%H:%M') .. ' ' .. text
  1276.   end
  1277.  
  1278.   local panel = consoleTabBar:getTabPanel(tab)
  1279.  
  1280.  
  1281.   local labela = g_ui.createWidget('ConsoleLabel2', consoleBuffer)
  1282.  
  1283.   labela:setId('consoleLabel' .. panel:getChildCount())
  1284.  
  1285.     if text:find("{.-}") then
  1286.  
  1287.         local first = true
  1288.         local last = ''
  1289.         for i,b in text:gmatch("(.-){(.-)}") do
  1290.             local label;
  1291.             if first then
  1292.                 label = g_ui.createWidget('ConsoleLabel', labela)
  1293.                 label:setText(i)
  1294.                 label:setColor(speaktype.color)
  1295.                 first = false
  1296.             else
  1297.                 label = g_ui.createWidget('ConsoleLabelColor', labela)
  1298.                 label:setText(i)
  1299.                 label:setColor(speaktype.color)
  1300.             end
  1301.             if b then
  1302.                 label = g_ui.createWidget('ConsoleLabelColor', labela)
  1303.                 label:setText(b)
  1304.                 label:setColor("#9F9DFF")
  1305.  
  1306.                 last = b
  1307.             end
  1308.  
  1309.  
  1310.         end
  1311.         local label = g_ui.createWidget('ConsoleLabelColor', labela)
  1312.         label:setText(text:match('{'..last..'}(.+)'))
  1313.         label:setColor(speaktype.color)
  1314.  
  1315.  
  1316.     else
  1317.       local label = g_ui.createWidget('ConsoleLabel', labela)
  1318.       label:setText(text)
  1319.   if not MSGS[tab:getText()] then
  1320.     MSGS[tab:getText()] = {}
  1321.   end
  1322.   MSGS[tab:getText()][#MSGS[tab:getText()]+1] = text
  1323.       label:setColor(speaktype.color)
  1324.     end
  1325.      --consoleTabBar:blinkTab(tab)
  1326.  
  1327.  
  1328.  
  1329.   if consoleBuffer:getChildCount() > MAX_LINES then
  1330.     consoleBuffer:getFirstChild():destroy()
  1331.   end
  1332.   if (txt2:len() > 2) then
  1333.     addTabTextNpc(txt2, speaktype, tab, creatureName)
  1334.   end
  1335. end
  1336.  
  1337. IGNORED = {}
  1338.  
  1339.  
  1340. function popupMenu(mousePos, mouseButton, creatureName, text,isNpc)
  1341.   if mouseButton == MouseRightButton then
  1342.     local menu = g_ui.createWidget('PopupMenu')
  1343.     if creatureName then
  1344.  
  1345.       if creatureName ~= g_game.getLocalPlayer():getName()and not isNpc then
  1346.         menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end)
  1347.         if (not Player:hasVip(creatureName)) then
  1348.  
  1349.           menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end)
  1350.           menu:addOption(tr('Report'), function () modules.game_playerreport.show(creatureName,nil,true) end)
  1351.         end
  1352.                 if modules.game_console.getOwnPrivateTab() then
  1353.           menu:addSeparator()
  1354.           menu:addOption(tr('Invite to private chat'), function() g_game.inviteToOwnChannel(creatureName) end)
  1355.           menu:addOption(tr('Exclude from private chat'), function() g_game.excludeFromOwnChannel(creatureName) end)
  1356.         end
  1357.         -- TODO ignore creatureName
  1358.         menu:addSeparator()
  1359.       end
  1360.       --TODO select all
  1361.       menu:addOption(tr('Copy message'), function () g_window.setClipboardText(text) end)
  1362.       if modules.game_ruleviolation.hasWindowAccess() and not isNpc then
  1363.         menu:addSeparator()
  1364.         menu:addOption(tr('Rule Violation'), function() local k = text:match('.+%:%s(.+)'); modules.game_ruleviolation.show(creatureName, k ,true) end)
  1365.       end
  1366.  
  1367.       menu:addSeparator()
  1368.       menu:addOption(tr('Copy name'), function () g_window.setClipboardText(creatureName) end)
  1369.       menu:addOption(tr((IGNORED[creatureName] and tr("Unignore") or tr("Ignore"))..' '..creatureName), function ()
  1370.         --ignore
  1371.         IGNORED[creatureName] = IGNORED[creatureName] and nil or true
  1372.       end)
  1373.     else
  1374.       --TODO select all
  1375.       menu:addOption(tr('Copy message'), function () g_window.setClipboardText(text) end)
  1376.     end
  1377.     menu:display(mousePos)
  1378.   end
  1379.  
  1380. end
  1381.  
  1382.  
  1383.  
  1384. -- function processMessageMenu(mousePos, mouseButton, creatureName, text, label, tab)
  1385.   -- if mouseButton == MouseRightButton then
  1386.     -- local menu = g_ui.createWidget('PopupMenu')
  1387.     -- if creatureName and #creatureName > 0 then
  1388.       -- if creatureName ~= g_game.getLocalPlayer():getName() then
  1389.         -- menu:addOption(tr('Message to ' .. creatureName), function () g_game.openPrivateChannel(creatureName) end)
  1390.         -- if not g_game.getLocalPlayer():hasVip(creatureName) then
  1391.           -- menu:addOption(tr('Add to VIP list'), function () g_game.addVip(creatureName) end)
  1392.         -- end
  1393.         -- if modules.game_console.getOwnPrivateTab() then
  1394.           -- menu:addSeparator()
  1395.           -- menu:addOption(tr('Invite to private chat'), function() g_game.inviteToOwnChannel(creatureName) end)
  1396.           -- menu:addOption(tr('Exclude from private chat'), function() g_game.excludeFromOwnChannel(creatureName) end)
  1397.         -- end
  1398.         -- menu:addOption(tr((IGNORED[creatureName] and tr("Unignore") or tr("Ignore"))..' '..creatureName), function ()
  1399.         -- ignore
  1400.         -- IGNORED[creatureName] = IGNORED[creatureName] and nil or true
  1401.       -- end)
  1402.         -- menu:addSeparator()
  1403.       -- end
  1404.       -- if modules.game_ruleviolation.hasWindowAccess() then
  1405.         -- menu:addOption(tr('Rule Violation'), function() modules.game_ruleviolation.show(creatureName, text:match('.+%:%s(.+)')) end)
  1406.         -- menu:addSeparator()
  1407.       -- end
  1408.  
  1409.       -- menu:addOption(tr('Copy name'), function () g_window.setClipboardText(creatureName) end)
  1410.     -- end
  1411.     -- if label:hasSelection() then
  1412.       -- menu:addOption(tr('Copy'), function() g_window.setClipboardText(label:getSelection()) end, '(Ctrl+C)')
  1413.     -- end
  1414.     -- menu:addOption(tr('Copy message'), function() g_window.setClipboardText(text) end)
  1415.     -- menu:addOption(tr('Select all'), function() label:selectAll() end)
  1416.     -- if tab.violations then
  1417.       -- menu:addSeparator()
  1418.       -- menu:addOption(tr('Process') .. ' ' .. creatureName, function() processViolation(creatureName, text) end)
  1419.       -- menu:addOption(tr('Remove') .. ' ' .. creatureName, function() g_game.closeRuleViolation(creatureName) end)
  1420.     -- end
  1421.     -- menu:display(mousePos)
  1422.   -- end
  1423. -- end
  1424.  
  1425.  
  1426.  
  1427. -- function getRuleViolationsTab()
  1428.   -- if violationsChannelId then
  1429.     -- return getChannelTab(violationsChannelId)
  1430.   -- end
  1431.   -- return nil
  1432. -- end
  1433.  
  1434. -- function sendCurrentMessage()
  1435.   -- local message = consoleTextEdit:getText()
  1436.   -- if #message == 0 then return end
  1437.   -- consoleTextEdit:clearText()
  1438.  
  1439.   -- send message
  1440.   -- sendMessage(message)
  1441. -- end
  1442.  
  1443.  
  1444. -- function sendMessage(message, tab)
  1445.   -- local tab = tab or getCurrentTab()
  1446.   -- if not tab then return end
  1447.  
  1448.   -- for k,func in pairs(filters) do
  1449.     -- if func(message) then
  1450.       -- return true
  1451.     -- end
  1452.   -- end
  1453.  
  1454.   -- when talking on server log, the message goes to default channel
  1455.   -- local name = tab:getText()
  1456.   -- if tab == serverTab or tab == getRuleViolationsTab() then
  1457.     -- tab = defaultTab
  1458.     -- name = defaultTab:getText()
  1459.   -- end
  1460.  
  1461.   -- handling chat commands
  1462.   -- local channel = tab.channelId
  1463.   -- local originalMessage = message
  1464.   -- local chatCommandSayMode
  1465.   -- local chatCommandPrivate
  1466.   -- local chatCommandPrivateReady
  1467.   -- local chatCommandMessage
  1468.  
  1469.   -- player used yell command
  1470.   -- chatCommandMessage = message:match("^%#[y|Y] (.*)")
  1471.   -- if chatCommandMessage ~= nil then
  1472.     -- chatCommandSayMode = 'yell'
  1473.     -- channel = 0
  1474.     -- message = chatCommandMessage
  1475.   -- end
  1476.  
  1477.    -- player used whisper
  1478.   -- local chatCommandMessage = message:match("^%#[w|W] (.*)")
  1479.   -- if chatCommandMessage ~= nil then
  1480.     -- chatCommandSayMode = 'whisper'
  1481.     -- message = chatCommandMessage
  1482.     -- channel = 0
  1483.   -- end
  1484.  
  1485.   -- player say
  1486.   -- local chatCommandMessage = message:match("^%#[s|S] (.*)")
  1487.   -- if chatCommandMessage ~= nil then
  1488.     -- chatCommandSayMode = 'say'
  1489.     -- message = chatCommandMessage
  1490.     -- channel = 0
  1491.   -- end
  1492.  
  1493.   -- local findIni, findEnd, chatCommandInitial, chatCommandPrivate, chatCommandEnd, chatCommandMessage = message:find("([%*%@])(.+)([%*%@])(.*)")
  1494.   -- if findIni ~= nil and findIni == 1 then -- player used private chat command
  1495.     -- if chatCommandInitial == chatCommandEnd then
  1496.       -- chatCommandPrivateRepeat = false
  1497.       -- if chatCommandInitial == "*" then
  1498.         -- setTextEditText('*'.. chatCommandPrivate .. '* ')
  1499.       -- end
  1500.       -- message = chatCommandMessage:trim()
  1501.       -- chatCommandPrivateReady = true
  1502.     -- end
  1503.   -- end
  1504.  
  1505.   -- message = message:gsub("^(%s*)(.*)","%2") -- remove space characters from message init
  1506.   -- if #message == 0 then return end
  1507.  
  1508.   -- add new command to history
  1509.   -- currentMessageIndex = 0
  1510.   -- if #messageHistory == 0 or messageHistory[#messageHistory] ~= originalMessage then
  1511.     -- table.insert(messageHistory, originalMessage)
  1512.     -- if #messageHistory > MAX_HISTORY then
  1513.       -- table.remove(messageHistory, 1)
  1514.     -- end
  1515.   -- end
  1516.  
  1517.   -- local speaktypedesc
  1518.   -- if (channel or tab == defaultTab) and not chatCommandPrivateReady then
  1519.     -- if tab == defaultTab then
  1520.       -- speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc
  1521.       -- if speaktypedesc ~= 'say' then sayModeChange(2) end -- head back to say mode
  1522.     -- else
  1523.       -- speaktypedesc = chatCommandSayMode or 'channelYellow'
  1524.     -- end
  1525.  
  1526.     -- g_game.talkChannel(SpeakTypesSettings[speaktypedesc].speakType, channel, message)
  1527.     -- return
  1528.   -- else
  1529.     -- local isPrivateCommand = false
  1530.     -- local priv = true
  1531.     -- local tabname = name
  1532.     -- if chatCommandPrivateReady then
  1533.       -- speaktypedesc = 'privatePlayerToPlayer'
  1534.       -- name = chatCommandPrivate
  1535.       -- isPrivateCommand = true
  1536.     -- elseif tab.npcChat then
  1537.       -- speaktypedesc = 'privatePlayerToNpc'
  1538.     -- elseif tab == violationReportTab then
  1539.       -- if violationReportTab.locked then
  1540.         -- modules.game_textmessage.displayFailureMessage('Wait for a gamemaster reply.')
  1541.         -- return
  1542.       -- end
  1543.       -- speaktypedesc = 'rvrContinue'
  1544.       -- tabname = tr('Report Rule') .. '...'
  1545.     -- elseif tab.violationChatName then
  1546.       -- speaktypedesc = 'rvrAnswerTo'
  1547.       -- name = tab.violationChatName
  1548.       -- tabname = tab.violationChatName .. '\'...'
  1549.     -- else
  1550.       -- speaktypedesc = 'privatePlayerToPlayer'
  1551.     -- end
  1552.  
  1553.  
  1554.     -- local speaktype = SpeakTypesSettings[speaktypedesc]
  1555.     -- local player = g_game.getLocalPlayer()
  1556.     -- g_game.talkPrivate(speaktype.speakType, name, message)
  1557.  
  1558.     -- message = applyMessagePrefixies(g_game.getLocalPlayer():getName(), player:getLevel(), message)
  1559.     -- addPrivateText(message, speaktype, tabname, isPrivateCommand, g_game.getLocalPlayer():getName())
  1560.   -- end
  1561. -- end
  1562.  
  1563.  
  1564. -- function sayModeChange(sayMode)
  1565.   -- local buttom = consolePanel:getChildById('sayModeButton')
  1566.   -- if sayMode == nil then
  1567.     -- sayMode = buttom.sayMode + 1
  1568.   -- end
  1569.  
  1570.   -- if sayMode > #SayModes then sayMode = 1 end
  1571.  
  1572.   -- buttom:setIcon(SayModes[sayMode].icon)
  1573.   -- buttom.sayMode = sayMode
  1574. -- end
  1575.  
  1576. -- function getOwnPrivateTab()
  1577.   -- if not ownPrivateName then return end
  1578.   -- return getTab(ownPrivateName)
  1579. -- end
  1580.  
  1581. -- function setIgnoreNpcMessages(ignore)
  1582.   -- ignoreNpcMessages = ignore
  1583. -- end
  1584.  
  1585. -- function navigateMessageHistory(step)
  1586.   -- local numCommands = #messageHistory
  1587.   -- if numCommands > 0 then
  1588.     -- currentMessageIndex = math.min(math.max(currentMessageIndex + step, 0), numCommands)
  1589.     -- if currentMessageIndex > 0 then
  1590.       -- local command = messageHistory[numCommands - currentMessageIndex + 1]
  1591.       -- consoleTextEdit:setText(command)
  1592.     -- else
  1593.       -- consoleTextEdit:clearText()
  1594.     -- end
  1595.   -- end
  1596. -- end
  1597.  
  1598.  
  1599.  
  1600. -- function applyMessagePrefixies(name, level, message)
  1601.   -- if name then
  1602.     -- if modules.client_options.getOption('showLevelsInConsole') and level > 0 then
  1603.       -- message = name .. ' [' .. level .. ']: ' .. message
  1604.     -- else
  1605.       -- message = name .. ': ' .. message
  1606.     -- end
  1607.   -- end
  1608.   -- return message
  1609. -- end
  1610.  
  1611. -- function onTalk(name, level, mode, message, channelId, creaturePos)
  1612.   -- if mode == MessageModes.PrivateFrom and IGNOREPM then
  1613.     -- consolePanel:getChildById('blockedPlayers'):setIcon("blcokedred.png")
  1614.     -- scheduleEvent(function()
  1615.         -- consolePanel:getChildById('blockedPlayers'):setIcon("blcoked.png")
  1616.     -- end, 1000)
  1617.     -- return true
  1618.   -- end
  1619.   -- if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end
  1620.  
  1621.  
  1622.     -- if IGNORED[name] then
  1623.     -- consolePanel:getChildById('blockedPlayers'):setIcon("blcokedred.png")
  1624.     -- scheduleEvent(function()
  1625.         -- consolePanel:getChildById('blockedPlayers'):setIcon("blcoked.png")
  1626.     -- end, 1000)
  1627.     -- return true
  1628.   -- end
  1629.  
  1630.  
  1631.   -- if (mode == MessageModes.Say or mode == MessageModes.Whisper or mode == MessageModes.Yell or
  1632.       -- mode == MessageModes.Spell or mode == MessageModes.MonsterSay or mode == MessageModes.MonsterYell or
  1633.       -- mode == MessageModes.NpcFrom or mode == MessageModes.BarkLow or mode == MessageModes.BarkLoud) and
  1634.      -- creaturePos then
  1635.     -- local staticText = StaticText.create()
  1636.     -- if mode == MessageModes.NpcFrom then
  1637.         -- staticText:addMessage(name, mode, message:gsub('[{}]',' '))
  1638.     -- else
  1639.         -- staticText:addMessage(name, mode, message)
  1640.     -- end
  1641.     -- g_map.addThing(staticText, creaturePos, -1)
  1642.   -- end
  1643.  
  1644.   -- local defaultMessage = mode <= 3 and true or false
  1645.   -- speaktype = SpeakTypes[mode]
  1646.  
  1647.   -- if not speaktype then
  1648.     -- perror('unhandled onTalk message mode ' .. mode .. ': ' .. message)
  1649.     -- return
  1650.   -- end
  1651.  
  1652.   -- if speaktype == SpeakTypesSettings.none then return end
  1653.  
  1654.   -- if speaktype.hideInConsole then return end
  1655.  
  1656.   -- local composedMessage = applyMessagePrefixies(name, level, message)
  1657.  
  1658.   -- if speaktype.private then
  1659.     -- addPrivateText(composedMessage, speaktype, name, false, name)
  1660.     -- if modules.client_options.getOption('showPrivateMessagesOnScreen') and speaktype ~= SpeakTypesSettings.privateNpcToPlayer then
  1661.       -- modules.game_textmessage.displayPrivateMessage(name .. ':\n' .. message)
  1662.     -- end
  1663.   -- else
  1664.     -- local channel = tr('Default')
  1665.     -- if not defaultMessage then
  1666.       -- channel = channels[channelId]
  1667.     -- end
  1668.  
  1669.     -- if channel then
  1670.       -- addText(composedMessage, speaktype, channel, name)
  1671.     -- elseif channelId ~= 0 then
  1672.       -- server sent a message on a channel that is not open
  1673.       -- pwarning('message in channel id ' .. channelId .. ' which is unknown, this is a server bug, relogin if you want to see messages in this channel')
  1674.     -- end
  1675.   -- end
  1676. -- end
  1677.  
  1678. function onOpenChannel(channelId, channelName)
  1679.   addChannel(channelName, channelId)
  1680.   local ss = {'Avisos: Tutores e GMs não podem ficar logando em outros mundos, se forem vistos em outros mundos poderam ser banidos. Qualquer membro da Staff que for visto ofendendo players e/ou outros membros da Staff podem ter seus cargos retirados sem aviso.',
  1681.         'É proibido membros da Staff dividir a acc, por isso quem for visto logando na acc de outros players ou deixando outro player ou membro da Staff entrar na sua acc vai ter o cargo retirado.',
  1682.         'Sempre que ver um player fazendo algo errado avise que ele não pode fazer isso, diga o motivo e se ele continuar então deve ser aplicada uma NOTATAION. Sempre antes de aplicar uma punição avisem no counselor, mesmo que achem que não tem ninguem ON.',
  1683.         'Tutores nunca devem dar ban diretamente, com exceção de anuncios de sites hackers, ou criação de contas fakes com proposito de anuncios indevidos ou ofensas a Staff e/ou otPokemon.',
  1684.         'Casos de bot, uso de bugs, roubos, e outras coisas não relacionadas aos chats não devem ser punidos por tutores, os tutores que forem informados sobre essas coisas devem reportar, ctrl+r, e esperar que outro membro da equipe resolva. Bom jogo pra todos.',
  1685.         "Bem-vindo ao canal de ajuda.\nAqui você poderá tirar dúvidas relevantes sobre o jogo. Perguntas sobre localizações e respawns devem ser feitas no game-chat."
  1686.     }
  1687.     if channelId == 4 then
  1688.         addText(ss[math.random(1,#ss)], SpeakTypesSettings.channelWhite, channelName, '')
  1689.     end
  1690. setPokeInfo(' - ','-',0,0,1,0,7746,0,0,100)
  1691. removePokeAttr();
  1692. end
  1693.  
  1694. function onOpenPrivateChannel(receiver)
  1695.   addPrivateChannel(receiver)
  1696. end
  1697.  
  1698. -- function onOpenOwnPrivateChannel(channelId, channelName)
  1699.   -- local privateTab = getTab(channelName)
  1700.   -- if privateTab == nil then
  1701.     -- addChannel(channelName, channelId)
  1702.   -- end
  1703.   -- ownPrivateName = channelName
  1704. -- end
  1705.  
  1706. -- function onCloseChannel(channelId)
  1707.   -- local channel = channels[channelId]
  1708.   -- if channel then
  1709.     -- local tab = getTab(channel)
  1710.     -- if tab then
  1711.       -- consoleTabBar:removeTab(tab)
  1712.     -- end
  1713.     -- for k, v in pairs(channels) do
  1714.       -- if (k == tab.channelId) then channels[k] = nil end
  1715.     -- end
  1716.   -- end
  1717. -- end
  1718.  
  1719. function doChannelListSubmit()
  1720.   local channelListPanel = channelsWindow:getChildById('channelList')
  1721.   local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText()
  1722.   if openPrivateChannelWith ~= '' then
  1723.     g_game.openPrivateChannel(openPrivateChannelWith)
  1724.   else
  1725.     local selectedChannelLabel = channelListPanel:getFocusedChild()
  1726.     if not selectedChannelLabel then return end
  1727.     if selectedChannelLabel.channelId == 0xFFFF then
  1728.       g_game.openOwnChannel()
  1729.     else
  1730.       g_game.joinChannel(selectedChannelLabel.channelId)
  1731.     end
  1732.   end
  1733.  
  1734.   channelsWindow:destroy()
  1735. end
  1736.  
  1737.  
  1738. function onGameEditText(id, itemId, maxLength, text, writter, time)
  1739.  
  1740. end
  1741. function matar()
  1742.     -- if pokedex_UI then
  1743.         -- pokedex_UI:destroy()
  1744.         -- pokedex_UI = nil
  1745.         -- topButton:setOn(false)
  1746.     -- end
  1747. end
  1748. function closeRep()
  1749.     if Rep_window then
  1750.         Rep_window:destroy()
  1751.         Rep_window = nil
  1752.     end
  1753. end
  1754.  
  1755.  
  1756.  
  1757.  
  1758. CHKS = 0
  1759. function chooseRep(widget, focusedChild,old)
  1760.     local id = tonumber(focusedChild.id) or 0
  1761.     if id then
  1762.  
  1763.         CHKS = id
  1764.         Rep_window:getChildById('chk'):enable()
  1765.     else
  1766.         Rep_window:getChildById('chk'):disable()
  1767.     end
  1768. end
  1769.  
  1770.  
  1771. function Scan()
  1772.     if CHKS  then
  1773.         closeRep()
  1774.  
  1775.         g_game.getProtocolGame():sendExtendedOpcode(5, "77GTB"..CHKS)
  1776.  
  1777.     end
  1778. end
  1779. function closeReps()
  1780.     if Rep_window then
  1781.         Rep_window:destroy()
  1782.         Rep_window = nil
  1783.         return true
  1784.     end
  1785.     return false
  1786. end
  1787. function onChannelList(channelList,poke) ---dexhere    vazio
  1788.  
  1789.     if channelsWindow then channelsWindow:destroy() end
  1790.         if not channelList then
  1791.             channelList = loadedList
  1792.         end
  1793.         loadedList = channelList
  1794.  
  1795.  
  1796.         if channelList[1][2]:match('BNN(%d+)') then
  1797.             for i,b in pairs(channelList) do
  1798.                 if Rep_window then
  1799.                     return
  1800.                 end
  1801.                 Rep_window = g_ui.displayUI('reprwdw.otui')
  1802.                 Rep_window:getChildById('chk'):disable()
  1803.                 local list = Rep_window:getChildById('listoza')
  1804.                 --
  1805.                 for k,v in pairs(channelList) do
  1806.                     if k > 1 then
  1807.                         local channelId = v[1]
  1808.                         local channelName = v[2]
  1809.                         local label = g_ui.createWidget('ReprList', list)
  1810.                         label:setId("RP"..channelId)
  1811.                         label:setColor("#00ff00")
  1812.                         label:setText(channelName)
  1813.                         label.id = tonumber(string.match(channelName,"%[(%d+)%]"))
  1814.                     else
  1815.                         local label = g_ui.createWidget('ReprList', list)
  1816.                         label:setId("RP0")
  1817.                         label:setColor("#ff7777")
  1818.                         label:setText("Reports :)")
  1819.                     end
  1820.                 end
  1821.                 local label = g_ui.createWidget('ReprList', list)
  1822.                 label:setId("RP9999")
  1823.                 label:setColor("#a3a3ff")
  1824.                 label:setText("End reports =]")
  1825.                 connect(list, { onChildFocusChange =  function (self, focusedChild,old) chooseRep(self, focusedChild,old) end } )
  1826.             end
  1827.             return
  1828.         end
  1829.  
  1830.  
  1831.   if channelsWindow then channelsWindow:destroy() end
  1832.   channelsWindow = g_ui.displayUI('channelswindow')
  1833.   local channelListPanel = channelsWindow:getChildById('channelList')
  1834.   channelsWindow.onEnter = doChannelListSubmit
  1835.   channelsWindow.onDestroy = function() channelsWindow = nil end
  1836.   g_keyboard.bindKeyPress('Down', function() channelListPanel:focusNextChild(KeyboardFocusReason) end, channelsWindow)
  1837.   g_keyboard.bindKeyPress('Up', function() channelListPanel:focusPreviousChild(KeyboardFocusReason) end, channelsWindow)
  1838.  
  1839.   for k,v in pairs(channelList) do
  1840.     local channelId = v[1]
  1841.     local channelName = v[2]
  1842.  
  1843.     if #channelName > 0 then
  1844.       local label = g_ui.createWidget('ChannelListLabel', channelListPanel)
  1845.       label.channelId = channelId
  1846.       label:setText(channelName)
  1847.  
  1848.       label:setPhantom(false)
  1849.       label.onDoubleClick = doChannelListSubmit
  1850.     end
  1851.   end
  1852.  
  1853.  
  1854. end
  1855.  
  1856. FIRST = true
  1857. DEXDATA = {}
  1858. MOAR = "Você ainda não completou sua PokeDex!\nComplete para ganhar prêmios e pontos!"
  1859. JAAJITEM =0
  1860. function countP()
  1861.     local i = 0
  1862.     for a=1,544 do
  1863.         if DEXDATA[a] then
  1864.             i = i+1
  1865.         end
  1866.     end
  1867.     return i
  1868. end
  1869. function Parse_me(txt)
  1870.     for i,b in txt:gmatch("(%d+),(.-);") do
  1871.         DEXDATA[tonumber(i)] = b
  1872.     end
  1873. end
  1874. -- function info()
  1875.     -- if MOAR ~= '' and MOAR ~= nil then
  1876.         -- modules.game_textwindow.onGameEditText(os.time(), 3270, 0,MOAR, 0, os.time())
  1877.     -- end
  1878. -- end
  1879. -- LAST_SELECTED = ""
  1880. -- FISTDEX = false;
  1881. -- function doOpenDex(text,texto,item)
  1882.     -- MOAR = text or a
  1883.     -- text = text or a
  1884.  
  1885.     -- if (text == 0)then
  1886.         -- g_game.getProtocolGame():sendExtendedOpcode(5, "77RFRSH")
  1887.         -- scheduleEvent(function() FIRST = false refreshDexList() end, 800)
  1888.         -- text = nil
  1889.     -- end
  1890.  
  1891.     -- if not pokedex_UI then
  1892.         -- pokedex_UI = g_ui.displayUI('pokedex.otui')
  1893.         -- topButton:setOn(true)
  1894.         -- local PX =  g_window.getWidth()/2 - (653/2)
  1895.         -- local PY =  g_window.getHeight()/2 - (474/2)
  1896.         -- pokedex_UI:setX(PX)
  1897.         -- pokedex_UI:setY(PY)
  1898.  
  1899.         -- list = pokedex_UI:getChildById('listoza')
  1900.         -- connect(list, { onChildFocusChange =  function (self, focusedChild,old) selecting(self,focusedChild,old,-1) end } )
  1901.         -- pokedex_UI:getChildById('gotoo'):disable()
  1902.         -- for k=1,544 do
  1903.             -- if DEXDATA[k] then
  1904.                 -- loadedOnce = k
  1905.                 -- local channelId = k
  1906.                 -- local channelName = string.format("%.3d",k)..' - '..DEXDATA[k]
  1907.                 -- local label = g_ui.createWidget('DexList', list)
  1908.                 -- label:setId("PK"..channelId)
  1909.                 -- label:setColor("#37ae20")
  1910.                 -- label:setText(channelName)
  1911.  
  1912.             -- else
  1913.                 -- loadedOnce = k
  1914.                 -- local channelId = k
  1915.                 -- local channelName = string.format("%.3d",k)..' - ???'
  1916.                 -- local label = g_ui.createWidget('DexList', list)
  1917.                 -- label:setId("PK"..channelId)
  1918.                 -- label:setColor("#121296")
  1919.                 -- label:setText(channelName)
  1920.             -- end
  1921.         -- end
  1922.     -- end
  1923.         -- JAAJITEM=item
  1924.         -- if not text then
  1925.             -- if not text and not FIRST then
  1926.                 -- pokedex_UI:getChildById('description'):setText(tr(texto,countP() or 0))
  1927.             -- end
  1928.         -- else
  1929.             -- local Abriged = "Name: %s\nType: %s\nMinimum level %s\n\nTo more informations click\nnon the (I) button\n"
  1930.  
  1931.             -- local nome = text:match("Name: %s+(.-)\n") or text:match("Name: %s+(.-)\n")
  1932.             -- for k=1,544 do
  1933.                 -- if DEXDATA[k] and nome:lower() == DEXDATA[k]:lower() then
  1934.                     -- Abriged = Abriged..'Nº '..string.format("%.3d",k)
  1935.                     -- break
  1936.                 -- end
  1937.             -- end
  1938.             -- MOAR = text
  1939.             -- local f = io.open("modules/game_console/pokes/"..nome..".png","r");
  1940.             -- if not f then
  1941.  
  1942.                 -- pokedex_UI:getChildById('portrait'):setImageSource("unknow.png")
  1943.             -- else
  1944.                 -- f:close()
  1945.                 -- pokedex_UI:getChildById('portrait'):setImageSource("pokes/"..nome..".png")
  1946.             -- end
  1947.             -- pokedex_UI:getChildById('description'):setText(Abriged:format(nome:gsub('%a',string.upper,1),text:match("Tipo: (.-)\n") or text:match("Type: (.-)\n"),text:match("Necessario:%s*(%d+)") or text:match("required:%s*(%d+)") or 0))
  1948.         -- end
  1949.         -- pokedex_UI:getChildById('description'):setColor("#101010")
  1950.         -- pokedex_UI:getChildById('portrait'):setItemId(item or 7746)
  1951.  
  1952.  
  1953.  
  1954.  
  1955.         -- pokedex_UI:getChildById('portrait'):setItemId(item or 7746)
  1956.  
  1957.         -- pokedex_UI:getChildById('description'):setColor("#101010")
  1958.  
  1959.         -- if FIRST then
  1960.  
  1961.             -- g_game.getProtocolGame():sendExtendedOpcode(5, "77RFRSH")
  1962.             -- scheduleEvent(function() FIRST = false refreshDexList(true) end, 800)
  1963.         -- end
  1964.  
  1965. -- end
  1966. focused = nil
  1967.  
  1968. --Finding message
  1969. LEFIND = nil
  1970. lookforall = true
  1971. function setLookForAll(self)
  1972.     self:setChecked(not self:isChecked())
  1973.     lookforall = LEFIND:getChildById('ignore'):isChecked()
  1974.  
  1975. end
  1976. function openFind_destroy()
  1977.     if LEFIND then
  1978.         LEFIND:destroy();
  1979.         LEFIND = nil
  1980.     end
  1981. end
  1982. function openFind()
  1983.     openFind_destroy()
  1984.     LEFIND = g_ui.displayUI('lookfor.otui')
  1985.     if not LEFIND then
  1986.         return
  1987.     end
  1988.  
  1989.     LEFIND.onDestroy = function()
  1990.         LEFIND = nil
  1991.     end
  1992.     LEFIND:getChildById('ignore'):setChecked(lookforall )
  1993.  
  1994. end
  1995. function openFind_search()
  1996.     local msg = LEFIND:getChildById('msgs'):getText():lower();
  1997.     openFind_destroy()
  1998.     if msg:len() < 4 then
  1999.         modules.game_textmessage.displayMessage(MessageModes.Login, tr("You need at least 3 letters."))
  2000.         return true;
  2001.     end
  2002.     local find = {}
  2003.     if lookforall then
  2004.         for channel, messages in pairs(MSGS) do
  2005.             for i,message in pairs(messages) do
  2006.                 if tostring(message):lower():find(msg) then
  2007.                     find[#find +1] = {message,channel};
  2008.                 end
  2009.             end
  2010.         end
  2011.     else
  2012.         local tab = consoleTabBar:getCurrentTab()
  2013.         for channel, messages in pairs(MSGS) do
  2014.             if channel:lower() == tab:getText():lower() then
  2015.                 for i,message in pairs(messages) do
  2016.                     if tostring(message):lower():find(msg) then
  2017.                         find[#find +1] = {message,channel};
  2018.                     end
  2019.                 end
  2020.             end
  2021.         end
  2022.     end
  2023.     if #find == 0 then
  2024.         modules.game_textmessage.displayMessage(MessageModes.Login, tr("No matches."))
  2025.     else
  2026.         modules.game_textmessage.displayMessage(MessageModes.Login, (#find)..tr(" matches found"))
  2027.         local window = g_ui.displayUI('found.otui');
  2028.  
  2029.         img = window:getChildById('img')
  2030.         local gray=false;
  2031.         for i,b in pairs(find) do
  2032.             local questLabel = g_ui.createWidget('UIItem', img)
  2033.             questLabel:setBackgroundColor(gray and "#444444" or "#777777")
  2034.             questLabel:setText(b[2])
  2035.             questLabel:setHeight(14)
  2036.             questLabel.onMouseRelease = function (self, mousePos, mouseButton)
  2037.                 leOpenMenuCopy(mousePos, mouseButton,  b[1])
  2038.             end
  2039.             if (b[1]:len() > 50) then
  2040.  
  2041.                 local questLabel = g_ui.createWidget('UIItem', img)
  2042.                 questLabel:setBackgroundColor(gray and "#444444" or "#777777")
  2043.                 questLabel:setText(" ")
  2044.                 questLabel:setHeight(14)
  2045.             end
  2046.             gray = not gray;
  2047.  
  2048.  
  2049.         end
  2050.         gray = false;
  2051.         name = window:getChildById('name')
  2052.         for i,b in pairs(find) do
  2053.             local questLabel = g_ui.createWidget('UIItem', name)
  2054.             questLabel:setBackgroundColor(gray and "#444444" or "#777777")
  2055.             questLabel:setText(b[1]:sub(1,50)..(b[1]:len() > 50 and "..." or ""))
  2056.             questLabel:setHeight(14)
  2057.             questLabel.onMouseRelease = function (self, mousePos, mouseButton)
  2058.                 leOpenMenuCopy(mousePos, mouseButton,  b[1])
  2059.             end
  2060.             if (b[1]:len() > 50) then
  2061.                 local questLabel = g_ui.createWidget('UIItem', name)
  2062.                 questLabel:setBackgroundColor(gray and "#444444" or "#777777")
  2063.                 questLabel:setText(b[1]:sub(50,100)..(b[1]:len() > 100 and "..." or ""))
  2064.                 questLabel:setHeight(14)
  2065.                 questLabel.onMouseRelease = function (self, mousePos, mouseButton)
  2066.                     leOpenMenuCopy(mousePos, mouseButton,  b[1])
  2067.                 end
  2068.             end
  2069.             gray = not gray;
  2070.         end
  2071.  
  2072.  
  2073.  
  2074.  
  2075.     end
  2076. end
  2077.  
  2078. function leOpenMenuCopy(mousePos, mouseButton, text)
  2079.   if mouseButton == MouseRightButton then
  2080.     local menu = g_ui.createWidget('PopupMenu')
  2081.  
  2082.       menu:addOption(tr('Copy message'), function () g_window.setClipboardText(text) end)
  2083.       if (text:match("%d+:%d+ (.-)%s*%[%d+%]")) then
  2084.         local name  = text:match("%d+:%d+ (.-)%s*%[%d+%]")
  2085.         menu:addSeparator()
  2086.         menu:addOption(tr('Copy name'), function () g_window.setClipboardText(name) end)
  2087.         menu:addOption(tr('Send message to')..' ' .. name, function () openFind_destroy() g_game.openPrivateChannel(name) end)
  2088.       end
  2089.  
  2090.     menu:display(mousePos)
  2091.     end
  2092. end
  2093.  
  2094.  
  2095. --End
  2096.  
  2097. -- function selecting(self,focusedChild,old,jaaj)
  2098.     -- focused = focusedChild
  2099.  
  2100.     -- if not focusedChild:getText():find('?') and LAST_SELECTED ~= focusedChild:getText() then
  2101.         -- pokedex_UI:getChildById('listoza'):focusChild(focusedChild)
  2102.         -- LAST_SELECTED = focusedChild:getText();
  2103.  
  2104.         -- g_game.getProtocolGame():sendExtendedOpcode(5,"77OP"..tostring(focusedChild:getText():match("%d+")))
  2105.  
  2106.     -- end
  2107. -- end
  2108. -- function refreshDexList(cancel_desc)
  2109.     -- if pokedex_UI then
  2110.         -- local list = pokedex_UI:getChildById('listoza')
  2111.         -- for k=1,544 do
  2112.             -- if DEXDATA[k] then
  2113.                 -- local wid = list:getChildById('PK'..k)
  2114.                 -- wid:setColor("#37ae20")
  2115.                 -- wid:setText(string.format("%.3d",k)..' - '..DEXDATA[k])
  2116.             -- end
  2117.         -- end
  2118.         --[[if not text then
  2119.             pokedex_UI:getChildById('description'):setText("Hello. This is the pokedex.\n\nYou have found "..countP().." pokemon.\n\n\n\n\n\n\n"..os.date("%H:%M:%S - %d/%m/%Y",os.time()))
  2120.         else
  2121.             pokedex_UI:getChildById('description'):setText(text)
  2122.         end]]
  2123.     -- end
  2124. -- end
  2125. -- function goNext()
  2126.     -- local ok = false
  2127.     -- if pokedex_UI then
  2128.         -- local list = pokedex_UI:getChildById('listoza')
  2129.         -- for k=1,544 do
  2130.             -- local wid = list:getChildById('PK'..k)
  2131.  
  2132.             -- if ok and not wid:getText():find('?') then
  2133.                 -- selecting(list,wid,nil)
  2134.                 -- return true
  2135.             -- end
  2136.             -- if wid == focused then
  2137.                 -- ok = true
  2138.             -- end
  2139.         -- end
  2140.         -- for k=1,544 do
  2141.             -- local wid = list:getChildById('PK'..k)
  2142.             -- if not wid:getText():find('?') then
  2143.                 -- selecting(list,wid,nil)
  2144.  
  2145.                 -- return true
  2146.             -- end
  2147.         -- end
  2148.     -- end
  2149. -- end
  2150.  
  2151. -- function goPrev()
  2152.     -- local ok = false
  2153.     -- if pokedex_UI then
  2154.         -- local list = pokedex_UI:getChildById('listoza')
  2155.         -- for k=544,1,-1 do
  2156.             -- local wid = list:getChildById('PK'..k)
  2157.  
  2158.             -- if ok and not wid:getText():find('?') then
  2159.                 -- selecting(list,wid,nil)
  2160.                 -- return true
  2161.             -- end
  2162.             -- if wid == focused then
  2163.                 -- ok = true
  2164.             -- end
  2165.         -- end
  2166.         -- for k=544,1,-1 do
  2167.             -- local wid = list:getChildById('PK'..k)
  2168.             -- if not wid:getText():find('?') then
  2169.                 -- selecting(list,wid,nil)
  2170.                 -- return true
  2171.             -- end
  2172.         -- end
  2173.     -- end
  2174. -- end
  2175.  
  2176. -- function openPlayerReportRuleViolationWindow()
  2177.   -- if violationWindow or violationReportTab then return end
  2178.   -- violationWindow = g_ui.loadUI('violationwindow', rootWidget)
  2179.   -- violationWindow.onEscape = function()
  2180.     -- violationWindow:destroy()
  2181.     -- violationWindow = nil
  2182.   -- end
  2183.   -- violationWindow.onEnter = function()
  2184.     -- local text = violationWindow:getChildById('text'):getText()
  2185.     -- g_game.talkChannel(MessageModes.RVRChannel, 0, text)
  2186.     -- violationReportTab = addTab(tr('Report Rule') .. '...', true)
  2187.     -- addTabText(tr('Please wait patiently for a gamemaster to reply') .. '.', SpeakTypesSettings.privateRed, violationReportTab)
  2188.     -- addTabText(applyMessagePrefixies(g_game.getCharacterName(), 0, text),  SpeakTypesSettings.say, violationReportTab, g_game.getCharacterName())
  2189.     -- violationReportTab.locked = true
  2190.     -- violationWindow:destroy()
  2191.     -- violationWindow = nil
  2192.   -- end
  2193. -- end
  2194.  
  2195. -- function lookFor()
  2196.     -- if pokedex_UI then
  2197.         -- local asd = pokedex_UI:getChildById('searchk')
  2198.         -- local look = asd:getText():lower();
  2199.         -- if look:len() < 2 then
  2200.             -- return;
  2201.         -- end
  2202.         -- local max = 545;
  2203.         -- if focused then
  2204.             -- local n = focused:getId():match("(%d+)");
  2205.             -- max = math.min(n,max)
  2206.             -- if max <= 1 then
  2207.                 -- max = 545;
  2208.             -- end
  2209.         -- end
  2210.         -- local list = pokedex_UI:getChildById('listoza')
  2211.         -- local firstF = nil
  2212.         -- for k=max-1,1,-1 do
  2213.             -- local wid = list:getChildById('PK'..k)
  2214.             -- if not firstF then
  2215.                 -- firstF = wid;
  2216.             -- end
  2217.             -- if wid and not wid:getText():find('?') then
  2218.                 -- local pname = wid:getText():lower();
  2219.  
  2220.                 -- if pname:find(look) then
  2221.                     -- selecting(list,wid,nil)
  2222.                     -- return true
  2223.                 -- end
  2224.             -- end
  2225.         -- end
  2226.         -- focused = firstF;local lastChannelsOpen = g_settings.getNode('lastChannelsOpen')
  2227.   -- if lastChannelsOpen then
  2228.     -- local savedChannels = lastChannelsOpen[g_game.getCharacterName()]
  2229.     -- if savedChannels then
  2230.       -- for channelName, channelId in pairs(savedChannels) do
  2231.         -- channelId = tonumber(channelId)
  2232.         -- if channelId ~= -1 and channelId < 100 then
  2233.           -- if not table.find(channels, channelId) then
  2234.             -- g_game.joinChannel(channelId)
  2235.             -- table.insert(ignoredChannels, channelId)
  2236.           -- end
  2237.         -- end
  2238.       -- end
  2239.     -- end
  2240.   -- end
  2241.   -- scheduleEvent(function() ignoredChannels = {} end, 3000)
  2242.  
  2243.     -- end
  2244. -- end
  2245. -- function online()
  2246.   -- if g_game.getProtocolVersion() < 862 then
  2247.     -- g_keyboard.bindKeyDown('Ctrl+R', openPlayerReportRuleViolationWindow)
  2248.   -- end
  2249.   -- open last channels
  2250.   --
  2251. -- end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top