220 lines
4.1 KiB
C#
220 lines
4.1 KiB
C#
using System;
|
|
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
|
|
|
namespace LLib.Buddy;
|
|
|
|
public static class BuddyStateHelper
|
|
{
|
|
public unsafe static bool IsCompanionSummoned()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return false;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.TimeLeft > 0f;
|
|
}
|
|
|
|
public unsafe static bool IsCompanionMounted()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return false;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.Mounted;
|
|
}
|
|
|
|
public unsafe static string GetCompanionName()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.NameString;
|
|
}
|
|
|
|
public unsafe static byte GetCompanionColorStainId()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.CurrentColorStainId;
|
|
}
|
|
|
|
public unsafe static byte GetCompanionRank()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.Rank;
|
|
}
|
|
|
|
public unsafe static uint GetCompanionCurrentXP()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0u;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.CurrentXP;
|
|
}
|
|
|
|
public unsafe static byte GetCompanionStars()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.Stars;
|
|
}
|
|
|
|
public unsafe static byte GetCompanionSkillPoints()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.SkillPoints;
|
|
}
|
|
|
|
public unsafe static byte GetDefenderLevel()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.Levels[0];
|
|
}
|
|
|
|
public unsafe static byte GetAttackerLevel()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.Levels[1];
|
|
}
|
|
|
|
public unsafe static byte GetHealerLevel()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.Levels[2];
|
|
}
|
|
|
|
public unsafe static (byte Head, byte Chest, byte Feet) GetEquippedBardingIds()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return (Head: 0, Chest: 0, Feet: 0);
|
|
}
|
|
Span<byte> buddyEquipRowIds = ptr->Buddy.CompanionInfo.BuddyEquipRowIds;
|
|
return (Head: buddyEquipRowIds[0], Chest: buddyEquipRowIds[1], Feet: buddyEquipRowIds[2]);
|
|
}
|
|
|
|
public unsafe static bool IsBardingUnlocked(uint bardingId)
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr != null)
|
|
{
|
|
return ptr->Buddy.CompanionInfo.IsBuddyEquipUnlocked(bardingId);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public unsafe static byte GetActiveCommand()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.ActiveCommand;
|
|
}
|
|
|
|
public unsafe static byte GetFavoriteFeed()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.CompanionInfo.FavoriteFeed;
|
|
}
|
|
|
|
public unsafe static bool IsPetSummoned()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (ptr->Buddy.PetInfo.Pet != null)
|
|
{
|
|
return ptr->Buddy.PetInfo.Pet->EntityId != 0;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public unsafe static byte GetPetOrder()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.PetInfo.Order;
|
|
}
|
|
|
|
public unsafe static byte GetPetStance()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return 0;
|
|
}
|
|
return ptr->Buddy.PetInfo.Stance;
|
|
}
|
|
|
|
public unsafe static bool IsBattleBuddyPresent()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return false;
|
|
}
|
|
Span<FFXIVClientStructs.FFXIV.Client.Game.UI.Buddy.BuddyMember> battleBuddies = ptr->Buddy.BattleBuddies;
|
|
for (int i = 0; i < battleBuddies.Length; i++)
|
|
{
|
|
if (battleBuddies[i].EntityId != 0)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public unsafe static bool HasDutyHelpers()
|
|
{
|
|
UIState* ptr = UIState.Instance();
|
|
if (ptr == null)
|
|
{
|
|
return false;
|
|
}
|
|
return ptr->Buddy.DutyHelperInfo.HasHelpers;
|
|
}
|
|
}
|