public static void CheckCameraConditionSets() { var preset = Cammy.Config.Presets.FirstOrDefault(preset => preset.CheckConditionSet()); if (preset == null || preset == activePreset) { return; } DisableCameraPresets(); preset.Apply(); activePreset = preset; }
public static void Update() { if (!Game.isLoggedIn || Game.isChangingAreas || FreeCam.Enabled) { return; } if (presetOverride != null) { if (activePreset != null) { return; } activePreset = presetOverride; activePreset.Apply(); return; } CheckCameraConditionSets(); }
public static void DisableCameraPresets() { activePreset = null; }
public static void SetPresetOverride(CameraConfigPreset preset) { DisableCameraPresets(); presetOverride = preset; }
private static void DrawPresetEditor(CameraConfigPreset preset) { if (ImGui.InputText("Name", ref preset.Name, 64)) { Cammy.Config.Save(); } ImGui.Spacing(); ImGui.Columns(3, null, false); if (ImGui.Checkbox("Starting Zoom##Use", ref preset.UseStartZoom)) { Cammy.Config.Save(); } ImGui.NextColumn(); if (ImGui.Checkbox("Starting FoV##Use", ref preset.UseStartFoV)) { Cammy.Config.Save(); } if (preset.UseStartZoom || preset.UseStartFoV) { ImGui.NextColumn(); if (ImGui.Checkbox("Only on Login", ref preset.UseStartOnLogin)) { Cammy.Config.Save(); } } ImGui.Columns(1); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); var arrowOffset = ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().ItemSpacing.X + 25 * ImGuiHelpers.GlobalScale; ImGui.Spacing(); ImGui.SameLine(arrowOffset); AddSubtractAction("Zoom", 0.1f, x => { preset.StartZoom += x; preset.MinZoom += x; preset.MaxZoom += x; }); if (preset.UseStartZoom) { ResetSliderFloat("Starting##Zoom", ref preset.StartZoom, preset.MinZoom, preset.MaxZoom, 6, "%.2f"); } ResetSliderFloat("Minimum##Zoom", ref preset.MinZoom, 1, preset.MaxZoom, 1.5f, "%.2f"); ResetSliderFloat("Maximum##Zoom", ref preset.MaxZoom, preset.MinZoom, 100, 20, "%.2f"); ResetSliderFloat("Delta##Zoom", ref preset.ZoomDelta, 0, 5, 0.75f, "%.2f"); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); ImGui.Spacing(); ImGui.SameLine(arrowOffset); AddSubtractAction("Field of View", 0.01f, x => { preset.StartFoV += x; preset.MinFoV += x; preset.MaxFoV += x; }); if (ImGui.IsItemHovered()) { ImGui.SetTooltip("In some weather, the FoV will cause lag or crash if the total is 3.14."); } if (preset.UseStartFoV) { ResetSliderFloat("Starting##FoV", ref preset.StartFoV, preset.MinFoV, preset.MaxFoV, 0.78f, "%f"); } ResetSliderFloat("Minimum##FoV", ref preset.MinFoV, 0.01f, preset.MaxFoV, 0.69f, "%f"); ResetSliderFloat("Maximum##FoV", ref preset.MaxFoV, preset.MinFoV, 3, 0.78f, "%f"); ResetSliderFloat("Delta##FoV", ref preset.FoVDelta, 0, 0.5f, 0.08726646751f, "%f"); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); ResetSliderFloat("Minimum V Rotation", ref preset.MinVRotation, -1.569f, preset.MaxVRotation, -1.483530f, "%f"); ResetSliderFloat("Maximum V Rotation", ref preset.MaxVRotation, preset.MinVRotation, 1.569f, 0.785398f, "%f"); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); ResetSliderFloat("Camera Height Offset", ref preset.HeightOffset, -1, 1, 0, "%.2f"); ResetSliderFloat("Tilt", ref preset.Tilt, (float)-Math.PI, (float)Math.PI, 0, "%f"); ResetSliderFloat("Look at Height Offset", ref preset.LookAtHeightOffset, -10, 10, Game.GetDefaultLookAtHeightOffset, "%f"); ImGui.Spacing(); ImGui.Separator(); ImGui.Spacing(); var qolBarEnabled = IPC.QoLBarEnabled; var conditionSets = qolBarEnabled ? IPC.QoLBarConditionSets : Array.Empty <string>(); var display = preset.ConditionSet >= 0 ? preset.ConditionSet < conditionSets.Length ? $"[{preset.ConditionSet + 1}] {conditionSets[preset.ConditionSet]}" : (preset.ConditionSet + 1).ToString() : "None"; if (ImGui.BeginCombo("Condition Set", display)) { if (ImGui.Selectable("None##ConditionSet", preset.ConditionSet < 0)) { preset.ConditionSet = -1; Cammy.Config.Save(); } if (qolBarEnabled) { for (int i = 0; i < conditionSets.Length; i++) { var name = conditionSets[i]; if (!ImGui.Selectable($"[{i + 1}] {name}", i == preset.ConditionSet)) { continue; } preset.ConditionSet = i; Cammy.Config.Save(); } } ImGui.EndCombo(); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Uses a QoL Bar Condition Set to automatically swap to this preset." + "\nPresets higher in the list will have priority over lower ones." + "\nCondition Sets should be made using the QoL Bar plugin config." + "\nPlease see the \"Other Settings\" tab to verify if QoL Bar was detected."); } }