-
-
Save Chiaia/544c6eda54bc971cf5bd9d27bf6e04d4 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
function completed_mission_unpack(packet, data) | |
local sandy_mission_3 = data:unpack('C', 0x07) | |
local sandy_mission_2 = data:unpack('C', 0x06) | |
local sandy_mission_1 = data:unpack('C', 0x05) | |
local bastok_mission_3 = data:unpack('C', 0x0F) | |
local bastok_mission_2 = data:unpack('C', 0x0E) | |
local bastok_mission_1 = data:unpack('C', 0x0D) | |
local windy_mission_3 = data:unpack('C', 0x17) | |
local windy_mission_2 = data:unpack('C', 0x16) | |
local windy_mission_1 = data:unpack('C', 0x15) | |
data = data:sub(1, 0x07 - 1) .. ('C':pack(spoof3 or sandy_mission_3)) .. data:sub(0x07 + 1) | |
data = data:sub(1, 0x06 - 1) .. ('C':pack(spoof2 or sandy_mission_2)) .. data:sub(0x06 + 1) | |
data = data:sub(1, 0x05 - 1) .. ('C':pack(spoof1 or sandy_mission_1)) .. data:sub(0x05 + 1) | |
--print(data:sub(0x07, 0x07):unpack('C')) | |
if windy_mission_3 ~= 00 then | |
if windy_mission_3 >= 255 then | |
player_cache.missions['windurst rank'] = 10 | |
player_cache.missions['Completed Windurst Missions'] = 21 | |
elseif windy_mission_3 >= 127 then | |
player_cache.missions['windurst rank'] = 9 | |
player_cache.missions['Completed Windurst Missions'] = 20 | |
elseif windy_mission_3 >= 63 then | |
player_cache.missions['windurst rank'] = 9 | |
player_cache.missions['Completed Windurst Missions'] = 19 | |
elseif windy_mission_3 >= 31 then | |
player_cache.missions['windurst rank'] = 8 | |
player_cache.missions['Completed Windurst Missions'] = 18 | |
elseif windy_mission_3 >= 15 then | |
player_cache.missions['windurst rank'] = 8 | |
player_cache.missions['Completed Windurst Missions'] = 17 | |
elseif windy_mission_3 >= 7 then | |
player_cache.missions['windurst rank'] = 7 | |
player_cache.missions['Completed Windurst Missions'] = 16 | |
elseif windy_mission_3 >= 3 then | |
player_cache.missions['windurst rank'] = 7 | |
player_cache.missions['Completed Windurst Missions'] = 15 | |
elseif windy_mission_3 >= 1 then | |
player_cache.missions['windurst rank'] = 6 | |
player_cache.missions['Completed Windurst Missions'] = 14 | |
else | |
end | |
elseif windy_mission_2 ~= 00 then | |
if windy_mission_2 > 127 then | |
player_cache.missions['Completed Windurst Missions'] = 13 | |
elseif windy_mission_2 >= 63 then | |
player_cache.missions['windurst rank'] = 6 | |
player_cache.missions['Completed Windurst Missions'] = 12 | |
elseif windy_mission_2 >= 31 then | |
player_cache.missions['windurst rank'] = 5 | |
player_cache.missions['Completed Windurst Missions'] = 11 | |
elseif windy_mission_2 >= 15 then | |
player_cache.missions['windurst rank'] = 5 | |
player_cache.missions['Completed Windurst Missions'] = 10 | |
elseif windy_mission_2 >= 7 then | |
player_cache.missions['windurst rank'] = 4 | |
player_cache.missions['Completed Windurst Missions'] = 9 | |
elseif windy_mission_2 >= 3 then | |
player_cache.missions['windurst rank'] = 3 | |
player_cache.missions['Completed Windurst Missions'] = 8 | |
elseif windy_mission_2 >= 1 then | |
player_cache.missions['windurst rank'] = 3 | |
player_cache.missions['Completed Windurst Missions'] = 7 | |
else | |
end | |
elseif windy_mission_1 ~= 00 then | |
if windy_mission_1 >= 127 then | |
player_cache.missions['Completed Windurst Missions'] = 6 | |
elseif windy_mission_1 >= 63 then | |
player_cache.missions['windurst rank'] = 3 | |
player_cache.missions['Completed Windurst Missions'] = 5 | |
elseif windy_mission_1 >= 31 then | |
player_cache.missions['windurst rank'] = 2 | |
player_cache.missions['Completed Windurst Missions'] = 4 | |
elseif windy_mission_1 >= 15 then | |
player_cache.missions['windurst rank'] = 2 | |
player_cache.missions['Completed Windurst Missions'] = 3 | |
elseif windy_mission_1 >= 7 then | |
player_cache.missions['windurst rank'] = 2 | |
player_cache.missions['Completed Windurst Missions'] = 2 | |
elseif windy_mission_1 >= 3 then | |
player_cache.missions['windurst rank'] = 1 | |
player_cache.missions['Completed Windurst Missions'] = 1 | |
elseif windy_mission_1 >= 1 then | |
player_cache.missions['windurst rank'] = 1 | |
player_cache.missions['Completed Windurst Missions'] = 0 | |
else | |
windower.add_to_chat(settings.warning, 'You have got big problems, m8.') | |
end | |
else | |
player_cache.missions['windurst rank'] = 0 | |
end | |
if sandy_mission_3 ~= 00 then | |
if sandy_mission_3 >= 255 then | |
player_cache.missions['san d\'oria rank'] = 10 | |
player_cache.missions['Completed San d\'Oria Missions'] = 21 | |
elseif sandy_mission_3 >= 127 then | |
player_cache.missions['san d\'oria rank'] = 9 | |
player_cache.missions['Completed San d\'Oria Missions'] = 20 | |
elseif sandy_mission_3 >= 63 then | |
player_cache.missions['san d\'oria rank'] = 9 | |
player_cache.missions['Completed San d\'Oria Missions'] = 19 | |
elseif sandy_mission_3 >= 31 then | |
player_cache.missions['san d\'oria rank'] = 8 | |
player_cache.missions['Completed San d\'Oria Missions'] = 18 | |
elseif sandy_mission_3 >= 15 then | |
player_cache.missions['san d\'oria rank'] = 8 | |
player_cache.missions['Completed San d\'Oria Missions'] = 17 | |
elseif sandy_mission_3 >= 7 then | |
player_cache.missions['san d\'oria rank'] = 7 | |
player_cache.missions['Completed San d\'Oria Missions'] = 16 | |
elseif sandy_mission_3 >= 3 then | |
player_cache.missions['san d\'oria rank'] = 7 | |
player_cache.missions['Completed San d\'Oria Missions'] = 15 | |
elseif sandy_mission_3 >= 1 then | |
player_cache.missions['san d\'oria rank'] = 6 | |
player_cache.missions['Completed San d\'Oria Missions'] = 14 | |
else | |
end | |
elseif sandy_mission_2 ~= 00 then | |
if sandy_mission_2 > 127 then | |
player_cache.missions['Completed San d\'Oria Missions'] = 13 | |
elseif sandy_mission_2 >= 63 then | |
player_cache.missions['san d\'oria rank'] = 6 | |
player_cache.missions['Completed San d\'Oria Missions'] = 12 | |
elseif sandy_mission_2 >= 31 then | |
player_cache.missions['san d\'oria rank'] = 5 | |
player_cache.missions['Completed San d\'Oria Missions'] = 11 | |
elseif sandy_mission_2 >= 15 then | |
player_cache.missions['san d\'oria rank'] = 5 | |
player_cache.missions['Completed San d\'Oria Missions'] = 10 | |
elseif sandy_mission_2 >= 7 then | |
player_cache.missions['san d\'oria rank'] = 4 | |
player_cache.missions['Completed San d\'Oria Missions'] = 9 | |
elseif sandy_mission_2 >= 3 then | |
player_cache.missions['san d\'oria rank'] = 3 | |
player_cache.missions['Completed San d\'Oria Missions'] = 8 | |
elseif sandy_mission_2 >= 1 then | |
player_cache.missions['san d\'oria rank'] = 3 | |
player_cache.missions['Completed San d\'Oria Missions'] = 7 | |
else | |
end | |
elseif sandy_mission_1 ~= 00 then | |
if sandy_mission_1 >= 127 then | |
player_cache.missions['Completed San d\'Oria Missions'] = 6 | |
elseif sandy_mission_1 >= 63 then | |
player_cache.missions['san d\'oria rank'] = 3 | |
player_cache.missions['Completed San d\'Oria Missions'] = 5 | |
elseif sandy_mission_1 >= 31 then | |
player_cache.missions['san d\'oria rank'] = 2 | |
player_cache.missions['Completed San d\'Oria Missions'] = 4 | |
elseif sandy_mission_1 >= 15 then | |
player_cache.missions['san d\'oria rank'] = 2 | |
player_cache.missions['Completed San d\'Oria Missions'] = 3 | |
elseif sandy_mission_1 >= 7 then | |
player_cache.missions['san d\'oria rank'] = 2 | |
player_cache.missions['Completed San d\'Oria Missions'] = 2 | |
elseif sandy_mission_1 >= 3 then | |
player_cache.missions['san d\'oria rank'] = 1 | |
player_cache.missions['Completed San d\'Oria Missions'] = 1 | |
elseif sandy_mission_1 >= 1 then | |
player_cache.missions['san d\'oria rank'] = 1 | |
player_cache.missions['Completed San d\'Oria Missions'] = 0 | |
else | |
windower.add_to_chat(settings.warning, 'You have got big problems, m8.') | |
end | |
else | |
player_cache.missions['san d\'oria rank'] = 0 | |
end | |
if bastok_mission_3 ~= 00 then | |
if bastok_mission_3 >= 255 then | |
player_cache.missions['bastok rank'] = 10 | |
player_cache.missions['Completed Bastok Missions'] = 21 | |
elseif bastok_mission_3 >= 127 then | |
player_cache.missions['bastok rank'] = 9 | |
player_cache.missions['Completed Bastok Missions'] = 20 | |
elseif bastok_mission_3 >= 63 then | |
player_cache.missions['bastok rank'] = 9 | |
player_cache.missions['Completed Bastok Missions'] = 19 | |
elseif bastok_mission_3 >= 31 then | |
player_cache.missions['bastok rank'] = 8 | |
player_cache.missions['Completed Bastok Missions'] = 18 | |
elseif bastok_mission_3 >= 15 then | |
player_cache.missions['bastok rank'] = 8 | |
player_cache.missions['Completed Bastok Missions'] = 17 | |
elseif bastok_mission_3 >= 7 then | |
player_cache.missions['bastok rank'] = 7 | |
player_cache.missions['Completed Bastok Missions'] = 16 | |
elseif bastok_mission_3 >= 3 then | |
player_cache.missions['bastok rank'] = 7 | |
player_cache.missions['Completed Bastok Missions'] = 15 | |
elseif bastok_mission_3 >= 1 then | |
player_cache.missions['bastok rank'] = 6 | |
player_cache.missions['Completed Bastok Missions'] = 14 | |
else | |
end | |
elseif bastok_mission_2 ~= 00 then | |
if bastok_mission_2 > 127 then | |
player_cache.missions['Completed Bastok Missions'] = 13 | |
elseif bastok_mission_2 >= 63 then | |
player_cache.missions['bastok rank'] = 6 | |
player_cache.missions['Completed Bastok Missions'] = 12 | |
elseif bastok_mission_2 >= 31 then | |
player_cache.missions['bastok rank'] = 5 | |
player_cache.missions['Completed Bastok Missions'] = 11 | |
elseif bastok_mission_2 >= 15 then | |
player_cache.missions['bastok rank'] = 5 | |
player_cache.missions['Completed Bastok Missions'] = 10 | |
elseif bastok_mission_2 >= 7 then | |
player_cache.missions['bastok rank'] = 4 | |
player_cache.missions['Completed Bastok Missions'] = 9 | |
elseif bastok_mission_2 >= 3 then | |
player_cache.missions['bastok rank'] = 3 | |
player_cache.missions['Completed Bastok Missions'] = 8 | |
elseif bastok_mission_2 >= 1 then | |
player_cache.missions['bastok rank'] = 3 | |
player_cache.missions['Completed Bastok Missions'] = 7 | |
else | |
end | |
elseif bastok_mission_1 ~= 00 then | |
if bastok_mission_1 >= 127 then | |
player_cache.missions['Completed Bastok Missions'] = 6 | |
elseif bastok_mission_1 >= 63 then | |
player_cache.missions['bastok rank'] = 3 | |
player_cache.missions['Completed Bastok Missions'] = 5 | |
elseif bastok_mission_1 >= 31 then | |
player_cache.missions['bastok rank'] = 2 | |
player_cache.missions['Completed Bastok Missions'] = 4 | |
elseif bastok_mission_1 >= 15 then | |
player_cache.missions['bastok rank'] = 2 | |
player_cache.missions['Completed Bastok Missions'] = 3 | |
elseif bastok_mission_1 >= 7 then | |
player_cache.missions['bastok rank'] = 2 | |
player_cache.missions['Completed Bastok Missions'] = 2 | |
elseif bastok_mission_1 >= 3 then | |
player_cache.missions['bastok rank'] = 1 | |
player_cache.missions['Completed Bastok Missions'] = 1 | |
elseif bastok_mission_1 >= 1 then | |
player_cache.missions['bastok rank'] = 1 | |
player_cache.missions['Completed Bastok Missions'] = 0 | |
else | |
windower.add_to_chat(settings.warning, 'You have got big problems, m8.') | |
end | |
else | |
player_cache.missions['bastok rank'] = 0 | |
end | |
return data | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-- The first rank, not mission, of each subsection seems like it's missing a line, I added that.
https://gist.github.com/bracketsage/7c49495b87b315d8139dde555c21859e