Compare commits

...

4 Commits

Author SHA1 Message Date
Anna 1ba35b67c9
refactor: use helper method 2022-05-11 00:01:34 -04:00
Anna 13f4da7283
fix: check enum instead 2022-05-10 23:59:40 -04:00
Anna a0e3e5f6a8
style: reformat 2022-05-10 23:58:40 -04:00
Anna 0553e1ceb3
fix: don't check for contains before replace 2022-05-10 23:57:52 -04:00
10 changed files with 64 additions and 66 deletions

View File

@ -47,5 +47,4 @@ internal class Configuration : IPluginConfiguration {
| 1 << 14
| 1 << 15
| 1 << 16;
}

View File

@ -77,6 +77,10 @@ internal class Obscurer : IDisposable {
var text = Util.ReadRawSeString(textPtr);
if (text.Payloads.All(payload => payload.Type != PayloadType.RawText)) {
return;
}
var tval = text.TextValue;
if (string.IsNullOrWhiteSpace(tval) || tval.All(c => !char.IsLetter(c)) || Coords.IsMatch(tval)) {
return;
@ -106,8 +110,7 @@ internal class Obscurer : IDisposable {
return false;
}
var gameChara = (FFXIVClientStructs.FFXIV.Client.Game.Character.Character*) chara.Address;
var name = Marshal.PtrToStringUTF8((IntPtr) gameChara->GameObject.Name)!;
var name = chara.RawName()!;
if (this.Plugin.Config.ObscureAppearancesExcludeFriends && this.Friends.Contains(name)) {
return false;
@ -173,8 +176,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 +203,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),
};

View File

@ -24,9 +24,7 @@ internal static class Util {
//
// break;
case TextPayload txt:
if (txt.Text.Contains(name)) {
txt.Text = txt.Text.Replace(name, replacement);
}
break;
}