Skip to content

Conversation

@Traelblaser
Copy link
Contributor

Tweaks return value of completed as follows:
From: (buggy code)
Screenshot 2025-03-07 at 2 15 14 PM

To: (what was intended)
Screenshot 2025-03-07 at 2 16 06 PM

@Traelblaser
Copy link
Contributor Author

Traelblaser commented Mar 7, 2025

No more nesting of the set inside another set
Screenshot 2025-03-07 at 2 33 43 PM

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),
}

[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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants