Skip to content

Instantly share code, notes, and snippets.

@TeoTwawki
Created December 28, 2015 01:28
Show Gist options
  • Save TeoTwawki/7aa7ec7c691b1c13491d to your computer and use it in GitHub Desktop.
Save TeoTwawki/7aa7ec7c691b1c13491d to your computer and use it in GitHub Desktop.
packet logging - fork and edit as needed.
--[[
plogger.lua (c) 2013-2014 Hypnotoad
(c) 2014 atom0s
This addon is based on the old plugin for LuaCast (Ashita v1) by
Hypnotoad. I, atom0s, do not take any credit for the work of this
plugin outside of updating it to an addon for Ashita v2.
]]--
_addon.author = 'atom0s & Hypnotoad';
_addon.name = 'plogger';
_addon.version = '1.0.0';
require 'common'
---------------------------------------------------------------------------------------------------
-- USER CONFIGURATION - PLEASE READ BEFORE MAKING EDITS!
---------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-- ClientIgnore - Any packet id set to true in this table will be ignored from the client.
-----------------------------------------------------------------------------------------------
local ClientIgnore =
{ -- Commented out = this will be logged
[0x0A] = true, -- (Update) Session Key
[0x0C] = true, -- (Request) PC
-- [0x0D] = true, -- (Update) Leave Area
[0x0F] = true, -- (Request) Quests/Missions/Items/Key Items
-- [0x11] = true, -- (Sync) Zoning
[0x15] = true, -- (Notify) Position
-- [0x16] = true, -- (Event) NPC Info
[0x17] = true, -- (Notify) Wrong NPC
[0x1A] = true, -- Actions
-- [0x1B] = true, -- (World Pass) Purchasing
[0x1C] = true, -- (Unknown) Pet Ability
-- [0x28] = true, -- (Storage) Item Removal
-- [0x29] = true, -- (Storage) Item Moving
-- [0x32] = true, -- (Trade)
-- [0x33] = true, -- (Trade)
-- [0x34] = true, -- (Trade) Item Move
[0x5A] = true, -- (Update) World Map
[0x5B] = true, -- (Update) Current Event
-- [0x5C] = true, -- (Update) Event Position
-- [0x5D] = true, -- Job Emote
-- [0x5E] = true, -- (Notify) Zone Line
-- [0x60] = true, -- (Notify) Info To Complete Event
[0x61] = true, -- (Request) Update
-- [0x63] = true, -- (Request) Chocobo Digging
-- [0x64] = true, -- (Notify) Key Item Check
-- [0x66] = true, -- (Request) Fishing End
-- [0xDB] = true, -- Search Language
[0xDD] = true, -- (Request) Check Command
[0xDE] = true, -- Bazaar Message
[0xE0] = true, -- Search Comment
-- [0xE1] = true, -- (Request) Linkshell Welcome
-- [0xE2] = true, -- (Update) Linkshell Welcome
-- [0xE7] = true, -- (Request) Shutdown/Logout
-- [0xE8] = true, -- Resting
-- [0xEA] = true, -- (Command) Sit
-- [0xF1] = true, -- (Request) Remove Status Effect
-- [0xF2] = true, -- (Notify) Blocked Route
-- [0xF4] = true, -- (Request) Wide Scan
-- [0xF5] = true, -- (Request) Wide Scan Target Select
-- [0xFA] = true, -- (Mog House) Place Furniture
-- [0xFB] = true, -- (Mog House) Remove Furniture
[0x100] = true, -- (Request) Change Job
[0x102] = true, -- (Set) Blue Mage Spells
-- [0x104] = true, -- (Bazaar) Leave
-- [0x105] = true, -- (Bazaar) View
-- [0x106] = true, -- (Bazaar) Purchase
-- [0x109] = true, -- (Bazaar) Exit Price Setting
-- [0x10A] = true, -- (Bazaar) Set Prices
-- [0x10B] = true, -- (Bazaar) Open Set Prices/Close Bazaar" }
};
-----------------------------------------------------------------------------------------------
-- ServerIgnore - Any packet id set to true in this table will be ignored from the server.
-----------------------------------------------------------------------------------------------
local ServerIgnore =
{ -- Commented out = this will be logged
-- [0x05] = true, -- (Bazaar) Item
-- [0x06] = true, -- (Bazaar) Purchase
-- [0x07] = true, -- (Bazaar) Close
-- [0x08] = true, -- (Bazaar) Check
-- [0x09] = true, -- (Bazaar) Confirmation/Standard Message
-- [0x0A] = true, -- (Update) Zoning
-- [0x0B] = true, -- (Update) ServerIP
-- [0x0D] = true, -- (Update) PC
[0x0E] = true, -- (Update) Entity
-- [0x17] = true, -- (Message) Chat
[0x1B] = true, -- (Character) Jobs
[0x1C] = true, -- (Inventory) Size
[0x1D] = true, -- (Inventory) Finish
[0x1E] = true, -- (Inventory) Modify
[0x1F] = true, -- (Inventory) Assign
[0x20] = true, -- (Inventory) Item
-- [0x21] = true, -- (Trade) Request
-- [0x22] = true, -- (Trade) Action
-- [0x23] = true, -- (Trade) Update
-- [0x25] = true, -- (Trade) Item
-- [0x27] = true, -- (Notify) Caught Fish
[0x28] = true, -- Actions
-- [0x29] = true, -- (Message) Basic
-- [0x2A] = true, -- (Message) Special
-- [0x2C] = true, -- Auction House
-- [0x2D] = true, -- (Message) Debug
-- [0x2E] = true, -- (Menu) Moogle
-- [0x2F] = true, -- Chocobo Digging
[0x30] = true, -- (Sync) Animation
-- [0x34] = true, -- Cutscene
-- [0x36] = true, -- (Message) Text
[0x37] = true, -- (Update) Character
-- [0x38] = true, -- Fade out
[0x39] = true, -- (Unknown39)
-- [0x3C] = true, -- (Menu) Shop Items
-- [0x3D] = true, -- (Menu) Shop Appraisal
-- [0x3E] = true, -- (Menu) Shop
-- [0x3F] = true, -- (Menu) Shop Buy
[0x41] = true, -- Stop Downloading
[0x44] = true, -- (Update) Automaton/Set BLU Spells
-- [0x4B] = true, -- Delivery Box
-- [0x4D] = true, -- (Message) Server
[0x4F] = true, -- Downloading Data
[0x50] = true, -- (Update) Equipment
[0x51] = true, -- (Character) Appearance
-- [0x52] = true, -- Release
-- [0x53] = true, -- (Message) System
[0x55] = true, -- (Update) Key Items
[0x56] = true, -- Quest/Mission Log
[0x57] = true, -- (Update) Weather
[0x58] = true, -- Lock-on Target
-- [0x59] = true, -- World Pass
[0x5A] = true, -- Emote
[0x5B] = true, -- (Sync) Position
-- [0x5C] = true, -- (Update) Event
-- [0x5E] = true, -- (Update) Conquest
-- [0x5F] = true, -- Chocobo Music
[0x61] = true, -- (Character) Stats
[0x62] = true, -- (Update) Skills
-- [0x63] = true, -- (Menu) Merits
[0x65] = true, -- (Unknown65)
[0x67] = true, -- (Sync) Level/Pet
-- [0x6F] = true, -- (Message) Synth
-- [0x71] = true, -- (Update) Campaign
-- [0x81] = true, -- (Update) Fishing
-- [0x83] = true, -- (Menu) Guild Buy
-- [0x85] = true, -- (Menu) Guild Sell
-- [0x86] = true, -- (Menu) Guild
-- [0x8C] = true, -- (Merits) Points Categories
[0xA0] = true, -- (Party) Map
[0xAA] = true, -- (Character) Spells
[0xAB] = true, -- (UnknownAB)
[0xAC] = true, -- (Character) Abilities
[0xAD] = true, -- (UnknownAD)
-- [0xB4] = true, -- (Menu) Config
-- [0xC8] = true, -- (Party) Define
[0xC9] = true, -- (Notify) Check Command
-- [0xCA] = true, -- (Bazaar) Message
-- [0xCC] = true, -- (Linkshell) Message
[0xDC] = true, -- (Party) Invitation
[0xD2] = true, -- (Item) Found Treasure
[0xD3] = true, -- (Item) Lot Treasure
[0xDD] = true, -- (Update) Party Member
[0xDF] = true, -- (Update) Health
-- [0xE0] = true, -- (Linkshell) Equip
[0xE1] = true, -- (Party) Search
[0xE2] = true, -- (UnknownE2)
-- [0xF4] = true, -- (Wide Scan)
-- [0xF5] = true, -- (Wide Scan) Tracking
-- [0xF6] = true, -- (Wide Scan) Status
-- [0xF9] = true, -- (Menu) Raise/Tractor
};
---------------------------------------------------------------------------------------------------
-- DO NOT EDIT BELOW THIS LINE!
---------------------------------------------------------------------------------------------------
--[[ Packet Enumeration Definitions ]]--
local PacketEnums =
{
["Revival_Type"] = { "TYPE_HOMEPOINT", "TYPE_RAISE", "TYPE_TRACTOR" },
["Widescan_Status"] = { "WIDESCAN_BEGIN", "WIDESCAN_END" }
};
--[[ Client Packet Identifiers ]]--
local ClientIdentifier =
{
[0x0A] = { Type = "(Update) Session Key" },
[0x0C] = { Type = "(Request) PC" },
[0x0D] = { Type = "(Update) Leave Area" },
[0x0F] = { Type = "(Request) Quests/Missions/Items/Key Items" },
[0x11] = { Type = "(Sync) Zoning" },
[0x15] = { Type = "(Notify) Position" },
[0x16] = { Type = "(Event) NPC Info" },
[0x17] = { Type = "(Notify) Wrong NPC" },
[0x1A] = { Type = "Actions" },
[0x1B] = { Type = "(World Pass) Purchasing" },
[0x1C] = { Type = "(Unknown) Pet Ability" },
[0x28] = { Type = "(Storage) Item Removal" },
[0x29] = { Type = "(Storage) Item Moving" },
[0x32] = { Type = "(Trade)" },
[0x33] = { Type = "(Trade)" },
[0x34] = { Type = "(Trade) Item Move" },
[0x5A] = { Type = "(Update) World Map" },
[0x5B] = { Type = "(Update) Current Event" },
[0x5C] = { Type = "(Update) Event Position" },
[0x5D] = { Type = "Job Emote" },
[0x5E] = { Type = "(Notify) Zone Line" },
[0x60] = { Type = "(Notify) Info To Complete Event" },
[0x61] = { Type = "(Request) Update" },
[0x63] = { Type = "(Request) Chocobo Digging" },
[0x64] = { Type = "(Notify) Key Item Check" },
[0x66] = { Type = "(Request) Fishing End" },
[0xDB] = { Type = "Search Language" },
[0xDD] = { Type = "(Request) Check Command" },
[0xDE] = { Type = "Bazaar Message" },
[0xE0] = { Type = "Search Comment" },
[0xE1] = { Type = "(Request) Linkshell Welcome" },
[0xE2] = { Type = "(Update) Linkshell Welcome" },
[0xE7] = { Type = "(Request) Shutdown/Logout" },
[0xE8] = { Type = "Resting" },
[0xEA] = { Type = "(Command) Sit" },
[0xF1] = { Type = "(Request) Remove Status Effect" },
[0xF2] = { Type = "(Notify) Blocked Route" },
[0xF4] = { Type = "(Request) Wide Scan" },
[0xF5] = { Type = "(Request) Wide Scan Target Select" },
[0xFA] = { Type = "(Mog House) Place Furniture" },
[0xFB] = { Type = "(Mog House) Remove Furniture" },
[0x100] = { Type = "(Request) Change Job" },
[0x102] = { Type = "(Set) Blue Mage Spells" },
[0x104] = { Type = "(Bazaar) Leave" },
[0x105] = { Type = "(Bazaar) View" },
[0x106] = { Type = "(Bazaar) Purchase" },
[0x109] = { Type = "(Bazaar) Exit Price Setting" },
[0x10A] = { Type = "(Bazaar) Set Prices" },
[0x10B] = { Type = "(Bazaar) Open Set Prices/Close Bazaar" }
};
--[[ Server Packet Identifiers ]]--
local ServerIdentifier =
{
[0x05] = { Type = "(Bazaar) Item" },
[0x06] = { Type = "(Bazaar) Purchase" },
[0x07] = { Type = "(Bazaar) Close" },
[0x08] = { Type = "(Bazaar) Check" },
[0x09] = { Type = "(Bazaar) Confirmation/Standard Message" },
[0x0A] = { Type = "(Update) Zoning",
Size = 51, oArray = {
{ "0x04", "I", "PlayerID" },
{ "0x08", "H", "TargID" },
{ "0x0B", "b", "Rotation" },
{ "0x0C", "f", "XCoord" },
{ "0x10", "f", "YCoord" },
{ "0x14", "f", "ZCoord" },
{ "0x1C", "b", "MoveSpeed" },
{ "0x1D", "b", "SpeedSub" },
{ "0x1E", "b", "HP%" },
{ "0x1F", "b", "Anim" },
{ "0x30", "b", "Zone(To)" },
{ "0x38", "I", "SysTime" },
{ "0x3C", "I", "VanaTime" },
{ "0x40", "b", "Zone(CS)" },
{ "0x42", "b", "Zone(To)" },
{ "0x44", "b", "FaceID" },
{ "0x45", "b", "RaceID" },
{ "0x46", "H", "HeadID" },
{ "0x48", "H", "BodyID" },
{ "0x4A", "H", "HandsID" },
{ "0x4C", "H", "LegsID" },
{ "0x4E", "H", "FeetID" },
{ "0x50", "H", "MainID" },
{ "0x52", "H", "SubID" },
{ "0x54", "H", "RangedID" },
{ "0x56", "b", "BackgroundMusic1" },
{ "0x58", "b", "BackgroundMusic2" },
{ "0x5A", "b", "BattleMusic(Solo)" },
{ "0x5C", "b", "BattleMusic(Party)" },
{ "0x60", "H", "Boundary" },
{ "0x62", "b", "Zone(CS)" },
{ "0x64", "H", "CSID" },
{ "0x68", "H", "Weather" },
{ "0x6A", "I", "WeatherChangeTime" },
{ "0x84", "A12", "PlayerName" },
{ "0xA0", "I", "PlayTime" },
{ "0xA4", "I", "DeathTimer" },
{ "0xAA", "H", "MogHouseID" },
{ "0xAC", "b", "Pause(CS)" },
{ "0xAE", "b", "LeaveMogHouseID" },
{ "0xAF", "b", "CanUseMogMenu" },
{ "0xCC", "H", "StatStr" },
{ "0xCE", "H", "StatDex" },
{ "0xD0", "H", "StatVit" },
{ "0xD2", "H", "StatAgi" },
{ "0xD4", "H", "StatInt" },
{ "0xD6", "H", "StatMnd" },
{ "0xD8", "H", "StatChr" },
{ "0xE8", "I", "MaxHP" },
{ "0xEB", "I", "MaxMP" },
{ "0x100", "b", "bUnk" } } },
[0x0B] = { Type = "(Update) ServerIP",
Size = 3, oArray = {
{ "0x04", "b", "Type" },
{ "0x08", "I", "IP" },
{ "0x0C", "H", "Port" } } },
[0x0D] = { Type = "(Update) PC",
Size = 34, oArray = {
{ "0x04", "I", "PlayerID" },
{ "0x08", "H", "TargID" },
{ "0x0A", "b", "pUnk" },
{ "0x0B", "b", "Rotation" },
{ "0x0C", "f", "XCoord" },
{ "0x10", "f", "YCoord" },
{ "0x14", "f", "ZCoord" },
{ "0x18", "H", "Moving" },
{ "0x1A", "H", "TargID2" },
{ "0x1C", "b", "MoveSpeed" },
{ "0x1D", "b", "SpeedSub" },
{ "0x1E", "b", "HP%" },
{ "0x1F", "b", "Anim" },
{ "0x20", "I", "NameFlags" },
{ "0x21", "b", "UnkFlags" },
{ "0x23", "b", "InvisFlag" },
{ "0x24", "b", "LSColorR" },
{ "0x25", "b", "LSColorG" },
{ "0x26", "b", "LSColorB" },
{ "0x27", "b", "PvPFlag" },
{ "0x30", "H", "CostumeID" },
{ "0x34", "I", "ChocoboColor?" },
{ "0x3C", "H", "PetTargID" },
{ "0x44", "b", "FaceID" },
{ "0x45", "b", "RaceID" },
{ "0x46", "H", "HeadID" },
{ "0x48", "H", "BodyID" },
{ "0x4A", "H", "HandsID" },
{ "0x4C", "H", "LegsID" },
{ "0x4E", "H", "FeetID" },
{ "0x50", "H", "MainID" },
{ "0x52", "H", "SubID" },
{ "0x54", "H", "RangedID" },
{ "0x56", "A12", "PlayerName" } } },
[0x0E] = { Type = "(Update) Entity" ,
Size = 18, oArray = {
{ "0x04", "I", "id" },
{ "0x08", "H", "targid" },
{ "0x0C", "f", "xpos" },
{ "0x10", "f", "ypos" },
{ "0x14", "f", "zpos" },
{ "0x0B", "b", "rotation" },
{ "0x0A", "b", "sizetype" },
{ "0x18", "H", "moving" },
{ "0x1C", "b", "speed" },
{ "0x1D", "b", "speedsub" },
{ "0x1F", "b", "animation" },
{ "0x20", "I", "status" },
{ "0x21", "b", "unk" },
{ "0x27", "b", "nameprefix" },
{ "0x29", "H", "unk3" },
{ "0x2A", "I", "animationsub" },
{ "0x2B", "H", "namevis" },
{ "0x34", "A12", "size" } ,
{ "0x30", "A12", "specialname" } } },
[0x17] = { Type = "(Message) Chat",
Size = 3, oArray = {
{ "0x04", "b", "MessageType" },
{ "0x05", "b", "Flags" },
{ "0x06", "b", "ZoneID" } } },
[0x1B] = { Type = "(Character) Jobs",
Size = 8, oArray = {
{ "0x04", "b", "RaceID" },
{ "0x08", "b", "MainJobID" },
{ "0x0B", "b", "SubJobID" },
--[[ { "0x0C", "20", "Jobs" },
{ "0x20", "14", "Stats" }, ]]--
{ "0x3C", "I", "HP" },
{ "0x40", "I", "MP" },
{ "0x44", "I", "JobsUnlocked" },
{ "0x60", "H", "EquipBlock" } } },
[0x1C] = { Type = "(Inventory) Size" },
[0x1D] = { Type = "(Inventory) Finish" },
[0x1E] = { Type = "(Inventory) Modify" },
[0x1F] = { Type = "(Inventory) Assign" },
[0x20] = { Type = "(Inventory) Item" },
[0x21] = { Type = "(Trade) Request" },
[0x22] = { Type = "(Trade) Action" },
[0x23] = { Type = "(Trade) Update" },
[0x25] = { Type = "(Trade) Item" },
[0x27] = { Type = "(Notify) Caught Fish" },
[0x28] = { Type = "Actions" },
[0x29] = { Type = "(Message) Basic" },
[0x2A] = { Type = "(Message) Special" },
[0x2C] = { Type = "Auction House" },
[0x2D] = { Type = "(Message) Debug" },
[0x2E] = { Type = "(Menu) Moogle" },
[0x2F] = { Type = "Chocobo Digging" },
[0x30] = { Type = "(Sync) Animation" },
[0x32] = { Type = "Eventcs",
Size = 2, oArray = {
{ "0x08", "H", "npc" },
{ "0x0D", "H", "csnumber" }}},
[0x34] = { Type = "Cutscene",
Size = 11, oArray = {
{ "0x08", "H", "npc" },
{ "0x2C", "H", "csnumber" },
{ "0x0C", "H", "P1" },
{ "0x10", "H", "P2" },
{ "0x14", "H", "P3" },
{ "0x18", "H", "P4" },
{ "0x1C", "H", "P5" },
{ "0x20", "H", "P6" },
{ "0x24", "H", "P7" },
{ "0x28", "H", "P8" },
{ "0x2A", "H", "zone" }}},
[0x36] = { Type = "(Message) Text",
Size = 3, oArray = {
{ "0x04", "I", "SpeakerID" },
{ "0x08", "H", "TargID" },
{ "0x0A", "H", "MessageID" } } },
[0x37] = { Type = "(Update) Character",
Size = 22, oArray = {
--[[{ "0x04", "b12", "StatusIcons" }, ]]--
{ "0x24", "I", "PlayerID" },
{ "0x28", "b", "NameFlags" },
{ "0x29", "b", "Gender" },
{ "0x2A", "b", "HP%" },
{ "0x2B", "b", "NameFlags2" },
{ "0x2C", "b", "MoveSpeed" },
{ "0x2D", "b", "InvisFlag" },
{ "0x2E", "b", "bUnk" },
{ "0x2F", "b", "NameFlags3" },
{ "0x30", "b", "Animation" },
{ "0x31", "b", "LSColorR" },
{ "0x32", "b", "LSColorG" },
{ "0x33", "b", "LSColorB" },
{ "0x34", "H", "PetTargID" },
{ "0x36", "b", "BallistaFlag" },
{ "0x38", "b", "SneakFlag" },
{ "0x3C", "I", "DeathTimer" },
{ "0x40", "I", "VanaTime" },
{ "0x44", "H", "CostumeID" },
{ "0x4A", "b", "FishingAnim" },
{ "0x4C", "I", "EffectFlags1" },
{ "0x50", "I", "EffectFlags2" } } },
[0x38] = { Type = "Fade out" },
[0x39] = { Type = "(Unknown39)" },
[0x3C] = { Type = "(Menu) Shop Items" },
[0x3D] = { Type = "(Menu) Shop Appraisal" },
[0x3E] = { Type = "(Menu) Shop" },
[0x3F] = { Type = "(Menu) Shop Buy" },
[0x41] = { Type = "Stop Downloading" },
[0x44] = { Type = "(Update) Automaton/Set BLU Spells" },
[0x4B] = { Type = "Delivery Box" },
[0x4D] = { Type = "(Message) Server" },
[0x4F] = { Type = "Downloading Data" },
[0x50] = { Type = "(Update) Equipment" },
[0x51] = { Type = "(Character) Appearance" },
[0x52] = { Type = "Release" },
[0x53] = { Type = "(Message) System" },
[0x55] = { Type = "(Update) Key Items" },
[0x56] = { Type = "Quest/Mission Log" },
[0x57] = { Type = "(Update) Weather" },
[0x58] = { Type = "Lock-on Target" },
[0x59] = { Type = "World Pass" },
[0x5A] = { Type = "Emote" },
[0x5B] = { Type = "(Sync) Position" },
[0x5C] = { Type = "(Update) Event" },
[0x5E] = { Type = "(Update) Conquest" },
[0x5F] = { Type = "Chocobo Music" },
[0x61] = { Type = "(Character) Stats" },
[0x62] = { Type = "(Update) Skills" },
[0x63] = { Type = "(Menu) Merits" },
[0x65] = { Type = "(Unknown65)" },
[0x67] = { Type = "(Sync) Level/Pet" },
[0x6F] = { Type = "(Message) Synth" },
[0x71] = { Type = "(Update) Campaign" },
[0x81] = { Type = "(Update) Fishing" },
[0x83] = { Type = "(Menu) Guild Buy" },
[0x85] = { Type = "(Menu) Guild Sell" },
[0x86] = { Type = "(Menu) Guild" },
[0x8C] = { Type = "(Merits) Points Categories" },
[0xA0] = { Type = "(Party) Map" },
[0xAA] = { Type = "(Character) Spells" },
[0xAB] = { Type = "(UnknownAB)" },
[0xAC] = { Type = "(Character) Abilities" },
[0xAD] = { Type = "(UnknownAD)" },
[0xB4] = { Type = "(Menu) Config" },
[0xC8] = { Type = "(Party) Define" },
[0xC9] = { Type = "(Notify) Check Command" },
[0xCA] = { Type = "(Bazaar) Message" },
[0xCC] = { Type = "(Linkshell) Message" },
[0xDC] = { Type = "(Party) Invitation" },
[0xD2] = { Type = "(Item) Found Treasure" },
[0xD3] = { Type = "(Item) Lot Treasure" },
[0xDD] = { Type = "(Update) Party Member",
Size = 11, oArray = {
{ "0x04", "I", "PlayerID" },
{ "0x08", "I", "HP" },
{ "0x0C", "I", "MP" },
{ "0x10", "H", "TP" },
{ "0x14", "H", "PartyFlags" },
{ "0x18", "H", "TargID" },
{ "0x1A", "b", "PartySize" },
{ "0x1D", "b", "HP%" },
{ "0x1E", "b", "MP%" },
{ "0x1F", "b", "Zone" },
{ "0x22", "A12", "Name" } } },
[0xDF] = { Type = "(Update) Health",
Size = 7, oArray = {
{ "0x04", "I", "ID" },
{ "0x08", "I", "HP" },
{ "0x0C", "I", "MP" },
{ "0x10", "I", "TP" },
{ "0x14", "H", "TargID" },
{ "0x16", "b", "HP%" },
{ "0x17", "b", "MP%" } } },
[0xE0] = { Type = "(Linkshell) Equip",
Size = 1, oArray = {
{ "0x04", "b", "LinkshellID" } } },
[0xE1] = { Type = "(Party) Search",
Size = 1, oArray = {
{ "0x04", "I", "PartyID" } } },
[0xE2] = { Type = "(UnknownE2)" },
[0xF4] = { Type = "(Wide Scan)" },
[0xF5] = { Type = "(Wide Scan) Tracking",
Size = 6, oArray = {
{ "0x04", "f", "XCoord" },
{ "0x08", "f", "YCoord" },
{ "0x0C", "f", "ZCoord" },
{ "0x10", "I", "Unk" },
{ "0x12", "H", "TargID" },
{ "0x14", "b", "Status" } } },
[0xF6] = { Type = "(Wide Scan) Status",
Size = 1, oArray = {
{ "0x04", "b", "Status" } } },
[0xF9] = { Type = "(Menu) Raise/Tractor",
Size = 3, oArray = {
{ "0x04", "I", "ID" },
{ "0x08", "H", "TargID" },
{ "0x0A", "b", "Type" } } }
};
---------------------------------------------------------------------------------------------------
-- func : hexdump
-- desc : Formats a string into hex and ascii format, blocksize is the length of lines.
---------------------------------------------------------------------------------------------------
local function hexdump(str, blocksize, packetId)
local ret = " 0 1 2 3 4 5 6 7 8 9 A B C D E F\n";
ret = ret.. " -----------------------------------------------\n";
for x = 0, string.len(str), blocksize do
bytes = string.sub(str, x+1, x + blocksize);
ret=ret.. " ";
ret=ret.. string.gsub(bytes,"(.)",function (x) return string.format("%02X ",string.byte(x)) end);
ret=ret.. string.rep(" ", blocksize - string.len(bytes) + 1);
ret=ret.. string.gsub(bytes, "%c", ".");
ret=ret.."\n";
end
ret = string.gsub(ret,"%%","%%%%");
return ret;
end
---------------------------------------------------------------------------------------------------
-- func : offsetdump
-- desc : Converts packet offsets from table definitions into easily readable values.
---------------------------------------------------------------------------------------------------
local function offsetdump(packet, identifier)
local ret = " ";
for i = 1, identifier.Size, 1 do
-- Get the Offset values from our Offset Array.
local offsets = identifier.oArray[i];
-- Locate the offset of the specific type with bunpack.
local offset, data = pack.unpack(packet, offsets[2], offsets[1]+1);
-- This should not happen.
if(data == nil) then
print(string.format("No data found at offset %s (%s)", offsets[1], identifier.Type));
else
-- Format identifier names and data into one string.
ret=ret.. string.format("%s: %s ", offsets[3], data);
end
if((i % 5) == 0) then
ret=ret.. "\n ";
end
end
ret = ret.. "\n\n";
return ret;
end
---------------------------------------------------------------------------------------------------
-- func: incoming_packet
-- desc: Called when our addon receives an incoming packet.
---------------------------------------------------------------------------------------------------
ashita.register_event('incoming_packet', function(id, size, packet)
-- Check if this packet is being ignored..
if (ServerIgnore[id] == true) then
return false;
end
-- Prepare the local variables..
local s = '';
local i = ServerIdentifier[id];
-- Open the output file..
local f = io.open(AshitaCore:GetInstallPath() .. '\\Packets[Incoming].txt', 'a+');
-- Create the output format..
if (i ~= nil) then
s = s .. string.format('[%s] 0x%02X, %d Bytes - %s\n', os.date('%I:%M:%S'), id, size, i.Type);
else
s = s .. string.format('[%s] 0x%02X, %d Bytes - (Unknown)\n', os.date('%I:%M:%S'), id, size);
end
-- Dump the packet data..
s = s .. hexdump(packet, 16, id);
s = s .. '\n';
-- Dump the packet info..
if (i ~= nil and i.Size ~= nil) then
s = s .. offsetdump(packet, i);
end
s = s .. '\n';
f:write(s);
f:flush();
f:close();
return false;
end );
---------------------------------------------------------------------------------------------------
-- func: outgoing_packet
-- desc: Called when our addon receives an outgoing packet.
---------------------------------------------------------------------------------------------------
ashita.register_event('outgoing_packet', function(id, size, packet)
-- Check if this packet is being ignored..
if (ClientIgnore[id] == true) then
return false;
end
-- Prepare the local variables..
local s = '';
local i = ClientIdentifier[id];
-- Open the output file..
local f = io.open(AshitaCore:GetInstallPath() .. '\\Packets[Outgoing].txt', 'a+');
-- Create the output format..
if (i ~= nil) then
s = s .. string.format('[%s] 0x%02X, %d Bytes - %s\n', os.date('%I:%M:%S'), id, size, i.Type);
else
s = s .. string.format('[%s] 0x%02X, %d Bytes - (Unknown)\n', os.date('%I:%M:%S'), id, size);
end
-- Dump the packet data..
s = s .. hexdump(packet, 16, id);
s = s .. '\n';
-- Dump the packet info..
if (i ~= nil and i.Size ~= nil) then
s = s .. offsetdump(packet, i);
end
s = s .. '\n';
f:write(s);
f:flush();
f:close();
return false;
end );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment