Remove this. everywhere, add small note to override style
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>1.20.2</Version>
|
<Version>1.20.3</Version>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|||||||
+11
-11
@@ -12,14 +12,14 @@ internal abstract class Chunk {
|
|||||||
internal Payload? Link { get; set; }
|
internal Payload? Link { get; set; }
|
||||||
|
|
||||||
protected Chunk(ChunkSource source, Payload? link) {
|
protected Chunk(ChunkSource source, Payload? link) {
|
||||||
this.Source = source;
|
Source = source;
|
||||||
this.Link = link;
|
Link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal SeString? GetSeString() => this.Source switch {
|
internal SeString? GetSeString() => Source switch {
|
||||||
ChunkSource.None => null,
|
ChunkSource.None => null,
|
||||||
ChunkSource.Sender => this.Message?.SenderSource,
|
ChunkSource.Sender => Message?.SenderSource,
|
||||||
ChunkSource.Content => this.Message?.ContentSource,
|
ChunkSource.Content => Message?.ContentSource,
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ internal class TextChunk : Chunk {
|
|||||||
internal string Content { get; set; }
|
internal string Content { get; set; }
|
||||||
|
|
||||||
internal TextChunk(ChunkSource source, Payload? link, string content) : base(source, link) {
|
internal TextChunk(ChunkSource source, Payload? link, string content) : base(source, link) {
|
||||||
this.Content = content;
|
Content = content;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CS8618
|
#pragma warning disable CS8618
|
||||||
@@ -66,10 +66,10 @@ internal class TextChunk : Chunk {
|
|||||||
public TextChunk NewWithStyle(ChunkSource source, Payload? link, string content)
|
public TextChunk NewWithStyle(ChunkSource source, Payload? link, string content)
|
||||||
{
|
{
|
||||||
return new TextChunk(source, link, content) {
|
return new TextChunk(source, link, content) {
|
||||||
FallbackColour = this.FallbackColour,
|
FallbackColour = FallbackColour,
|
||||||
Foreground = this.Foreground,
|
Foreground = Foreground,
|
||||||
Glow = this.Glow,
|
Glow = Glow,
|
||||||
Italic = this.Italic,
|
Italic = Italic,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ internal class IconChunk : Chunk {
|
|||||||
internal BitmapFontIcon Icon { get; set; }
|
internal BitmapFontIcon Icon { get; set; }
|
||||||
|
|
||||||
public IconChunk(ChunkSource source, Payload? link, BitmapFontIcon icon) : base(source, link) {
|
public IconChunk(ChunkSource source, Payload? link, BitmapFontIcon icon) : base(source, link) {
|
||||||
this.Icon = icon;
|
Icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IconChunk() : base(ChunkSource.None, null) {
|
public IconChunk() : base(ChunkSource.None, null) {
|
||||||
|
|||||||
+12
-12
@@ -10,24 +10,24 @@ internal class ChatCode {
|
|||||||
internal ChatType Type { get; }
|
internal ChatType Type { get; }
|
||||||
internal ChatSource Source { get; }
|
internal ChatSource Source { get; }
|
||||||
internal ChatSource Target { get; }
|
internal ChatSource Target { get; }
|
||||||
private ChatSource SourceFrom(ushort shift) => (ChatSource) (1 << ((this.Raw >> shift) & 0xF));
|
private ChatSource SourceFrom(ushort shift) => (ChatSource) (1 << ((Raw >> shift) & 0xF));
|
||||||
|
|
||||||
internal ChatCode(ushort raw) {
|
internal ChatCode(ushort raw) {
|
||||||
this.Raw = raw;
|
Raw = raw;
|
||||||
this.Type = (ChatType) (this.Raw & Clear7);
|
Type = (ChatType) (Raw & Clear7);
|
||||||
this.Source = this.SourceFrom(11);
|
Source = SourceFrom(11);
|
||||||
this.Target = this.SourceFrom(7);
|
Target = SourceFrom(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BsonCtor]
|
[BsonCtor]
|
||||||
public ChatCode(ushort raw, ChatType type, ChatSource source, ChatSource target) {
|
public ChatCode(ushort raw, ChatType type, ChatSource source, ChatSource target) {
|
||||||
this.Raw = raw;
|
Raw = raw;
|
||||||
this.Type = type;
|
Type = type;
|
||||||
this.Source = source;
|
Source = source;
|
||||||
this.Target = target;
|
Target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal ChatType Parent() => this.Type switch {
|
internal ChatType Parent() => Type switch {
|
||||||
ChatType.Say => ChatType.Say,
|
ChatType.Say => ChatType.Say,
|
||||||
ChatType.GmSay => ChatType.Say,
|
ChatType.GmSay => ChatType.Say,
|
||||||
ChatType.Shout => ChatType.Shout,
|
ChatType.Shout => ChatType.Shout,
|
||||||
@@ -81,11 +81,11 @@ internal class ChatCode {
|
|||||||
ChatType.FreeCompanyLoginLogout => ChatType.FreeCompanyAnnouncement,
|
ChatType.FreeCompanyLoginLogout => ChatType.FreeCompanyAnnouncement,
|
||||||
ChatType.PvpTeamAnnouncement => ChatType.PvpTeamAnnouncement,
|
ChatType.PvpTeamAnnouncement => ChatType.PvpTeamAnnouncement,
|
||||||
ChatType.PvpTeamLoginLogout => ChatType.PvpTeamAnnouncement,
|
ChatType.PvpTeamLoginLogout => ChatType.PvpTeamAnnouncement,
|
||||||
_ => this.Type,
|
_ => Type,
|
||||||
};
|
};
|
||||||
|
|
||||||
internal bool IsBattle() {
|
internal bool IsBattle() {
|
||||||
switch (this.Type) {
|
switch (Type) {
|
||||||
case ChatType.Damage:
|
case ChatType.Damage:
|
||||||
case ChatType.Miss:
|
case ChatType.Miss:
|
||||||
case ChatType.Action:
|
case ChatType.Action:
|
||||||
|
|||||||
+12
-12
@@ -7,18 +7,18 @@ internal sealed class Commands : IDisposable {
|
|||||||
private Dictionary<string, CommandWrapper> Registered { get; } = new();
|
private Dictionary<string, CommandWrapper> Registered { get; } = new();
|
||||||
|
|
||||||
internal Commands(Plugin plugin) {
|
internal Commands(Plugin plugin) {
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
foreach (var name in this.Registered.Keys) {
|
foreach (var name in Registered.Keys) {
|
||||||
Plugin.CommandManager.RemoveHandler(name);
|
Plugin.CommandManager.RemoveHandler(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Initialise() {
|
internal void Initialise() {
|
||||||
foreach (var wrapper in this.Registered.Values) {
|
foreach (var wrapper in Registered.Values) {
|
||||||
Plugin.CommandManager.AddHandler(wrapper.Name, new CommandInfo(this.Invoke) {
|
Plugin.CommandManager.AddHandler(wrapper.Name, new CommandInfo(Invoke) {
|
||||||
HelpMessage = wrapper.Description ?? string.Empty,
|
HelpMessage = wrapper.Description ?? string.Empty,
|
||||||
ShowInHelp = wrapper.ShowInHelp,
|
ShowInHelp = wrapper.ShowInHelp,
|
||||||
});
|
});
|
||||||
@@ -26,7 +26,7 @@ internal sealed class Commands : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal CommandWrapper Register(string name, string? description = null, bool? showInHelp = null) {
|
internal CommandWrapper Register(string name, string? description = null, bool? showInHelp = null) {
|
||||||
if (this.Registered.TryGetValue(name, out var wrapper)) {
|
if (Registered.TryGetValue(name, out var wrapper)) {
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
wrapper.Description = description;
|
wrapper.Description = description;
|
||||||
}
|
}
|
||||||
@@ -38,12 +38,12 @@ internal sealed class Commands : IDisposable {
|
|||||||
return wrapper;
|
return wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Registered[name] = new CommandWrapper(name, description, showInHelp ?? true);
|
Registered[name] = new CommandWrapper(name, description, showInHelp ?? true);
|
||||||
return this.Registered[name];
|
return Registered[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Invoke(string command, string arguments) {
|
private void Invoke(string command, string arguments) {
|
||||||
if (!this.Registered.TryGetValue(command, out var wrapper)) {
|
if (!Registered.TryGetValue(command, out var wrapper)) {
|
||||||
Plugin.Log.Warning($"Missing registration for command {command}");
|
Plugin.Log.Warning($"Missing registration for command {command}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -64,12 +64,12 @@ internal sealed class CommandWrapper {
|
|||||||
internal event Action<string, string>? Execute;
|
internal event Action<string, string>? Execute;
|
||||||
|
|
||||||
internal CommandWrapper(string name, string? description, bool showInHelp) {
|
internal CommandWrapper(string name, string? description, bool showInHelp) {
|
||||||
this.Name = name;
|
Name = name;
|
||||||
this.Description = description;
|
Description = description;
|
||||||
this.ShowInHelp = showInHelp;
|
ShowInHelp = showInHelp;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Invoke(string command, string arguments) {
|
internal void Invoke(string command, string arguments) {
|
||||||
this.Execute?.Invoke(command, arguments);
|
Execute?.Invoke(command, arguments);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,21 +39,21 @@ internal sealed unsafe class Context {
|
|||||||
private Plugin Plugin { get; }
|
private Plugin Plugin { get; }
|
||||||
|
|
||||||
internal Context(Plugin plugin) {
|
internal Context(Plugin plugin) {
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InviteToNoviceNetwork(string name, ushort world) {
|
internal void InviteToNoviceNetwork(string name, ushort world) {
|
||||||
if (this._inviteToNoviceNetwork == null) {
|
if (_inviteToNoviceNetwork == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.3: 221EFD
|
// 6.3: 221EFD
|
||||||
var a1 = this.Plugin.Functions.GetInfoProxyByIndex(0x14);
|
var a1 = Plugin.Functions.GetInfoProxyByIndex(0x14);
|
||||||
|
|
||||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||||
// can specify content id if we have it, but there's no need
|
// can specify content id if we have it, but there's no need
|
||||||
this._inviteToNoviceNetwork(a1, 0, world, namePtr);
|
_inviteToNoviceNetwork(a1, 0, world, namePtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,48 +66,48 @@ internal sealed unsafe class Context {
|
|||||||
// 0x10006: search recipes using this material
|
// 0x10006: search recipes using this material
|
||||||
|
|
||||||
internal void TryOn(uint itemId, byte stainId) {
|
internal void TryOn(uint itemId, byte stainId) {
|
||||||
if (this._tryOn == null) {
|
if (_tryOn == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._tryOn(0xFF, itemId, stainId, 0, 0);
|
_tryOn(0xFF, itemId, stainId, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void LinkItem(uint itemId) {
|
internal void LinkItem(uint itemId) {
|
||||||
if (this._linkItem == null) {
|
if (_linkItem == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ChatLog);
|
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ChatLog);
|
||||||
this._linkItem(agent, itemId);
|
_linkItem(agent, itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OpenItemComparison(uint itemId) {
|
internal void OpenItemComparison(uint itemId) {
|
||||||
if (this._itemComparison == null) {
|
if (_itemComparison == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ItemCompare);
|
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.ItemCompare);
|
||||||
this._itemComparison(agent, 0x4D, itemId, 0);
|
_itemComparison(agent, 0x4D, itemId, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SearchForRecipesUsingItem(uint itemId) {
|
internal void SearchForRecipesUsingItem(uint itemId) {
|
||||||
if (this._searchForRecipesUsingItem == null || this._searchForRecipesUsingItemVfunc is not { } offset) {
|
if (_searchForRecipesUsingItem == null || _searchForRecipesUsingItemVfunc is not { } offset) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uiModule = Framework.Instance()->GetUiModule();
|
var uiModule = Framework.Instance()->GetUiModule();
|
||||||
var vf = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[offset / 8];
|
var vf = (delegate* unmanaged<UIModule*, IntPtr>) uiModule->vfunc[offset / 8];
|
||||||
var a1 = vf(uiModule);
|
var a1 = vf(uiModule);
|
||||||
this._searchForRecipesUsingItem(a1, itemId);
|
_searchForRecipesUsingItem(a1, itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SearchForItem(uint itemId) {
|
internal void SearchForItem(uint itemId) {
|
||||||
if (this._searchForItem == null) {
|
if (_searchForItem == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemFinder = Framework.Instance()->GetUiModule()->GetItemFinderModule();
|
var itemFinder = Framework.Instance()->GetUiModule()->GetItemFinderModule();
|
||||||
this._searchForItem(itemFinder, itemId, 1);
|
_searchForItem(itemFinder, itemId, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,26 +66,26 @@ internal unsafe class GameFunctions : IDisposable {
|
|||||||
internal Context Context { get; }
|
internal Context Context { get; }
|
||||||
|
|
||||||
internal GameFunctions(Plugin plugin) {
|
internal GameFunctions(Plugin plugin) {
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
this.Party = new Party(this.Plugin);
|
Party = new Party(Plugin);
|
||||||
this.Chat = new Chat(this.Plugin);
|
Chat = new Chat(Plugin);
|
||||||
this.Context = new Context(this.Plugin);
|
Context = new Context(Plugin);
|
||||||
|
|
||||||
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
||||||
|
|
||||||
this.ResolveTextCommandPlaceholderHook?.Enable();
|
ResolveTextCommandPlaceholderHook?.Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
this.Chat.Dispose();
|
Chat.Dispose();
|
||||||
|
|
||||||
this.ResolveTextCommandPlaceholderHook?.Dispose();
|
ResolveTextCommandPlaceholderHook?.Dispose();
|
||||||
|
|
||||||
Marshal.FreeHGlobal(this._placeholderNamePtr);
|
Marshal.FreeHGlobal(_placeholderNamePtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IntPtr GetInfoModule() {
|
private IntPtr GetInfoModule() {
|
||||||
if (this._infoModuleVfunc is not { } vfunc) {
|
if (_infoModuleVfunc is not { } vfunc) {
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,25 +95,25 @@ internal unsafe class GameFunctions : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal IntPtr GetInfoProxyByIndex(uint idx) {
|
internal IntPtr GetInfoProxyByIndex(uint idx) {
|
||||||
var infoModule = this.GetInfoModule();
|
var infoModule = GetInfoModule();
|
||||||
return infoModule == IntPtr.Zero ? IntPtr.Zero : this._getInfoProxyByIndex(infoModule, idx);
|
return infoModule == IntPtr.Zero ? IntPtr.Zero : _getInfoProxyByIndex(infoModule, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal uint? GetCurrentChatLogEntryIndex() {
|
internal uint? GetCurrentChatLogEntryIndex() {
|
||||||
if (this._currentChatEntryOffset == null) {
|
if (_currentChatEntryOffset == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var log = (IntPtr) Framework.Instance()->GetUiModule()->GetRaptureLogModule();
|
var log = (IntPtr) Framework.Instance()->GetUiModule()->GetRaptureLogModule();
|
||||||
return *(uint*) (log + this._currentChatEntryOffset.Value);
|
return *(uint*) (log + _currentChatEntryOffset.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SendFriendRequest(string name, ushort world) {
|
internal void SendFriendRequest(string name, ushort world) {
|
||||||
this.ListCommand(name, world, "friendlist");
|
ListCommand(name, world, "friendlist");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddToBlacklist(string name, ushort world) {
|
internal void AddToBlacklist(string name, ushort world) {
|
||||||
this.ListCommand(name, world, "blist");
|
ListCommand(name, world, "blist");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ListCommand(string name, ushort world, string commandName) {
|
private void ListCommand(string name, ushort world, string commandName) {
|
||||||
@@ -123,8 +123,8 @@ internal unsafe class GameFunctions : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var worldName = row.Name.RawString;
|
var worldName = row.Name.RawString;
|
||||||
this._replacementName = $"{name}@{worldName}";
|
_replacementName = $"{name}@{worldName}";
|
||||||
this.Plugin.Common.Functions.Chat.SendMessage($"/{commandName} add {this._placeholder}");
|
Plugin.Common.Functions.Chat.SendMessage($"/{commandName} add {_placeholder}");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void SetAddonInteractable(string name, bool interactable) {
|
internal static void SetAddonInteractable(string name, bool interactable) {
|
||||||
@@ -236,41 +236,41 @@ internal unsafe class GameFunctions : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal bool IsMentor() {
|
internal bool IsMentor() {
|
||||||
if (this._isMentor == null || this._isMentorA1 == null || this._isMentorA1.Value == IntPtr.Zero) {
|
if (_isMentor == null || _isMentorA1 == null || _isMentorA1.Value == IntPtr.Zero) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._isMentor(this._isMentorA1.Value) > 0;
|
return _isMentor(_isMentorA1.Value) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OpenPartyFinder(uint id) {
|
internal void OpenPartyFinder(uint id) {
|
||||||
if (this._openPartyFinder == null) {
|
if (_openPartyFinder == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.LookingForGroup);
|
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.LookingForGroup);
|
||||||
if (agent != null) {
|
if (agent != null) {
|
||||||
this._openPartyFinder(agent, id);
|
_openPartyFinder(agent, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void OpenAchievement(uint id) {
|
internal void OpenAchievement(uint id) {
|
||||||
if (this._openAchievement == null) {
|
if (_openAchievement == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Achievement);
|
var agent = Framework.Instance()->GetUiModule()->GetAgentModule()->GetAgentByInternalId(AgentId.Achievement);
|
||||||
if (agent != null) {
|
if (agent != null) {
|
||||||
this._openAchievement(agent, id);
|
_openAchievement(agent, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool IsInInstance() {
|
internal bool IsInInstance() {
|
||||||
if (this._inInstance == null) {
|
if (_inInstance == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._inInstance() != 0;
|
return _inInstance() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool TryOpenAdventurerPlate(ulong playerId)
|
internal bool TryOpenAdventurerPlate(ulong playerId)
|
||||||
@@ -304,21 +304,21 @@ internal unsafe class GameFunctions : IDisposable {
|
|||||||
private string? _replacementName;
|
private string? _replacementName;
|
||||||
|
|
||||||
private IntPtr ResolveTextCommandPlaceholderDetour(IntPtr a1, byte* placeholderText, byte a3, byte a4) {
|
private IntPtr ResolveTextCommandPlaceholderDetour(IntPtr a1, byte* placeholderText, byte a3, byte a4) {
|
||||||
if (this._replacementName == null) {
|
if (_replacementName == null) {
|
||||||
goto Original;
|
goto Original;
|
||||||
}
|
}
|
||||||
|
|
||||||
var placeholder = MemoryHelper.ReadStringNullTerminated((IntPtr) placeholderText);
|
var placeholder = MemoryHelper.ReadStringNullTerminated((IntPtr) placeholderText);
|
||||||
if (placeholder != this._placeholder) {
|
if (placeholder != _placeholder) {
|
||||||
goto Original;
|
goto Original;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryHelper.WriteString(this._placeholderNamePtr, this._replacementName);
|
MemoryHelper.WriteString(_placeholderNamePtr, _replacementName);
|
||||||
this._replacementName = null;
|
_replacementName = null;
|
||||||
|
|
||||||
return this._placeholderNamePtr;
|
return _placeholderNamePtr;
|
||||||
|
|
||||||
Original:
|
Original:
|
||||||
return this.ResolveTextCommandPlaceholderHook!.Original(a1, placeholderText, a3, a4);
|
return ResolveTextCommandPlaceholderHook!.Original(a1, placeholderText, a3, a4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,57 +25,57 @@ internal sealed unsafe class Party {
|
|||||||
private Plugin Plugin { get; }
|
private Plugin Plugin { get; }
|
||||||
|
|
||||||
internal Party(Plugin plugin) {
|
internal Party(Plugin plugin) {
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
Plugin.GameInteropProvider.InitializeFromAttributes(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InviteSameWorld(string name, ushort world, ulong contentId) {
|
internal void InviteSameWorld(string name, ushort world, ulong contentId) {
|
||||||
if (this._inviteToParty == null) {
|
if (_inviteToParty == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.11: 214A55
|
// 6.11: 214A55
|
||||||
var a1 = this.Plugin.Functions.GetInfoProxyByIndex(2);
|
var a1 = Plugin.Functions.GetInfoProxyByIndex(2);
|
||||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||||
// this only works if target is on the same world
|
// this only works if target is on the same world
|
||||||
this._inviteToParty(a1, contentId, namePtr, world);
|
_inviteToParty(a1, contentId, namePtr, world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InviteOtherWorld(ulong contentId) {
|
internal void InviteOtherWorld(ulong contentId) {
|
||||||
if (this._inviteToPartyContentId == null) {
|
if (_inviteToPartyContentId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.11: 214A55
|
// 6.11: 214A55
|
||||||
var a1 = this.Plugin.Functions.GetInfoProxyByIndex(2);
|
var a1 = Plugin.Functions.GetInfoProxyByIndex(2);
|
||||||
if (contentId != 0) {
|
if (contentId != 0) {
|
||||||
// third param is world, but it requires a specific world
|
// third param is world, but it requires a specific world
|
||||||
// if they're not on that world, it will fail
|
// if they're not on that world, it will fail
|
||||||
// pass 0 and it will work on any world EXCEPT for the world the
|
// pass 0 and it will work on any world EXCEPT for the world the
|
||||||
// current player is on
|
// current player is on
|
||||||
this._inviteToPartyContentId(a1, contentId, 0);
|
_inviteToPartyContentId(a1, contentId, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InviteInInstance(ulong contentId) {
|
internal void InviteInInstance(ulong contentId) {
|
||||||
if (this._inviteToPartyInInstance == null) {
|
if (_inviteToPartyInInstance == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6.11: 214A55
|
// 6.11: 214A55
|
||||||
var a1 = this.Plugin.Functions.GetInfoProxyByIndex(2);
|
var a1 = Plugin.Functions.GetInfoProxyByIndex(2);
|
||||||
if (contentId != 0) {
|
if (contentId != 0) {
|
||||||
// third param is world, but it requires a specific world
|
// third param is world, but it requires a specific world
|
||||||
// if they're not on that world, it will fail
|
// if they're not on that world, it will fail
|
||||||
// pass 0 and it will work on any world EXCEPT for the world the
|
// pass 0 and it will work on any world EXCEPT for the world the
|
||||||
// current player is on
|
// current player is on
|
||||||
this._inviteToPartyInInstance(a1, contentId);
|
_inviteToPartyInInstance(a1, contentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Kick(string name, ulong contentId) {
|
internal void Kick(string name, ulong contentId) {
|
||||||
if (this._kick == null) {
|
if (_kick == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,12 +85,12 @@ internal sealed unsafe class Party {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||||
this._kick(agent, namePtr, 0, contentId);
|
_kick(agent, namePtr, 0, contentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Promote(string name, ulong contentId) {
|
internal void Promote(string name, ulong contentId) {
|
||||||
if (this._promote == null) {
|
if (_promote == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ internal sealed unsafe class Party {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
fixed (byte* namePtr = name.ToTerminatedBytes()) {
|
||||||
this._promote(agent, namePtr, 0, contentId);
|
_promote(agent, namePtr, 0, contentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ internal class ChannelSwitchInfo {
|
|||||||
internal string? Text { get; }
|
internal string? Text { get; }
|
||||||
|
|
||||||
internal ChannelSwitchInfo(InputChannel? channel, bool permanent = false, RotateMode rotate = RotateMode.None, string? text = null) {
|
internal ChannelSwitchInfo(InputChannel? channel, bool permanent = false, RotateMode rotate = RotateMode.None, string? text = null) {
|
||||||
this.Channel = channel;
|
Channel = channel;
|
||||||
this.Permanent = permanent;
|
Permanent = permanent;
|
||||||
this.Rotate = rotate;
|
Rotate = rotate;
|
||||||
this.Text = text;
|
Text = text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ internal sealed class ChatActivatedArgs {
|
|||||||
internal TellTarget? TellTarget { get; init; }
|
internal TellTarget? TellTarget { get; init; }
|
||||||
|
|
||||||
internal ChatActivatedArgs(ChannelSwitchInfo channelSwitchInfo) {
|
internal ChatActivatedArgs(ChannelSwitchInfo channelSwitchInfo) {
|
||||||
this.ChannelSwitchInfo = channelSwitchInfo;
|
ChannelSwitchInfo = channelSwitchInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ internal sealed class TellHistoryInfo {
|
|||||||
internal ulong ContentId { get; }
|
internal ulong ContentId { get; }
|
||||||
|
|
||||||
internal TellHistoryInfo(string name, uint world, ulong contentId) {
|
internal TellHistoryInfo(string name, uint world, ulong contentId) {
|
||||||
this.Name = name;
|
Name = name;
|
||||||
this.World = world;
|
World = world;
|
||||||
this.ContentId = contentId;
|
ContentId = contentId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ internal sealed class TellTarget {
|
|||||||
internal TellReason Reason { get; }
|
internal TellReason Reason { get; }
|
||||||
|
|
||||||
internal TellTarget(string name, ushort world, ulong contentId, TellReason reason) {
|
internal TellTarget(string name, ushort world, ulong contentId, TellReason reason) {
|
||||||
this.Name = name;
|
Name = name;
|
||||||
this.World = world;
|
World = world;
|
||||||
this.ContentId = contentId;
|
ContentId = contentId;
|
||||||
this.Reason = reason;
|
Reason = reason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-16
@@ -19,47 +19,47 @@ internal sealed class ExtraChat : IDisposable {
|
|||||||
internal (string, uint)? ChannelOverride { get; set; }
|
internal (string, uint)? ChannelOverride { get; set; }
|
||||||
|
|
||||||
private Dictionary<string, uint> ChannelCommandColoursInternal { get; set; } = new();
|
private Dictionary<string, uint> ChannelCommandColoursInternal { get; set; } = new();
|
||||||
internal IReadOnlyDictionary<string, uint> ChannelCommandColours => this.ChannelCommandColoursInternal;
|
internal IReadOnlyDictionary<string, uint> ChannelCommandColours => ChannelCommandColoursInternal;
|
||||||
|
|
||||||
private Dictionary<Guid, string> ChannelNamesInternal { get; set; } = new();
|
private Dictionary<Guid, string> ChannelNamesInternal { get; set; } = new();
|
||||||
internal IReadOnlyDictionary<Guid, string> ChannelNames => this.ChannelNamesInternal;
|
internal IReadOnlyDictionary<Guid, string> ChannelNames => ChannelNamesInternal;
|
||||||
|
|
||||||
internal ExtraChat(Plugin plugin) {
|
internal ExtraChat(Plugin plugin) {
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
|
|
||||||
this.OverrideChannelGate = Plugin.Interface.GetIpcSubscriber<OverrideInfo, object>("ExtraChat.OverrideChannelColour");
|
OverrideChannelGate = Plugin.Interface.GetIpcSubscriber<OverrideInfo, object>("ExtraChat.OverrideChannelColour");
|
||||||
this.ChannelCommandColoursGate = Plugin.Interface.GetIpcSubscriber<Dictionary<string, uint>, Dictionary<string, uint>>("ExtraChat.ChannelCommandColours");
|
ChannelCommandColoursGate = Plugin.Interface.GetIpcSubscriber<Dictionary<string, uint>, Dictionary<string, uint>>("ExtraChat.ChannelCommandColours");
|
||||||
this.ChannelNamesGate = Plugin.Interface.GetIpcSubscriber<Dictionary<Guid, string>, Dictionary<Guid, string>>("ExtraChat.ChannelNames");
|
ChannelNamesGate = Plugin.Interface.GetIpcSubscriber<Dictionary<Guid, string>, Dictionary<Guid, string>>("ExtraChat.ChannelNames");
|
||||||
|
|
||||||
this.OverrideChannelGate.Subscribe(this.OnOverrideChannel);
|
OverrideChannelGate.Subscribe(OnOverrideChannel);
|
||||||
this.ChannelCommandColoursGate.Subscribe(this.OnChannelCommandColours);
|
ChannelCommandColoursGate.Subscribe(OnChannelCommandColours);
|
||||||
this.ChannelNamesGate.Subscribe(this.OnChannelNames);
|
ChannelNamesGate.Subscribe(OnChannelNames);
|
||||||
try {
|
try {
|
||||||
this.ChannelCommandColoursInternal = this.ChannelCommandColoursGate.InvokeFunc(null!);
|
ChannelCommandColoursInternal = ChannelCommandColoursGate.InvokeFunc(null!);
|
||||||
this.ChannelNamesInternal = this.ChannelNamesGate.InvokeFunc(null!);
|
ChannelNamesInternal = ChannelNamesGate.InvokeFunc(null!);
|
||||||
} catch (Exception) {
|
} catch (Exception) {
|
||||||
// no-op
|
// no-op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
this.OverrideChannelGate.Unsubscribe(this.OnOverrideChannel);
|
OverrideChannelGate.Unsubscribe(OnOverrideChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnOverrideChannel(OverrideInfo info) {
|
private void OnOverrideChannel(OverrideInfo info) {
|
||||||
if (info.Channel == null) {
|
if (info.Channel == null) {
|
||||||
this.ChannelOverride = null;
|
ChannelOverride = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ChannelOverride = (info.Channel, info.Rgba);
|
ChannelOverride = (info.Channel, info.Rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnChannelCommandColours(Dictionary<string, uint> obj) {
|
private void OnChannelCommandColours(Dictionary<string, uint> obj) {
|
||||||
this.ChannelCommandColoursInternal = obj;
|
ChannelCommandColoursInternal = obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnChannelNames(Dictionary<Guid, string> obj) {
|
private void OnChannelNames(Dictionary<Guid, string> obj) {
|
||||||
this.ChannelNamesInternal = obj;
|
ChannelNamesInternal = obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-14
@@ -15,38 +15,38 @@ internal sealed class IpcManager : IDisposable {
|
|||||||
internal List<string> Registered { get; } = new();
|
internal List<string> Registered { get; } = new();
|
||||||
|
|
||||||
public IpcManager(DalamudPluginInterface pluginInterface) {
|
public IpcManager(DalamudPluginInterface pluginInterface) {
|
||||||
this.Interface = pluginInterface;
|
Interface = pluginInterface;
|
||||||
|
|
||||||
this.RegisterGate = this.Interface.GetIpcProvider<string>("ChatTwo.Register");
|
RegisterGate = Interface.GetIpcProvider<string>("ChatTwo.Register");
|
||||||
this.RegisterGate.RegisterFunc(this.Register);
|
RegisterGate.RegisterFunc(Register);
|
||||||
|
|
||||||
this.AvailableGate = this.Interface.GetIpcProvider<object?>("ChatTwo.Available");
|
AvailableGate = Interface.GetIpcProvider<object?>("ChatTwo.Available");
|
||||||
|
|
||||||
this.UnregisterGate = this.Interface.GetIpcProvider<string, object?>("ChatTwo.Unregister");
|
UnregisterGate = Interface.GetIpcProvider<string, object?>("ChatTwo.Unregister");
|
||||||
this.UnregisterGate.RegisterAction(this.Unregister);
|
UnregisterGate.RegisterAction(Unregister);
|
||||||
|
|
||||||
this.InvokeGate = this.Interface.GetIpcProvider<string, PlayerPayload?, ulong, Payload?, SeString?, SeString?, object?>("ChatTwo.Invoke");
|
InvokeGate = Interface.GetIpcProvider<string, PlayerPayload?, ulong, Payload?, SeString?, SeString?, object?>("ChatTwo.Invoke");
|
||||||
|
|
||||||
this.AvailableGate.SendMessage();
|
AvailableGate.SendMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Invoke(string id, PlayerPayload? sender, ulong contentId, Payload? payload, SeString? senderString, SeString? content) {
|
internal void Invoke(string id, PlayerPayload? sender, ulong contentId, Payload? payload, SeString? senderString, SeString? content) {
|
||||||
this.InvokeGate.SendMessage(id, sender, contentId, payload, senderString, content);
|
InvokeGate.SendMessage(id, sender, contentId, payload, senderString, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string Register() {
|
private string Register() {
|
||||||
var id = Guid.NewGuid().ToString();
|
var id = Guid.NewGuid().ToString();
|
||||||
this.Registered.Add(id);
|
Registered.Add(id);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Unregister(string id) {
|
private void Unregister(string id) {
|
||||||
this.Registered.Remove(id);
|
Registered.Remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
this.UnregisterGate.UnregisterFunc();
|
UnregisterGate.UnregisterFunc();
|
||||||
this.RegisterGate.UnregisterFunc();
|
RegisterGate.UnregisterFunc();
|
||||||
this.Registered.Clear();
|
Registered.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+46
-46
@@ -12,15 +12,15 @@ internal class SortCode {
|
|||||||
internal ChatSource Source { get; set; }
|
internal ChatSource Source { get; set; }
|
||||||
|
|
||||||
internal SortCode(ChatType type, ChatSource source) {
|
internal SortCode(ChatType type, ChatSource source) {
|
||||||
this.Type = type;
|
Type = type;
|
||||||
this.Source = source;
|
Source = source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SortCode() {
|
public SortCode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool Equals(SortCode other) {
|
private bool Equals(SortCode other) {
|
||||||
return this.Type == other.Type && this.Source == other.Source;
|
return Type == other.Type && Source == other.Source;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object? obj) {
|
public override bool Equals(object? obj) {
|
||||||
@@ -32,12 +32,12 @@ internal class SortCode {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj.GetType() == this.GetType() && this.Equals((SortCode) obj);
|
return obj.GetType() == GetType() && Equals((SortCode) obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode() {
|
public override int GetHashCode() {
|
||||||
unchecked {
|
unchecked {
|
||||||
return ((int) this.Type * 397) ^ (int) this.Source;
|
return ((int) Type * 397) ^ (int) Source;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,16 +68,16 @@ internal class Message {
|
|||||||
internal int Hash { get; }
|
internal int Hash { get; }
|
||||||
|
|
||||||
internal Message(ulong receiver, ChatCode code, List<Chunk> sender, List<Chunk> content, SeString senderSource, SeString contentSource) {
|
internal Message(ulong receiver, ChatCode code, List<Chunk> sender, List<Chunk> content, SeString senderSource, SeString contentSource) {
|
||||||
this.Receiver = receiver;
|
Receiver = receiver;
|
||||||
this.Date = DateTime.UtcNow;
|
Date = DateTime.UtcNow;
|
||||||
this.Code = code;
|
Code = code;
|
||||||
this.Sender = sender;
|
Sender = sender;
|
||||||
this.Content = ReplaceContentURLs(content);
|
Content = ReplaceContentURLs(content);
|
||||||
this.SenderSource = senderSource;
|
SenderSource = senderSource;
|
||||||
this.ContentSource = contentSource;
|
ContentSource = contentSource;
|
||||||
this.SortCode = new SortCode(this.Code.Type, this.Code.Source);
|
SortCode = new SortCode(Code.Type, Code.Source);
|
||||||
this.ExtraChatChannel = this.ExtractExtraChatChannel();
|
ExtraChatChannel = ExtractExtraChatChannel();
|
||||||
this.Hash = this.GenerateHash();
|
Hash = GenerateHash();
|
||||||
|
|
||||||
foreach (var chunk in sender.Concat(content)) {
|
foreach (var chunk in sender.Concat(content)) {
|
||||||
chunk.Message = this;
|
chunk.Message = this;
|
||||||
@@ -85,56 +85,56 @@ internal class Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal Message(ObjectId id, ulong receiver, ulong contentId, DateTime date, BsonDocument code, BsonArray sender, BsonArray content, BsonValue senderSource, BsonValue contentSource, BsonDocument sortCode) {
|
internal Message(ObjectId id, ulong receiver, ulong contentId, DateTime date, BsonDocument code, BsonArray sender, BsonArray content, BsonValue senderSource, BsonValue contentSource, BsonDocument sortCode) {
|
||||||
this.Id = id;
|
Id = id;
|
||||||
this.Receiver = receiver;
|
Receiver = receiver;
|
||||||
this.ContentId = contentId;
|
ContentId = contentId;
|
||||||
this.Date = date;
|
Date = date;
|
||||||
this.Code = BsonMapper.Global.ToObject<ChatCode>(code);
|
Code = BsonMapper.Global.ToObject<ChatCode>(code);
|
||||||
this.Sender = BsonMapper.Global.Deserialize<List<Chunk>>(sender);
|
Sender = BsonMapper.Global.Deserialize<List<Chunk>>(sender);
|
||||||
// Don't call ReplaceContentURLs here since we're loading the message
|
// Don't call ReplaceContentURLs here since we're loading the message
|
||||||
// from the database and it should already have parsed URL data.
|
// from the database and it should already have parsed URL data.
|
||||||
this.Content = BsonMapper.Global.Deserialize<List<Chunk>>(content);
|
Content = BsonMapper.Global.Deserialize<List<Chunk>>(content);
|
||||||
this.SenderSource = BsonMapper.Global.Deserialize<SeString>(senderSource);
|
SenderSource = BsonMapper.Global.Deserialize<SeString>(senderSource);
|
||||||
this.ContentSource = BsonMapper.Global.Deserialize<SeString>(contentSource);
|
ContentSource = BsonMapper.Global.Deserialize<SeString>(contentSource);
|
||||||
this.SortCode = BsonMapper.Global.ToObject<SortCode>(sortCode);
|
SortCode = BsonMapper.Global.ToObject<SortCode>(sortCode);
|
||||||
this.ExtraChatChannel = this.ExtractExtraChatChannel();
|
ExtraChatChannel = ExtractExtraChatChannel();
|
||||||
this.Hash = this.GenerateHash();
|
Hash = GenerateHash();
|
||||||
|
|
||||||
foreach (var chunk in this.Sender.Concat(this.Content)) {
|
foreach (var chunk in Sender.Concat(Content)) {
|
||||||
chunk.Message = this;
|
chunk.Message = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Message(ObjectId id, ulong receiver, ulong contentId, DateTime date, BsonDocument code, BsonArray sender, BsonArray content, BsonValue senderSource, BsonValue contentSource, BsonDocument sortCode, BsonValue extraChatChannel) {
|
internal Message(ObjectId id, ulong receiver, ulong contentId, DateTime date, BsonDocument code, BsonArray sender, BsonArray content, BsonValue senderSource, BsonValue contentSource, BsonDocument sortCode, BsonValue extraChatChannel) {
|
||||||
this.Id = id;
|
Id = id;
|
||||||
this.Receiver = receiver;
|
Receiver = receiver;
|
||||||
this.ContentId = contentId;
|
ContentId = contentId;
|
||||||
this.Date = date;
|
Date = date;
|
||||||
this.Code = BsonMapper.Global.ToObject<ChatCode>(code);
|
Code = BsonMapper.Global.ToObject<ChatCode>(code);
|
||||||
this.Sender = BsonMapper.Global.Deserialize<List<Chunk>>(sender);
|
Sender = BsonMapper.Global.Deserialize<List<Chunk>>(sender);
|
||||||
// Don't call ReplaceContentURLs here since we're loading the message
|
// Don't call ReplaceContentURLs here since we're loading the message
|
||||||
// from the database and it should already have parsed URL data.
|
// from the database and it should already have parsed URL data.
|
||||||
this.Content = BsonMapper.Global.Deserialize<List<Chunk>>(content);
|
Content = BsonMapper.Global.Deserialize<List<Chunk>>(content);
|
||||||
this.SenderSource = BsonMapper.Global.Deserialize<SeString>(senderSource);
|
SenderSource = BsonMapper.Global.Deserialize<SeString>(senderSource);
|
||||||
this.ContentSource = BsonMapper.Global.Deserialize<SeString>(contentSource);
|
ContentSource = BsonMapper.Global.Deserialize<SeString>(contentSource);
|
||||||
this.SortCode = BsonMapper.Global.ToObject<SortCode>(sortCode);
|
SortCode = BsonMapper.Global.ToObject<SortCode>(sortCode);
|
||||||
this.ExtraChatChannel = BsonMapper.Global.Deserialize<Guid>(extraChatChannel);
|
ExtraChatChannel = BsonMapper.Global.Deserialize<Guid>(extraChatChannel);
|
||||||
this.Hash = this.GenerateHash();
|
Hash = GenerateHash();
|
||||||
|
|
||||||
foreach (var chunk in this.Sender.Concat(this.Content)) {
|
foreach (var chunk in Sender.Concat(Content)) {
|
||||||
chunk.Message = this;
|
chunk.Message = this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GenerateHash() {
|
private int GenerateHash() {
|
||||||
return this.SortCode.GetHashCode()
|
return SortCode.GetHashCode()
|
||||||
^ this.ExtraChatChannel.GetHashCode()
|
^ ExtraChatChannel.GetHashCode()
|
||||||
^ string.Join("", this.Sender.Select(c => c.StringValue())).GetHashCode()
|
^ string.Join("", Sender.Select(c => c.StringValue())).GetHashCode()
|
||||||
^ string.Join("", this.Content.Select(c => c.StringValue())).GetHashCode();
|
^ string.Join("", Content.Select(c => c.StringValue())).GetHashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Guid ExtractExtraChatChannel() {
|
private Guid ExtractExtraChatChannel() {
|
||||||
if (this.ContentSource.Payloads.Count > 0 && this.ContentSource.Payloads[0] is RawPayload raw) {
|
if (ContentSource.Payloads.Count > 0 && ContentSource.Payloads[0] is RawPayload raw) {
|
||||||
// this does an encode and clone every time it's accessed, so cache
|
// this does an encode and clone every time it's accessed, so cache
|
||||||
var data = raw.Data;
|
var data = raw.Data;
|
||||||
if (data[1] == 0x27 && data[2] == 18 && data[3] == 0x20) {
|
if (data[1] == 0x27 && data[2] == 18 && data[3] == 0x20) {
|
||||||
|
|||||||
Generated
+9
@@ -1967,6 +1967,15 @@ namespace ChatTwo.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Override your selected dalamud style with a different one.
|
||||||
|
/// </summary>
|
||||||
|
internal static string Options_OverrideStyle_Name_Desc {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Options_OverrideStyle_Name_Desc", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Styles.
|
/// Looks up a localized string similar to Styles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -920,4 +920,7 @@
|
|||||||
<data name="Options_About_Discord_Thread" xml:space="preserve">
|
<data name="Options_About_Discord_Thread" xml:space="preserve">
|
||||||
<value>Get help in the discord thread: </value>
|
<value>Get help in the discord thread: </value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Options_OverrideStyle_Name_Desc" xml:space="preserve">
|
||||||
|
<value>Override your selected dalamud style with a different one</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|||||||
+17
-17
@@ -11,17 +11,17 @@ internal class TextureCache : IDisposable {
|
|||||||
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _statusIcons = new();
|
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _statusIcons = new();
|
||||||
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _eventItemIcons = new();
|
private readonly Dictionary<(uint, bool), IDalamudTextureWrap> _eventItemIcons = new();
|
||||||
|
|
||||||
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> ItemIcons => this._itemIcons;
|
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> ItemIcons => _itemIcons;
|
||||||
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> StatusIcons => this._statusIcons;
|
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> StatusIcons => _statusIcons;
|
||||||
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> EventItemIcons => this._eventItemIcons;
|
internal IReadOnlyDictionary<(uint, bool), IDalamudTextureWrap> EventItemIcons => _eventItemIcons;
|
||||||
|
|
||||||
internal TextureCache(ITextureProvider textureProvider) {
|
internal TextureCache(ITextureProvider textureProvider) {
|
||||||
this.TextureProvider = textureProvider;
|
TextureProvider = textureProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
var allIcons = this.ItemIcons.Values
|
var allIcons = ItemIcons.Values
|
||||||
.Concat(this.StatusIcons.Values);
|
.Concat(StatusIcons.Values);
|
||||||
|
|
||||||
foreach (var tex in allIcons) {
|
foreach (var tex in allIcons) {
|
||||||
tex.Dispose();
|
tex.Dispose();
|
||||||
@@ -34,40 +34,40 @@ internal class TextureCache : IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tex = hq
|
var tex = hq
|
||||||
? this.TextureProvider.GetIcon(icon, ITextureProvider.IconFlags.ItemHighQuality)
|
? TextureProvider.GetIcon(icon, ITextureProvider.IconFlags.ItemHighQuality)
|
||||||
: this.TextureProvider.GetIcon(icon);
|
: TextureProvider.GetIcon(icon);
|
||||||
if (tex != null) {
|
if (tex != null) {
|
||||||
dict[(icon, hq)] = tex;
|
dict[(icon, hq)] = tex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddItem(Item item, bool hq) {
|
internal void AddItem(Item item, bool hq) {
|
||||||
this.AddIcon(this._itemIcons, item.Icon, hq);
|
AddIcon(_itemIcons, item.Icon, hq);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddStatus(Status status) {
|
internal void AddStatus(Status status) {
|
||||||
this.AddIcon(this._statusIcons, status.Icon);
|
AddIcon(_statusIcons, status.Icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddEventItem(EventItem item) {
|
internal void AddEventItem(EventItem item) {
|
||||||
this.AddIcon(this._eventItemIcons, item.Icon);
|
AddIcon(_eventItemIcons, item.Icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IDalamudTextureWrap? GetItem(Item item, bool hq = false) {
|
internal IDalamudTextureWrap? GetItem(Item item, bool hq = false) {
|
||||||
this.AddItem(item, hq);
|
AddItem(item, hq);
|
||||||
this.ItemIcons.TryGetValue((item.Icon, hq), out var icon);
|
ItemIcons.TryGetValue((item.Icon, hq), out var icon);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IDalamudTextureWrap? GetStatus(Status status) {
|
internal IDalamudTextureWrap? GetStatus(Status status) {
|
||||||
this.AddStatus(status);
|
AddStatus(status);
|
||||||
this.StatusIcons.TryGetValue((status.Icon, false), out var icon);
|
StatusIcons.TryGetValue((status.Icon, false), out var icon);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IDalamudTextureWrap? GetEventItem(EventItem item) {
|
internal IDalamudTextureWrap? GetEventItem(EventItem item) {
|
||||||
this.AddEventItem(item);
|
AddEventItem(item);
|
||||||
this.EventItemIcons.TryGetValue((item.Icon, false), out var icon);
|
EventItemIcons.TryGetValue((item.Icon, false), out var icon);
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ internal class AutoCompleteInfo {
|
|||||||
internal int EndPos { get; }
|
internal int EndPos { get; }
|
||||||
|
|
||||||
internal AutoCompleteInfo(string toComplete, int startPos, int endPos) {
|
internal AutoCompleteInfo(string toComplete, int startPos, int endPos) {
|
||||||
this.ToComplete = toComplete;
|
ToComplete = toComplete;
|
||||||
this.StartPos = startPos;
|
StartPos = startPos;
|
||||||
this.EndPos = endPos;
|
EndPos = endPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -169,7 +169,7 @@ internal sealed class FaceData {
|
|||||||
internal byte[] Data { get; }
|
internal byte[] Data { get; }
|
||||||
|
|
||||||
internal FaceData(byte[] data) {
|
internal FaceData(byte[] data) {
|
||||||
this.Data = data;
|
Data = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,8 +178,8 @@ internal sealed class FontData {
|
|||||||
internal FaceData? Italic { get; }
|
internal FaceData? Italic { get; }
|
||||||
|
|
||||||
internal FontData(FaceData regular, FaceData? italic) {
|
internal FontData(FaceData regular, FaceData? italic) {
|
||||||
this.Regular = regular;
|
Regular = regular;
|
||||||
this.Italic = italic;
|
Italic = italic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,8 +189,8 @@ internal sealed class Font {
|
|||||||
internal string ResourcePathItalic { get; }
|
internal string ResourcePathItalic { get; }
|
||||||
|
|
||||||
internal Font(string name, string resourcePath, string resourcePathItalic) {
|
internal Font(string name, string resourcePath, string resourcePathItalic) {
|
||||||
this.Name = name;
|
Name = name;
|
||||||
this.ResourcePath = resourcePath;
|
ResourcePath = resourcePath;
|
||||||
this.ResourcePathItalic = resourcePathItalic;
|
ResourcePathItalic = resourcePathItalic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ internal sealed class ChatColours : ISettingsTab {
|
|||||||
public string Name => Language.Options_ChatColours_Tab + "###tabs-chat-colours";
|
public string Name => Language.Options_ChatColours_Tab + "###tabs-chat-colours";
|
||||||
|
|
||||||
internal ChatColours(Configuration mutable, Plugin plugin) {
|
internal ChatColours(Configuration mutable, Plugin plugin) {
|
||||||
this.Mutable = mutable;
|
Mutable = mutable;
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
var sortable = ChatTypeExt.SortOrder
|
var sortable = ChatTypeExt.SortOrder
|
||||||
@@ -36,23 +36,23 @@ internal sealed class ChatColours : ISettingsTab {
|
|||||||
foreach (var (_, types) in ChatTypeExt.SortOrder) {
|
foreach (var (_, types) in ChatTypeExt.SortOrder) {
|
||||||
foreach (var type in types) {
|
foreach (var type in types) {
|
||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) {
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.UndoAlt, $"{type}", Language.Options_ChatColours_Reset)) {
|
||||||
this.Mutable.ChatColours.Remove(type);
|
Mutable.ChatColours.Remove(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", Language.Options_ChatColours_Import)) {
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.LongArrowAltDown, $"{type}", Language.Options_ChatColours_Import)) {
|
||||||
var gameColour = this.Plugin.Functions.Chat.GetChannelColour(type);
|
var gameColour = Plugin.Functions.Chat.GetChannelColour(type);
|
||||||
this.Mutable.ChatColours[type] = gameColour ?? type.DefaultColour() ?? 0;
|
Mutable.ChatColours[type] = gameColour ?? type.DefaultColour() ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
var vec = this.Mutable.ChatColours.TryGetValue(type, out var colour)
|
var vec = Mutable.ChatColours.TryGetValue(type, out var colour)
|
||||||
? ColourUtil.RgbaToVector3(colour)
|
? ColourUtil.RgbaToVector3(colour)
|
||||||
: ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0);
|
: ColourUtil.RgbaToVector3(type.DefaultColour() ?? 0);
|
||||||
if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) {
|
if (ImGui.ColorEdit3(type.Name(), ref vec, ImGuiColorEditFlags.NoInputs)) {
|
||||||
this.Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec);
|
Mutable.ChatColours[type] = ColourUtil.Vector3ToRgba(vec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,36 +11,36 @@ internal sealed class Database : ISettingsTab {
|
|||||||
public string Name => Language.Options_Database_Tab + "###tabs-database";
|
public string Name => Language.Options_Database_Tab + "###tabs-database";
|
||||||
|
|
||||||
internal Database(Configuration mutable, Store store) {
|
internal Database(Configuration mutable, Store store) {
|
||||||
this.Store = store;
|
Store = store;
|
||||||
this.Mutable = mutable;
|
Mutable = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _showAdvanced;
|
private bool _showAdvanced;
|
||||||
|
|
||||||
public void Draw(bool changed) {
|
public void Draw(bool changed) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
this._showAdvanced = ImGui.GetIO().KeyShift;
|
_showAdvanced = ImGui.GetIO().KeyShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiUtil.OptionCheckbox(ref this.Mutable.DatabaseBattleMessages, Language.Options_DatabaseBattleMessages_Name, Language.Options_DatabaseBattleMessages_Description);
|
ImGuiUtil.OptionCheckbox(ref Mutable.DatabaseBattleMessages, Language.Options_DatabaseBattleMessages_Name, Language.Options_DatabaseBattleMessages_Description);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (ImGuiUtil.OptionCheckbox(ref this.Mutable.LoadPreviousSession, Language.Options_LoadPreviousSession_Name, Language.Options_LoadPreviousSession_Description)) {
|
if (ImGuiUtil.OptionCheckbox(ref Mutable.LoadPreviousSession, Language.Options_LoadPreviousSession_Name, Language.Options_LoadPreviousSession_Description)) {
|
||||||
if (this.Mutable.LoadPreviousSession) {
|
if (Mutable.LoadPreviousSession) {
|
||||||
this.Mutable.FilterIncludePreviousSessions = true;
|
Mutable.FilterIncludePreviousSessions = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (ImGuiUtil.OptionCheckbox(ref this.Mutable.FilterIncludePreviousSessions, Language.Options_FilterIncludePreviousSessions_Name, Language.Options_FilterIncludePreviousSessions_Description)) {
|
if (ImGuiUtil.OptionCheckbox(ref Mutable.FilterIncludePreviousSessions, Language.Options_FilterIncludePreviousSessions_Name, Language.Options_FilterIncludePreviousSessions_Description)) {
|
||||||
if (!this.Mutable.FilterIncludePreviousSessions) {
|
if (!Mutable.FilterIncludePreviousSessions) {
|
||||||
this.Mutable.LoadPreviousSession = false;
|
Mutable.LoadPreviousSession = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiUtil.OptionCheckbox(
|
ImGuiUtil.OptionCheckbox(
|
||||||
ref this.Mutable.SharedMode,
|
ref Mutable.SharedMode,
|
||||||
Language.Options_SharedMode_Name,
|
Language.Options_SharedMode_Name,
|
||||||
string.Format(Language.Options_SharedMode_Description, Plugin.PluginName)
|
string.Format(Language.Options_SharedMode_Description, Plugin.PluginName)
|
||||||
);
|
);
|
||||||
@@ -48,16 +48,16 @@ internal sealed class Database : ISettingsTab {
|
|||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (this._showAdvanced && ImGui.TreeNodeEx(Language.Options_Database_Advanced)) {
|
if (_showAdvanced && ImGui.TreeNodeEx(Language.Options_Database_Advanced)) {
|
||||||
ImGui.PushTextWrapPos();
|
ImGui.PushTextWrapPos();
|
||||||
ImGuiUtil.WarningText(Language.Options_Database_Advanced_Warning);
|
ImGuiUtil.WarningText(Language.Options_Database_Advanced_Warning);
|
||||||
|
|
||||||
if (ImGui.Button("Checkpoint")) {
|
if (ImGui.Button("Checkpoint")) {
|
||||||
this.Store.Database.Checkpoint();
|
Store.Database.Checkpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.Button("Rebuild")) {
|
if (ImGui.Button("Rebuild")) {
|
||||||
this.Store.Database.Rebuild();
|
Store.Database.Rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PopTextWrapPos();
|
ImGui.PopTextWrapPos();
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ internal sealed class Display : ISettingsTab {
|
|||||||
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
|
ImGuiUtil.OptionCheckbox(ref Mutable.ShowPopOutTitleBar, Language.Options_ShowPopOutTitleBar_Name);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
ImGui.Checkbox(Language.Options_OverrideStyle_Name, ref Mutable.OverrideStyle);
|
ImGuiUtil.OptionCheckbox(ref Mutable.OverrideStyle, Language.Options_OverrideStyle_Name, Language.Options_OverrideStyle_Name_Desc);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (Mutable.OverrideStyle)
|
if (Mutable.OverrideStyle)
|
||||||
@@ -98,7 +98,7 @@ internal sealed class Display : ISettingsTab {
|
|||||||
var currentStyle = Mutable.ChosenStyle.Equals("") ? StyleModel.GetConfiguredStyle().Name : Mutable.ChosenStyle;
|
var currentStyle = Mutable.ChosenStyle.Equals("") ? StyleModel.GetConfiguredStyle().Name : Mutable.ChosenStyle;
|
||||||
if (ImGui.BeginCombo(Language.Options_OverrideStyleDropdown_Name, currentStyle)) {
|
if (ImGui.BeginCombo(Language.Options_OverrideStyleDropdown_Name, currentStyle)) {
|
||||||
foreach (var style in StyleModel.GetConfiguredStyles()) {
|
foreach (var style in StyleModel.GetConfiguredStyles()) {
|
||||||
if (ImGui.Selectable(style.Name, this.Mutable.ChosenStyle == style.Name)) {
|
if (ImGui.Selectable(style.Name, Mutable.ChosenStyle == style.Name)) {
|
||||||
Mutable.ChosenStyle = style.Name;
|
Mutable.ChosenStyle = style.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,45 +12,45 @@ public class Fonts : ISettingsTab {
|
|||||||
private List<string> JpFonts { get; set; } = new();
|
private List<string> JpFonts { get; set; } = new();
|
||||||
|
|
||||||
internal Fonts(Configuration mutable) {
|
internal Fonts(Configuration mutable) {
|
||||||
this.Mutable = mutable;
|
Mutable = mutable;
|
||||||
this.UpdateFonts();
|
UpdateFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFonts() {
|
private void UpdateFonts() {
|
||||||
this.GlobalFonts = Ui.Fonts.GetFonts();
|
GlobalFonts = Ui.Fonts.GetFonts();
|
||||||
this.JpFonts = Ui.Fonts.GetJpFonts();
|
JpFonts = Ui.Fonts.GetJpFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(bool changed) {
|
public void Draw(bool changed) {
|
||||||
if (changed) {
|
if (changed) {
|
||||||
this.UpdateFonts();
|
UpdateFonts();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.PushTextWrapPos();
|
ImGui.PushTextWrapPos();
|
||||||
|
|
||||||
ImGui.Checkbox(Language.Options_FontsEnabled, ref this.Mutable.FontsEnabled);
|
ImGui.Checkbox(Language.Options_FontsEnabled, ref Mutable.FontsEnabled);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (this.Mutable.FontsEnabled) {
|
if (Mutable.FontsEnabled) {
|
||||||
if (ImGuiUtil.BeginComboVertical(Language.Options_Font_Name, this.Mutable.GlobalFont)) {
|
if (ImGuiUtil.BeginComboVertical(Language.Options_Font_Name, Mutable.GlobalFont)) {
|
||||||
foreach (var font in Ui.Fonts.GlobalFonts) {
|
foreach (var font in Ui.Fonts.GlobalFonts) {
|
||||||
if (ImGui.Selectable(font.Name, this.Mutable.GlobalFont == font.Name)) {
|
if (ImGui.Selectable(font.Name, Mutable.GlobalFont == font.Name)) {
|
||||||
this.Mutable.GlobalFont = font.Name;
|
Mutable.GlobalFont = font.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsWindowAppearing() && this.Mutable.GlobalFont == font.Name) {
|
if (ImGui.IsWindowAppearing() && Mutable.GlobalFont == font.Name) {
|
||||||
ImGui.SetScrollHereY(0.5f);
|
ImGui.SetScrollHereY(0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
foreach (var name in this.GlobalFonts) {
|
foreach (var name in GlobalFonts) {
|
||||||
if (ImGui.Selectable(name, this.Mutable.GlobalFont == name)) {
|
if (ImGui.Selectable(name, Mutable.GlobalFont == name)) {
|
||||||
this.Mutable.GlobalFont = name;
|
Mutable.GlobalFont = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsWindowAppearing() && this.Mutable.GlobalFont == name) {
|
if (ImGui.IsWindowAppearing() && Mutable.GlobalFont == name) {
|
||||||
ImGui.SetScrollHereY(0.5f);
|
ImGui.SetScrollHereY(0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,25 +62,25 @@ public class Fonts : ISettingsTab {
|
|||||||
ImGuiUtil.WarningText(Language.Options_Font_Warning);
|
ImGuiUtil.WarningText(Language.Options_Font_Warning);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (ImGuiUtil.BeginComboVertical(Language.Options_JapaneseFont_Name, this.Mutable.JapaneseFont)) {
|
if (ImGuiUtil.BeginComboVertical(Language.Options_JapaneseFont_Name, Mutable.JapaneseFont)) {
|
||||||
foreach (var (name, _) in Ui.Fonts.JapaneseFonts) {
|
foreach (var (name, _) in Ui.Fonts.JapaneseFonts) {
|
||||||
if (ImGui.Selectable(name, this.Mutable.JapaneseFont == name)) {
|
if (ImGui.Selectable(name, Mutable.JapaneseFont == name)) {
|
||||||
this.Mutable.JapaneseFont = name;
|
Mutable.JapaneseFont = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsWindowAppearing() && this.Mutable.JapaneseFont == name) {
|
if (ImGui.IsWindowAppearing() && Mutable.JapaneseFont == name) {
|
||||||
ImGui.SetScrollHereY(0.5f);
|
ImGui.SetScrollHereY(0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
foreach (var family in this.JpFonts) {
|
foreach (var family in JpFonts) {
|
||||||
if (ImGui.Selectable(family, this.Mutable.JapaneseFont == family)) {
|
if (ImGui.Selectable(family, Mutable.JapaneseFont == family)) {
|
||||||
this.Mutable.JapaneseFont = family;
|
Mutable.JapaneseFont = family;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsWindowAppearing() && this.Mutable.JapaneseFont == family) {
|
if (ImGui.IsWindowAppearing() && Mutable.JapaneseFont == family) {
|
||||||
ImGui.SetScrollHereY(0.5f);
|
ImGui.SetScrollHereY(0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,12 +94,12 @@ public class Fonts : ISettingsTab {
|
|||||||
if (ImGui.CollapsingHeader(Language.Options_ExtraGlyphs_Name)) {
|
if (ImGui.CollapsingHeader(Language.Options_ExtraGlyphs_Name)) {
|
||||||
ImGuiUtil.HelpText(string.Format(Language.Options_ExtraGlyphs_Description, Plugin.PluginName));
|
ImGuiUtil.HelpText(string.Format(Language.Options_ExtraGlyphs_Description, Plugin.PluginName));
|
||||||
|
|
||||||
var range = (int) this.Mutable.ExtraGlyphRanges;
|
var range = (int) Mutable.ExtraGlyphRanges;
|
||||||
foreach (var extra in Enum.GetValues<ExtraGlyphRanges>()) {
|
foreach (var extra in Enum.GetValues<ExtraGlyphRanges>()) {
|
||||||
ImGui.CheckboxFlags(extra.Name(), ref range, (int) extra);
|
ImGui.CheckboxFlags(extra.Name(), ref range, (int) extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Mutable.ExtraGlyphRanges = (ExtraGlyphRanges) range;
|
Mutable.ExtraGlyphRanges = (ExtraGlyphRanges) range;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
@@ -108,9 +108,9 @@ public class Fonts : ISettingsTab {
|
|||||||
const float speed = .0125f;
|
const float speed = .0125f;
|
||||||
const float min = 8f;
|
const float min = 8f;
|
||||||
const float max = 36f;
|
const float max = 36f;
|
||||||
ImGuiUtil.DragFloatVertical(Language.Options_FontSize_Name, ref this.Mutable.FontSize, speed, min, max, $"{this.Mutable.FontSize:N1}");
|
ImGuiUtil.DragFloatVertical(Language.Options_FontSize_Name, ref Mutable.FontSize, speed, min, max, $"{Mutable.FontSize:N1}");
|
||||||
ImGuiUtil.DragFloatVertical(Language.Options_JapaneseFontSize_Name, ref this.Mutable.JapaneseFontSize, speed, min, max, $"{this.Mutable.JapaneseFontSize:N1}");
|
ImGuiUtil.DragFloatVertical(Language.Options_JapaneseFontSize_Name, ref Mutable.JapaneseFontSize, speed, min, max, $"{Mutable.JapaneseFontSize:N1}");
|
||||||
ImGuiUtil.DragFloatVertical(Language.Options_SymbolsFontSize_Name, ref this.Mutable.SymbolsFontSize, speed, min, max, $"{this.Mutable.SymbolsFontSize:N1}");
|
ImGuiUtil.DragFloatVertical(Language.Options_SymbolsFontSize_Name, ref Mutable.SymbolsFontSize, speed, min, max, $"{Mutable.SymbolsFontSize:N1}");
|
||||||
ImGuiUtil.HelpText(Language.Options_SymbolsFontSize_Description);
|
ImGuiUtil.HelpText(Language.Options_SymbolsFontSize_Description);
|
||||||
|
|
||||||
ImGui.PopTextWrapPos();
|
ImGui.PopTextWrapPos();
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ internal sealed class Miscellaneous : ISettingsTab {
|
|||||||
public string Name => Language.Options_Miscellaneous_Tab + "###tabs-miscellaneous";
|
public string Name => Language.Options_Miscellaneous_Tab + "###tabs-miscellaneous";
|
||||||
|
|
||||||
public Miscellaneous(Configuration mutable) {
|
public Miscellaneous(Configuration mutable) {
|
||||||
this.Mutable = mutable;
|
Mutable = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(bool changed) {
|
public void Draw(bool changed) {
|
||||||
if (ImGuiUtil.BeginComboVertical(Language.Options_Language_Name, this.Mutable.LanguageOverride.Name())) {
|
if (ImGuiUtil.BeginComboVertical(Language.Options_Language_Name, Mutable.LanguageOverride.Name())) {
|
||||||
foreach (var language in Enum.GetValues<LanguageOverride>()) {
|
foreach (var language in Enum.GetValues<LanguageOverride>()) {
|
||||||
if (ImGui.Selectable(language.Name())) {
|
if (ImGui.Selectable(language.Name())) {
|
||||||
this.Mutable.LanguageOverride = language;
|
Mutable.LanguageOverride = language;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,10 +27,10 @@ internal sealed class Miscellaneous : ISettingsTab {
|
|||||||
ImGuiUtil.HelpText(string.Format(Language.Options_Language_Description, Plugin.PluginName));
|
ImGuiUtil.HelpText(string.Format(Language.Options_Language_Description, Plugin.PluginName));
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (ImGuiUtil.BeginComboVertical(Language.Options_CommandHelpSide_Name, this.Mutable.CommandHelpSide.Name())) {
|
if (ImGuiUtil.BeginComboVertical(Language.Options_CommandHelpSide_Name, Mutable.CommandHelpSide.Name())) {
|
||||||
foreach (var side in Enum.GetValues<CommandHelpSide>()) {
|
foreach (var side in Enum.GetValues<CommandHelpSide>()) {
|
||||||
if (ImGui.Selectable(side.Name(), this.Mutable.CommandHelpSide == side)) {
|
if (ImGui.Selectable(side.Name(), Mutable.CommandHelpSide == side)) {
|
||||||
this.Mutable.CommandHelpSide = side;
|
Mutable.CommandHelpSide = side;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,10 +40,10 @@ internal sealed class Miscellaneous : ISettingsTab {
|
|||||||
ImGuiUtil.HelpText(string.Format(Language.Options_CommandHelpSide_Description, Plugin.PluginName));
|
ImGuiUtil.HelpText(string.Format(Language.Options_CommandHelpSide_Description, Plugin.PluginName));
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
if (ImGuiUtil.BeginComboVertical(Language.Options_KeybindMode_Name, this.Mutable.KeybindMode.Name())) {
|
if (ImGuiUtil.BeginComboVertical(Language.Options_KeybindMode_Name, Mutable.KeybindMode.Name())) {
|
||||||
foreach (var mode in Enum.GetValues<KeybindMode>()) {
|
foreach (var mode in Enum.GetValues<KeybindMode>()) {
|
||||||
if (ImGui.Selectable(mode.Name(), this.Mutable.KeybindMode == mode)) {
|
if (ImGui.Selectable(mode.Name(), Mutable.KeybindMode == mode)) {
|
||||||
this.Mutable.KeybindMode = mode;
|
Mutable.KeybindMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.IsItemHovered()) {
|
if (ImGui.IsItemHovered()) {
|
||||||
@@ -59,7 +59,7 @@ internal sealed class Miscellaneous : ISettingsTab {
|
|||||||
ImGuiUtil.HelpText(string.Format(Language.Options_KeybindMode_Description, Plugin.PluginName));
|
ImGuiUtil.HelpText(string.Format(Language.Options_KeybindMode_Description, Plugin.PluginName));
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
|
|
||||||
ImGui.Checkbox(Language.Options_SortAutoTranslate_Name, ref this.Mutable.SortAutoTranslate);
|
ImGui.Checkbox(Language.Options_SortAutoTranslate_Name, ref Mutable.SortAutoTranslate);
|
||||||
ImGuiUtil.HelpText(Language.Options_SortAutoTranslate_Description);
|
ImGuiUtil.HelpText(Language.Options_SortAutoTranslate_Description);
|
||||||
ImGui.Spacing();
|
ImGui.Spacing();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ internal sealed class Tabs : ISettingsTab {
|
|||||||
private int _toOpen = -2;
|
private int _toOpen = -2;
|
||||||
|
|
||||||
internal Tabs(Plugin plugin, Configuration mutable) {
|
internal Tabs(Plugin plugin, Configuration mutable) {
|
||||||
this.Plugin = plugin;
|
Plugin = plugin;
|
||||||
this.Mutable = mutable;
|
Mutable = mutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(bool changed) {
|
public void Draw(bool changed) {
|
||||||
@@ -28,29 +28,29 @@ internal sealed class Tabs : ISettingsTab {
|
|||||||
|
|
||||||
if (ImGui.BeginPopup(addTabPopup)) {
|
if (ImGui.BeginPopup(addTabPopup)) {
|
||||||
if (ImGui.Selectable(Language.Options_Tabs_NewTab)) {
|
if (ImGui.Selectable(Language.Options_Tabs_NewTab)) {
|
||||||
this.Mutable.Tabs.Add(new Tab());
|
Mutable.Tabs.Add(new Tab());
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
if (ImGui.Selectable(string.Format(Language.Options_Tabs_Preset, Language.Tabs_Presets_General))) {
|
if (ImGui.Selectable(string.Format(Language.Options_Tabs_Preset, Language.Tabs_Presets_General))) {
|
||||||
this.Mutable.Tabs.Add(TabsUtil.VanillaGeneral);
|
Mutable.Tabs.Add(TabsUtil.VanillaGeneral);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.Selectable(string.Format(Language.Options_Tabs_Preset, Language.Tabs_Presets_Event))) {
|
if (ImGui.Selectable(string.Format(Language.Options_Tabs_Preset, Language.Tabs_Presets_Event))) {
|
||||||
this.Mutable.Tabs.Add(TabsUtil.VanillaEvent);
|
Mutable.Tabs.Add(TabsUtil.VanillaEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndPopup();
|
ImGui.EndPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
var toRemove = -1;
|
var toRemove = -1;
|
||||||
var doOpens = this._toOpen > -2;
|
var doOpens = _toOpen > -2;
|
||||||
for (var i = 0; i < this.Mutable.Tabs.Count; i++) {
|
for (var i = 0; i < Mutable.Tabs.Count; i++) {
|
||||||
var tab = this.Mutable.Tabs[i];
|
var tab = Mutable.Tabs[i];
|
||||||
|
|
||||||
if (doOpens) {
|
if (doOpens) {
|
||||||
ImGui.SetNextItemOpen(i == this._toOpen);
|
ImGui.SetNextItemOpen(i == _toOpen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui.TreeNodeEx($"{tab.Name}###tab-{i}")) {
|
if (ImGui.TreeNodeEx($"{tab.Name}###tab-{i}")) {
|
||||||
@@ -58,21 +58,21 @@ internal sealed class Tabs : ISettingsTab {
|
|||||||
|
|
||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.Options_Tabs_Delete)) {
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.TrashAlt, tooltip: Language.Options_Tabs_Delete)) {
|
||||||
toRemove = i;
|
toRemove = i;
|
||||||
this._toOpen = -1;
|
_toOpen = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: Language.Options_Tabs_MoveUp) && i > 0) {
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowUp, tooltip: Language.Options_Tabs_MoveUp) && i > 0) {
|
||||||
(this.Mutable.Tabs[i - 1], this.Mutable.Tabs[i]) = (this.Mutable.Tabs[i], this.Mutable.Tabs[i - 1]);
|
(Mutable.Tabs[i - 1], Mutable.Tabs[i]) = (Mutable.Tabs[i], Mutable.Tabs[i - 1]);
|
||||||
this._toOpen = i - 1;
|
_toOpen = i - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: Language.Options_Tabs_MoveDown) && i < this.Mutable.Tabs.Count - 1) {
|
if (ImGuiUtil.IconButton(FontAwesomeIcon.ArrowDown, tooltip: Language.Options_Tabs_MoveDown) && i < Mutable.Tabs.Count - 1) {
|
||||||
(this.Mutable.Tabs[i + 1], this.Mutable.Tabs[i]) = (this.Mutable.Tabs[i], this.Mutable.Tabs[i + 1]);
|
(Mutable.Tabs[i + 1], Mutable.Tabs[i]) = (Mutable.Tabs[i], Mutable.Tabs[i + 1]);
|
||||||
this._toOpen = i + 1;
|
_toOpen = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.InputText(Language.Options_Tabs_Name, ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
|
ImGui.InputText(Language.Options_Tabs_Name, ref tab.Name, 512, ImGuiInputTextFlags.EnterReturnsTrue);
|
||||||
@@ -160,7 +160,7 @@ internal sealed class Tabs : ISettingsTab {
|
|||||||
ImGui.TreePop();
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.Plugin.ExtraChat.ChannelNames.Count > 0 && ImGui.TreeNodeEx(Language.Options_Tabs_ExtraChatChannels)) {
|
if (Plugin.ExtraChat.ChannelNames.Count > 0 && ImGui.TreeNodeEx(Language.Options_Tabs_ExtraChatChannels)) {
|
||||||
ImGui.Checkbox(Language.Options_Tabs_ExtraChatAll, ref tab.ExtraChatAll);
|
ImGui.Checkbox(Language.Options_Tabs_ExtraChatAll, ref tab.ExtraChatAll);
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
@@ -169,7 +169,7 @@ internal sealed class Tabs : ISettingsTab {
|
|||||||
ImGui.BeginDisabled();
|
ImGui.BeginDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var (id, name) in this.Plugin.ExtraChat.ChannelNames) {
|
foreach (var (id, name) in Plugin.ExtraChat.ChannelNames) {
|
||||||
var enabled = tab.ExtraChatChannels.Contains(id);
|
var enabled = tab.ExtraChatChannels.Contains(id);
|
||||||
if (!ImGui.Checkbox($"{name}##ec-{id}", ref enabled)) {
|
if (!ImGui.Checkbox($"{name}##ec-{id}", ref enabled)) {
|
||||||
continue;
|
continue;
|
||||||
@@ -196,11 +196,11 @@ internal sealed class Tabs : ISettingsTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (toRemove > -1) {
|
if (toRemove > -1) {
|
||||||
this.Mutable.Tabs.RemoveAt(toRemove);
|
Mutable.Tabs.RemoveAt(toRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doOpens) {
|
if (doOpens) {
|
||||||
this._toOpen = -2;
|
_toOpen = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ internal class SingleRow : ISelectorPart {
|
|||||||
public uint Row { get; }
|
public uint Row { get; }
|
||||||
|
|
||||||
public SingleRow(uint row) {
|
public SingleRow(uint row) {
|
||||||
this.Row = row;
|
Row = row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,8 +287,8 @@ internal class IndexRange : ISelectorPart {
|
|||||||
public uint End { get; }
|
public uint End { get; }
|
||||||
|
|
||||||
public IndexRange(uint start, uint end) {
|
public IndexRange(uint start, uint end) {
|
||||||
this.Start = start;
|
Start = start;
|
||||||
this.End = end;
|
End = end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ internal class ColumnSpecifier : ISelectorPart {
|
|||||||
public uint Column { get; }
|
public uint Column { get; }
|
||||||
|
|
||||||
public ColumnSpecifier(uint column) {
|
public ColumnSpecifier(uint column) {
|
||||||
this.Column = column;
|
Column = column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,9 +310,9 @@ internal class AutoTranslateEntry {
|
|||||||
internal SeString SeString { get; }
|
internal SeString SeString { get; }
|
||||||
|
|
||||||
public AutoTranslateEntry(uint group, uint row, string str, SeString seStr) {
|
public AutoTranslateEntry(uint group, uint row, string str, SeString seStr) {
|
||||||
this.Group = group;
|
Group = group;
|
||||||
this.Row = row;
|
Row = row;
|
||||||
this.String = str;
|
String = str;
|
||||||
this.SeString = seStr;
|
SeString = seStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,18 +6,18 @@ internal class Lender<T> {
|
|||||||
private int _counter;
|
private int _counter;
|
||||||
|
|
||||||
internal Lender(Func<T> ctor) {
|
internal Lender(Func<T> ctor) {
|
||||||
this._ctor = ctor;
|
_ctor = ctor;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ResetCounter() {
|
internal void ResetCounter() {
|
||||||
this._counter = 0;
|
_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal T Borrow() {
|
internal T Borrow() {
|
||||||
if (this._items.Count <= this._counter) {
|
if (_items.Count <= _counter) {
|
||||||
this._items.Add(this._ctor());
|
_items.Add(_ctor());
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._items[this._counter++];
|
return _items[_counter++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ internal class PartyFinderPayload : Payload {
|
|||||||
internal uint Id { get; }
|
internal uint Id { get; }
|
||||||
|
|
||||||
internal PartyFinderPayload(uint id) {
|
internal PartyFinderPayload(uint id) {
|
||||||
this.Id = id;
|
Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override byte[] EncodeImpl() {
|
protected override byte[] EncodeImpl() {
|
||||||
@@ -26,7 +26,7 @@ internal class AchievementPayload : Payload {
|
|||||||
internal uint Id { get; }
|
internal uint Id { get; }
|
||||||
|
|
||||||
internal AchievementPayload(uint id) {
|
internal AchievementPayload(uint id) {
|
||||||
this.Id = id;
|
Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override byte[] EncodeImpl() {
|
protected override byte[] EncodeImpl() {
|
||||||
|
|||||||
Reference in New Issue
Block a user