Skip to content

Commit

Permalink
Update Condition to check for island sanctuary intended use
Browse files Browse the repository at this point in the history
  • Loading branch information
MidoriKami committed Dec 26, 2022
1 parent ee24814 commit 3063fcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion KamiLib.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Game.ClientState;
using Dalamud.Data;
using Dalamud.Game.ClientState;
using Dalamud.Game.Gui;
using Dalamud.IoC;
using Dalamud.Logging;
Expand All @@ -18,6 +19,7 @@ public class Service
[PluginService] public static ChatGui Chat { get; private set; } = null!;
[PluginService] public static GameGui GameGui { get; private set; } = null!;
[PluginService] public static DalamudCondition Condition { get; private set; } = null!;
[PluginService] public static DataManager DataManager { get; private set; } = null!;
}

public static class KamiLib
Expand Down
9 changes: 8 additions & 1 deletion Utilities/Condition.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
using Dalamud.Game.ClientState.Conditions;
using KamiLib.Caching;
using Lumina.Excel.GeneratedSheets;

namespace KamiLib.Utilities;

public static class Condition
{
private static readonly LuminaCache<TerritoryType> TerritoryTypeCache = new();

public static bool IsBoundByDuty()
{
var baseBoundByDuty = Service.Condition[ConditionFlag.BoundByDuty];
var boundBy56 = Service.Condition[ConditionFlag.BoundByDuty56];
var boundBy95 = Service.Condition[ConditionFlag.BoundByDuty95];

if (Service.ClientState.TerritoryType == 1055)
var territoryInfo = TerritoryTypeCache.GetRow(Service.ClientState.TerritoryType);

// Island Sanctuary
if (territoryInfo.TerritoryIntendedUse == 49)
return false;

return baseBoundByDuty || boundBy56 || boundBy95;
Expand Down

0 comments on commit 3063fcf

Please sign in to comment.