muffin v6.12
This commit is contained in:
parent
060278c1b7
commit
155fbee291
59 changed files with 40083 additions and 58104 deletions
|
@ -25,22 +25,28 @@ internal sealed class StopConditionComponent : ConfigComponent
|
|||
|
||||
private readonly QuestRegistry _questRegistry;
|
||||
|
||||
private readonly QuestFunctions _questFunctions;
|
||||
|
||||
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)
|
||||
private readonly QuestController _questController;
|
||||
|
||||
public StopConditionComponent(IDalamudPluginInterface pluginInterface, QuestSelector questSelector, QuestFunctions questFunctions, QuestRegistry questRegistry, QuestTooltipComponent questTooltipComponent, UiUtils uiUtils, IClientState clientState, QuestController questController, Configuration configuration)
|
||||
: base(pluginInterface, configuration)
|
||||
{
|
||||
StopConditionComponent stopConditionComponent = this;
|
||||
_pluginInterface = pluginInterface;
|
||||
_questSelector = questSelector;
|
||||
_questRegistry = questRegistry;
|
||||
_questFunctions = questFunctions;
|
||||
_questTooltipComponent = questTooltipComponent;
|
||||
_uiUtils = uiUtils;
|
||||
_clientState = clientState;
|
||||
_questController = questController;
|
||||
_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)
|
||||
|
@ -94,7 +100,37 @@ internal sealed class StopConditionComponent : ConfigComponent
|
|||
}
|
||||
}
|
||||
ImGui.Separator();
|
||||
ImGui.Text("Stop when quest sequence reaches:");
|
||||
bool v3 = base.Configuration.Stop.SequenceToStopAfter;
|
||||
if (ImGui.Checkbox("Enable quest sequence stop condition", ref v3))
|
||||
{
|
||||
base.Configuration.Stop.SequenceToStopAfter = v3;
|
||||
Save();
|
||||
}
|
||||
using (ImRaii.Disabled(!v3))
|
||||
{
|
||||
int data2 = base.Configuration.Stop.TargetSequence;
|
||||
ImGui.SetNextItemWidth(100f);
|
||||
if (ImGui.InputInt("Stop at sequence", ref data2, 1, 1))
|
||||
{
|
||||
base.Configuration.Stop.TargetSequence = Math.Max(0, Math.Min(255, data2));
|
||||
Save();
|
||||
}
|
||||
QuestController.QuestProgress currentQuest = _questController.CurrentQuest;
|
||||
if (currentQuest != null)
|
||||
{
|
||||
int sequence = currentQuest.Sequence;
|
||||
ImGui.SameLine();
|
||||
ImU8String text = new ImU8String(11, 1);
|
||||
text.AppendLiteral("(Current: ");
|
||||
text.AppendFormatted(sequence);
|
||||
text.AppendLiteral(")");
|
||||
ImGui.TextDisabled(text);
|
||||
}
|
||||
}
|
||||
ImGui.Separator();
|
||||
ImGui.Text("Stop when completing any of the quests selected below:");
|
||||
DrawCurrentlyAcceptedQuests();
|
||||
_questSelector.DrawSelection();
|
||||
List<ElementId> questsToStopAfter = base.Configuration.Stop.QuestsToStopAfter;
|
||||
if (questsToStopAfter.Count > 0)
|
||||
|
@ -159,4 +195,88 @@ internal sealed class StopConditionComponent : ConfigComponent
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCurrentlyAcceptedQuests()
|
||||
{
|
||||
List<Quest> currentlyAcceptedQuests = GetCurrentlyAcceptedQuests();
|
||||
ImGui.Text("Currently Accepted Quests:");
|
||||
using (ImRaii.IEndObject endObject = ImRaii.Child("AcceptedQuestsList", new Vector2(-1f, 120f), border: true))
|
||||
{
|
||||
if (endObject)
|
||||
{
|
||||
if (currentlyAcceptedQuests.Count > 0)
|
||||
{
|
||||
foreach (Quest item in currentlyAcceptedQuests)
|
||||
{
|
||||
ImU8String id = new ImU8String(13, 1);
|
||||
id.AppendLiteral("AcceptedQuest");
|
||||
id.AppendFormatted(item.Id);
|
||||
using (ImRaii.PushId(id))
|
||||
{
|
||||
(Vector4, FontAwesomeIcon, string) questStyle = _uiUtils.GetQuestStyle(item.Id);
|
||||
bool flag = false;
|
||||
bool flag2 = base.Configuration.Stop.QuestsToStopAfter.Contains(item.Id);
|
||||
using (_pluginInterface.UiBuilder.IconFontFixedWidthHandle.Push())
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(flag2 ? new Vector4(0.5f, 0.5f, 0.5f, 1f) : questStyle.Item1, questStyle.Item2.ToIconString());
|
||||
flag = ImGui.IsItemHovered();
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(flag2 ? new Vector4(0.7f, 0.7f, 0.7f, 1f) : new Vector4(1f, 1f, 1f, 1f), item.Info.Name);
|
||||
if (flag | ImGui.IsItemHovered())
|
||||
{
|
||||
_questTooltipComponent.Draw(item.Info);
|
||||
}
|
||||
using (ImRaii.PushFont(UiBuilder.IconFont))
|
||||
{
|
||||
ImGui.SameLine(ImGui.GetContentRegionAvail().X + ImGui.GetStyle().WindowPadding.X - ImGui.CalcTextSize(FontAwesomeIcon.Plus.ToIconString()).X - ImGui.GetStyle().FramePadding.X * 2f);
|
||||
}
|
||||
using (ImRaii.Disabled(flag2))
|
||||
{
|
||||
if (ImGuiComponents.IconButton($"##Add{item.Id}", FontAwesomeIcon.Plus))
|
||||
{
|
||||
base.Configuration.Stop.QuestsToStopAfter.Add(item.Id);
|
||||
Save();
|
||||
}
|
||||
}
|
||||
if (ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled))
|
||||
{
|
||||
ImGui.SetTooltip(flag2 ? "Quest already added to stop conditions" : "Add this quest to stop conditions");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.7f, 0.7f, 0.7f, 1f));
|
||||
ImGui.TextWrapped("No quests currently accepted");
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui.Spacing();
|
||||
}
|
||||
|
||||
private List<Quest> GetCurrentlyAcceptedQuests()
|
||||
{
|
||||
List<Quest> list = new List<Quest>();
|
||||
try
|
||||
{
|
||||
foreach (Quest allQuest in _questRegistry.AllQuests)
|
||||
{
|
||||
if (_questFunctions.IsQuestAccepted(allQuest.Id))
|
||||
{
|
||||
list.Add(allQuest);
|
||||
}
|
||||
}
|
||||
list.Sort((Quest a, Quest b) => string.Compare(a.Info.Name, b.Info.Name, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
list.Clear();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue