Skip to content

Commit

Permalink
Merge pull request #36 from Hiroa/fix/35
Browse files Browse the repository at this point in the history
Fix #35 and add debug tool to detect duty with new territory id
  • Loading branch information
MidoriKami authored Jul 9, 2024
2 parents efc5b96 + 3593a52 commit f5f11ae
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ZodiacBuddy/BonusLight/BonusLightDuty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class BonusLightDuty
{ 292, new( 292, 16) }, // the Bowl of Embers (Hard)
{ 294, new( 294, 16) }, // the Howling Eye (Hard)
{ 293, new( 293, 16) }, // the Navel (Hard)
{ 207, new( 207, 16) }, // Thornmarch (Hard)
{ 1067, new(1067, 16) }, // Thornmarch (Hard)
{ 281, new( 281, 16) }, // the Whorleater (Hard)
{ 374, new( 374, 16) }, // the Striking Tree (Hard)
{ 377, new( 377, 16) }, // the Akh Afah Amphitheatre (Hard)
Expand Down Expand Up @@ -79,10 +79,10 @@ public class BonusLightDuty
{ 361, new( 361, 48) }, // Hullbreaker Isle
{ 373, new( 373, 48) }, // the Tam–Tara Deepcroft (Hard)
{ 365, new( 365, 48) }, // the Stone Vigil (Hard)
{ 371, new( 371, 48) }, // Snowcloak
{ 1062, new(1062, 48) }, // Snowcloak
{ 387, new( 387, 48) }, // Sastasha (Hard)
{ 367, new( 367, 48) }, // the Sunken Temple of Qarn (Hard)
{ 150, new( 150, 48) }, // the Keeper of the Lake
{ 1063, new(1063, 48) }, // the Keeper of the Lake
{ 188, new( 188, 48) }, // the Wanderer's Palace (Hard)
{ 189, new( 189, 48) }, // Amdapor Keep (Hard)

Expand All @@ -104,7 +104,7 @@ private BonusLightDuty(uint territoryId, uint defaultLightIntensity)
.GetRow(territoryId)!
.ContentFinderCondition.Value!.Name
.ToDalamudString()
.ToString()!;
.ToString();
}

/// <summary>
Expand Down Expand Up @@ -133,4 +133,10 @@ public static BonusLightDuty GetValue(uint territoryID)
/// <returns>True if the duty was found, otherwise false.</returns>
public static bool TryGetValue(uint territoryID, out BonusLightDuty? duty)
=> Dataset.TryGetValue(territoryID, out duty);

/// <summary>
/// Gets BonusLightDuty list.
/// </summary>
/// <returns>Dataset of the BonusLightDuty.</returns>
public static Dictionary<uint, BonusLightDuty> GetDataset() => Dataset;
}
9 changes: 9 additions & 0 deletions ZodiacBuddy/ConfigWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public override void Draw()

if (ImGui.CollapsingHeader("Brave"))
this.DrawBrave();

if (Service.Interface.IsDevMenuOpen && ImGui.CollapsingHeader("Debug"))
this.Debug();
}

private void DrawGeneral()
Expand Down Expand Up @@ -243,5 +246,11 @@ private void DrawBrave()

ImGui.Spacing();
}

private void Debug()
{
if (ImGui.Button("Check duties territory"))
DebugTools.CheckBonusLightDutyTerritories();
}
}
}
37 changes: 37 additions & 0 deletions ZodiacBuddy/DebugTools.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Dalamud.Game.Text;
using Dalamud.Game.Text.SeStringHandling;
using ZodiacBuddy.BonusLight;

namespace ZodiacBuddy
{
/// <summary>
/// Static class used to store debug and check functions for dev.
/// </summary>
public static class DebugTools
{
/// <summary>
/// Check that all the territory id have a name in Lumina.
/// <p/>
/// If a territory doesn't have a name, it's id have probably changed and a message is display in chat.
/// </summary>
public static void CheckBonusLightDutyTerritories()
{
foreach (var bonusLightDuty in BonusLightDuty.GetDataset())
{
if (string.IsNullOrWhiteSpace(bonusLightDuty.Value.DutyName))
{
var sb = new SeStringBuilder()
.AddUiForeground(45)
.AddText("[ZodiacBuddy] ")
.AddUiForegroundOff()
.Append($"Invalid territory id {bonusLightDuty.Key}");
Service.ChatGui.Print(new XivChatEntry
{
Type = XivChatType.Echo,
Message = sb.BuiltString,
});
}
}
}
}
}

0 comments on commit f5f11ae

Please sign in to comment.