Skip to content

Commit

Permalink
1.0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
paissaheavyindustries committed Nov 22, 2024
1 parent 597b4c4 commit bcfed10
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
6 changes: 3 additions & 3 deletions Where's Mouse.sln
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29709.97
# Visual Studio Version 17
VisualStudioVersion = 17.8.34511.84
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Where's Mouse", "WheresMouse\Where's Mouse.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WheresMouse", "WheresMouse\WheresMouse.csproj", "{13C812E9-0D42-4B95-8646-40EEBF30636F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
54 changes: 18 additions & 36 deletions WheresMouse/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Dalamud.Game.ClientState.Conditions;
using Dalamud.Game.Command;
using Dalamud.Interface.Utility;
using Dalamud.IoC;
using Dalamud.Logging;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
using FFXIVClientStructs.FFXIV.Common.Lua;
using ImGuiNET;
using System;
using System.Collections.Generic;
Expand All @@ -20,12 +18,7 @@ public sealed class Plugin : IDalamudPlugin

public string Name => "Where's Mouse";

private IDalamudPluginInterface _pi { get; init; }
private ICommandManager _cm { get; init; }
private IClientState _cs { get; init; }
private ICondition _cd { get; init; }
private IPluginLog _lo { get; init; }

private Service _svc = null;
private Wherenator _where = new Wherenator();
private Config _cfg;
private float _adjusterX = 0.0f;
Expand All @@ -37,44 +30,32 @@ public sealed class Plugin : IDalamudPlugin

private List<Maustrale> maustrales = new List<Maustrale>();

public Plugin(
IDalamudPluginInterface pluginInterface,
ICommandManager commandManager,
IClientState clientState,
IFramework framework,
IGameGui gameGui,
ICondition condition,
IPluginLog log
)
public Plugin(IDalamudPluginInterface pluginInterface)
{
_pi = pluginInterface;
_cm = commandManager;
_cs = clientState;
_cd = condition;
_lo = log;
_cfg = _pi.GetPluginConfig() as Config ?? new Config();
_pi.UiBuilder.Draw += DrawUI;
_pi.UiBuilder.OpenMainUi += DrawConfigUI;
_pi.UiBuilder.OpenConfigUi += DrawConfigUI;
_cm.AddHandler("/wheremouse", new CommandInfo(OnCommand)
_svc = pluginInterface.Create<Service>();
_cfg = _svc.pi.GetPluginConfig() as Config ?? new Config();
_svc.pi.UiBuilder.Draw += DrawUI;
_svc.pi.UiBuilder.OpenMainUi += DrawConfigUI;
_svc.pi.UiBuilder.OpenConfigUi += DrawConfigUI;
_svc.cm.AddHandler("/wheremouse", new CommandInfo(OnCommand)
{
HelpMessage = "Open Where's Mouse configuration"
});
}

public void Dispose()
{
_pi.UiBuilder.Draw -= DrawUI;
_pi.UiBuilder.OpenMainUi -= DrawConfigUI;
_pi.UiBuilder.OpenConfigUi -= DrawConfigUI;
_svc.pi.UiBuilder.Draw -= DrawUI;
_svc.pi.UiBuilder.OpenMainUi -= DrawConfigUI;
_svc.pi.UiBuilder.OpenConfigUi -= DrawConfigUI;
SaveConfig();
_cm.RemoveHandler("/wheremouse");
_svc.cm.RemoveHandler("/wheremouse");
}

public void SaveConfig()
{
_lo.Debug("Saving config");
_pi.SavePluginConfig(_cfg);
_svc.lo.Debug("Saving config");
_svc.pi.SavePluginConfig(_cfg);
}

private void OnCommand(string command, string args)
Expand Down Expand Up @@ -173,12 +154,13 @@ private void DrawUI()
if (ImGui.Begin(Name, ref open, ImGuiWindowFlags.NoCollapse) == false)
{
ImGui.End();
ImGui.PopStyleColor(3);
ImGui.PopStyleColor(3);
return;
}
if (open == false)
{
_cfg.Opened = false;
SaveConfig();
ImGui.End();
ImGui.PopStyleColor(3);
return;
Expand Down Expand Up @@ -486,7 +468,7 @@ private void DrawUI()
||
(pos.Y > disp.Y)
);
bool inCombat = _cd[ConditionFlag.InCombat];
bool inCombat = _svc.cd[ConditionFlag.InCombat];
if (_cfg.Enabled == true && _where.active == true)
{
if ((inCombat == true || _cfg.OnlyShowInCombat == false) && (offscreen == false || _cfg.OnlyOnScreen == false))
Expand Down
19 changes: 19 additions & 0 deletions WheresMouse/Service.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Dalamud.Plugin.Services;
using Dalamud.Plugin;
using Dalamud.IoC;

namespace WheresMouse
{

internal class Service
{

[PluginService] public IDalamudPluginInterface pi { get; private set; }
[PluginService] public ICommandManager cm { get; private set; }
[PluginService] public IClientState cs { get; private set; }
[PluginService] public ICondition cd { get; private set; }
[PluginService] public IPluginLog lo { get; private set; }

}

}
File renamed without changes.

0 comments on commit bcfed10

Please sign in to comment.