style: reformat
This commit is contained in:
parent
d64db95416
commit
2e0e2a9e38
|
@ -8,7 +8,7 @@ using Dalamud.Logging;
|
|||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
internal class AppearanceRepository {
|
||||
private Plugin Plugin { get; }
|
||||
|
@ -51,7 +51,7 @@ internal class AppearanceRepository {
|
|||
"Yda",
|
||||
"Yugiri",
|
||||
};
|
||||
|
||||
|
||||
internal IReadOnlyDictionary<uint, IReadOnlyList<Item>> JobMainHands { get; }
|
||||
internal IReadOnlyDictionary<uint, IReadOnlyList<Item>> JobOffHands { get; }
|
||||
|
||||
|
@ -88,7 +88,7 @@ internal class AppearanceRepository {
|
|||
if (!jobMainHands.ContainsKey(job.RowId)) {
|
||||
jobMainHands[job.RowId] = new List<Item>();
|
||||
}
|
||||
|
||||
|
||||
if (!jobOffHands.ContainsKey(job.RowId)) {
|
||||
jobOffHands[job.RowId] = new List<Item>();
|
||||
}
|
||||
|
@ -161,13 +161,13 @@ internal class AppearanceRepository {
|
|||
private int GetNpcIndexPersonal(uint objectId) {
|
||||
return new Random((int) (objectId + this.Salt)).Next(0, this.PersonalNpcs.Count);
|
||||
}
|
||||
|
||||
|
||||
internal unsafe ENpcBase GetNpc(uint objectId) {
|
||||
var player = *(GameObject**) this.Plugin.ObjectTable.Address;
|
||||
if (player != null && objectId == player->ObjectID && this.PersonalNpcs.Count > 0) {
|
||||
return this.PersonalNpcs[this.GetNpcIndexPersonal(objectId)];
|
||||
}
|
||||
|
||||
|
||||
return this.Npcs[this.GetNpcIndex(objectId)];
|
||||
}
|
||||
|
||||
|
@ -175,16 +175,16 @@ internal class AppearanceRepository {
|
|||
var random = new Random((int) (objectId + this.Salt));
|
||||
|
||||
var usesOffHand = this.JobOffHands[jobId].Count > 0;
|
||||
|
||||
|
||||
var mainHand = this.JobMainHands[jobId][random.Next(0, this.JobMainHands[jobId].Count)];
|
||||
var mainEquipCategory = mainHand.EquipSlotCategory.Value!;
|
||||
var offHand =
|
||||
mainEquipCategory.MainHand != 0 && mainEquipCategory.OffHand != 0
|
||||
? null
|
||||
: usesOffHand
|
||||
? this.JobOffHands[jobId][random.Next(0, this.JobOffHands[jobId].Count)]
|
||||
: null;
|
||||
|
||||
? null
|
||||
: usesOffHand
|
||||
? this.JobOffHands[jobId][random.Next(0, this.JobOffHands[jobId].Count)]
|
||||
: null;
|
||||
|
||||
return (mainHand, offHand);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using Dalamud.Game.Command;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
internal class Commands : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using Dalamud.Configuration;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
[Serializable]
|
||||
internal class Configuration : IPluginConfiguration {
|
||||
|
@ -23,29 +23,28 @@ internal class Configuration : IPluginConfiguration {
|
|||
public Sex PreferredSex = Sex.Female | Sex.Male;
|
||||
|
||||
public int PreferredRaces = 1 << 1
|
||||
| 1 << 2
|
||||
| 1 << 3
|
||||
| 1 << 4
|
||||
| 1 << 5
|
||||
| 1 << 6
|
||||
| 1 << 7
|
||||
| 1 << 8;
|
||||
|
||||
public int PreferredTribes = 1 << 1
|
||||
| 1 << 2
|
||||
| 1 << 3
|
||||
| 1 << 4
|
||||
| 1 << 5
|
||||
| 1 << 6
|
||||
| 1 << 7
|
||||
| 1 << 8;
|
||||
|
||||
public int PreferredTribes = 1 << 1
|
||||
| 1 << 2
|
||||
| 1 << 3
|
||||
| 1 << 4
|
||||
| 1 << 5
|
||||
| 1 << 6
|
||||
| 1 << 7
|
||||
| 1 << 8
|
||||
| 1 << 9
|
||||
| 1 << 10
|
||||
| 1 << 11
|
||||
| 1 << 12
|
||||
| 1 << 13
|
||||
| 1 << 14
|
||||
| 1 << 15
|
||||
| 1 << 16;
|
||||
|
||||
| 1 << 8
|
||||
| 1 << 9
|
||||
| 1 << 10
|
||||
| 1 << 11
|
||||
| 1 << 12
|
||||
| 1 << 13
|
||||
| 1 << 14
|
||||
| 1 << 15
|
||||
| 1 << 16;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct EquipData {
|
||||
|
|
|
@ -9,7 +9,7 @@ using Dalamud.Utility.Signatures;
|
|||
using FFXIVClientStructs.FFXIV.Client.Game.Object;
|
||||
using FFXIVClientStructs.FFXIV.Client.System.Framework;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
internal class GameFunctions : IDisposable {
|
||||
private static class Signatures {
|
||||
|
@ -60,21 +60,21 @@ internal class GameFunctions : IDisposable {
|
|||
private LoadExdDelegate LoadExd { get; init; } = null!;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Hooks
|
||||
|
||||
[Signature(Signatures.AtkTextNodeSetText, DetourName = nameof(AtkTextNodeSetTextDetour))]
|
||||
private Hook<AtkTextNodeSetTextDelegate> AtkTextNodeSetTextHook { get; init; } = null!;
|
||||
|
||||
|
||||
[Signature(Signatures.CharacterIsMount, DetourName = nameof(CharacterIsMountDetour))]
|
||||
private Hook<CharacterIsMountDelegate> CharacterIsMountHook { get; init; } = null!;
|
||||
|
||||
[Signature(Signatures.CharacterInitialise, DetourName = nameof(CharacterInitialiseDetour))]
|
||||
private Hook<CharacterInitialiseDelegate> CharacterInitializeHook { get; init; } = null!;
|
||||
|
||||
|
||||
[Signature(Signatures.FlagSlotUpdate, DetourName = nameof(FlagSlotUpdateDetour))]
|
||||
private Hook<FlagSlotUpdateDelegate> FlagSlotUpdateHook { get; init; } = null!;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
@ -82,11 +82,11 @@ internal class GameFunctions : IDisposable {
|
|||
internal delegate void AtkTextNodeSetTextEventDelegate(IntPtr node, IntPtr text, ref SeString? overwrite);
|
||||
|
||||
internal event AtkTextNodeSetTextEventDelegate? AtkTextNodeSetText;
|
||||
|
||||
|
||||
internal unsafe delegate void CharacterInitialiseEventDelegate(GameObject* gameObj, IntPtr humanPtr, IntPtr customiseDataPtr);
|
||||
|
||||
|
||||
internal event CharacterInitialiseEventDelegate? CharacterInitialise;
|
||||
|
||||
|
||||
internal unsafe delegate void FlagSlotUpdateEventDelegate(GameObject* gameObj, uint slot, EquipData* equipData);
|
||||
|
||||
internal event FlagSlotUpdateEventDelegate? FlagSlotUpdate;
|
||||
|
@ -149,9 +149,9 @@ internal class GameFunctions : IDisposable {
|
|||
|
||||
this.AtkTextNodeSetTextHook.Original(node, text);
|
||||
}
|
||||
|
||||
|
||||
private IntPtr _lastActor = IntPtr.Zero;
|
||||
|
||||
|
||||
private unsafe IntPtr CharacterIsMountDetour(IntPtr characterPtr) {
|
||||
var chara = (GameObject*) characterPtr;
|
||||
if (chara != null && chara->ObjectKind == (byte) ObjectKind.Pc) {
|
||||
|
@ -174,7 +174,7 @@ internal class GameFunctions : IDisposable {
|
|||
this.HumansToIds.Remove(human);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.HumansToIds[actorPtr] = id;
|
||||
this.CharacterInitialise?.Invoke((GameObject*) this._lastActor, actorPtr, customizeDataPtr);
|
||||
this._lastActor = IntPtr.Zero;
|
||||
|
@ -197,7 +197,7 @@ internal class GameFunctions : IDisposable {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return this.FlagSlotUpdateHook.Original(actorPtr, slot, equipDataPtr);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using Dalamud.Game;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
internal class NameRepository : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
|
|
@ -10,6 +10,7 @@ using Dalamud.Game.ClientState.Objects.Enums;
|
|||
using Dalamud.Game.ClientState.Objects.Types;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Group;
|
||||
using XivCommon.Functions.NamePlates;
|
||||
using GameObject = FFXIVClientStructs.FFXIV.Client.Game.Object.GameObject;
|
||||
|
@ -77,6 +78,10 @@ internal class Obscurer : IDisposable {
|
|||
|
||||
var text = Util.ReadRawSeString(textPtr);
|
||||
|
||||
if (text.Payloads.All(payload => payload is not TextPayload)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var tval = text.TextValue;
|
||||
if (string.IsNullOrWhiteSpace(tval) || tval.All(c => !char.IsLetter(c)) || Coords.IsMatch(tval)) {
|
||||
return;
|
||||
|
@ -173,8 +178,6 @@ internal class Obscurer : IDisposable {
|
|||
Wrists = 7,
|
||||
RightRing = 8,
|
||||
LeftRing = 9,
|
||||
MainHand = 10,
|
||||
OffHand = 11,
|
||||
}
|
||||
|
||||
private unsafe void OnFlagSlotUpdate(GameObject* gameObj, uint slot, EquipData* equipData) {
|
||||
|
@ -202,8 +205,8 @@ internal class Obscurer : IDisposable {
|
|||
EquipSlot.Wrists => (npc.ModelWrists, npc.DyeWrists.Row),
|
||||
EquipSlot.RightRing => (npc.ModelRightRing, npc.DyeRightRing.Row),
|
||||
EquipSlot.LeftRing => (npc.ModelLeftRing, npc.DyeLeftRing.Row),
|
||||
EquipSlot.MainHand => (mainHand.ModelMain, npc.DyeMainHand.Row),
|
||||
EquipSlot.OffHand => (mainHand.ModelSub != 0 ? mainHand.ModelSub : offHand?.ModelMain ?? 0, npc.DyeOffHand.Row),
|
||||
// EquipSlot.MainHand => (mainHand.ModelMain, npc.DyeMainHand.Row),
|
||||
// EquipSlot.OffHand => (mainHand.ModelSub != 0 ? mainHand.ModelSub : offHand?.ModelMain ?? 0, npc.DyeOffHand.Row),
|
||||
_ => (uint.MaxValue, uint.MaxValue),
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ using Dalamud.IoC;
|
|||
using Dalamud.Plugin;
|
||||
using XivCommon;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
public class Plugin : IDalamudPlugin {
|
||||
public string Name => "Nomina Occulta";
|
||||
|
@ -42,7 +42,7 @@ public class Plugin : IDalamudPlugin {
|
|||
|
||||
[PluginService]
|
||||
internal PartyList PartyList { get; private init; }
|
||||
|
||||
|
||||
[PluginService]
|
||||
internal TargetManager TargetManager { get; private init; }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ using Dalamud.Game.ClientState.Keys;
|
|||
using ImGuiNET;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
internal class PluginUi : IDisposable {
|
||||
private Plugin Plugin { get; }
|
||||
|
@ -67,18 +67,18 @@ internal class PluginUi : IDisposable {
|
|||
if (anyChanged) {
|
||||
this.Plugin.Config.PreferredSex = (Sex) sex;
|
||||
}
|
||||
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
|
||||
ImGui.TextUnformatted("Race");
|
||||
foreach (var race in this.Plugin.DataManager.GetExcelSheet<Race>()!) {
|
||||
if (race.RowId == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
var tribe1 = this.Plugin.DataManager.GetExcelSheet<Tribe>()!.GetRow(race.RowId * 2 - 1)!;
|
||||
var tribe2 = this.Plugin.DataManager.GetExcelSheet<Tribe>()!.GetRow(race.RowId * 2)!;
|
||||
|
||||
|
||||
if (ImGui.CheckboxFlags(race.Feminine.RawString, ref this.Plugin.Config.PreferredRaces, 1 << (int) race.RowId)) {
|
||||
anyChanged = true;
|
||||
|
||||
|
@ -90,12 +90,12 @@ internal class PluginUi : IDisposable {
|
|||
this.Plugin.Config.PreferredTribes &= ~(1 << (int) tribe2.RowId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImGui.TreePush();
|
||||
|
||||
anyChanged |= ImGui.CheckboxFlags(tribe1.Feminine.RawString, ref this.Plugin.Config.PreferredTribes, 1 << (int) tribe1.RowId);
|
||||
anyChanged |= ImGui.CheckboxFlags(tribe2.Feminine.RawString, ref this.Plugin.Config.PreferredTribes, 1 << (int) tribe2.RowId);
|
||||
|
||||
|
||||
ImGui.TreePop();
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ internal class PluginUi : IDisposable {
|
|||
this.Plugin.Functions.LoadSheet(Util.SheetName);
|
||||
}
|
||||
|
||||
if (this.Plugin.TargetManager.Target is {} target) {
|
||||
if (this.Plugin.TargetManager.Target is { } target) {
|
||||
var npc = this.Plugin.AppearanceRepository.GetNpc(target.ObjectId);
|
||||
ImGui.TextUnformatted(npc.ToString());
|
||||
ImGui.TextUnformatted(this.Plugin.DataManager.GetExcelSheet<ENpcResident>()!.GetRow(npc.RowId)!.Singular);
|
||||
|
|
|
@ -5,7 +5,7 @@ using Dalamud.Game.ClientState.Objects.Types;
|
|||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
|
||||
namespace NominaOcculta;
|
||||
namespace NominaOcculta;
|
||||
|
||||
internal static class Util {
|
||||
internal const string SheetName = "CharaMakeName";
|
||||
|
|
Loading…
Reference in New Issue