punish v6.8.18.0
This commit is contained in:
commit
060278c1b7
317 changed files with 554155 additions and 0 deletions
|
@ -0,0 +1,162 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using Questionable.Controller;
|
||||
using Questionable.Functions;
|
||||
using Questionable.Model;
|
||||
using Questionable.Model.Questing;
|
||||
using Questionable.Windows.QuestComponents;
|
||||
using Questionable.Windows.Utils;
|
||||
|
||||
namespace Questionable.Windows.ConfigComponents;
|
||||
|
||||
internal sealed class StopConditionComponent : ConfigComponent
|
||||
{
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
|
||||
private readonly QuestSelector _questSelector;
|
||||
|
||||
private readonly QuestRegistry _questRegistry;
|
||||
|
||||
private readonly QuestTooltipComponent _questTooltipComponent;
|
||||
|
||||
private readonly UiUtils _uiUtils;
|
||||
|
||||
private readonly IClientState _clientState;
|
||||
|
||||
public StopConditionComponent(IDalamudPluginInterface pluginInterface, QuestSelector questSelector, QuestFunctions questFunctions, QuestRegistry questRegistry, QuestTooltipComponent questTooltipComponent, UiUtils uiUtils, IClientState clientState, Configuration configuration)
|
||||
: base(pluginInterface, configuration)
|
||||
{
|
||||
StopConditionComponent stopConditionComponent = this;
|
||||
_pluginInterface = pluginInterface;
|
||||
_questSelector = questSelector;
|
||||
_questRegistry = questRegistry;
|
||||
_questTooltipComponent = questTooltipComponent;
|
||||
_uiUtils = uiUtils;
|
||||
_clientState = clientState;
|
||||
_questSelector.SuggestionPredicate = (Quest quest) => configuration.Stop.QuestsToStopAfter.All((ElementId x) => x != quest.Id);
|
||||
_questSelector.DefaultPredicate = (Quest quest) => quest.Info.IsMainScenarioQuest && questFunctions.IsQuestAccepted(quest.Id);
|
||||
_questSelector.QuestSelected = delegate(Quest quest)
|
||||
{
|
||||
configuration.Stop.QuestsToStopAfter.Add(quest.Id);
|
||||
stopConditionComponent.Save();
|
||||
};
|
||||
}
|
||||
|
||||
public override void DrawTab()
|
||||
{
|
||||
using ImRaii.IEndObject endObject = ImRaii.TabItem("Stop###StopConditionns");
|
||||
if (!endObject)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool v = base.Configuration.Stop.Enabled;
|
||||
if (ImGui.Checkbox("Stop Questionable when any of the conditions below are met", ref v))
|
||||
{
|
||||
base.Configuration.Stop.Enabled = v;
|
||||
Save();
|
||||
}
|
||||
ImGui.Separator();
|
||||
using (ImRaii.Disabled(!v))
|
||||
{
|
||||
ImGui.Text("Stop when character level reaches:");
|
||||
bool v2 = base.Configuration.Stop.LevelToStopAfter;
|
||||
if (ImGui.Checkbox("Enable level stop condition", ref v2))
|
||||
{
|
||||
base.Configuration.Stop.LevelToStopAfter = v2;
|
||||
Save();
|
||||
}
|
||||
using (ImRaii.Disabled(!v2))
|
||||
{
|
||||
int data = base.Configuration.Stop.TargetLevel;
|
||||
ImGui.SetNextItemWidth(100f);
|
||||
if (ImGui.InputInt("Stop at level", ref data, 1, 5))
|
||||
{
|
||||
base.Configuration.Stop.TargetLevel = Math.Max(1, Math.Min(100, data));
|
||||
Save();
|
||||
}
|
||||
int num = _clientState.LocalPlayer?.Level ?? 0;
|
||||
if (num > 0)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImU8String text = new ImU8String(11, 1);
|
||||
text.AppendLiteral("(Current: ");
|
||||
text.AppendFormatted(num);
|
||||
text.AppendLiteral(")");
|
||||
ImGui.TextDisabled(text);
|
||||
}
|
||||
}
|
||||
ImGui.Separator();
|
||||
ImGui.Text("Stop when completing any of the quests selected below:");
|
||||
_questSelector.DrawSelection();
|
||||
List<ElementId> questsToStopAfter = base.Configuration.Stop.QuestsToStopAfter;
|
||||
if (questsToStopAfter.Count > 0)
|
||||
{
|
||||
using (ImRaii.Disabled(!ImGui.IsKeyDown(ImGuiKey.ModCtrl)))
|
||||
{
|
||||
if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Trash, "Clear All"))
|
||||
{
|
||||
base.Configuration.Stop.QuestsToStopAfter.Clear();
|
||||
Save();
|
||||
}
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip("Hold CTRL to enable this button.");
|
||||
}
|
||||
ImGui.Separator();
|
||||
}
|
||||
Quest quest = null;
|
||||
for (int i = 0; i < questsToStopAfter.Count; i++)
|
||||
{
|
||||
ElementId elementId = questsToStopAfter[i];
|
||||
if (!_questRegistry.TryGetQuest(elementId, out Quest quest2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ImU8String text = new ImU8String(5, 1);
|
||||
text.AppendLiteral("Quest");
|
||||
text.AppendFormatted(elementId);
|
||||
using (ImRaii.PushId(text))
|
||||
{
|
||||
(Vector4, FontAwesomeIcon, string) questStyle = _uiUtils.GetQuestStyle(elementId);
|
||||
bool flag;
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(in questStyle.Item1, questStyle.Item2.ToIconString());
|
||||
flag = ImGui.IsItemHovered();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(quest2.Info.Name);
|
||||
flag |= ImGui.IsItemHovered();
|
||||
if (flag)
|
||||
{
|
||||
_questTooltipComponent.Draw(quest2.Info);
|
||||
}
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
{
|
||||
ImGui.SameLine(ImGui.GetContentRegionAvail().X + ImGui.GetStyle().WindowPadding.X - ImGui.CalcTextSize(FontAwesomeIcon.Times.ToIconString()).X - ImGui.GetStyle().FramePadding.X * 2f);
|
||||
}
|
||||
if (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
||||
{
|
||||
quest = quest2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quest != null)
|
||||
{
|
||||
base.Configuration.Stop.QuestsToStopAfter.Remove(quest.Id);
|
||||
Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue