using System; using Dalamud.Plugin; using Dalamud.Plugin.Services; using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; using XivCommon.Functions; using XivCommon.Functions.FriendList; using XivCommon.Functions.Housing; using XivCommon.Functions.NamePlates; using XivCommon.Functions.Tooltips; using Framework = FFXIVClientStructs.FFXIV.Client.System.Framework.Framework; namespace XivCommon; /// /// A class containing game functions /// public class GameFunctions : IDisposable { private IGameGui GameGui { get; } private IFramework Framework { get; } internal UiAlloc UiAlloc { get; } /// /// Chat functions /// public Chat Chat { get; } /// /// Party Finder functions and events /// public PartyFinder PartyFinder { get; } /// /// BattleTalk functions and events /// public BattleTalk BattleTalk { get; } /// /// Examine functions /// public Examine Examine { get; } /// /// Talk events /// public Talk Talk { get; } /// /// Chat bubble functions and events /// public ChatBubbles ChatBubbles { get; } /// /// Tooltip events /// public Tooltips Tooltips { get; } /// /// Name plate tools and events /// public NamePlates NamePlates { get; } /// /// Duty Finder functions /// public DutyFinder DutyFinder { get; } /// /// Friend list functions /// public FriendList FriendList { get; } /// /// Journal functions /// public Journal Journal { get; } /// /// Housing functions /// public Housing Housing { get; } internal GameFunctions(DalamudPluginInterface @interface, Hooks hooks) { var services = @interface.Create(); if (services == null) { throw new Exception("could not create services"); } Logger.Log = services.Log; this.Framework = services.Framework; this.GameGui = services.GameGui; var interop = services.GameInteropProvider; var objectTable = services.ObjectTable; var partyFinderGui = services.PartyFinderGui; var scanner = services.SigScanner; this.UiAlloc = new UiAlloc(scanner); this.Chat = new Chat(scanner); this.PartyFinder = new PartyFinder(scanner, partyFinderGui, interop, hooks); this.BattleTalk = new BattleTalk(interop, hooks.HasFlag(Hooks.BattleTalk)); this.Examine = new Examine(scanner); this.Talk = new Talk(scanner, interop, hooks.HasFlag(Hooks.Talk)); this.ChatBubbles = new ChatBubbles(objectTable, scanner, interop, hooks.HasFlag(Hooks.ChatBubbles)); this.Tooltips = new Tooltips(scanner, this.GameGui, interop, hooks.HasFlag(Hooks.Tooltips)); this.NamePlates = new NamePlates(this, scanner, interop, hooks.HasFlag(Hooks.NamePlates)); this.DutyFinder = new DutyFinder(scanner); this.Journal = new Journal(scanner); this.FriendList = new FriendList(); this.Housing = new Housing(scanner); } /// public void Dispose() { this.NamePlates.Dispose(); this.Tooltips.Dispose(); this.ChatBubbles.Dispose(); this.Talk.Dispose(); this.BattleTalk.Dispose(); this.PartyFinder.Dispose(); } /// /// Convenience method to get a pointer to . /// /// pointer to struct [Obsolete("Use Framework.Instance()")] public unsafe Framework* GetFramework() { return FFXIVClientStructs.FFXIV.Client.System.Framework.Framework.Instance(); } /// /// Gets the pointer to the UI module /// /// Pointer [Obsolete("Use Framework.Instance()->GetUiModule()")] public unsafe IntPtr GetUiModule() { return (IntPtr) this.GetFramework()->GetUiModule(); } /// /// Gets the pointer to the RaptureAtkModule /// /// Pointer [Obsolete("Use Framework.Instance()->GetUiModule()->GetRaptureAtkModule()")] public unsafe IntPtr GetAtkModule() { return (IntPtr) this.GetFramework()->GetUiModule()->GetRaptureAtkModule(); } /// /// Gets the pointer to the agent module /// /// Pointer [Obsolete("Use Framework.Instance()->GetUiModule()->GetAgentModule()")] public unsafe IntPtr GetAgentModule() { return (IntPtr) this.GetFramework()->GetUiModule()->GetAgentModule(); } /// /// Gets the pointer to an agent from its internal ID. /// /// internal id of agent /// Pointer /// if the signature for the function could not be found [Obsolete("Use Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId)")] public unsafe IntPtr GetAgentByInternalId(uint id) { return (IntPtr) this.GetFramework()->GetUiModule()->GetAgentModule()->GetAgentByInternalId((AgentId) id); } /// /// Gets the pointer to the AtkStage singleton /// /// Pointer /// if the signature for the function could not be found [Obsolete("Use AtkStage.GetSingleton()")] public unsafe IntPtr GetAtkStageSingleton() { return (IntPtr) AtkStage.GetSingleton(); } }