From 6d8c558014b7062af68067855bc5c88f5aac0579 Mon Sep 17 00:00:00 2001 From: atom0s Date: Tue, 2 May 2017 04:56:51 -0700 Subject: [PATCH] Added support for: server message, bazaar message, linkshell message --- links.lua | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/links.lua b/links.lua index 2ce6909..b65dd4e 100644 --- a/links.lua +++ b/links.lua @@ -25,7 +25,7 @@ _addon.author = 'atom0s'; _addon.name = 'links'; -_addon.version = '3.0.0'; +_addon.version = '3.0.1'; require 'common' @@ -121,17 +121,41 @@ end); -- desc: Called when our addon receives an incoming packet. --------------------------------------------------------------------------------------------------- ashita.register_event('incoming_packet', function(id, size, data) - -- Look for chat packets.. + local msg = nil; + + -- 0x0017 - Chat if (id == 0x17) then -- 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); while url ~= nil do table.insert(urls, url); url, start = ParseForLinks(msg ,start); end end - + return false; end);