Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 61 additions & 61 deletions addons/libs/extdata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1972,88 +1972,88 @@ end

function decode.AssaultLog(itemid, str)
local missions = T{
[2491] = T{
[2491] = {
-- "Leujaoam Log"
[1] = "Leujaom Cleansing",
[2] = "Orichalcum Survey",
[3] = "Escort Professor Chanoix",
[4] = "Shanarha Grass Conservation",
[5] = "Counting Sheep",
[6] = "Supplies Recovery",
[7] = "Azure Experiments",
[8] = "Imperial Code",
[9] = "Red Versus Blue",
[10] = "Bloody Rhondo"

[1] = {name="Leujaom Cleansing"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would change this back to being raw strings, and assemble the name attribute later. Also, please move the missions table outside of the function and close over it, like this:

do
    local missions = {
        [2491] = { name = 'Leujaoam',
            [1] = 'Leujaoam Cleansing', -- also fix Leujaoam in this name please
            [2] = 'Orichalcum Survey',
            ...
        },
    }

    function decode.AssaultLog(item_id, str)
        -- use the `missions` variable here
    end
end

[2] = {name="Orichalcum Survey"},
[3] = {name="Escort Professor Chanoix"},
[4] = {name="Shanarha Grass Conservation"},
[5] = {name="Counting Sheep"},
[6] = {name="Supplies Recovery"},
[7] = {name="Azure Experiments"},
[8] = {name="Imperial Code"},
[9] = {name="Red Versus Blue"},
[10] = {name="Bloody Rhondo"},
},
[2492] = T{
[2492] = {
-- "Mamool Ja Journal"
[1] = "Imperial Agent Rescue",
[2] = "Preemptive Strike",
[3] = "Sagelord Elimination",
[4] = "Breaking Morale",
[5] = "The Double Agent",
[6] = "Imperial Treasure Retrieval",
[7] = "Blitzkrieg",
[8] = "Marids in the Mist",
[9] = "Azure Ailments",
[10] = "The Susanoo Shuffle"
[1] = {name="Imperial Agent Rescue"},
[2] = {name="Preemptive Strike"},
[3] = {name="Sagelord Elimination"},
[4] = {name="Breaking Morale"},
[5] = {name="The Double Agent"},
[6] = {name="Imperial Treasure Retrieval"},
[7] = {name="Blitzkrieg"},
[8] = {name="Marids in the Mist"},
[9] = {name="Azure Ailments"},
[10] = {name="The Susanoo Shuffle"},
},

[2493] = T{
[2493] = {
-- "Lebros Chronicle"
[1] = "Excavation Duty",
[2] = "Lebros Supplies",
[3] = "Troll Fugitives",
[4] = "Evade and Escape",
[5] = "Siegemaster Assassination",
[6] = "Apkallu Breeding",
[7] = "Wamoura Farm Raid",
[8] = "Egg Conservation",
[9] = "Operation: Black Pearl",
[10] = "Better than One",
[1] = {name="Excavation Duty"},
[2] = {name="Lebros Supplies"},
[3] = {name="Troll Fugitives"},
[4] = {name="Evade and Escape"},
[5] = {name="Siegemaster Assassination"},
[6] = {name="Apkallu Breeding"},
[7] = {name="Wamoura Farm Raid"},
[8] = {name="Egg Conservation"},
[9] = {name="Operation: Black Pearl"},
[10] = {name="Better than One"},
},
[2494] = T{
[2494] = {
-- "Periqia Diary"
[1] = "Seagull Grounded",
[2] = "Requiem",
[3] = "Saving Private Ryaaf",
[4] = "Shooting Down the Baron",
[5] = "Building Bridges",
[6] = "Stop the Bloodshed",
[7] = "Defuse the Threat",
[8] = "Operation: Snake Eyes",
[9] = "Wake the Puppet",
[10] = "The Price Is Right",
[1] = {name="Seagull Grounded"},
[2] = {name="Requiem"},
[3] = {name="Saving Private Ryaaf"},
[4] = {name="Shooting Down the Baron"},
[5] = {name="Building Bridges"},
[6] = {name="Stop the Bloodshed"},
[7] = {name="Defuse the Threat"},
[8] = {name="Operation: Snake Eyes"},
[9] = {name="Wake the Puppet"},
[10] = {name="The Price Is Right"},
},
[2495] = T{
[2495] = {
-- "Ilrusi Ledger"
[1] = "Golden Salvage",
[2] = "Lamia No.13",
[3] = "Extermination",
[4] = "Demolition Duty",
[5] = "Searat Salvation",
[6] = "Apkallu Seizure",
[7] = "Lost and Found",
[8] = "Deserter",
[9] = "Desperately Seeking Cephalopods",
[10] = "Bellerophon's Bliss",
[1] = {name="Golden Salvage"},
[2] = {name="Lamia No.13"},
[3] = {name="Extermination"},
[4] = {name="Demolition Duty"},
[5] = {name="Searat Salvation"},
[6] = {name="Apkallu Seizure"},
[7] = {name="Lost and Found"},
[8] = {name="Deserter"},
[9] = {name="Desperately Seeking Cephalopods"},
[10] = {name="Bellerophon's Bliss"},
},
}

local names = missions[itemid]
local flags = {str:unpack("<q10")}
local data = T{flags}:key_map(function(id) return names[id] end)
local flags = T{str:unpack("<q10")}
for key, val in ipairs(flags) do
names[key].completed = val
end

local rettab = {
type='Assault Log',
completed = S{data},
completed = names,
flags = flags,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too happy with the structure of the result table. I would return something like this:

return {
    type = 'Assault Log',
    area = 'Ilrusi', -- will need to be looked up based on ID
    log = {
        { name = 'Golden Salvage', completed = false },
        ...
    },
}

With my above suggestion, this could be:

return {
    type = 'Assault Log',
    area = missions[item_id].name,
    log = table.range(10):map(function(index)
        return {
            name = missions[item_id][index],
            completed = flags[index],
        }
    end),
}

return rettab
end



function decode.BonanzaMarble(str)
local event_list = {
[0x00] = 'CS Event Race',
Expand Down