private void CheckTeleporter(Split split)
        {
            SplitTeleporter teleporter = Utility.GetEnumValue <SplitTeleporter>(split.Value);

            switch (teleporter)
            {
            case SplitTeleporter.HowlsDenActivated: CheckUberBoolValue(UberStateDefaults.savePedestalHowlsDen); break;

            case SplitTeleporter.HowlsDenTeleported: CheckScene(true, "howlsDenSaveRoom"); break;

            case SplitTeleporter.InkwaterMarshActivated: CheckUberBoolValue(UberStateDefaults.savePedestalInkwaterMarsh); break;

            case SplitTeleporter.InkwaterMarshTeleported: CheckScene(true, "swampIntroTop"); break;

            case SplitTeleporter.KwoloksHollowActivated: CheckUberBoolValue(UberStateDefaults.savePedestalKwoloksHollow); break;

            case SplitTeleporter.KwoloksHollowTeleported: CheckScene(true, "kwoloksCavernSaveRoomA"); break;

            case SplitTeleporter.LumaPoolsAActivated: CheckUberBoolValue(UberStateDefaults.savePedestalLumaPoolsA); break;

            case SplitTeleporter.LumaPoolsATeleported: CheckScene(true, "lumaPoolsSaveRoom"); break;

            case SplitTeleporter.LumaPoolsBActivated: CheckUberBoolValue(UberStateDefaults.savePedestalLumaPoolsB); break;

            case SplitTeleporter.LumaPoolsBTeleported: CheckScene(true, "lumaPoolsSaveRoomB"); break;

            case SplitTeleporter.MidnightBurrowsActivated: CheckUberBoolValue(UberStateDefaults.savePedestalMidnightBurrows); break;

            case SplitTeleporter.MidnightBurrowsTeleported: CheckScene(true, "howlsOriginA"); break;

            case SplitTeleporter.MouldwoodDepthsActivated: CheckUberBoolValue(UberStateDefaults.savePedestalMouldwood); break;

            case SplitTeleporter.MouldwoodDepthsTeleported: CheckScene(true, "mouldwoodDepthsF"); break;

            case SplitTeleporter.SilentWoodsAActivated: CheckUberBoolValue(UberStateDefaults.savePedestalSilentWoodsA); break;

            case SplitTeleporter.SilentWoodsATeleported: CheckScene(true, "petrifiedForestTarBubbleChallenge"); break;

            case SplitTeleporter.SilentWoodsBActivated: CheckUberBoolValue(UberStateDefaults.savePedestalSilentWoodsB); break;

            case SplitTeleporter.SilentWoodsBTeleported: CheckScene(true, "petrifiedForestTandemWindChaseA"); break;

            case SplitTeleporter.WellspringActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWellspring); break;

            case SplitTeleporter.WellspringTeleported: CheckScene(true, "waterMillCEntrance"); break;

            case SplitTeleporter.WellspringGladesActivated: CheckUberIntValue(UberStateDefaults.builderProjectSpiritWell, 3); break;

            case SplitTeleporter.WellspringGladesTeleported: CheckScene(true, "wellspringGladesHub"); break;

            case SplitTeleporter.WillowsEndActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWillowsEnd); break;

            case SplitTeleporter.WillowsEndTeleported: CheckScene(true, "willowsEndSaveRoom"); break;

            case SplitTeleporter.WillowsEndShriekActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWillowsEndShriek); break;

            case SplitTeleporter.WillowsEndShreikTeleported: CheckScene(true, "willowCeremonyIntro"); break;

            case SplitTeleporter.WindsweptWastesAActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWindsweptWastesA); break;

            case SplitTeleporter.WindsweptWastesATeleported: CheckScene(true, "petrifiedOwlFeedingGroundsRevised"); break;

            case SplitTeleporter.WindsweptWastesBActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWindsweptWastesB); break;

            case SplitTeleporter.WindsweptWastesBTeleported: CheckScene(true, "e3DesertI__clone0"); break;

            case SplitTeleporter.WindtornRuinsEntranceActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWindtornRuinsA); break;

            case SplitTeleporter.WindtornRuinsEntranceTeleported: CheckScene(true, "desertRuinsTowerSaveRoom"); break;

            case SplitTeleporter.WindtornRuinsBossActivated: CheckUberBoolValue(UberStateDefaults.savePedestalWindtornRuinsB); break;

            case SplitTeleporter.WindtornRuinsBossTeleported: CheckScene(true, "windtornRuinsC"); break;
            }
        }
Ejemplo n.º 2
0
        private void FixSplits()
        {
            int  index   = 1;
            bool changed = false;

            if (Settings.Autosplits.Count == 0)
            {
                Settings.Autosplits.Add(new Split()
                {
                    Name = "Auto Start", Type = SplitType.GameStart
                });
                changed = true;
            }
            else
            {
                Settings.Autosplits[0].Name = "Auto Start";
            }

            foreach (ISegment segment in State.Run)
            {
                if (index < Settings.Autosplits.Count)
                {
                    Split split = Settings.Autosplits[index++];
                    if (split.Name != segment.Name)
                    {
                        split.Name = segment.Name;
                        changed    = true;
                    }
                }
                else
                {
                    index++;
                    Settings.Autosplits.Add(new Split()
                    {
                        Name = segment.Name, Type = SplitType.ManualSplit
                    });
                    changed = true;
                }
            }

            while (index < Settings.Autosplits.Count)
            {
                Settings.Autosplits.RemoveAt(Settings.Autosplits.Count - 1);
                changed = true;
            }

            if (changed)
            {
                flowMain.SuspendLayout();
                flowMain.Controls.Clear();

                foreach (Split split in Settings.Autosplits)
                {
                    UserSplitSettings setting = new UserSplitSettings();
                    setting.UserSplit = split;
                    setting.UpdateControls(true);
                    flowMain.Controls.Add(setting);
                }

                flowMain.ResumeLayout(true);
            }
        }
        private void CheckSplit(Split split, bool updateValues)
        {
            GameState state = Memory.GameState();

            ShouldSplit = false;
            Paused      = Memory.IsLoadingGame(state);

            if (split.Type == SplitType.GameStart)
            {
                Screen screen     = Memory.TitleScreen();
                int    difficulty = Memory.Difficulty();
                bool   isStarted  = difficulty != 4 && lastIntValue == 4 && screen == Screen.ProfileSelected;
                if (screen == Screen.ProfileSelected && lastScreen == Screen.SaveSlots)
                {
                    Memory.SetDifficulty(4);
                }
                ShouldSplit   = !lastBoolValue && isStarted;
                lastBoolValue = isStarted;
                lastIntValue  = difficulty;
                lastScreen    = screen;
            }
            else
            {
                if (!updateValues && ((state != GameState.Game && split.Type != SplitType.Hitbox) || Memory.Dead() || (Paused && state != GameState.Game)))
                {
                    return;
                }

                switch (split.Type)
                {
                case SplitType.ManualSplit:
                    break;

                case SplitType.Ability:
                    SplitAbility ability = Utility.GetEnumValue <SplitAbility>(split.Value);
                    if (ability == SplitAbility.FastTravel)
                    {
                        CheckUberIntValue(UberStateDefaults.fastTravel, 1);
                    }
                    else
                    {
                        CheckAbility(Utility.GetEnumValue <AbilityType>(split.Value));
                    }
                    break;

                case SplitType.Shard:
                    ShardType shardType = ShardType.Overcharge;
                    bool      hasShard  = false;
                    if (Enum.TryParse <ShardType>(split.Value, out shardType))
                    {
                        hasShard = Memory.HasShard(shardType, 0);
                    }
                    else if (Enum.TryParse <ShardType>(split.Value.Substring(0, split.Value.Length - 1), out shardType))
                    {
                        hasShard = Memory.HasShard(shardType, int.Parse(split.Value.Substring(split.Value.Length - 1)));
                    }
                    ShouldSplit   = !lastBoolValue && hasShard;
                    lastBoolValue = hasShard;
                    break;

                case SplitType.AreaEnter:
                    CheckArea(split, true);
                    break;

                case SplitType.AreaLeave:
                    CheckArea(split, false);
                    break;

                case SplitType.WorldEvent:
                    CheckWorldEvent(split);
                    break;

                case SplitType.Wisp:
                    CheckWisp(split);
                    break;

                case SplitType.Boss:
                    CheckBoss(split);
                    break;

                case SplitType.Map:
                    CheckMap(split);
                    break;

                case SplitType.SpiritTrial:
                    CheckSpiritTrial(split);
                    break;

                case SplitType.Teleporter:
                    CheckTeleporter(split);
                    break;

                case SplitType.Hitbox:
                    Vector4 hitbox = new Vector4(split.Value);
                    CheckHitbox(hitbox);
                    break;

                case SplitType.UberState:
                    CheckBoolUberState(split);
                    break;

                case SplitType.GameEnd:
                    CheckHitbox(new Vector4("-4628.05,-6756,10,10"));
                    break;

                case SplitType.Seed:
                    CheckSeed(split);
                    break;

                case SplitType.CreepHeart:
                    Memory.UpdateUberState(UberStateDefaults.vineAClear);
                    Memory.UpdateUberState(UberStateDefaults.vineBClear);
                    Memory.UpdateUberState(UberStateDefaults.vineCClear);
                    Memory.UpdateUberState(UberStateDefaults.vineDClear);
                    Memory.UpdateUberState(UberStateDefaults.vineEClear);
                    Memory.UpdateUberState(UberStateDefaults.vineFClear);
                    Memory.UpdateUberState(UberStateDefaults.vineGClear);
                    Memory.UpdateUberState(UberStateDefaults.vineHClear);
                    int creepCount = UberStateDefaults.vineAClear.Value.Int + UberStateDefaults.vineBClear.Value.Int;
                    creepCount += UberStateDefaults.vineCClear.Value.Int + UberStateDefaults.vineDClear.Value.Int;
                    creepCount += UberStateDefaults.vineEClear.Value.Int + UberStateDefaults.vineFClear.Value.Int;
                    creepCount += UberStateDefaults.vineGClear.Value.Int + UberStateDefaults.vineHClear.Value.Int;

                    int splitCreeps = -1;
                    int.TryParse(split.Value, out splitCreeps);
                    ShouldSplit  = lastIntValue != creepCount && creepCount == splitCreeps;
                    lastIntValue = creepCount;
                    break;

                case SplitType.Keystone:
                    int keystones      = Memory.Keystones();
                    int splitKeystones = -1;
                    int.TryParse(split.Value, out splitKeystones);
                    ShouldSplit  = lastIntValue != keystones && keystones == splitKeystones;
                    lastIntValue = keystones;
                    break;

                case SplitType.Ore:
                    int ore      = Memory.Ore();
                    int splitOre = -1;
                    int.TryParse(split.Value, out splitOre);
                    ShouldSplit  = lastIntValue != ore && ore == splitOre;
                    lastIntValue = ore;
                    break;

                case SplitType.HealthCell:
                    Memory.UpdateUberState(UberStateDefaults.healthContainersCounter);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupKwolok);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupMouldwood);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupWindtorn);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupBaur);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupLagoon);
                    int health = UberStateDefaults.healthContainersCounter.Value.Int - (UberStateDefaults.wispRewardPickupKwolok.Value.Bool ? 2 : 0);
                    health -= (UberStateDefaults.wispRewardPickupMouldwood.Value.Bool ? 2 : 0) + (UberStateDefaults.wispRewardPickupWindtorn.Value.Bool ? 2 : 0);
                    health -= (UberStateDefaults.wispRewardPickupBaur.Value.Bool ? 2 : 0) + (UberStateDefaults.wispRewardPickupLagoon.Value.Bool ? 2 : 0);
                    int splitHealth = -1;
                    int.TryParse(split.Value, out splitHealth);
                    ShouldSplit  = lastIntValue != health && health == splitHealth;
                    lastIntValue = health;
                    break;

                case SplitType.EnergyCell:
                    Memory.UpdateUberState(UberStateDefaults.energyContainersCounter);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupKwolok);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupMouldwood);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupWindtorn);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupBaur);
                    Memory.UpdateUberState(UberStateDefaults.wispRewardPickupLagoon);
                    int energy = UberStateDefaults.energyContainersCounter.Value.Int - (UberStateDefaults.wispRewardPickupKwolok.Value.Bool ? 2 : 0);
                    energy -= (UberStateDefaults.wispRewardPickupMouldwood.Value.Bool ? 2 : 0) + (UberStateDefaults.wispRewardPickupWindtorn.Value.Bool ? 2 : 0);
                    energy -= (UberStateDefaults.wispRewardPickupBaur.Value.Bool ? 2 : 0) + (UberStateDefaults.wispRewardPickupLagoon.Value.Bool ? 2 : 0);
                    int splitEnergy = -1;
                    int.TryParse(split.Value, out splitEnergy);
                    ShouldSplit  = lastIntValue != energy && energy == splitEnergy;
                    lastIntValue = energy;
                    break;
                }

                if ((state != GameState.Game && split.Type != SplitType.Hitbox) || Memory.Dead() || (Paused && state != GameState.Game))
                {
                    ShouldSplit = false;
                }
                else if (DateTime.Now > splitLate)
                {
                    ShouldSplit = true;
                    splitLate   = DateTime.MaxValue;
                }
            }
        }