Last active
May 21, 2020 02:57
-
-
Save Ivaar/22947dbe3bd7f7b8f6a6a70c12884cf3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_addon.command = 'chocolor' | |
bit = require('bit') | |
local colors = { | |
yellow = 0, | |
black = 1, | |
blue = 2, | |
red = 3, | |
green = 4 | |
} | |
local appearance = { | |
head = 0x01, | |
feet = 0x08, | |
tail = 0x40 | |
} | |
local rented = 0x20 | |
local raised = 0x40 | |
local color = bit.lshift(colors.black ,1) | |
local look = bit.bor(appearance.head,appearance.feet,appearance.tail) | |
windower.register_event('incoming chunk', function(id,data) | |
if id == 0x0A and data:byte(32) == 0x05 and data:byte(33) == rented then | |
return data:sub(1,32)..string.char(raised)..data:sub(34) | |
elseif id == 0x37 and data:byte(49) == 0x05 and bit.band(data:byte(42),rented) == rented then | |
return data:sub(1,41)..string.char(bit.bor(bit.band(data:byte(42),0x9F),raised))..data:sub(43) | |
elseif id == 0x67 and data:byte(5) == 0x02 then--and data:byte(20) == raised then | |
return data:sub(1,24)..string.char(look, bit.bor(color, bit.band(data:byte(26),0xF0)))..data:sub(27) | |
--elseif id == 0x0D and data:byte(32) == 0x05 then | |
-- return data:sub(1,32)..string.char(0x40)..data:sub(34,52)..string.char(look, bit.bor(color, bit.band(data:byte(54),0xF0)))..data:sub(55) | |
end | |
end) | |
windower.register_event('addon command', function(...) | |
local commands = {...} | |
local value = 0 | |
for x = 1, #commands do | |
local v = commands[x]:lower() | |
if colors[v] then | |
color = bit.lshift(colors[v] ,1) | |
elseif appearance[v] then | |
value = bit.bor(value, appearance[v]) | |
end | |
end | |
look = value | |
end) | |
--[[ | |
windower.register_event('incoming chunk', function(id,data) | |
if id == 0x037 or id == 0x00A then | |
local packet = packets.parse('incoming', data) | |
if packet.Status == 0x05 and packet['Mount Type'] == rented then | |
packet['Mount Type'] = raised | |
return packets.build(packet) | |
end | |
elseif id == 0x0D and data:byte(32) == 0x05 or id == 0x67 and data:byte(5) == 0x02 then | |
local packet = packets.parse('incoming', data) | |
if packet['Mount Type'] ~= 0 then | |
packet['Mount Type'] = raised | |
packet['Chocobo Color'] = look.color | |
packet['Chocobo Special Head'] = look.head | |
packet['Chocobo Special Tail'] = look.tail | |
packet['Chocobo Special Feet'] = look.feet | |
return packets.build(packet) | |
end | |
end | |
end) | |
]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment