API 9
This commit is contained in:
commit
0371be9580
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/.idea
|
||||
*.user
|
16
RetainerShutUp.sln
Normal file
16
RetainerShutUp.sln
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RetainerShutUp", "RetainerShutUp\RetainerShutUp.csproj", "{40A7D1C5-536E-411E-B24D-3AA490FBDE7E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{40A7D1C5-536E-411E-B24D-3AA490FBDE7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{40A7D1C5-536E-411E-B24D-3AA490FBDE7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{40A7D1C5-536E-411E-B24D-3AA490FBDE7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{40A7D1C5-536E-411E-B24D-3AA490FBDE7E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
3
RetainerShutUp/.gitignore
vendored
Normal file
3
RetainerShutUp/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/dist
|
||||
/obj
|
||||
/bin
|
20
RetainerShutUp/DalamudPackager.targets
Normal file
20
RetainerShutUp/DalamudPackager.targets
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Debug'">
|
||||
<DalamudPackager
|
||||
ProjectDir="$(ProjectDir)"
|
||||
OutputPath="$(OutputPath)"
|
||||
AssemblyName="$(AssemblyName)"
|
||||
MakeZip="false"
|
||||
VersionComponents="2"/>
|
||||
</Target>
|
||||
|
||||
<Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
|
||||
<DalamudPackager
|
||||
ProjectDir="$(ProjectDir)"
|
||||
OutputPath="$(OutputPath)"
|
||||
AssemblyName="$(AssemblyName)"
|
||||
MakeZip="true"
|
||||
VersionComponents="2"/>
|
||||
</Target>
|
||||
</Project>
|
84
RetainerShutUp/Plogon.cs
Normal file
84
RetainerShutUp/Plogon.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Dalamud.Game.ClientState.Conditions;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Logging;
|
||||
using Dalamud.Memory;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game;
|
||||
|
||||
namespace RetainerShutUp;
|
||||
|
||||
public class Plogon : IDalamudPlugin
|
||||
{
|
||||
private readonly IChatGui _chatGui;
|
||||
private readonly IClientState _clientState;
|
||||
private readonly ICondition _condition;
|
||||
private readonly IPluginLog _pluginLog;
|
||||
|
||||
private List<string>? _retainerNames = null;
|
||||
|
||||
public Plogon(IChatGui chatGui, IClientState clientState, ICondition condition, IPluginLog pluginLog)
|
||||
{
|
||||
_chatGui = chatGui;
|
||||
_clientState = clientState;
|
||||
_condition = condition;
|
||||
_pluginLog = pluginLog;
|
||||
|
||||
_clientState.Logout += LogOut;
|
||||
_chatGui.CheckMessageHandled += CheckMessageHandled;
|
||||
}
|
||||
|
||||
private void LogOut()
|
||||
{
|
||||
_retainerNames = null;
|
||||
}
|
||||
|
||||
private void CheckMessageHandled(XivChatType type, uint senderId, ref SeString sender, ref SeString message,
|
||||
ref bool isHandled)
|
||||
{
|
||||
if (isHandled || type != XivChatType.NPCDialogue || senderId != 0 ||
|
||||
!_condition[ConditionFlag.OccupiedSummoningBell])
|
||||
return;
|
||||
|
||||
if (_retainerNames == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> newNames = new() { "Feo Ul" };
|
||||
unsafe
|
||||
{
|
||||
RetainerManager* retainerManager = RetainerManager.Instance();
|
||||
if (retainerManager == null || retainerManager->Ready != 1)
|
||||
return;
|
||||
|
||||
foreach (var retainer in retainerManager->RetainersSpan)
|
||||
{
|
||||
if (!retainer.Available)
|
||||
continue;
|
||||
|
||||
newNames.Add(MemoryHelper.ReadSeStringNullTerminated((IntPtr)retainer.Name).ToString());
|
||||
}
|
||||
}
|
||||
_retainerNames = newNames;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_pluginLog.Error(e, "Could not fetch retainers");
|
||||
_chatGui.PrintError(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
if (_retainerNames != null && _retainerNames.Contains(sender.ToString()))
|
||||
isHandled = true;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_chatGui.CheckMessageHandled -= CheckMessageHandled;
|
||||
_clientState.Logout -= LogOut;
|
||||
}
|
||||
}
|
58
RetainerShutUp/RetainerShutUp.csproj
Normal file
58
RetainerShutUp/RetainerShutUp.csproj
Normal file
@ -0,0 +1,58 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Version>1.0</Version>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<OutputPath>dist</OutputPath>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
<DebugType>portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<DalamudLibPath>$(DALAMUD_HOME)/</DalamudLibPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DalamudPackager" Version="2.1.12"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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="Lumina">
|
||||
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Lumina.Excel">
|
||||
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
<Reference Include="FFXIVClientStructs">
|
||||
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
|
||||
<Private>false</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin" Condition="'$(Configuration)' == 'Release'">
|
||||
<Exec Command="rename $(OutDir)$(AssemblyName)\latest.zip $(AssemblyName)-$(Version).zip"/>
|
||||
</Target>
|
||||
</Project>
|
7
RetainerShutUp/RetainerShutUp.json
Normal file
7
RetainerShutUp/RetainerShutUp.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"Name": "RetainerShutUp",
|
||||
"Author": "Liza Carvelli",
|
||||
"Punchline": "",
|
||||
"Description": "",
|
||||
"RepoUrl": "https://git.carvel.li/liza/Influx"
|
||||
}
|
13
RetainerShutUp/packages.lock.json
Normal file
13
RetainerShutUp/packages.lock.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net7.0-windows7.0": {
|
||||
"DalamudPackager": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.1.12, )",
|
||||
"resolved": "2.1.12",
|
||||
"contentHash": "Sc0PVxvgg4NQjcI8n10/VfUQBAS4O+Fw2pZrAqBdRMbthYGeogzu5+xmIGCGmsEZ/ukMOBuAqiNiB5qA3MRalg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user