mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Some more touches.
This commit is contained in:
parent
ce03fb59c8
commit
fd3a066aee
18 changed files with 64 additions and 136 deletions
2
OtterGui
2
OtterGui
|
|
@ -1 +1 @@
|
|||
Subproject commit ee7815a4f4c91ec04a240c9e52733f2f5ffa15d0
|
||||
Subproject commit 99bd0a889806f0560109686ca3b29a4edfa48f76
|
||||
|
|
@ -5,6 +5,7 @@ using Dalamud.Game.ClientState.Objects.Enums;
|
|||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Penumbra.GameData.Actors;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ using Penumbra.Mods;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Collections.Manager;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Util;
|
||||
using Penumbra.Collections.Manager;
|
||||
|
||||
using Penumbra.Collections.Manager;
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Collections;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ using Penumbra.Services;
|
|||
using Penumbra.UI;
|
||||
using Penumbra.UI.Classes;
|
||||
using Penumbra.UI.Tabs;
|
||||
using Penumbra.Util;
|
||||
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
|
||||
namespace Penumbra;
|
||||
|
|
|
|||
|
|
@ -225,12 +225,9 @@ public unsafe class AnimationHookService : IDisposable
|
|||
}
|
||||
|
||||
var ret = _loadCharacterVfxHook.Original(vfxPath, vfxParams, unk1, unk2, unk3, unk4);
|
||||
#if DEBUG
|
||||
var path = new ByteString(vfxPath);
|
||||
Penumbra.Log.Verbose(
|
||||
$"Load Character VFX: {path} 0x{vfxParams->GameObjectId:X} {vfxParams->TargetCount} {unk1} {unk2} {unk3} {unk4} -> "
|
||||
Penumbra.Log.Excessive(
|
||||
$"Load Character VFX: {new ByteString(vfxPath)} 0x{vfxParams->GameObjectId:X} {vfxParams->TargetCount} {unk1} {unk2} {unk3} {unk4} -> "
|
||||
+ $"0x{ret:X} {_animationLoadData.Value.ModCollection.Name} {_animationLoadData.Value.AssociatedGameObject} {last.ModCollection.Name} {last.AssociatedGameObject}");
|
||||
#endif
|
||||
_animationLoadData.Value = last;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -250,11 +247,9 @@ public unsafe class AnimationHookService : IDisposable
|
|||
: ResolveData.Invalid;
|
||||
|
||||
var ret = _loadAreaVfxHook.Original(vfxId, pos, caster, unk1, unk2, unk3);
|
||||
#if DEBUG
|
||||
Penumbra.Log.Verbose(
|
||||
Penumbra.Log.Excessive(
|
||||
$"Load Area VFX: {vfxId}, {pos[0]} {pos[1]} {pos[2]} {(caster != null ? new ByteString(caster->GetName()).ToString() : "Unknown")} {unk1} {unk2} {unk3}"
|
||||
+ $" -> {ret:X} {_animationLoadData.Value.ModCollection.Name} {_animationLoadData.Value.AssociatedGameObject} {last.ModCollection.Name} {last.AssociatedGameObject}");
|
||||
#endif
|
||||
_animationLoadData.Value = last;
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Newtonsoft.Json;
|
|||
using Newtonsoft.Json.Linq;
|
||||
using OtterGui;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Penumbra.Import;
|
|||
using Penumbra.Import.Structs;
|
||||
using Penumbra.Meta;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using OtterGui.Classes;
|
|||
using Penumbra.Collections;
|
||||
using Penumbra.Meta.Manipulations;
|
||||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.String.Classes;
|
||||
using Penumbra.Util;
|
||||
|
||||
|
|
|
|||
47
Penumbra/Services/ChatService.cs
Normal file
47
Penumbra/Services/ChatService.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using System.Collections.Generic;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Plugin;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using OtterGui.Log;
|
||||
|
||||
namespace Penumbra.Services;
|
||||
|
||||
public class ChatService : OtterGui.Classes.ChatService
|
||||
{
|
||||
private readonly ChatGui _chat;
|
||||
|
||||
public ChatService(Logger log, DalamudPluginInterface pi, ChatGui chat, UiBuilder uiBuilder)
|
||||
: base(log, pi)
|
||||
=> _chat = chat;
|
||||
|
||||
public void LinkItem(Item item)
|
||||
{
|
||||
// @formatter:off
|
||||
var payloadList = new List<Payload>
|
||||
{
|
||||
new UIForegroundPayload((ushort)(0x223 + item.Rarity * 2)),
|
||||
new UIGlowPayload((ushort)(0x224 + item.Rarity * 2)),
|
||||
new ItemPayload(item.RowId, false),
|
||||
new UIForegroundPayload(500),
|
||||
new UIGlowPayload(501),
|
||||
new TextPayload($"{(char)SeIconChar.LinkMarker}"),
|
||||
new UIForegroundPayload(0),
|
||||
new UIGlowPayload(0),
|
||||
new TextPayload(item.Name),
|
||||
new RawPayload(new byte[] { 0x02, 0x27, 0x07, 0xCF, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03 }),
|
||||
new RawPayload(new byte[] { 0x02, 0x13, 0x02, 0xEC, 0x03 }),
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
var payload = new SeString(payloadList);
|
||||
|
||||
_chat.PrintChat(new XivChatEntry
|
||||
{
|
||||
Message = payload,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,8 @@ using System.Text;
|
|||
using OtterGui.Classes;
|
||||
using OtterGui.Log;
|
||||
using Penumbra.Mods;
|
||||
using Penumbra.Services;
|
||||
|
||||
namespace Penumbra.Util;
|
||||
namespace Penumbra.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Any file type that we want to save via SaveService.
|
||||
|
|
@ -18,7 +18,6 @@ using Penumbra.UI;
|
|||
using Penumbra.UI.AdvancedWindow;
|
||||
using Penumbra.UI.ModsTab;
|
||||
using Penumbra.UI.Tabs;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.Services;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,7 @@ using Penumbra.Util;
|
|||
|
||||
namespace Penumbra.Services;
|
||||
|
||||
public interface IServiceWrapper<out T> : IDisposable
|
||||
{
|
||||
public string Name { get; }
|
||||
public T? Service { get; }
|
||||
public bool Valid { get; }
|
||||
}
|
||||
|
||||
public abstract class SyncServiceWrapper<T> : IServiceWrapper<T>
|
||||
public abstract class SyncServiceWrapper<T>
|
||||
{
|
||||
public string Name { get; }
|
||||
public T Service { get; }
|
||||
|
|
@ -40,7 +33,7 @@ public abstract class SyncServiceWrapper<T> : IServiceWrapper<T>
|
|||
}
|
||||
}
|
||||
|
||||
public abstract class AsyncServiceWrapper<T> : IServiceWrapper<T>
|
||||
public abstract class AsyncServiceWrapper<T>
|
||||
{
|
||||
public string Name { get; }
|
||||
public T? Service { get; private set; }
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Dalamud.Data;
|
||||
using Dalamud.Plugin;
|
||||
using OtterGui.Classes;
|
||||
using OtterGui.Widgets;
|
||||
using Penumbra.GameData.Data;
|
||||
using Penumbra.GameData.Files;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ using Penumbra.Mods;
|
|||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.UI.Classes;
|
||||
using Penumbra.Util;
|
||||
using ChatService = Penumbra.Services.ChatService;
|
||||
|
||||
namespace Penumbra.UI.ModsTab;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ using Penumbra.Mods;
|
|||
using Penumbra.Mods.Manager;
|
||||
using Penumbra.Services;
|
||||
using Penumbra.UI.AdvancedWindow;
|
||||
using Penumbra.Util;
|
||||
|
||||
namespace Penumbra.UI.ModsTab;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,109 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Internal.Notifications;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Utility;
|
||||
using Lumina.Excel.GeneratedSheets;
|
||||
using OtterGui.Log;
|
||||
|
||||
namespace Penumbra.Util;
|
||||
|
||||
public class ChatService
|
||||
{
|
||||
private readonly Logger _log;
|
||||
private readonly UiBuilder _uiBuilder;
|
||||
private readonly ChatGui _chat;
|
||||
|
||||
public ChatService(Logger log, DalamudPluginInterface pi, ChatGui chat)
|
||||
{
|
||||
_log = log;
|
||||
_uiBuilder = pi.UiBuilder;
|
||||
_chat = chat;
|
||||
}
|
||||
|
||||
public void LinkItem(Item item)
|
||||
{
|
||||
// @formatter:off
|
||||
var payloadList = new List<Payload>
|
||||
{
|
||||
new UIForegroundPayload((ushort)(0x223 + item.Rarity * 2)),
|
||||
new UIGlowPayload((ushort)(0x224 + item.Rarity * 2)),
|
||||
new ItemPayload(item.RowId, false),
|
||||
new UIForegroundPayload(500),
|
||||
new UIGlowPayload(501),
|
||||
new TextPayload($"{(char)SeIconChar.LinkMarker}"),
|
||||
new UIForegroundPayload(0),
|
||||
new UIGlowPayload(0),
|
||||
new TextPayload(item.Name),
|
||||
new RawPayload(new byte[] { 0x02, 0x27, 0x07, 0xCF, 0x01, 0x01, 0x01, 0xFF, 0x01, 0x03 }),
|
||||
new RawPayload(new byte[] { 0x02, 0x13, 0x02, 0xEC, 0x03 }),
|
||||
};
|
||||
// @formatter:on
|
||||
|
||||
var payload = new SeString(payloadList);
|
||||
|
||||
_chat.PrintChat(new XivChatEntry
|
||||
{
|
||||
Message = payload,
|
||||
});
|
||||
}
|
||||
|
||||
public void NotificationMessage(string content, string? title = null, NotificationType type = NotificationType.None)
|
||||
{
|
||||
var logLevel = type switch
|
||||
{
|
||||
NotificationType.None => Logger.LogLevel.Information,
|
||||
NotificationType.Success => Logger.LogLevel.Information,
|
||||
NotificationType.Warning => Logger.LogLevel.Warning,
|
||||
NotificationType.Error => Logger.LogLevel.Error,
|
||||
NotificationType.Info => Logger.LogLevel.Information,
|
||||
_ => Logger.LogLevel.Debug,
|
||||
};
|
||||
_uiBuilder.AddNotification(content, title, type);
|
||||
_log.Message(logLevel, title.IsNullOrEmpty() ? content : $"[{title}] {content}");
|
||||
}
|
||||
}
|
||||
|
||||
public static class SeStringBuilderExtensions
|
||||
{
|
||||
public const ushort Green = 504;
|
||||
public const ushort Yellow = 31;
|
||||
public const ushort Red = 534;
|
||||
public const ushort Blue = 517;
|
||||
public const ushort White = 1;
|
||||
public const ushort Purple = 541;
|
||||
|
||||
public static SeStringBuilder AddText(this SeStringBuilder sb, string text, int color, bool brackets = false)
|
||||
=> sb.AddUiForeground((ushort)color).AddText(brackets ? $"[{text}]" : text).AddUiForegroundOff();
|
||||
|
||||
public static SeStringBuilder AddGreen(this SeStringBuilder sb, string text, bool brackets = false)
|
||||
=> AddText(sb, text, Green, brackets);
|
||||
|
||||
public static SeStringBuilder AddYellow(this SeStringBuilder sb, string text, bool brackets = false)
|
||||
=> AddText(sb, text, Yellow, brackets);
|
||||
|
||||
public static SeStringBuilder AddRed(this SeStringBuilder sb, string text, bool brackets = false)
|
||||
=> AddText(sb, text, Red, brackets);
|
||||
|
||||
public static SeStringBuilder AddBlue(this SeStringBuilder sb, string text, bool brackets = false)
|
||||
=> AddText(sb, text, Blue, brackets);
|
||||
|
||||
public static SeStringBuilder AddWhite(this SeStringBuilder sb, string text, bool brackets = false)
|
||||
=> AddText(sb, text, White, brackets);
|
||||
|
||||
public static SeStringBuilder AddPurple(this SeStringBuilder sb, string text, bool brackets = false)
|
||||
=> AddText(sb, text, Purple, brackets);
|
||||
|
||||
public static SeStringBuilder AddCommand(this SeStringBuilder sb, string command, string description)
|
||||
=> sb.AddText(" 》 ")
|
||||
.AddBlue(command)
|
||||
.AddText($" - {description}");
|
||||
|
||||
public static SeStringBuilder AddInitialPurple(this SeStringBuilder sb, string word, bool withComma = true)
|
||||
=> sb.AddPurple($"[{word[0]}]")
|
||||
.AddText(withComma ? $"{word[1..]}, " : word[1..]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue