99 lines
3.1 KiB
C#
99 lines
3.1 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Numerics;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Game.Text;
|
|
using Dalamud.Interface;
|
|
using Dalamud.Interface.Colors;
|
|
using Dalamud.Interface.Utility.Raii;
|
|
using Questionable.Controller;
|
|
using Questionable.Data;
|
|
using Questionable.Model;
|
|
using Questionable.Windows.QuestComponents;
|
|
|
|
namespace Questionable.Windows.JournalComponents;
|
|
|
|
internal sealed class QuestRewardComponent
|
|
{
|
|
private readonly QuestRegistry _questRegistry;
|
|
|
|
private readonly QuestData _questData;
|
|
|
|
private readonly QuestTooltipComponent _questTooltipComponent;
|
|
|
|
private readonly UiUtils _uiUtils;
|
|
|
|
private bool _showEventRewards;
|
|
|
|
public QuestRewardComponent(QuestRegistry questRegistry, QuestData questData, QuestTooltipComponent questTooltipComponent, UiUtils uiUtils)
|
|
{
|
|
_questRegistry = questRegistry;
|
|
_questData = questData;
|
|
_questTooltipComponent = questTooltipComponent;
|
|
_uiUtils = uiUtils;
|
|
}
|
|
|
|
public void DrawItemRewards()
|
|
{
|
|
using ImRaii.IEndObject endObject = ImRaii.TabItem("Item Rewards");
|
|
if (!(!endObject))
|
|
{
|
|
ImGui.Checkbox("Show rewards from seasonal event quests", ref _showEventRewards);
|
|
ImGui.Spacing();
|
|
ImGui.BulletText("Only untradeable items are listed (e.g. the Wind-up Airship can be sold on the market board).");
|
|
DrawGroup("Mounts", EItemRewardType.Mount);
|
|
DrawGroup("Minions", EItemRewardType.Minion);
|
|
DrawGroup("Orchestrion Rolls", EItemRewardType.OrchestrionRoll);
|
|
DrawGroup("Triple Triad Cards", EItemRewardType.TripleTriadCard);
|
|
DrawGroup("Fashion Accessories", EItemRewardType.FashionAccessory);
|
|
}
|
|
}
|
|
|
|
private void DrawGroup(string label, EItemRewardType type)
|
|
{
|
|
ImU8String label2 = new ImU8String(9, 2);
|
|
label2.AppendFormatted(label);
|
|
label2.AppendLiteral("###Reward");
|
|
label2.AppendFormatted(type);
|
|
if (!ImGui.CollapsingHeader(label2))
|
|
{
|
|
return;
|
|
}
|
|
foreach (ItemReward item in _questData.RedeemableItems.Where((ItemReward x) => x.Type == type).OrderBy<ItemReward, string>((ItemReward x) => x.Name, StringComparer.CurrentCultureIgnoreCase))
|
|
{
|
|
if (!_questData.TryGetQuestInfo(item.ElementId, out IQuestInfo questInfo))
|
|
{
|
|
continue;
|
|
}
|
|
bool flag = questInfo is QuestInfo questInfo2 && questInfo2.IsSeasonalEvent;
|
|
if (!_showEventRewards && flag)
|
|
{
|
|
continue;
|
|
}
|
|
string text = item.Name;
|
|
if (flag)
|
|
{
|
|
text = text + " " + SeIconChar.Clock.ToIconString();
|
|
}
|
|
bool flag2 = item.IsUnlocked();
|
|
Vector4 color = ((!_questRegistry.IsKnownQuest(item.ElementId)) ? ImGuiColors.DalamudGrey : (flag2 ? ImGuiColors.ParsedGreen : ImGuiColors.DalamudRed));
|
|
FontAwesomeIcon icon = (flag2 ? FontAwesomeIcon.Check : FontAwesomeIcon.Times);
|
|
if (!_uiUtils.ChecklistItem(text, color, icon))
|
|
{
|
|
continue;
|
|
}
|
|
using ImRaii.IEndObject endObject = ImRaii.Tooltip();
|
|
if (!(!endObject))
|
|
{
|
|
label2 = new ImU8String(15, 1);
|
|
label2.AppendLiteral("Obtained from: ");
|
|
label2.AppendFormatted(questInfo.Name);
|
|
ImGui.Text(label2);
|
|
using (ImRaii.PushIndent())
|
|
{
|
|
_questTooltipComponent.DrawInner(questInfo, showItemRewards: false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|