Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FI Sky Palace Stage Tracking #144

Open
AardWolf opened this issue Aug 13, 2021 · 3 comments
Open

FI Sky Palace Stage Tracking #144

AardWolf opened this issue Aug 13, 2021 · 3 comments

Comments

@AardWolf
Copy link
Contributor

https://github.com/mh-community-tools/mh-helper-extension/blob/864d682a78e6ca44ed54375c4d4d1fd29c9bdaf4/src/scripts/main.js#L1907

Sky palace expansion has new fancy mice that come to play when there are 3 of the same tile active. They come to play more often when there are 4. We should count the same-named active tiles and if one of them is 3 or 4 add a stage decoration indicating which type is x3/x4.

@AardWolf
Copy link
Contributor Author

user.enviroment_atts.hunting_site_atts.activated_island_mod_types has the code names. user.enviroment_atts.hunting_site_atts.island_mod_panels can translate the code names to decorative names by matching type to code name, and using name for the string.

Something like (pseudocode):

types = {}
activated_types.foreach -> types{type}++
type = types.filter(types[t] > 3) // there will be only one but we can make sure
count = types[type]
name = island_mod_panels.filter(mp.type = type).name
message.stage += ` x${count} $name`

Something like that - get the type that has 3+ active panels, turn that type name into a string, append the count and name to the stage

@AardWolf
Copy link
Contributor Author

We're testing this, setting env_attrs to the hunting_site_attributes:

if (env_attrs.is_vault_island 
    && 'activated_island_mod_types' in env_attrs 
    && Array.isArray(env_attrs.activated_island_mod_types)) {
    const panels = {};
    env_attrs.activated_island_mod_types.forEach(t => t in panels ? panels[t]++ : panels[t] = 1);
    let counter = 0;
    let mod_type = '';
    for (const [type, num] of Object.entries(panels)) {
        if (num >= 3) {
            counter = num;
            mod_type = env_attrs.island_mod_panels.filter(p => p.type === type)[0].name;
        }
    }
    if (counter && mod_type)
        console.log(`New Stage: ${env_attrs.island_name} ${counter}x ${mod_type}`);
    else 
        console.log(`Didn't set counter (${counter}) or mod_type. Vault: ${env_attrs.is_vault_island}`);
}

@AardWolf
Copy link
Contributor Author

Addressed in sky_palace branch and several merges. Some database cleanup has happened.

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

No branches or pull requests

1 participant