Found my old source copy

This commit is contained in:
Liza 2024-05-29 01:20:15 +02:00
commit 40a3e6c202
Signed by: liza
GPG Key ID: 7199F8D727D55F67
9 changed files with 825 additions and 0 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
[*.{cs,vb}]
# IDE0003: Remove qualification
dotnet_style_qualification_for_event = false:none
# IDE0003: Remove qualification
dotnet_style_qualification_for_field = false:none
# IDE0003: Remove qualification
dotnet_style_qualification_for_method = false:none
# IDE0003: Remove qualification
dotnet_style_qualification_for_property = false:none
# IDE0060: Remove unused parameter
dotnet_code_quality_unused_parameters = non_public:suggestion

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

340
.gitignore vendored Normal file
View File

@ -0,0 +1,340 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb

18
DalamudPackager.targets Normal file
View File

@ -0,0 +1,18 @@
<?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"/>
</Target>
<Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
<DalamudPackager
ProjectDir="$(ProjectDir)"
OutputPath="$(OutputPath)"
AssemblyName="$(AssemblyName)"
MakeZip="true"/>
</Target>
</Project>

193
Plugin.cs Normal file
View File

@ -0,0 +1,193 @@
using Dalamud.Game.ClientState.Objects.Types;
using Dalamud.Plugin;
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
using ImGuiNET;
using System;
using System.Collections.Generic;
using System.Numerics;
using Dalamud.Interface.Utility;
using Dalamud.Plugin.Services;
namespace ZodiacFinder
{
public class Plugin : IDalamudPlugin
{
private readonly DalamudPluginInterface pluginInterface;
private readonly IChatGui chat;
private readonly IClientState clientState;
private readonly IObjectTable objectTable;
private readonly IDataManager dataManager;
private readonly IGameGui gameGui;
private readonly IDictionary<uint, Book> books = new Dictionary<uint, Book>();
private ISet<uint> atmaWeapons = new HashSet<uint> {
7824, // Curtana Atma
7825, // Sphairai Atma
7826, // Bravura Atma
7827, // Gae Bolg Atma
7828, // Artemis Bow Atma
7829, // Thyrus Atma
7830, // Stardust Rod Atma
7831, // Veil of Wiyu Atma
7832, // Omnilex Atma
7833, // Holy Shield Atma
9251, // Yoshimitsu Atma
};
public string Name => "ZodiacFinder";
public Plugin(
DalamudPluginInterface pi,
ICommandManager commands,
IChatGui chat,
IClientState clientState,
IObjectTable objectTable,
IDataManager dataManager,
IGameGui gameGui)
{
this.pluginInterface = pi;
this.chat = chat;
this.clientState = clientState;
this.objectTable = objectTable;
this.dataManager = dataManager;
this.gameGui = gameGui;
this.pluginInterface.UiBuilder.Draw += this.Draw;
this.PopulateBooks();
}
#region IDisposable Support
protected virtual void Dispose(bool disposing)
{
if (!disposing) return;
this.pluginInterface.UiBuilder.Draw -= this.Draw;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
#endregion
private unsafe void Draw()
{
if (!clientState.IsLoggedIn || clientState.IsPvP || objectTable == null || !HasAtmaWeaponEquipped())
return;
var bookId = GetCurrentBook();
if (bookId == 0)
return;
var relicNote = RelicNote.Instance();
if (relicNote == null)
return;
var book = books[bookId];
for (int index = 0; index < objectTable.Length; ++index)
{
GameObject obj = objectTable[index];
if (!(obj is BattleNpc npc) || npc.CurrentHp == 0)
continue;
var indexInBook = book.Enemies.IndexOf(npc.NameId);
if (indexInBook == -1)
continue;
if (relicNote->GetMonsterProgress(indexInBook) >= 3)
continue;
if (!gameGui.WorldToScreen(new Vector3(obj.Position.X, obj.Position.Y, obj.Position.Z), out var pos))
continue;
ImGui.PushStyleVar(ImGuiStyleVar.WindowPadding, new Vector2(0, 0));
ImGuiHelpers.ForceNextWindowMainViewport();
ImGuiHelpers.SetNextWindowPosRelativeMainViewport(new Vector2(0, 0));
ImGui.Begin($"zodiac###{index}",
ImGuiWindowFlags.NoInputs | ImGuiWindowFlags.NoNav | ImGuiWindowFlags.NoTitleBar |
ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoSavedSettings);
ImGui.SetWindowSize(ImGui.GetIO().DisplaySize);
ImGui.GetWindowDrawList().AddCircleFilled(new Vector2(pos.X, pos.Y), 5f, ImGui.GetColorU32(0xff0000ff), 100);
//ImGui.GetWindowDrawList().AddText(new Vector2(pos.X, pos.Y), ImGui.GetColorU32(0xffffffff), $"{npc.NameId} - {obj.Name.TextValue}");
ImGui.End();
ImGui.PopStyleVar();
}
}
private bool HasAtmaWeaponEquipped()
{
return atmaWeapons.Contains(GetEquippedItem(0)) || atmaWeapons.Contains(GetEquippedItem(1));
}
private unsafe uint GetCurrentBook()
{
var im = InventoryManager.Instance();
if (im == null)
return 0;
var keyItems = im->GetInventoryContainer(InventoryType.KeyItems);
for (int i = 0; i < keyItems->Size; ++i)
{
var slot = keyItems->GetInventorySlot(i);
if (slot == null)
continue;
uint itemId = slot->ItemID;
if (books.ContainsKey(itemId))
return itemId;
}
return 0;
}
private unsafe uint GetEquippedItem(int index)
{
var im = InventoryManager.Instance();
if (im == null)
return 0;
var equipped = im->GetInventoryContainer(InventoryType.EquippedItems);
if (equipped == null)
return 0;
var slot = equipped->GetInventorySlot(index);
if (slot == null)
return 0;
return slot->ItemID;
}
private void PopulateBooks()
{
var relicNoteSheet = this.dataManager.GetExcelSheet<Excel.RelicNote>()!;
foreach (var row in relicNoteSheet)
{
if (row.EventItem == null || row.EventItem.Row == 0)
continue;
var book = new Book();
for (int i = 0; i < row.MonsterNoteTargetCommon.Length; i++)
{
book.Enemies.Add(row.MonsterNoteTargetCommon[i].MonsterNoteTargetCommon.Value!.BNpcName.Row);
}
//chat.Print($"{row.EventItem.Row} - {book}");
books.Add(row.EventItem.Row, book);
}
}
internal sealed class Book
{
public IList<uint> Enemies = new List<uint>();
public override string ToString()
{
return string.Join(",", Enemies);
}
}
}
}

110
RelicNote.cs Normal file
View File

@ -0,0 +1,110 @@
using Lumina;
using Lumina.Data;
using Lumina.Excel;
using Lumina.Excel.GeneratedSheets;
namespace ZodiacFinder.Excel
{
[Sheet("RelicNote", columnHash: 0xb557320e)]
public partial class RelicNote : ExcelRow
{
public class RelicNoteMonsterNoteTargetCommon
{
public LazyRow<MonsterNoteTarget> MonsterNoteTargetCommon { get; set; }
public byte MonsterCount { get; set; }
}
public class RelicNoteFate
{
public LazyRow<Fate> Fate { get; set; }
public LazyRow<PlaceName> PlaceName { get; set; }
}
public LazyRow<EventItem> EventItem { get; set; }
public RelicNoteMonsterNoteTargetCommon[] MonsterNoteTargetCommon { get; set; }
public LazyRow<MonsterNoteTarget>[] MonsterNoteTargetNM { get; set; }
public ushort Unknown24 { get; set; }
public RelicNoteFate[] Fate { get; set; }
public LazyRow<Leve>[] Leve { get; set; }
/// <inheritdoc/>
public override void PopulateData(RowParser parser, GameData gameData, Language language)
{
base.PopulateData(parser, gameData, language);
this.EventItem = new LazyRow<EventItem>(gameData, parser.ReadColumn<uint>(0), language);
this.MonsterNoteTargetCommon = new RelicNoteMonsterNoteTargetCommon[10];
for (var i = 0; i < 10; i++)
{
this.MonsterNoteTargetCommon[i] = new RelicNoteMonsterNoteTargetCommon
{
MonsterNoteTargetCommon = new LazyRow<MonsterNoteTarget>(gameData, parser.ReadColumn<ushort>(1 + (i * 2) + 0), language),
MonsterCount = parser.ReadColumn<byte>(1 + (i * 2) + 1),
};
}
this.MonsterNoteTargetNM = new LazyRow<MonsterNoteTarget>[3];
for (var i = 0; i < 3; i++)
this.MonsterNoteTargetNM[i] = new LazyRow<MonsterNoteTarget>(gameData, parser.ReadColumn<ushort>(21 + i), language);
this.Unknown24 = parser.ReadColumn<ushort>(24);
this.Fate = new RelicNoteFate[3];
for (var i = 0; i < 3; i++)
{
this.Fate[i] = new RelicNoteFate
{
Fate = new LazyRow<Fate>(gameData, parser.ReadColumn<ushort>(25 + (i * 2) + 0), language),
PlaceName = new LazyRow<PlaceName>(gameData, parser.ReadColumn<ushort>(25 + (i * 2) + 1), language),
};
}
this.Leve = new LazyRow<Leve>[3];
for (var i = 0; i < 3; i++)
this.Leve[i] = new LazyRow<Leve>(gameData, parser.ReadColumn<ushort>(31 + i), language);
}
}
[Sheet("MonsterNoteTarget", columnHash: 0x4157404f)]
public partial class MonsterNoteTarget : ExcelRow
{
public class MonsterNoteTargetPlaceName
{
public LazyRow<PlaceName> Zone { get; set; }
public LazyRow<PlaceName> Location { get; set; }
}
public LazyRow<BNpcName> BNpcName { get; set; }
public int Icon { get; set; }
public LazyRow<Town> Town { get; set; }
public MonsterNoteTargetPlaceName[] PlaceName { get; set; }
public override void PopulateData(RowParser parser, GameData gameData, Language language)
{
base.PopulateData(parser, gameData, language);
this.BNpcName = new LazyRow<BNpcName>(gameData, parser.ReadColumn<ushort>(0), language);
this.Icon = parser.ReadColumn<int>(1);
this.Town = new LazyRow<Town>(gameData, parser.ReadColumn<byte>(2), language);
this.PlaceName = new MonsterNoteTargetPlaceName[3];
for (var i = 0; i < 3; i++)
{
this.PlaceName[i] = new MonsterNoteTargetPlaceName
{
Zone = new LazyRow<PlaceName>(gameData, parser.ReadColumn<ushort>(3 + (i * 2) + 0), language),
Location = new LazyRow<PlaceName>(gameData, parser.ReadColumn<ushort>(3 + (i * 2) + 1), language),
};
}
}
}
}

52
ZodiacFinder.csproj Normal file
View File

@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<LangVersion>9.0</LangVersion>
<Version>2.0.0.0</Version>
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DalamudPackager" Version="2.1.8" />
</ItemGroup>
<ItemGroup>
<!--You may need to adjust these paths yourself. These point to a Dalamud assembly in AppData.-->
<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>
<Reference Include="Lumina.Excel">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Lumina.Excel.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\Newtonsoft.Json.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="FFXIVClientStructs">
<HintPath>$(AppData)\XIVLauncher\addon\Hooks\dev\FFXIVClientStructs.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
</Project>

8
ZodiacFinder.json Normal file
View File

@ -0,0 +1,8 @@
{
"Name": "ZodiacFinder",
"Author": "liza",
"Punchline": "Find Monsters for Zodiac Books",
"Description": "Find Monsters for Zodiac Books",
"RepoUrl": "",
"Tags": []
}

25
ZodiacFinder.sln Normal file
View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32414.318
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZodiacFinder", "ZodiacFinder.csproj", "{7A76E8A0-EF18-4FF3-A972-646635CEE119}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A76E8A0-EF18-4FF3-A972-646635CEE119}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A76E8A0-EF18-4FF3-A972-646635CEE119}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A76E8A0-EF18-4FF3-A972-646635CEE119}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A76E8A0-EF18-4FF3-A972-646635CEE119}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F19EF4CF-717B-4648-B1D6-C8CDE0202DAB}
EndGlobalSection
EndGlobal