public static void UponPickingOption(Option option, PlayerMod player, List<Option> LastPickedOptions)
        {
            TerraGuardian[] Guardians = player.GetAllGuardianFollowers;
            switch (option.oType)
            {
                case Option.OptionType.Order:
                case Option.OptionType.Action:
                case Option.OptionType.Item:
                case Option.OptionType.Interaction:
                case Option.OptionType.PullGuardians:
                    {
                        AddOptionHolder();
                        AddOption(Option.OptionType.PickGuardian, true, 255);
                        for (int i = 0; i < Guardians.Length; i++)
                        {
                            if (!Guardians[i].Active)
                                continue;
                            if (i == 0 && player.ControllingGuardian)
                                continue;
                            AddOption(Option.OptionType.PickGuardian, true, i);
                        }
                    }
                    break;
                case Option.OptionType.SwitchGroup:
                    {
                        AddOptionHolder();
                        for(int i = 0; i < 255; i++)
                        {
                            if(Main.player[i].active && i != Main.myPlayer)
                            {
                                AddOption(Option.OptionType.PickTeam, true, i);
                            }
                        }
                    }
                    break;
                case Option.OptionType.Tactic:
                    {
                        AddOptionHolder();
                        AddOption(Option.OptionType.ChargeOnTarget);
                        AddOption(Option.OptionType.AvoidContactWithTarget);
                        AddOption(Option.OptionType.AttackTargetFromAwayIt);
                        AddOption(Option.OptionType.FreeWill);
                    }
                    break;
                case Option.OptionType.PickTeam:
                    {
                        PlayerMod.ChangeSelectedGroup(option.InternalValue);
                        Close();
                    }
                    break;
                case Option.OptionType.PickGuardian:
                    {
                        SelectedGuardian = (byte)option.InternalValue;
                        switch (LastPickedOptions[0].oType)
                        {
                            case Option.OptionType.Order:
                                {
                                    AddOptionHolder();
                                    AddOption(Option.OptionType.Follow);
                                    AddOption(Option.OptionType.WaitHere);
                                    AddOption(Option.OptionType.GuardHere);
                                    AddOption(Option.OptionType.GoAheadBehind);
                                    AddOption(Option.OptionType.AvoidCombat);
                                }
                                break;
                            case Option.OptionType.Action:
                                {
                                    AddOptionHolder();
                                    AddOption(Option.OptionType.GoSellLoot, ((SelectedGuardian == 255 && Guardians.Any(x => x.Active && x.HasFlag(GuardianFlags.MayGoSellLoot))) ||
                                        (SelectedGuardian < 255 && Guardians[SelectedGuardian].HasFlag(GuardianFlags.MayGoSellLoot))));
                                    AddOption(Option.OptionType.UseFurniture);
                                    AddOption(Option.OptionType.LiftMe);
                                    AddOption(Option.OptionType.LaunchMe, player.player.wings > 0);
                                    AddOption(Option.OptionType.FreeControl,
                                        (SelectedGuardian == 255 && Guardians.Any(x => x.Active && x.PlayerMounted && x.HasFlag(GuardianFlags.StopMindingAfk))) ||
                                        (SelectedGuardian != 255 && Guardians[SelectedGuardian].PlayerMounted && Guardians[SelectedGuardian].HasFlag(GuardianFlags.StopMindingAfk)));
                                }
                                break;
                            case Option.OptionType.Item:
                                {
                                    AddOptionHolder();
                                    AddOption(Option.OptionType.HealSelf);
                                    AddOption(Option.OptionType.UseBuffPotions);
                                    AddOption(Option.OptionType.UseSkillResetPotion);
                                    AddOption(Option.OptionType.UseStatusIncreaseItem);
                                }
                                break;
                            case Option.OptionType.Interaction:
                                {
                                    AddOptionHolder();
                                    AddOption(Option.OptionType.MountGuardian, (SelectedGuardian == 255 && Guardians.Any(x => x.Active && (x.HasFlag(GuardianFlags.AllowMount) || x.PlayerMounted))) ||
                                        (SelectedGuardian != 255 && (Guardians[SelectedGuardian].HasFlag(GuardianFlags.AllowMount) || Guardians[SelectedGuardian].PlayerMounted)));
                                    AddOption(Option.OptionType.ShareMount, player.player.mount.Active && (SelectedGuardian == 255 || (!player.GetAllGuardianFollowers[SelectedGuardian].PlayerControl && !player.GetAllGuardianFollowers[SelectedGuardian].HasFlag(GuardianFlags.DisableMountSharing))));
                                    AddOption(Option.OptionType.TeleportWithPlayer,
                                        ((SelectedGuardian == 255 && Main.player[Main.myPlayer].GetModPlayer<PlayerMod>().GetAllGuardianFollowers.Any(x => x.Active && x.HasMagicMirror)) ||
                                        (SelectedGuardian != 255 && Main.player[Main.myPlayer].GetModPlayer<PlayerMod>().GetAllGuardianFollowers[SelectedGuardian].HasMagicMirror)));
                                    AddOption(Option.OptionType.PlayerControl,
                                        !player.IsCompanionParty && (
                                        (SelectedGuardian == 255 && Guardians.Any(x => x.Active && x.HasFlag(GuardianFlags.PlayerControl))) ||
                                        (SelectedGuardian < 255 && Guardians[SelectedGuardian].Active && Guardians[SelectedGuardian].HasFlag(GuardianFlags.PlayerControl))));
                                    AddOption(Option.OptionType.SetLeader, SelectedGuardian != 0 && SelectedGuardian != 255 && !player.ControllingGuardian);
                                }
                                break;
                            case Option.OptionType.PullGuardians:
                                {
                                    TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                                    for (int g = 0; g < guardians.Length; g++)
                                    {
                                        if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander)
                                        {
                                            guardians[g].BePulledByPlayer();
                                        }
                                    }
                                    Close();
                                }
                                break;
                        }
                    }
                    break;

                case Option.OptionType.Follow:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander)
                            {
                                guardians[g].GuardingPosition = null;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.WaitHere:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        Point GuardPosition = new Point((int)player.player.Center.X / 16, (int)(player.player.position.Y + player.player.height - 1) / 16);
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerMounted)
                            {
                                guardians[g].GuardingPosition = GuardPosition;
                                guardians[g].IsGuardingPlace = false;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.GuardHere:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        Point GuardPosition = new Point((int)player.player.Center.X / 16, (int)(player.player.position.Y + player.player.height - 1) / 16);
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerMounted)
                            {
                                guardians[g].GuardingPosition = GuardPosition;
                                guardians[g].IsGuardingPlace = true;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.GoAheadBehind:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander)
                            {
                                guardians[g].ChargeAhead = !guardians[g].ChargeAhead;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.AvoidCombat:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander)
                            {
                                guardians[g].AvoidCombat = !guardians[g].AvoidCombat;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.FreeControl:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        byte HighestPriority = 0;
                        TerraGuardian MountedPriority = null;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && guardians[g].PlayerMounted && guardians[g].HasFlag(GuardianFlags.StopMindingAfk))
                            {
                                byte Priority = 0;
                                if (guardians[g].ReverseMount)
                                {
                                    Priority = 1;
                                }
                                else
                                {
                                    Priority = 2;
                                }
                                if (Priority > HighestPriority)
                                {
                                    MountedPriority = guardians[g];
                                    HighestPriority = Priority;
                                }
                            }
                        }
                        if (MountedPriority != null)
                        {
                            MountedPriority.ToggleGuardianFullControl(!MountedPriority.GuardianHasControlWhenMounted);
                        }
                        Close();
                    }
                    break;

                case Option.OptionType.GoSellLoot:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && guardians[g].HasFlag(GuardianFlags.MayGoSellLoot) && !guardians[g].PlayerControl)
                            {
                                GuardianActions.SellLootCommand(guardians[g]);
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.TeleportWithPlayer:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                if (GuardianActions.TeleportWithPlayerCommand(guardians[g], player.player))
                                    break;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.UseFurniture:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander)
                            {
                                if (guardians[g].furniturex != -1)
                                {
                                    guardians[g].LeaveFurniture();
                                }
                                else
                                {
                                    guardians[g].UseNearbyFurniture();
                                }
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.LiftMe:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                if (GuardianActions.UseLiftPlayer(guardians[g], Main.player[guardians[g].OwnerPos]))
                                    break;
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.LaunchMe:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                GuardianActions.UseLaunchPlayer(guardians[g], Main.player[guardians[g].OwnerPos]);
                            }
                        }
                        Close();
                    }
                    break;

                case Option.OptionType.HealSelf:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                guardians[g].AttemptToUseHealingPotion();
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.UseBuffPotions:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                GuardianActions.UseBuffPotions(guardians[g]);
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.UseSkillResetPotion:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander)
                            {
                                GuardianActions.UseSkillResetPotionCommand(guardians[g]);
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.UseStatusIncreaseItem:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                GuardianActions.UseStatusIncreaseItems(guardians[g]);
                            }
                        }
                        Close();
                    }
                    break;

                case Option.OptionType.MountGuardian:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        bool Dismount = player.MountedOnGuardian || player.GuardianMountingOnPlayer;
                        bool SomeoneMounted = player.GuardianMountingOnPlayer, MountedOnGuardian = player.MountedOnGuardian;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && guardians[g].HasFlag(GuardianFlags.AllowMount) && !guardians[g].PlayerControl)
                            {
                                if (SelectedGuardian == 255)
                                {
                                    if (guardians[g].PlayerMounted)
                                    {
                                        if (Dismount)
                                        {
                                            GuardianActions.GuardianPutPlayerOnTheFloorCommand(guardians[g]);
                                        }
                                    }
                                    else
                                    {
                                        if (!Dismount)
                                        {
                                            if (GuardianActions.GuardianPutPlayerOnShoulderCommand(guardians[g]))
                                                break;
                                        }
                                    }
                                }
                                else
                                {
                                    if (guardians[g].PlayerMounted)
                                    {
                                        GuardianActions.GuardianPutPlayerOnTheFloorCommand(guardians[g]);
                                    }
                                    else
                                    {
                                        if (!guardians[g].ReverseMount)
                                        {
                                            if (!MountedOnGuardian)
                                            {
                                                if (GuardianActions.GuardianPutPlayerOnShoulderCommand(guardians[g]))
                                                    break;
                                            }
                                        }
                                        else if (!SomeoneMounted)
                                        {
                                            if (GuardianActions.GuardianPutPlayerOnShoulderCommand(guardians[g]))
                                                break;
                                        }
                                    }
                                }
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.ShareMount:
                    {
                        TerraGuardian[] guardians = player.GetAllGuardianFollowers;
                        for (int g = 0; g < guardians.Length; g++)
                        {
                            if ((SelectedGuardian == 255 || g == SelectedGuardian) && guardians[g].Active && !guardians[g].IsCommander && !guardians[g].PlayerControl)
                            {
                                if (guardians[g].SittingOnPlayerMount)
                                    guardians[g].DoSitOnPlayerMount(false);
                                else
                                    GuardianActions.GuardianJoinPlayerMountCommand(guardians[g], Main.player[guardians[g].OwnerPos]);
                            }
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.PlayerControl:
                    {
                        if (player.Guardian.Active && player.Guardian.HasFlag(GuardianFlags.PlayerControl))
                        {
                            player.Guardian.TogglePlayerControl();
                        }
                        Close();
                    }
                    break;
                case Option.OptionType.SetLeader:
                    {
                        player.ChangeLeaderGuardian(SelectedGuardian);
                        Close();
                    }
                    break;
                case Option.OptionType.ChargeOnTarget:
                    {
                        player.CurrentTactic = PlayerMod.BehaviorChanges.ChargeOnTarget;
                        Close();
                    }
                    break;
                case Option.OptionType.AvoidContactWithTarget:
                    {
                        player.CurrentTactic = PlayerMod.BehaviorChanges.AvoidContact;
                        Close();
                    }
                    break;
                case Option.OptionType.AttackTargetFromAwayIt:
                    {
                        player.CurrentTactic = PlayerMod.BehaviorChanges.StayAwayFromTarget;
                        Close();
                    }
                    break;
                case Option.OptionType.FreeWill:
                    {
                        player.CurrentTactic = PlayerMod.BehaviorChanges.FreeWill;
                        Close();
                    }
                    break;
            }
        }