Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ca8d5425e6 | |||
| ef4e46c5e4 | |||
| 3715dcb9ac | |||
| f9ab3462eb | |||
| 8e7d49ca01 | |||
| 966ee43d87 | |||
| e6b7ad7351 | |||
| 95adfcd00f | |||
| 9738948a2a | |||
| 7272365630 | |||
| 94f7b003d2 | |||
| 3f849e69ef |
@@ -35,7 +35,7 @@ namespace Pilz.Dalamud.ActivityContexts
|
||||
PluginServices.ClientState.TerritoryChanged -= ClientState_TerritoryChanged;
|
||||
}
|
||||
|
||||
private void ClientState_TerritoryChanged(object? sender, ushort e)
|
||||
private void ClientState_TerritoryChanged(ushort obj)
|
||||
{
|
||||
CheckCurrentTerritory();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Pilz.Dalamud
|
||||
/// Removes a Payload from a given list.
|
||||
/// Using <code>List.Remove()</code> does not use the reference to compare for some reason. Tis is a workaround.
|
||||
/// </summary>
|
||||
/// <param name="seString"></param>
|
||||
/// <param name="payloads"></param>
|
||||
/// <param name="payload"></param>
|
||||
public static void Remove(this List<Payload> payloads, Payload payload)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Pilz.Dalamud.Nameplates.EventArgs
|
||||
public IntPtr TitlePtr { get; set; }
|
||||
public IntPtr NamePtr { get; set; }
|
||||
public IntPtr FreeCompanyPtr { get; set; }
|
||||
public IntPtr PrefixPtr { get; set; }
|
||||
public bool IsTitleAboveName { get; set; }
|
||||
public bool IsTitleVisible { get; set; }
|
||||
public int IconID { get; set; }
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace Pilz.Dalamud.Nameplates.EventArgs
|
||||
public SafeNameplateObject SafeNameplateObject { get; set; }
|
||||
public SeString Title { get; internal set; }
|
||||
public SeString Name { get; internal set; }
|
||||
public SeString FreeCompany { get; set; }
|
||||
public SeString FreeCompany { get; internal set; }
|
||||
public SeString Prefix { get; internal set; }
|
||||
|
||||
public bool IsTitleAboveName
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||
using Pilz.Dalamud.Nameplates.Model;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using System.Xml.Linq;
|
||||
using Dalamud.Plugin.Services;
|
||||
|
||||
namespace Pilz.Dalamud.Nameplates
|
||||
{
|
||||
@@ -28,9 +29,9 @@ namespace Pilz.Dalamud.Nameplates
|
||||
public event AddonNamePlate_SetPlayerNameManagedEventHandler AddonNamePlate_SetPlayerNameManaged;
|
||||
public delegate void AddonNamePlate_SetPlayerNameManagedEventHandler(AddonNamePlate_SetPlayerNameManagedEventArgs eventArgs);
|
||||
|
||||
[Signature("48 89 5C 24 ?? 48 89 6C 24 ?? 56 57 41 54 41 56 41 57 48 83 EC 40 44 0F B6 E2", DetourName = nameof(SetPlayerNameplateDetour))]
|
||||
private readonly Hook<AddonNamePlate_SetPlayerNameplateDetour>? hook_AddonNamePlate_SetPlayerNameplateDetour = null;
|
||||
private unsafe delegate IntPtr AddonNamePlate_SetPlayerNameplateDetour(IntPtr playerNameplateObjectPtr, bool isTitleAboveName, bool isTitleVisible, IntPtr titlePtr, IntPtr namePtr, IntPtr freeCompanyPtr, int iconId);
|
||||
[Signature("E8 ?? ?? ?? ?? E9 ?? ?? ?? ?? 48 8B 5C 24 ?? 45 38 BE", DetourName = nameof(SetPlayerNameplateDetour))]
|
||||
private Hook<AddonNamePlate_SetPlayerNameplateDetour>? hook_AddonNamePlate_SetPlayerNameplateDetour = null;
|
||||
private unsafe delegate IntPtr AddonNamePlate_SetPlayerNameplateDetour(IntPtr playerNameplateObjectPtr, bool isTitleAboveName, bool isTitleVisible, IntPtr titlePtr, IntPtr namePtr, IntPtr freeCompanyPtr, IntPtr prefix, int iconId);
|
||||
|
||||
/// <summary>
|
||||
/// Defines if all hooks are enabled. If this is false, then there might be something wrong or the class already has been disposed.
|
||||
@@ -52,7 +53,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
/// </summary>
|
||||
public NameplateHooks()
|
||||
{
|
||||
SignatureHelper.Initialise(this);
|
||||
PluginServices.GameInteropProvider.InitializeFromAttributes(this);
|
||||
}
|
||||
|
||||
~NameplateHooks()
|
||||
@@ -86,7 +87,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
return hook != null && hook.IsEnabled;
|
||||
}
|
||||
|
||||
private IntPtr SetPlayerNameplateDetour(IntPtr playerNameplateObjectPtr, bool isTitleAboveName, bool isTitleVisible, IntPtr titlePtr, IntPtr namePtr, IntPtr freeCompanyPtr, int iconId)
|
||||
private IntPtr SetPlayerNameplateDetour(IntPtr playerNameplateObjectPtr, bool isTitleAboveName, bool isTitleVisible, IntPtr titlePtr, IntPtr namePtr, IntPtr freeCompanyPtr, IntPtr prefix, int iconId)
|
||||
{
|
||||
var result = IntPtr.Zero;
|
||||
|
||||
@@ -98,6 +99,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
TitlePtr = titlePtr,
|
||||
NamePtr = namePtr,
|
||||
FreeCompanyPtr = freeCompanyPtr,
|
||||
PrefixPtr = prefix,
|
||||
IsTitleAboveName = isTitleAboveName,
|
||||
IsTitleVisible = isTitleVisible,
|
||||
IconID = iconId
|
||||
@@ -118,6 +120,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
eventArgs.TitlePtr,
|
||||
eventArgs.NamePtr,
|
||||
eventArgs.FreeCompanyPtr,
|
||||
prefix,
|
||||
eventArgs.IconID);
|
||||
};
|
||||
|
||||
@@ -130,6 +133,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
var freeTitle = false;
|
||||
var freeName = false;
|
||||
var freeFreeCompany = false;
|
||||
var freePrefix = false;
|
||||
|
||||
// Create NamePlateObject if possible
|
||||
var namePlateObj = new SafeNameplateObject(playerNameplateObjectPtr);
|
||||
@@ -141,18 +145,20 @@ namespace Pilz.Dalamud.Nameplates
|
||||
SafeNameplateObject = namePlateObj,
|
||||
Title = GameInterfaceHelper.ReadSeString(eventArgs.TitlePtr),
|
||||
Name = GameInterfaceHelper.ReadSeString(eventArgs.NamePtr),
|
||||
FreeCompany = GameInterfaceHelper.ReadSeString(eventArgs.FreeCompanyPtr)
|
||||
FreeCompany = GameInterfaceHelper.ReadSeString(eventArgs.FreeCompanyPtr),
|
||||
Prefix = GameInterfaceHelper.ReadSeString(eventArgs.PrefixPtr)
|
||||
};
|
||||
|
||||
// Get raw string content
|
||||
var titleRaw = managedEventArgs.Title.Encode();
|
||||
var nameRaw = managedEventArgs.Name.Encode();
|
||||
var freeCompanyRaw = managedEventArgs.FreeCompany.Encode();
|
||||
var prefixRaw = managedEventArgs.Prefix.Encode();
|
||||
|
||||
// Invoke Managed Event
|
||||
AddonNamePlate_SetPlayerNameManaged.Invoke(managedEventArgs);
|
||||
|
||||
// Get new Title string ontent
|
||||
// Get new Title string content
|
||||
var titleNewRaw = managedEventArgs.Title.Encode();
|
||||
if (!titleRaw.SequenceEqual(titleNewRaw))
|
||||
{
|
||||
@@ -160,7 +166,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
freeTitle = true;
|
||||
}
|
||||
|
||||
// Get new Name string ontent
|
||||
// Get new Name string content
|
||||
var nameNewRaw = managedEventArgs.Name.Encode();
|
||||
if (!nameRaw.SequenceEqual(nameNewRaw))
|
||||
{
|
||||
@@ -168,7 +174,7 @@ namespace Pilz.Dalamud.Nameplates
|
||||
freeName = true;
|
||||
}
|
||||
|
||||
// Get new Free Company string ontent
|
||||
// Get new Free Company string content
|
||||
var freeCompanyNewRaw = managedEventArgs.FreeCompany.Encode();
|
||||
if (!freeCompanyRaw.SequenceEqual(freeCompanyNewRaw))
|
||||
{
|
||||
@@ -176,6 +182,14 @@ namespace Pilz.Dalamud.Nameplates
|
||||
freeFreeCompany = true;
|
||||
}
|
||||
|
||||
// Get new Prefix string content
|
||||
var prefixNewRaw = managedEventArgs.Prefix.Encode();
|
||||
if (!prefixRaw.SequenceEqual(prefixNewRaw))
|
||||
{
|
||||
eventArgs.PrefixPtr = GameInterfaceHelper.PluginAllocate(prefixNewRaw);
|
||||
freePrefix = true;
|
||||
}
|
||||
|
||||
// Call Original as we changed something
|
||||
callOriginal();
|
||||
|
||||
@@ -186,6 +200,8 @@ namespace Pilz.Dalamud.Nameplates
|
||||
GameInterfaceHelper.PluginFree(eventArgs.NamePtr);
|
||||
if (freeFreeCompany)
|
||||
GameInterfaceHelper.PluginFree(eventArgs.FreeCompanyPtr);
|
||||
if (freePrefix)
|
||||
GameInterfaceHelper.PluginFree(eventArgs.PrefixPtr);
|
||||
}
|
||||
else if(!hasDefaultHookEvent)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Pilz.Dalamud.Nameplates.Tools
|
||||
/// Gets a change of the position of the element of your choice where you can add your payloads.
|
||||
/// </summary>
|
||||
/// <param name="element">The position of your choice.</param>
|
||||
/// <param name="position">The position of your choice.</param>
|
||||
/// <returns></returns>
|
||||
public StringChange GetChange(NameplateElements element, StringPosition position)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Pilz.Dalamud.Nameplates.Tools
|
||||
/// taking into account whether or not the player is in a duty.
|
||||
/// </summary>
|
||||
/// <param name="iconId">The incoming icon id that is being overwritten by the plugin.</param>
|
||||
/// <param name="priorityIconId">The icon id that should be used.</param>
|
||||
/// <param name="activityContext"></param>
|
||||
/// <returns>Whether a priority icon was found.</returns>
|
||||
public bool IsPriorityIcon(int iconId, ActivityContext activityContext)
|
||||
{
|
||||
|
||||
@@ -21,12 +21,21 @@
|
||||
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
|
||||
<Copyright>Pilzinsel64</Copyright>
|
||||
<PackageProjectUrl>https://github.com/Pilzinsel64/Pilz.Dalamud</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/Pilzinsel64/Pilz.Dalamud</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>0.3.1</Version>
|
||||
<Version>0.5.1</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="FFXIVClientStructs">
|
||||
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
|
||||
@@ -58,4 +67,8 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.IoC;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -14,11 +15,12 @@ namespace Pilz.Dalamud
|
||||
{
|
||||
public class PluginServices
|
||||
{
|
||||
[PluginService] public static GameGui GameGui { get; set; } = null;
|
||||
[PluginService] public static DalamudPluginInterface PluginInterface { get; set; } = null;
|
||||
[PluginService] public static ClientState ClientState { get; set; } = null;
|
||||
[PluginService] public static DataManager DataManager { get; set; } = null;
|
||||
[PluginService] public static ObjectTable ObjectTable { get; set; } = null;
|
||||
[PluginService] public static IGameGui GameGui { get; set; } = null;
|
||||
[PluginService] public static IClientState ClientState { get; set; } = null;
|
||||
[PluginService] public static IDataManager DataManager { get; set; } = null;
|
||||
[PluginService] public static IObjectTable ObjectTable { get; set; } = null;
|
||||
[PluginService] public static IGameInteropProvider GameInteropProvider { get; set; } = null;
|
||||
|
||||
public static void Initialize(DalamudPluginInterface dalamudPluginInterface)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ public class NameplateFeature : IDisposable
|
||||
}
|
||||
```
|
||||
|
||||
This is an example of editing the title to "Good Player" and change the color of the name:
|
||||
This is an example of editing the title to "Good Player", make the name italic and also force the title to always be above the name:
|
||||
|
||||
```cs
|
||||
private void Hooks_AddonNamePlate_SetPlayerNameManaged(Pilz.Dalamud.Nameplates.EventArgs.AddonNamePlate_SetPlayerNameManagedEventArgs eventArgs)
|
||||
|
||||
6
packages.lock.json
Normal file
6
packages.lock.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net7.0-windows7.0": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user