eternalUnion / AngryLevelLoader

MIT License
8 stars 2 forks source link

Load angry levels with AbruptLevelChanger #13

Closed Hydraxous closed 5 months ago

Hydraxous commented 5 months ago

Allows AbruptLevelChanger to load angry levels by id.

Also im not sure why the FinalRank file looks like the whole file was replaced, it might be formatting or something im not sure. The patch for FinalRank.ChangeLevel was the only thing actually changed in that file.

eternalUnion commented 5 months ago

There also seems to be an ancient method called GetLevel in Plugin.cs which I rarely used

public static LevelContainer GetLevel(string id)
{
    foreach (AngryBundleContainer container in angryBundles.Values)
    {
        foreach (LevelContainer level in container.levels.Values)
        {
            if (level.field.data.uniqueIdentifier == id)
                return level;
        }
    }

    return null;
}

yeah no idea why I did not make that sort of method

Hydraxous commented 5 months ago

ooooh I didnt even see that

eternalUnion commented 5 months ago

epic fail

public static bool TryFindLevel(string id, out LevelContainer level)
{
    level = null;

    foreach (AngryBundleContainer container in Plugin.angryBundles.Values)
    {
        foreach (LevelContainer levelContainer in container.levels.Values)
        {
            if (level.data.uniqueIdentifier == id) // not level, levelContainer
            {
                level = levelContainer;
                return true;
            }
        }
    }

    return false;
}
Hydraxous commented 5 months ago

I'm sorry.