Exemple #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            IPC.Dispose();

            Config.Save();
            new CameraConfigPreset().Apply();

            DalamudApi.Framework.Update   -= Update;
            DalamudApi.ClientState.Login  -= Login;
            DalamudApi.ClientState.Logout -= Logout;
            DalamudApi.PluginInterface.UiBuilder.OpenConfigUi -= ToggleConfig;
            DalamudApi.PluginInterface.UiBuilder.Draw         -= Draw;
            DalamudApi.Dispose();

            if (FreeCam.Enabled)
            {
                FreeCam.Toggle();
            }

            Game.Dispose();
            Memory.Dispose();
        }
Exemple #2
0
 private void Update(Framework framework)
 {
     if (!pluginReady)
     {
         return;
     }
     Game.Update();
     FreeCam.Update();
     PresetManager.Update();
 }
Exemple #3
0
        private static void DrawFreeCamButton()
        {
            ImGuiHelpers.ForceNextWindowMainViewport();
            var size = new Vector2(50) * ImGuiHelpers.GlobalScale;

            ImGui.SetNextWindowSize(size, ImGuiCond.Always);
            ImGuiHelpers.SetNextWindowPosRelativeMainViewport(new Vector2(ImGuiHelpers.MainViewport.Size.X - size.X, 0), ImGuiCond.Always);
            ImGui.Begin("FreeCam Button", ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoSavedSettings | ImGuiWindowFlags.NoFocusOnAppearing);

            if (ImGui.IsWindowHovered() && ImGui.IsMouseReleased(ImGuiMouseButton.Left))
            {
                FreeCam.Toggle();
            }

            ImGui.End();
        }
Exemple #4
0
        private static unsafe void DrawOtherSettings()
        {
            ImGui.TextUnformatted("QoL Bar Status:");
            if (!IPC.QoLBarEnabled)
            {
                ImGui.SameLine();
                ImGui.TextColored(new Vector4(1, 0, 0, 1), "Disabled");
                ImGui.SameLine();
                ImGui.PushFont(UiBuilder.IconFont);
                if (ImGui.SmallButton($"{FontAwesomeIcon.UndoAlt.ToIconString()}##CheckQoLBar"))
                {
                    IPC.Dispose();
                    IPC.Initialize();
                }
                ImGui.PopFont();
            }
            else
            {
                ImGui.SameLine();
                ImGui.TextColored(new Vector4(0, 1, 0, 1), "Enabled");
            }

            ImGui.Spacing();
            ImGui.Columns(3, null, false);

            {
                var _ = Game.GetCameraTargetHook.IsEnabled;
                if (ImGui.Checkbox("Spectate Focus / Soft Target", ref _))
                {
                    Game.ToggleSpectate();
                }
            }

            {
                ImGui.NextColumn();
                var _ = FreeCam.Enabled;
                if (ImGui.Checkbox("Free Cam", ref _))
                {
                    FreeCam.Toggle();
                }
            }

            ImGui.NextColumn();
            if (ImGui.Checkbox("Toggle Free Cam on Death/Revive", ref Cammy.Config.FreeCamOnDeath))
            {
                Cammy.Config.Save();
            }

            if (Game.cameraNoCollideReplacer.IsValid)
            {
                ImGui.NextColumn();
                var _ = Game.cameraNoCollideReplacer.IsEnabled;
                if (ImGui.Checkbox("Disable Camera Collision", ref _))
                {
                    Game.cameraNoCollideReplacer.Toggle();
                }
            }

            ImGui.Columns(1);
            ImGui.Spacing();

            {
                ImGui.PushFont(UiBuilder.IconFont);
                if (ImGui.Button($"{FontAwesomeIcon.UndoAlt.ToIconString()}##Reset???"))
                {
                    Game.cameraManager->WorldCamera->Mode = 1;
                }
                ImGui.PopFont();
                ImGui.SameLine();
                var _ = Game.cameraManager->WorldCamera->Mode;
                if (ImGui.SliderInt("???", ref _, 0, 2))
                {
                    Game.cameraManager->WorldCamera->Mode = _;
                }
            }
        }
Exemple #5
0
        private unsafe void ToggleConfig(string command, string argument)
        {
            if (string.IsNullOrEmpty(argument))
            {
                ToggleConfig();
                return;
            }

            var regex      = Regex.Match(argument, "^(\\w+) ?(.*)");
            var subcommand = regex.Success && regex.Groups.Count > 1 ? regex.Groups[1].Value : string.Empty;

            switch (subcommand.ToLower())
            {
            case "preset":
            {
                if (regex.Groups.Count < 2 || string.IsNullOrEmpty(regex.Groups[2].Value))
                {
                    PresetManager.SetPresetOverride(null);
                    PrintEcho("Removed preset override.");
                    return;
                }

                var arg    = regex.Groups[2].Value;
                var preset = Config.Presets.FirstOrDefault(preset => preset.Name == arg);

                if (preset == null)
                {
                    PrintError($"Failed to find preset \"{arg}\"");
                    return;
                }

                PresetManager.SetPresetOverride(preset);
                PrintEcho($"Preset set to \"{arg}\"");
                break;
            }

            case "zoom":
            {
                if (regex.Groups.Count < 2 || !float.TryParse(regex.Groups[2].Value, out var amount))
                {
                    PrintError("Invalid amount.");
                    return;
                }

                Game.cameraManager->WorldCamera->CurrentZoom = amount;
                break;
            }

            case "fov":
            {
                if (regex.Groups.Count < 2 || !float.TryParse(regex.Groups[2].Value, out var amount))
                {
                    PrintError("Invalid amount.");
                    return;
                }

                Game.cameraManager->WorldCamera->CurrentFoV = amount;
                break;
            }

            case "spectate":
            {
                Game.ToggleSpectate();
                PrintEcho($"Spectating is now {(Game.GetCameraTargetHook.IsEnabled ? "enabled" : "disabled")}!");
                break;
            }

            case "nocollide":
            {
                Game.cameraNoCollideReplacer.Toggle();
                PrintEcho($"Camera collision is now {(Game.cameraNoCollideReplacer.IsEnabled ? "disabled" : "enabled")}!");
                break;
            }

            case "freecam":
            {
                FreeCam.Toggle();
                break;
            }

            case "help":
            {
                PrintEcho("Subcommands:" +
                          "\npreset <name> - Applies a preset to override automatic presets, specified by name. Use without a name to disable." +
                          "\nzoom <amount> - Sets the current zoom level." +
                          "\nfov <amount> - Sets the current FoV level." +
                          "\nspectate - Toggles the \"Spectate Focus / Soft Target\" option." +
                          "\nnocollide - Toggles the \"Disable Camera Collision\" option." +
                          "\nfreecam - Toggles the \"Free Cam\" option.");
                break;
            }

            default:
            {
                PrintError("Invalid usage: " + cammySubcommands);
                break;
            }
            }
        }