forked from aly/qstbak
muffin v7.4.10
This commit is contained in:
parent
2df81c5d15
commit
b8dd142c23
47 changed files with 3604 additions and 1058 deletions
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Components;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using Dalamud.Plugin;
|
||||
|
|
@ -39,6 +40,8 @@ internal sealed class StopConditionComponent : ConfigComponent
|
|||
|
||||
private readonly QuestController _questController;
|
||||
|
||||
private ElementId? _draggedItem;
|
||||
|
||||
public StopConditionComponent(IDalamudPluginInterface pluginInterface, QuestSelector questSelector, QuestFunctions questFunctions, QuestRegistry questRegistry, QuestTooltipComponent questTooltipComponent, UiUtils uiUtils, IObjectTable objectTable, IClientState clientState, QuestController questController, Configuration configuration)
|
||||
: base(pluginInterface, configuration)
|
||||
{
|
||||
|
|
@ -167,112 +170,172 @@ internal sealed class StopConditionComponent : ConfigComponent
|
|||
ImGui.SetTooltip("Hold CTRL to enable this button.");
|
||||
}
|
||||
ImGui.Separator();
|
||||
ImGui.Text("(Drag arrow buttons to reorder)");
|
||||
}
|
||||
Quest quest = null;
|
||||
for (int i = 0; i < questsToStopAfter.Count; i++)
|
||||
DrawStopQuestList(questsToStopAfter);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawStopQuestList(List<ElementId> questsToStopAfter)
|
||||
{
|
||||
Quest quest = null;
|
||||
Quest quest2 = null;
|
||||
int index = 0;
|
||||
float x = ImGui.GetContentRegionAvail().X;
|
||||
List<(Vector2, Vector2)> list = new List<(Vector2, Vector2)>();
|
||||
for (int i = 0; i < questsToStopAfter.Count; i++)
|
||||
{
|
||||
Vector2 item = ImGui.GetCursorScreenPos() + new Vector2(0f, (0f - ImGui.GetStyle().ItemSpacing.Y) / 2f);
|
||||
ElementId elementId = questsToStopAfter[i];
|
||||
if (!_questRegistry.TryGetQuest(elementId, out Quest quest3))
|
||||
{
|
||||
ElementId elementId = questsToStopAfter[i];
|
||||
if (!_questRegistry.TryGetQuest(elementId, out Quest quest2))
|
||||
continue;
|
||||
}
|
||||
ImU8String id = new ImU8String(5, 1);
|
||||
id.AppendLiteral("Quest");
|
||||
id.AppendFormatted(elementId);
|
||||
using (ImRaii.PushId(id))
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImU8String text = new ImU8String(1, 1);
|
||||
text.AppendFormatted(i + 1);
|
||||
text.AppendLiteral(".");
|
||||
ImGui.Text(text);
|
||||
ImGui.SameLine();
|
||||
(Vector4, FontAwesomeIcon, string) questStyle = _uiUtils.GetQuestStyle(elementId);
|
||||
bool flag;
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ImU8String id = new ImU8String(5, 1);
|
||||
id.AppendLiteral("Quest");
|
||||
id.AppendFormatted(elementId);
|
||||
using (ImRaii.PushId(id))
|
||||
{
|
||||
(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)
|
||||
ImGui.TextColored(in questStyle.Item1, questStyle.Item2.ToIconString());
|
||||
flag = ImGui.IsItemHovered();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.Text(quest3.Info.Name);
|
||||
flag |= ImGui.IsItemHovered();
|
||||
if (flag)
|
||||
{
|
||||
_questTooltipComponent.Draw(quest3.Info);
|
||||
}
|
||||
string text2 = elementId.ToString();
|
||||
int currentItem = (int)base.Configuration.Stop.QuestStopModes.GetValueOrDefault(text2, Questionable.Configuration.EStopConditionMode.Stop);
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(70f);
|
||||
ImU8String label = new ImU8String(6, 1);
|
||||
label.AppendLiteral("##Mode");
|
||||
label.AppendFormatted(text2);
|
||||
if (ImGui.Combo(label, ref currentItem, (ReadOnlySpan<string>)StopModeNames, StopModeNames.Length))
|
||||
{
|
||||
base.Configuration.Stop.QuestStopModes[text2] = (Configuration.EStopConditionMode)currentItem;
|
||||
Save();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
base.Configuration.Stop.QuestSequences.TryGetValue(text2, out var value);
|
||||
bool v = value.HasValue;
|
||||
ImU8String label2 = new ImU8String(8, 1);
|
||||
label2.AppendLiteral("##UseSeq");
|
||||
label2.AppendFormatted(text2);
|
||||
if (ImGui.Checkbox(label2, ref v))
|
||||
{
|
||||
if (v)
|
||||
{
|
||||
_questTooltipComponent.Draw(quest2.Info);
|
||||
base.Configuration.Stop.QuestSequences[text2] = 1;
|
||||
}
|
||||
string text3 = elementId.ToString();
|
||||
int currentItem3 = (int)base.Configuration.Stop.QuestStopModes.GetValueOrDefault(text3, Questionable.Configuration.EStopConditionMode.Stop);
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(70f);
|
||||
ImU8String label = new ImU8String(6, 1);
|
||||
label.AppendLiteral("##Mode");
|
||||
label.AppendFormatted(text3);
|
||||
if (ImGui.Combo(label, ref currentItem3, (ReadOnlySpan<string>)StopModeNames, StopModeNames.Length))
|
||||
else
|
||||
{
|
||||
if (currentItem3 == 0)
|
||||
{
|
||||
quest = quest2;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Configuration.Stop.QuestStopModes[text3] = (Configuration.EStopConditionMode)currentItem3;
|
||||
Save();
|
||||
}
|
||||
base.Configuration.Stop.QuestSequences.Remove(text2);
|
||||
}
|
||||
Save();
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetTooltip("Stop at specific sequence (unchecked = stop on quest completion)");
|
||||
}
|
||||
using (ImRaii.Disabled(!v))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
base.Configuration.Stop.QuestSequences.TryGetValue(text3, out var value);
|
||||
bool v2 = value.HasValue;
|
||||
ImU8String label2 = new ImU8String(8, 1);
|
||||
label2.AppendLiteral("##UseSeq");
|
||||
label2.AppendFormatted(text3);
|
||||
if (ImGui.Checkbox(label2, ref v2))
|
||||
ImGui.Text("Seq:");
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(85f);
|
||||
int data = value ?? 1;
|
||||
ImU8String label3 = new ImU8String(10, 1);
|
||||
label3.AppendLiteral("##SeqValue");
|
||||
label3.AppendFormatted(text2);
|
||||
if (ImGui.InputInt(label3, ref data, 1, 1) && v)
|
||||
{
|
||||
if (v2)
|
||||
{
|
||||
base.Configuration.Stop.QuestSequences[text3] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Configuration.Stop.QuestSequences.Remove(text3);
|
||||
}
|
||||
base.Configuration.Stop.QuestSequences[text2] = Math.Max(0, Math.Min(255, data));
|
||||
Save();
|
||||
}
|
||||
if (ImGui.IsItemHovered())
|
||||
}
|
||||
if (questsToStopAfter.Count > 1)
|
||||
{
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
{
|
||||
ImGui.SetTooltip("Stop at specific sequence (unchecked = stop on quest completion)");
|
||||
ImGui.SameLine(ImGui.GetContentRegionAvail().X + ImGui.GetStyle().WindowPadding.X - ImGui.CalcTextSize(FontAwesomeIcon.ArrowsUpDown.ToIconString()).X - ImGui.CalcTextSize(FontAwesomeIcon.Times.ToIconString()).X - ImGui.GetStyle().FramePadding.X * 4f - ImGui.GetStyle().ItemSpacing.X);
|
||||
}
|
||||
using (ImRaii.Disabled(!v2))
|
||||
if (_draggedItem == elementId)
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.Text("Seq:");
|
||||
ImGui.SameLine();
|
||||
ImGui.SetNextItemWidth(85f);
|
||||
int data3 = value ?? 1;
|
||||
ImU8String label3 = new ImU8String(10, 1);
|
||||
label3.AppendLiteral("##SeqValue");
|
||||
label3.AppendFormatted(text3);
|
||||
if (ImGui.InputInt(label3, ref data3, 1, 1) && v2)
|
||||
{
|
||||
base.Configuration.Stop.QuestSequences[text3] = Math.Max(0, Math.Min(255, data3));
|
||||
Save();
|
||||
}
|
||||
ImGuiComponents.IconButton("##Move", FontAwesomeIcon.ArrowsUpDown, ImGui.ColorConvertU32ToFloat4(ImGui.GetColorU32(ImGuiCol.ButtonActive)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGuiComponents.IconButton("##Move", FontAwesomeIcon.ArrowsUpDown);
|
||||
}
|
||||
if (_draggedItem == null && ImGui.IsItemActive() && ImGui.IsMouseDragging(ImGuiMouseButton.Left))
|
||||
{
|
||||
_draggedItem = elementId;
|
||||
}
|
||||
ImGui.SameLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
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 (ImGuiComponents.IconButton($"##Remove{i}", FontAwesomeIcon.Times))
|
||||
{
|
||||
quest = quest3;
|
||||
}
|
||||
}
|
||||
if (quest != null)
|
||||
Vector2 item2 = new Vector2(item.X + x, ImGui.GetCursorScreenPos().Y - ImGui.GetStyle().ItemSpacing.Y + 2f);
|
||||
list.Add((item, item2));
|
||||
}
|
||||
if (!ImGui.IsMouseDragging(ImGuiMouseButton.Left))
|
||||
{
|
||||
_draggedItem = null;
|
||||
}
|
||||
else if (_draggedItem != null)
|
||||
{
|
||||
int num = questsToStopAfter.FindIndex((ElementId elementId2) => elementId2 == _draggedItem);
|
||||
if (num >= 0 && num < list.Count)
|
||||
{
|
||||
string key2 = quest.Id.ToString();
|
||||
base.Configuration.Stop.QuestsToStopAfter.Remove(quest.Id);
|
||||
base.Configuration.Stop.QuestSequences.Remove(key2);
|
||||
base.Configuration.Stop.QuestStopModes.Remove(key2);
|
||||
Save();
|
||||
var (pMin, pMax) = list[num];
|
||||
ImGui.GetWindowDrawList().AddRect(pMin, pMax, ImGui.GetColorU32(ImGuiColors.DalamudGrey), 3f, ImDrawFlags.RoundCornersAll);
|
||||
int num2 = list.FindIndex(((Vector2 TopLeft, Vector2 BottomRight) tuple2) => ImGui.IsMouseHoveringRect(tuple2.TopLeft, tuple2.BottomRight, clip: true));
|
||||
if (num2 >= 0 && num != num2)
|
||||
{
|
||||
quest2 = (_questRegistry.TryGetQuest(_draggedItem, out Quest quest4) ? quest4 : null);
|
||||
index = num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quest != null)
|
||||
{
|
||||
string key = quest.Id.ToString();
|
||||
base.Configuration.Stop.QuestsToStopAfter.Remove(quest.Id);
|
||||
base.Configuration.Stop.QuestSequences.Remove(key);
|
||||
base.Configuration.Stop.QuestStopModes.Remove(key);
|
||||
Save();
|
||||
}
|
||||
if (quest2 != null)
|
||||
{
|
||||
questsToStopAfter.Remove(quest2.Id);
|
||||
questsToStopAfter.Insert(index, quest2.Id);
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCurrentlyAcceptedQuests()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue