public unsafe void Initialize(DalamudPluginInterface pluginInterface) { Interface = pluginInterface; Configuration = pluginInterface.GetPluginConfig() as JobIconsConfiguration ?? new JobIconsConfiguration(); Address = new PluginAddressResolver(); Address.Setup(pluginInterface.TargetModuleScanner); XivApi.Initialize(Interface, Address); IconSet.Initialize(this); SetNamePlateHook = new Hook <SetNamePlateDelegate>(Address.AddonNamePlate_SetNamePlatePtr, new SetNamePlateDelegate(SetNamePlateDetour), this); SetNamePlateHook.Enable(); EmptySeStringPtr = XivApi.StringToSeStringPtr(""); var commandInfo = new CommandInfo(CommandHandler) { HelpMessage = "Opens Job Icons config.", ShowInHelp = true }; Interface.CommandManager.AddHandler(Command1, commandInfo); Interface.CommandManager.AddHandler(Command2, commandInfo); Task.Run(() => FixNamePlates(FixNonPlayerCharacterNamePlatesTokenSource.Token)); PluginGui = new JobIconsGui(this); }
private XivApi(DalamudPluginInterface pluginInterface, PluginAddressResolver address) { Interface = pluginInterface; Address = address; SetNamePlate = Marshal.GetDelegateForFunctionPointer <SetNamePlateDelegate>(address.AddonNamePlate_SetNamePlatePtr); GetUIModule = Marshal.GetDelegateForFunctionPointer <Framework_GetUIModuleDelegate>(address.Framework_GetUIModulePtr); IsObjectIDInParty = Marshal.GetDelegateForFunctionPointer <GroupManager_IsObjectIDInPartyDelegate>(address.GroupManager_IsObjectIDInPartyPtr); IsObjectIDInAlliance = Marshal.GetDelegateForFunctionPointer <GroupManager_IsObjectIDInAllianceDelegate>(address.GroupManager_IsObjectIDInAlliancePtr); SetNodeScale = Marshal.GetDelegateForFunctionPointer <AtkResNode_SetScaleDelegate>(address.AtkResNode_SetScalePtr); SetNodePosition = Marshal.GetDelegateForFunctionPointer <AtkResNode_SetPositionShortDelegate>(address.AtkResNode_SetPositionShortPtr); LookupBattleCharaByObjectID = Marshal.GetDelegateForFunctionPointer <BattleCharaStore_LookupBattleCharaByObjectIDDelegate>(address.BattleCharaStore_LookupBattleCharaByObjectIDPtr); EmptySeStringPtr = StringToSeStringPtr(""); Interface.ClientState.OnLogout += OnLogout_ResetRaptureAtkModule; }
public static void Initialize(DalamudPluginInterface pluginInterface, PluginAddressResolver address) { Instance ??= new XivApi(pluginInterface, address); }