Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions Properties/AssemblyInfo.cs

This file was deleted.

26 changes: 0 additions & 26 deletions Properties/Settings.Designer.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Properties/Settings.settings

This file was deleted.

50 changes: 28 additions & 22 deletions SlideCast.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
using System;
using Dalamud.Plugin;
using ImGuiNET;
using Dalamud.Interface;
using Dalamud.Configuration;
using Num = System.Numerics;
using System.Runtime.InteropServices;
using Dalamud.Game.Command;
using System.Linq;
using System.Collections.Generic;
using ImGuiNET;
using Num = System.Numerics;
using Dalamud.Configuration;
using Dalamud.Game;
using Dalamud.Game.ClientState;
using Dalamud.Game.Command;
using Dalamud.IoC;
using Dalamud.Interface;
using Dalamud.Plugin;

namespace SlideCast
{
public class SlideCast : IDalamudPlugin
{
[PluginService] public static DalamudPluginInterface PluginInterface { get; private set; } = null!;
[PluginService] public static CommandManager CommandManager { get; private set; } = null!;
[PluginService] public static SigScanner SigScanner { get; private set; }
[PluginService] public static ClientState ClientState { get; private set; }

public string Name => "Slide Cast";
private DalamudPluginInterface _pI;
private Config _configuration;
private bool _enabled;
private bool _config;
Expand Down Expand Up @@ -43,18 +50,17 @@ public class SlideCast : IDalamudPlugin
private Colour _colS = new Colour(0.04f, 0.8f, 1f, 1f);
private readonly Colour _col1S = new Colour(0.04f, 0.4f, 1f, 1f);

public void Initialize(DalamudPluginInterface pluginInterface)
public SlideCast()
{
_pI = pluginInterface;
_configuration = pluginInterface.GetPluginConfig() as Config ?? new Config();
_scan1 = pluginInterface.TargetModuleScanner.ScanText("E8 ?? ?? ?? ?? 41 b8 01 00 00 00 48 8d 15 ?? ?? ?? ?? 48 8b 48 20 e8 ?? ?? ?? ?? 48 8b cf");
_scan2 = pluginInterface.TargetModuleScanner.ScanText("e8 ?? ?? ?? ?? 48 8b cf 48 89 87 ?? ?? 00 00 e8 ?? ?? ?? ?? 41 b8 01 00 00 00");
_configuration = PluginInterface.GetPluginConfig() as Config ?? new Config();
_scan1 = SigScanner.ScanText("E8 ?? ?? ?? ?? 41 b8 01 00 00 00 48 8d 15 ?? ?? ?? ?? 48 8b 48 20 e8 ?? ?? ?? ?? 48 8b cf");
_scan2 = SigScanner.ScanText("e8 ?? ?? ?? ?? 48 8b cf 48 89 87 ?? ?? 00 00 e8 ?? ?? ?? ?? 41 b8 01 00 00 00");
_getBaseUiObj = Marshal.GetDelegateForFunctionPointer<GetBaseUiObjDelegate>(_scan1);
_getUi2ObjByName = Marshal.GetDelegateForFunctionPointer<GetUi2ObjByNameDelegate>(_scan2);
_castBar = _getUi2ObjByName(Marshal.ReadIntPtr(_getBaseUiObj(), 0x20), "_CastBar", 1) != IntPtr.Zero ? _getUi2ObjByName(Marshal.ReadIntPtr(_getBaseUiObj(), 0x20), "_CastBar", 1) : IntPtr.Zero;
_pI.UiBuilder.OnBuildUi += DrawWindow;
_pI.UiBuilder.OnOpenConfigUi += ConfigWindow;
_pI.CommandManager.AddHandler("/slc", new CommandInfo(Command)
PluginInterface.UiBuilder.Draw += DrawWindow;
PluginInterface.UiBuilder.OpenConfigUi += ConfigWindow;
CommandManager.AddHandler("/slc", new CommandInfo(Command)
{
HelpMessage = "Open SlideCast config menu"
});
Expand All @@ -63,8 +69,8 @@ public void Initialize(DalamudPluginInterface pluginInterface)
_slideTime = _configuration.SlideTime;
_slideCol = _configuration.SlideCol;

pluginInterface.ClientState.OnLogout += (s, e) => _enabled = false;
pluginInterface.ClientState.OnLogin += (s, e) => _enabled = _configuration.Enabled;
ClientState.Logout += (s, e) => _enabled = false;
ClientState.Login += (s, e) => _enabled = _configuration.Enabled;
}

private void Command(string command, string arguments)
Expand All @@ -74,12 +80,12 @@ private void Command(string command, string arguments)

public void Dispose()
{
_pI.UiBuilder.OnBuildUi -= DrawWindow;
_pI.UiBuilder.OnOpenConfigUi -= ConfigWindow;
_pI.CommandManager.RemoveHandler("/slc");
PluginInterface.UiBuilder.Draw -= DrawWindow;
PluginInterface.UiBuilder.OpenConfigUi -= ConfigWindow;
CommandManager.RemoveHandler("/slc");
}

private void ConfigWindow(object sender, EventArgs args)
private void ConfigWindow()
{
_config = true;
}
Expand Down Expand Up @@ -231,7 +237,7 @@ private void SaveConfig()
_configuration.Enabled = _enabled;
_configuration.SlideTime = _slideTime;
_configuration.SlideCol = _slideCol;
_pI.SavePluginConfig(_configuration);
PluginInterface.SavePluginConfig(_configuration);
}
}

Expand Down
130 changes: 57 additions & 73 deletions SlideCast.csproj
Original file line number Diff line number Diff line change
@@ -1,74 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlideCast</RootNamespace>
<AssemblyName>SlideCast</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dalamud">
<HintPath>$(APPDATA)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(APPDATA)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(APPDATA)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
</Reference>
<Reference Include="Lumina">
<HintPath>$(APPDATA)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="SlideCast.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Target">
<Platforms>x64</Platforms>
<PlatformTarget>x64</PlatformTarget>
<RootNamespace>SlideCast</RootNamespace>
<AssemblyName>SlideCast</AssemblyName>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<TargetFramework>net5-windows</TargetFramework>
<LangVersion>latest</LangVersion>
<Authors>Haplo064</Authors>
<Company>Haplo064</Company>
<Product>SlideCast</Product>
<Copyright>Copyright © 2021</Copyright>
<OutputPath>bin\$(Configuration)\</OutputPath>
<OutputType>Library</OutputType>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Version>1.0.0.0</Version>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PackageId>SlideCast</PackageId>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DefineConstants>TRACE;DEBUG</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.2" />
<Reference Include="Dalamud">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Dalamud.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGui.NET">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGui.NET.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="ImGuiScene">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\ImGuiScene.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Lumina">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>

<Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
<DalamudPackager ProjectDir="$(ProjectDir)" OutputPath="$(OutputPath)" AssemblyName="$(AssemblyName)" MakeZip="true" />
</Target>
</Project>
10 changes: 5 additions & 5 deletions SlideCast.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlideCast", "SlideCast.csproj", "{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SlideCast", "SlideCast.csproj", "{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Release|Any CPU.Build.0 = Release|Any CPU
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Debug|Any CPU.ActiveCfg = Debug|x64
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Debug|Any CPU.Build.0 = Debug|x64
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Release|Any CPU.ActiveCfg = Release|x64
{5BE879EC-7A17-44E4-B659-AE84EED2A3EF}.Release|Any CPU.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
5 changes: 5 additions & 0 deletions SlideCast.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: SlideCast
author: Haplo064
description: Adds an indicator of when it's safe to move while casting.
punchline: Safe casting indicator.
repo_url: https://github.com/Haplo064/SlideCast