Skip to content

Commit

Permalink
MinionRoulette 1.1.3.0 [PUSH]
Browse files Browse the repository at this point in the history
6.5 Update
  • Loading branch information
InitialDet committed Oct 4, 2023
1 parent dd59df6 commit e7317ba
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 120 deletions.
8 changes: 2 additions & 6 deletions MinionRoulette/Configuration/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ namespace MinionRoulette.Configuration;
[Serializable]
public class Configuration : IPluginConfiguration
{
public int Version { get; set; } = 1;

public bool PluginEnabled = true;
public int Version { get; set; } = 1;

public void Save()
{
Expand All @@ -18,13 +17,10 @@ public void Save()
public static Configuration Load()
{
if (Service.PluginInterface.GetPluginConfig() is Configuration config)
{
return config;
}

config = new Configuration();
config.Save();
return config;
}
}

}
37 changes: 20 additions & 17 deletions MinionRoulette/MinionRoulette.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
using Dalamud.Game.Command;
using Dalamud.Plugin;

// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedType.Global

namespace MinionRoulette;

public class Plugin : IDalamudPlugin
{
public static string Name => Service.PluginName;

private const string CmdMrCfg = "/minionroulette";
private const string CmdMrCfgShort = "/mrcfg";
private const string CmdMrToggle = "/mrtoggle";
private const string CmdMrToggle = "/mrtoggle";
private static PluginUi _pluginUi = null!;

private readonly SwapManager _currentZone;
private static PluginUi _pluginUi = null!;

public Plugin(DalamudPluginInterface pluginInterface)
{
Expand All @@ -32,7 +31,6 @@ public Plugin(DalamudPluginInterface pluginInterface)
Service.Commands.AddHandler(CmdMrCfgShort, new CommandInfo(OnCommand)
{
HelpMessage = "Opens Config Window"

});

Service.Commands.AddHandler(CmdMrCfg, new CommandInfo(OnCommand)
Expand All @@ -43,6 +41,21 @@ public Plugin(DalamudPluginInterface pluginInterface)
_currentZone.Init();
}

public static string Name => Service.PluginName;

public void Dispose()
{
_pluginUi.Dispose();
_currentZone.Dispose();

Service.Configuration.Save();
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
Service.Commands.RemoveHandler(CmdMrCfg);
Service.Commands.RemoveHandler(CmdMrCfgShort);
Service.Commands.RemoveHandler(CmdMrToggle);
}

private static void OnCommand(string command, string args)
{
switch (command.Trim())
Expand All @@ -62,18 +75,8 @@ private static void OnCommand(string command, string args)
}
}

private static void OnOpenConfigUi() => _pluginUi.Toggle();

public void Dispose()
private static void OnOpenConfigUi()
{
_pluginUi.Dispose();
_currentZone.Dispose();

Service.Configuration.Save();
Service.PluginInterface.UiBuilder.Draw -= Service.WindowSystem.Draw;
Service.PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
Service.Commands.RemoveHandler(CmdMrCfg);
Service.Commands.RemoveHandler(CmdMrCfgShort);
Service.Commands.RemoveHandler(CmdMrToggle);
_pluginUi.Toggle();
}
}
134 changes: 67 additions & 67 deletions MinionRoulette/MinionRoulette.csproj
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Det</Authors>
<Version>1.1.3.0</Version>
<Description>Swaps between your favorite minions</Description>
<PackageProjectUrl>https://github.com/InitialDet/MinionRoulette</PackageProjectUrl>
<Configurations>Release;Debug</Configurations>
<TargetFramework>net7.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputPath>bin\$(Configuration)\</OutputPath>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>
<PropertyGroup>
<Authors>Det</Authors>
<Version>1.1.3.0</Version>
<Description>Swaps between your favorite minions</Description>
<PackageProjectUrl>https://github.com/InitialDet/MinionRoulette</PackageProjectUrl>
<Configurations>Release;Debug</Configurations>
<TargetFramework>net7.0-windows</TargetFramework>
<Platforms>x64</Platforms>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<OutputPath>bin\$(Configuration)\</OutputPath>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
</PropertyGroup>

<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>
<PropertyGroup>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>

<ItemGroup>
<Content Include="MinionRoulette.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="MinionRoulette.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>

<ItemGroup>
<Folder Include="images\" />
</ItemGroup>
<ItemGroup>
<Folder Include="images\"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.12" />
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
<Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Dalamud">
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina.Excel">
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>
11 changes: 8 additions & 3 deletions MinionRoulette/MinionRoulette.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
"Punchline": "Swap between your minions every time you change zones",
"Description": "Make sure to enable the checkbox in the Minion Guide if you want only your favorite minions to be swapped",
"IconUrl": "https://raw.githubusercontent.com/InitialDet/MinionRoulette/main/MinionRoulette/images/icon.png",
"ImageUrls": [
"ImageUrls": [
""
],
"RepoUrl": "https://github.com/InitialDet/MinionRoulette",
"Tags": ["Casual","Minion"],
"CategoryTags": ["other"],
"Tags": [
"Casual",
"Minion"
],
"CategoryTags": [
"other"
],
"InternalName": "MinionRoulette",
"ApplicableVersion": "any",
"LoadPriority": 0,
Expand Down
17 changes: 8 additions & 9 deletions MinionRoulette/PluginUI.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using Dalamud.Interface.Windowing;
using ImGuiNET;
using System;
using Dalamud.Interface.Colors;
using System.Diagnostics;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
using ImGuiNET;

namespace MinionRoulette;

public class PluginUi : Window, IDisposable
{
public PluginUi() : base($"{Service.PluginName} Settings")
Expand All @@ -27,8 +28,9 @@ public override void Draw()
return;

ShowKofi();
ImGui.Checkbox("Enable MinionRoulette", ref Service.Configuration.PluginEnabled);

if (ImGui.Checkbox("Enable MinionRoulette", ref Service.Configuration.PluginEnabled))
Service.Configuration.Save();

if (Service.Configuration.PluginEnabled)
ImGui.TextColored(ImGuiColors.HealerGreen, "MinionRoulette Enabled");
else
Expand All @@ -52,11 +54,8 @@ private static void ShowKofi()
ImGui.PushStyleColor(ImGuiCol.ButtonHovered, 0xAA000000 | 0x005E5BFF);

if (ImGui.Button(buttonText))
{
Process.Start(new ProcessStartInfo { FileName = "https://ko-fi.com/initialdet", UseShellExecute = true });
}

ImGui.PopStyleColor(3);
}
}

}
14 changes: 8 additions & 6 deletions MinionRoulette/Service.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using Dalamud.IoC;
using Dalamud.Interface.Windowing;
using Dalamud.IoC;
using Dalamud.Plugin;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin.Services;

namespace MinionRoulette;

public class Service
{
public static void Initialize(DalamudPluginInterface pluginInterface)
=> pluginInterface.Create<Service>();

public const string PluginName = "MinionRoulette";

[PluginService] public static DalamudPluginInterface PluginInterface { get; private set; } = null!;
Expand All @@ -20,5 +18,9 @@ public static void Initialize(DalamudPluginInterface pluginInterface)

public static Configuration.Configuration Configuration { get; set; } = null!;
public static WindowSystem WindowSystem { get; } = new(PluginName);
}

public static void Initialize(DalamudPluginInterface pluginInterface)
{
pluginInterface.Create<Service>();
}
}
Loading

0 comments on commit e7317ba

Please sign in to comment.