Skip to content

Commit

Permalink
1.0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
paissaheavyindustries committed Oct 3, 2023
1 parent 383e17f commit 3a83186
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
5 changes: 3 additions & 2 deletions Telesto/Doodles/Image.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ImGuiNET;
using Dalamud.Interface.Internal;
using ImGuiNET;
using ImGuiScene;
using System;
using System.Collections;
Expand Down Expand Up @@ -32,7 +33,7 @@ internal enum AlignmentEnum
internal AlignmentEnum valign = AlignmentEnum.Near;
internal Coordinate position { get; set; }
internal uint IconId = 0;
internal TextureWrap? Texture { get; set; } = null;
internal IDalamudTextureWrap? Texture { get; set; } = null;

internal int calcWidth;
internal int calcHeight;
Expand Down
51 changes: 27 additions & 24 deletions Telesto/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using ImGuiScene;
using static System.Reflection.Metadata.BlobBuilder;
using Dalamud.Plugin.Services;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Internal;

namespace Telesto
{
Expand Down Expand Up @@ -229,13 +232,13 @@ public void Dispose()
public string Name => "Telesto";

private DalamudPluginInterface _pi { get; init; }
private CommandManager _cm { get; init; }
internal ChatGui _cg { get; init; }
private GameGui _gg { get; init; }
private ClientState _cs { get; init; }
private ObjectTable _ot { get; init; }
private PartyList _pl { get; init; }
private DataManager _dm { get; init; }
private ICommandManager _cm { get; init; }
internal IChatGui _cg { get; init; }
private IGameGui _gg { get; init; }
private IClientState _cs { get; init; }
private IObjectTable _ot { get; init; }
private IPartyList _pl { get; init; }
private ITextureProvider _tp { get; init; }
private Dictionary<string, Subscription> Subscriptions = new Dictionary<string, Subscription>();
private ManualResetEvent SendPendingEvent = new ManualResetEvent(false);
private ManualResetEvent StopEvent = new ManualResetEvent(false);
Expand Down Expand Up @@ -273,20 +276,20 @@ public void Dispose()
private Dictionary<string, Doodle> Doodles = new Dictionary<string, Doodle>();
private Queue<PendingRequest> Requests = new Queue<PendingRequest>();
private Queue<Tuple<string, string>> Sends = new Queue<Tuple<string, string>>();
private Dictionary<int, TextureWrap> _textures = new Dictionary<int, TextureWrap>();
private Dictionary<int, IDalamudTextureWrap> _textures = new Dictionary<int, IDalamudTextureWrap>();

[PluginService]
public static SigScanner TargetModuleScanner { get; private set; }
public static ISigScanner TargetModuleScanner { get; private set; }

public Plugin(
[RequiredVersion("1.0")] DalamudPluginInterface pluginInterface,
[RequiredVersion("1.0")] CommandManager commandManager,
[RequiredVersion("1.0")] ClientState clientState,
[RequiredVersion("1.0")] ObjectTable objectTable,
[RequiredVersion("1.0")] GameGui gameGui,
[RequiredVersion("1.0")] ChatGui chatGui,
[RequiredVersion("1.0")] PartyList partylist,
[RequiredVersion("1.0")] DataManager dataManager
[RequiredVersion("1.0")] ICommandManager commandManager,
[RequiredVersion("1.0")] IClientState clientState,
[RequiredVersion("1.0")] IObjectTable objectTable,
[RequiredVersion("1.0")] IGameGui gameGui,
[RequiredVersion("1.0")] IChatGui chatGui,
[RequiredVersion("1.0")] IPartyList partylist,
[RequiredVersion("1.0")] ITextureProvider textureProvider
)
{
_pi = pluginInterface;
Expand All @@ -296,7 +299,7 @@ public Plugin(
_gg = gameGui;
_cg = chatGui;
_pl = partylist;
_dm = dataManager;
_tp = textureProvider;
_cfg = _pi.GetPluginConfig() as Config ?? new Config();
_pi.UiBuilder.Draw += DrawUI;
_pi.UiBuilder.OpenConfigUi += OpenConfigUI;
Expand All @@ -312,14 +315,14 @@ public Plugin(
LoadTextures();
if (_cs.IsLoggedIn == true)
{
_cs_Login(null, null);
_cs_Login();
}
SendThread = new Thread(new ParameterizedThreadStart(SendThreadProc));
SendThread.Name = "Telesto send thread";
SendThread.Start(this);
}

private void _cs_TerritoryChanged(object sender, ushort e)
private void _cs_TerritoryChanged(ushort e)
{
_territoryChanged = true;
}
Expand All @@ -331,7 +334,7 @@ private void LoadTextures()

private void UnloadTextures()
{
foreach (KeyValuePair<int, TextureWrap> kp in _textures)
foreach (KeyValuePair<int, IDalamudTextureWrap> kp in _textures)
{
if (kp.Value != null)
{
Expand Down Expand Up @@ -364,9 +367,9 @@ private void FindSigs()
}
}

internal TextureWrap? GetTexture(uint id)
internal IDalamudTextureWrap? GetTexture(uint id)
{
return _dm.GetImGuiTextureIcon(id);
return _tp.GetIcon(id, Dalamud.Plugin.Services.ITextureProvider.IconFlags.None);
}

private IntPtr SearchForSig(string sig)
Expand All @@ -379,7 +382,7 @@ private IntPtr SearchForStaticAddress(string sig, int offset)
return TargetModuleScanner.GetStaticAddressFromSig(sig, 11);
}

private void _cs_Logout(object sender, EventArgs e)
private void _cs_Logout()
{
_loggedIn = false;
ResetSigs();
Expand All @@ -395,7 +398,7 @@ private void _cs_Logout(object sender, EventArgs e)
}
}

private void _cs_Login(object sender, EventArgs e)
private void _cs_Login()
{
_loggedIn = true;
ResetSigs();
Expand Down

0 comments on commit 3a83186

Please sign in to comment.