Browse Source

Added support for: server message, bazaar message, linkshell message

master
atom0s 8 years ago
parent
commit
6d8c558014
  1. 30
      links.lua

30
links.lua

@ -25,7 +25,7 @@
_addon.author = 'atom0s'; _addon.author = 'atom0s';
_addon.name = 'links'; _addon.name = 'links';
_addon.version = '3.0.0'; _addon.version = '3.0.1';
require 'common' require 'common'
@ -121,10 +121,34 @@ end);
-- desc: Called when our addon receives an incoming packet. -- desc: Called when our addon receives an incoming packet.
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
ashita.register_event('incoming_packet', function(id, size, data) ashita.register_event('incoming_packet', function(id, size, data)
-- Look for chat packets.. local msg = nil;
-- 0x0017 - Chat
if (id == 0x17) then if (id == 0x17) then
-- Obtain the chat message from the packet.. -- Obtain the chat message from the packet..
local msg, _ = struct.unpack('s', data, 0x18 + 1); msg, _ = struct.unpack('s', data, 0x18 + 1);
end
-- 0x004D - Server Message
if (id == 0x004D) then
-- Obtain the chat message from the packet..
msg, _ = struct.unpack('s', data, 0x18 + 1);
end
-- 0x00CA - Bazaar Message
if (id == 0x00CA) then
-- Obtain the chat message from the packet..
msg, _ = struct.unpack('s', data, 0x04 + 1);
end
-- 0x00CC - Linkshell Message
if (id == 0x00CC) then
-- Obtain the chat message from the packet..
msg, _ = struct.unpack('s', data, 0x08 + 1);
end
-- Parse the message for links..
if (msg ~= nil) then
local url, start = ParseForLinks(msg, 0); local url, start = ParseForLinks(msg, 0);
while url ~= nil do while url ~= nil do
table.insert(urls, url); table.insert(urls, url);

Loading…
Cancel
Save