first commit
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 2.1 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CharacterSelectPlugin
|
||||
{
|
||||
[Serializable]
|
||||
public class Character
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Macros { get; set; } = ""; // Default to empty instead of null
|
||||
public string? ImagePath { get; set; }
|
||||
public List<CharacterDesign> Designs { get; set; }
|
||||
public Vector3 NameplateColor { get; set; } = new Vector3(1.0f, 1.0f, 1.0f); // Default to white
|
||||
public string PenumbraCollection { get; set; } = "";
|
||||
public string GlamourerDesign { get; set; } = "";
|
||||
public string CustomizeProfile { get; set; } = "";
|
||||
public bool IsFavorite { get; set; } = false; // Allows favouriting
|
||||
public DateTime DateAdded { get; set; } = DateTime.Now; // Tracks when the character was added
|
||||
public int SortOrder { get; set; } = 0; // Tracks manual drag-drop order
|
||||
public string HonorificTitle { get; set; } = "";
|
||||
public string HonorificPrefix { get; set; } = "";
|
||||
public string HonorificSuffix { get; set; } = "";
|
||||
public Vector3 HonorificColor { get; set; } = new Vector3(1.0f, 1.0f, 1.0f); // Default white
|
||||
public Vector3 HonorificGlow { get; set; } = new Vector3(1.0f, 1.0f, 1.0f); // Default white
|
||||
public string MoodlePreset { get; set; } = ""; // MOODLES
|
||||
public byte IdlePoseIndex { get; set; } = 0; // Idles!
|
||||
public byte SitPoseIndex { get; set; } = 255;
|
||||
public byte GroundSitPoseIndex { get; set; } = 255;
|
||||
public byte DozePoseIndex { get; set; } = 255;
|
||||
public string? Pronouns { get; set; }
|
||||
public string? Gender { get; set; }
|
||||
public string? Age { get; set; }
|
||||
public string? Race { get; set; }
|
||||
public string? SexualOrientation { get; set; }
|
||||
public string? RelationshipStatus { get; set; }
|
||||
public string? Occupation { get; set; }
|
||||
public string? Abilities { get; set; }
|
||||
public string? Bio { get; set; }
|
||||
public string? RpTags { get; set; }
|
||||
public string? RpImagePath { get; set; } // Optional override image
|
||||
public RPProfile RPProfile { get; set; } = new();
|
||||
public string? LastInGameName { get; set; }
|
||||
public List<string> Tags { get; set; } = new();
|
||||
[JsonIgnore]
|
||||
public string Tag
|
||||
{
|
||||
get => Tags.FirstOrDefault() ?? "";
|
||||
set
|
||||
{
|
||||
Tags.Clear();
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
Tags.Add(value);
|
||||
}
|
||||
}
|
||||
public List<string> KnownTags { get; set; } = new();
|
||||
public List<string> DesignTags { get; set; } = new List<string>();
|
||||
public string CharacterAutomation { get; set; } = "";
|
||||
public List<DesignFolder> DesignFolders { get; set; } = new();
|
||||
public Vector3? OverrideAccentColor { get; set; } // if you're ever persisting the selection outside RPProfile
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public Character(
|
||||
string name,
|
||||
string macros,
|
||||
string? imagePath,
|
||||
List<CharacterDesign> designs,
|
||||
Vector3 nameplateColor,
|
||||
string penumbraCollection,
|
||||
string glamourerDesign,
|
||||
string customizeProfile,
|
||||
string honorificTitle,
|
||||
string honorificPrefix,
|
||||
string honorificSuffix,
|
||||
Vector3 honorificColor,
|
||||
Vector3 honorificGlow,
|
||||
string moodlePreset,
|
||||
string characterautomation)
|
||||
{
|
||||
Name = name;
|
||||
Macros = macros ?? ""; // Prevents null macros
|
||||
ImagePath = imagePath;
|
||||
Designs = designs ?? new List<CharacterDesign>();
|
||||
NameplateColor = nameplateColor;
|
||||
PenumbraCollection = penumbraCollection;
|
||||
GlamourerDesign = glamourerDesign;
|
||||
CustomizeProfile = customizeProfile;
|
||||
HonorificTitle = honorificTitle;
|
||||
HonorificPrefix = honorificPrefix;
|
||||
HonorificSuffix = honorificSuffix;
|
||||
HonorificColor = honorificColor;
|
||||
HonorificGlow = honorificGlow;
|
||||
MoodlePreset = moodlePreset;
|
||||
CharacterAutomation = characterautomation;
|
||||
}
|
||||
}
|
||||
public class DesignFolder
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
|
||||
// Optional parent (for future nesting)
|
||||
public Guid? ParentFolderId { get; set; } = null;
|
||||
// Manual ordering index within its parent
|
||||
public int SortOrder { get; set; } = 0;
|
||||
|
||||
// <<< Add this! >>>
|
||||
public DesignFolder()
|
||||
{
|
||||
Name = "";
|
||||
Id = Guid.NewGuid();
|
||||
ParentFolderId = null;
|
||||
SortOrder = 0;
|
||||
}
|
||||
|
||||
public DesignFolder(string name)
|
||||
{
|
||||
Name = name;
|
||||
Id = Guid.NewGuid();
|
||||
}
|
||||
|
||||
public DesignFolder(string name, Guid id)
|
||||
{
|
||||
Name = name;
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public DesignFolder(DesignFolder other)
|
||||
{
|
||||
Name = other.Name;
|
||||
Id = other.Id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CharacterSelectPlugin
|
||||
{
|
||||
public class CharacterDesign
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Macro { get; set; }
|
||||
public bool IsAdvancedMode { get; set; } // Tracks if Advanced Mode was used
|
||||
public string AdvancedMacro { get; set; } // Stores Advanced Mode macro separately
|
||||
public string GlamourerDesign { get; set; } // Store Glamourer Design separately
|
||||
public DateTime DateAdded { get; set; } = DateTime.UtcNow; // Automatically set when created
|
||||
public bool IsFavorite { get; set; } // Used for sorting by Favorites
|
||||
public string Automation { get; set; } = "";
|
||||
public string CustomizePlusProfile { get; set; } = "";
|
||||
public string Tag { get; set; } = "Unsorted";
|
||||
public List<string> KnownTags { get; set; } = new();
|
||||
public List<string> DesignTags { get; set; } = new List<string>();
|
||||
public Guid? FolderId { get; set; } = null; // null = Unsorted
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public int SortOrder { get; set; } = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
public CharacterDesign(string name, string macro, bool isAdvancedMode = false, string advancedMacro = "", string glamourerDesign = "", string automation = "", string customizePlusProfile = "")
|
||||
{
|
||||
Name = name;
|
||||
Macro = macro;
|
||||
IsAdvancedMode = isAdvancedMode; // Tracks if this design was saved in Advanced Mode
|
||||
AdvancedMacro = advancedMacro; // Stores the exact Advanced Mode macro if used
|
||||
GlamourerDesign = glamourerDesign; // Store Glamourer Design
|
||||
Automation = automation; // Store Glamourer Automation
|
||||
CustomizePlusProfile = customizePlusProfile; // Store Design C+ Profiles
|
||||
DateAdded = DateTime.UtcNow;
|
||||
IsFavorite = false; // Default to not favourited
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Dalamud.NET.Sdk/12.0.2">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0-windows</TargetFramework>
|
||||
<!-- Windows-specific target framework -->
|
||||
<Version>1.1.1.3</Version>
|
||||
<Description>Character Select+.</Description>
|
||||
<PackageProjectUrl>https://github.com/USBTURTLECUP/Character-Select-</PackageProjectUrl>
|
||||
<PackageLicenseExpression>AGPL-3.0-or-later</PackageLicenseExpression>
|
||||
<IsPackable>false</IsPackable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\Data\goat.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<Visible>false</Visible>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="CharacterSelectPlugin.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<Content Include="..\Data\goat.png">
|
||||
<Link>goat.png</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
<Content Include="Assets\**\*.*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Header Files\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"Author": "Kid Icarus",
|
||||
"Name": "Character Select+",
|
||||
"InternalName": "CharacterSelectPlugin",
|
||||
"AssemblyVersion": "1.1.0.0",
|
||||
"Description": "Character Select+ allows you to create, save, and instantly apply fully customized character profiles with the press of a button. Switch between your OCs effortlessly using /select CharacterName, applying Penumbra Collections, Glamourer Designs, Customize+ Profiles, Honorific Titles, Moodle Presets, and Idles in one command.\n\nWhile profile switching is its core purpose, Character Select+ includes additional features:\n✔ Advanced Mode – Create custom macro setups for deeper character customization.\n✔ Profile-Specific Designs – Use multiple outfits, styles, and looks per character.\n✔ Favorites & Sorting – Keep profiles organized by name, date, or importance.\n✔ Quick Swap Bar! \n✔ One-Click Macro Execution – Run predefined commands instantly when selecting a character.\n\nWhether you're roleplaying, gposing, or just love quick customization, Character Select+ makes switching between characters faster, easier, and seamless.\n",
|
||||
"ApplicableVersion": "any",
|
||||
"Tags": [
|
||||
"character",
|
||||
"select",
|
||||
"ocs"
|
||||
],
|
||||
"DalamudApiLevel": 12,
|
||||
"LoadRequiredState": 0,
|
||||
"LoadSync": false,
|
||||
"CanUnloadAsync": false,
|
||||
"LoadPriority": 0,
|
||||
"Punchline": "Swap between your OCs with a single click",
|
||||
"AcceptsFeedback": true,
|
||||
"IconUrl": "https://raw.githubusercontent.com/IcarusXIV/Character-Select-/master/CharacterSelectPlugin/Assets/Icon.png"
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using Dalamud.Configuration;
|
||||
using Dalamud.Plugin;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Numerics;
|
||||
|
||||
namespace CharacterSelectPlugin
|
||||
{
|
||||
[Serializable]
|
||||
public class Configuration : IPluginConfiguration
|
||||
{
|
||||
public int Version { get; set; } = 1;
|
||||
public List<Character> Characters { get; set; } = new List<Character>();
|
||||
public Vector3 NewCharacterColor { get; set; } = new Vector3(1.0f, 1.0f, 1.0f);
|
||||
|
||||
// Existing Settings
|
||||
public bool IsConfigWindowMovable { get; set; } = true;
|
||||
public bool SomePropertyToBeSavedAndWithADefault { get; set; } = false;
|
||||
|
||||
// Profile Settings
|
||||
public float ProfileImageScale { get; set; } = 1.0f; // Image scaling
|
||||
public int ProfileColumns { get; set; } = 3; // Number of profiles per row
|
||||
public float ProfileSpacing { get; set; } = 10.0f; // Default spacing between profiles
|
||||
|
||||
private IDalamudPluginInterface pluginInterface;
|
||||
public int CurrentSortIndex { get; set; } = 0; // Default to Manual (SortType.Manual = 0)
|
||||
public PersistentPoseSet DefaultPoses { get; set; } = new();
|
||||
public bool IsQuickSwitchWindowOpen { get; set; } = false;
|
||||
public bool EnableAutomations { get; set; } = false;
|
||||
public string LastSeenVersion { get; set; } = "";
|
||||
public ProfileSharing RPSharingMode { get; set; } = ProfileSharing.AlwaysShare;
|
||||
public List<string> KnownTags { get; set; } = new();
|
||||
public byte LastIdlePoseAppliedByPlugin { get; set; } = 255;
|
||||
public byte LastSitPoseAppliedByPlugin { get; set; } = 255;
|
||||
public byte LastGroundSitPoseAppliedByPlugin { get; set; } = 255;
|
||||
public byte LastDozePoseAppliedByPlugin { get; set; } = 255;
|
||||
public Dictionary<string, string> LastUsedCharacterByPlayer { get; set; } = new();
|
||||
public bool EnableLastUsedCharacterAutoload { get; set; } = false;
|
||||
public string? LastSessionId { get; set; } = null;
|
||||
public string? PreviousSessionId { get; set; }
|
||||
[JsonProperty]
|
||||
public float UIScaleMultiplier { get; set; } = 1.0f;
|
||||
[DefaultValue(true)]
|
||||
public bool ApplyIdleOnLogin { get; set; } = true;
|
||||
public uint LastKnownJobId { get; set; } = 0;
|
||||
public Dictionary<string, string> LastUsedDesignByCharacter { get; set; } = new();
|
||||
public bool ReapplyDesignOnJobChange { get; set; } = false;
|
||||
public string? LastUsedDesignCharacterKey { get; set; } = null;
|
||||
public string? LastUsedCharacterKey { get; set; } = null;
|
||||
[DefaultValue(false)]
|
||||
public bool EnableLoginDelay { get; set; } = false;
|
||||
[JsonProperty]
|
||||
public bool EnablePoseAutoSave { get; set; } = true;
|
||||
public bool EnableSafeMode { get; set; } = false;
|
||||
public bool QuickSwitchCompact { get; set; } = false;
|
||||
|
||||
|
||||
|
||||
public Configuration(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
this.pluginInterface = pluginInterface;
|
||||
}
|
||||
|
||||
public static Configuration Load(IDalamudPluginInterface pluginInterface)
|
||||
{
|
||||
var config = pluginInterface.GetPluginConfig() as Configuration ?? new Configuration(pluginInterface);
|
||||
config.pluginInterface = pluginInterface;
|
||||
|
||||
// Ensure valid sorting index
|
||||
if (config.CurrentSortIndex < 0 || config.CurrentSortIndex > 4)
|
||||
config.CurrentSortIndex = 0;
|
||||
|
||||
return config;
|
||||
}
|
||||
[Serializable]
|
||||
public class PersistentPoseSet
|
||||
{
|
||||
public byte Idle { get; set; } = 255;
|
||||
public byte Sit { get; set; } = 255;
|
||||
public byte GroundSit { get; set; } = 255;
|
||||
public byte Doze { get; set; } = 255;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Save()
|
||||
{
|
||||
pluginInterface.SavePluginConfig(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using Dalamud.Game.Gui.ContextMenu;
|
||||
using Dalamud.Plugin.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CharacterSelectPlugin.Managers
|
||||
{
|
||||
public class ContextMenuManager : IDisposable
|
||||
{
|
||||
private readonly Plugin plugin;
|
||||
private readonly IContextMenu contextMenu;
|
||||
|
||||
private static readonly string[] ValidAddons =
|
||||
[
|
||||
"PartyMemberList",
|
||||
"FriendList",
|
||||
"FreeCompany",
|
||||
"LinkShell",
|
||||
"CrossWorldLinkshell",
|
||||
"_PartyList",
|
||||
"ChatLog",
|
||||
"LookingForGroup",
|
||||
"BlackList",
|
||||
"ContentMemberList",
|
||||
"SocialList",
|
||||
"ContactList",
|
||||
"CharacterInspect",
|
||||
];
|
||||
|
||||
private static readonly Dictionary<uint, string> WorldIdToName = new()
|
||||
{
|
||||
{ 404, "Marilith" },
|
||||
{ 410, "Rafflesia" },
|
||||
{ 411, "White Rook" },
|
||||
{ 100, "FictitiousWorld" },
|
||||
};
|
||||
|
||||
public ContextMenuManager(Plugin plugin, IContextMenu contextMenu)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.contextMenu = contextMenu;
|
||||
this.contextMenu.OnMenuOpened += OnMenuOpened;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.contextMenu.OnMenuOpened -= OnMenuOpened;
|
||||
}
|
||||
|
||||
private void OnMenuOpened(IMenuOpenedArgs args)
|
||||
{
|
||||
if (args.Target is not MenuTargetDefault def || !ValidAddons.Contains(args.AddonName))
|
||||
return;
|
||||
|
||||
// Skip if the clicked thing has no valid home world (NPCs, FC actions, etc)
|
||||
if (def.TargetHomeWorld.RowId == 0)
|
||||
return;
|
||||
|
||||
var name = def.TargetName;
|
||||
var worldRow = def.TargetHomeWorld;
|
||||
|
||||
string worldName = worldRow.RowId > 0
|
||||
? worldRow.Value.Name.ToString()
|
||||
: $"World-{worldRow.RowId}";
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
args.AddMenuItem(new MenuItem
|
||||
{
|
||||
Name = "View RP Profile",
|
||||
OnClicked = _ => Task.Run(() => plugin.TryRequestRPProfile($"{name}@{worldName}")),
|
||||
IsEnabled = true
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// CharacterSelectPlugin/DesignItem.cs
|
||||
using System;
|
||||
|
||||
namespace CharacterSelectPlugin
|
||||
{
|
||||
public class DesignItem
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public Guid? ParentFolderId { get; set; }
|
||||
public bool IsFolder { get; }
|
||||
public DesignFolder? Folder { get; }
|
||||
public CharacterDesign? Design { get; }
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
// Folder ctor
|
||||
public DesignItem(DesignFolder f)
|
||||
{
|
||||
Id = f.Id;
|
||||
IsFolder = true;
|
||||
Folder = f;
|
||||
ParentFolderId = f.ParentFolderId; // adapt if your folder tracks this differently
|
||||
SortOrder = f.SortOrder; // assume you’ve persisted this
|
||||
}
|
||||
|
||||
// Design ctor
|
||||
public DesignItem(CharacterDesign d)
|
||||
{
|
||||
Id = d.Id;
|
||||
IsFolder = false;
|
||||
Design = d;
|
||||
ParentFolderId = d.FolderId;
|
||||
SortOrder = d.SortOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
#pragma once
|
||||
#include <ctime>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include <filesystem>
|
||||
#include <unordered_map>
|
||||
#include <algorithm> // std::min, std::max
|
||||
|
||||
#define IFD_DIALOG_FILE 0
|
||||
#define IFD_DIALOG_DIRECTORY 1
|
||||
#define IFD_DIALOG_SAVE 2
|
||||
|
||||
namespace ifd {
|
||||
class FileDialog {
|
||||
public:
|
||||
static inline FileDialog& Instance()
|
||||
{
|
||||
static FileDialog ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
FileDialog();
|
||||
~FileDialog();
|
||||
|
||||
bool Save(const std::string& key, const std::string& title, const std::string& filter, const std::string& startingDir = "");
|
||||
|
||||
bool Open(const std::string& key, const std::string& title, const std::string& filter, bool isMultiselect = false, const std::string& startingDir = "");
|
||||
|
||||
bool IsDone(const std::string& key);
|
||||
|
||||
inline bool HasResult() { return m_result.size(); }
|
||||
inline const std::filesystem::path& GetResult() { return m_result[0]; }
|
||||
inline const std::vector<std::filesystem::path>& GetResults() { return m_result; }
|
||||
|
||||
void Close();
|
||||
|
||||
void RemoveFavorite(const std::string& path);
|
||||
void AddFavorite(const std::string& path);
|
||||
inline const std::vector<std::string>& GetFavorites() { return m_favorites; }
|
||||
|
||||
inline void SetZoom(float z) {
|
||||
m_zoom = std::min<float>(25.0f, std::max<float>(1.0f, z));
|
||||
m_refreshIconPreview();
|
||||
}
|
||||
inline float GetZoom() { return m_zoom; }
|
||||
|
||||
std::function<void*(uint8_t*, int, int, char)> CreateTexture; // char -> fmt -> { 0 = BGRA, 1 = RGBA }
|
||||
std::function<void(void*)> DeleteTexture;
|
||||
|
||||
class FileTreeNode {
|
||||
public:
|
||||
#ifdef _WIN32
|
||||
FileTreeNode(const std::wstring& path) {
|
||||
Path = std::filesystem::path(path);
|
||||
Read = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
FileTreeNode(const std::string& path) {
|
||||
Path = std::filesystem::u8path(path);
|
||||
Read = false;
|
||||
}
|
||||
|
||||
std::filesystem::path Path;
|
||||
bool Read;
|
||||
std::vector<FileTreeNode*> Children;
|
||||
};
|
||||
class FileData {
|
||||
public:
|
||||
FileData(const std::filesystem::path& path);
|
||||
|
||||
std::filesystem::path Path;
|
||||
bool IsDirectory;
|
||||
size_t Size;
|
||||
time_t DateModified;
|
||||
|
||||
bool HasIconPreview;
|
||||
void* IconPreview;
|
||||
uint8_t* IconPreviewData;
|
||||
int IconPreviewWidth, IconPreviewHeight;
|
||||
};
|
||||
|
||||
private:
|
||||
std::string m_currentKey;
|
||||
std::string m_currentTitle;
|
||||
std::filesystem::path m_currentDirectory;
|
||||
bool m_isMultiselect;
|
||||
bool m_isOpen;
|
||||
uint8_t m_type;
|
||||
char m_inputTextbox[1024];
|
||||
char m_pathBuffer[1024];
|
||||
char m_newEntryBuffer[1024];
|
||||
char m_searchBuffer[128];
|
||||
std::vector<std::string> m_favorites;
|
||||
bool m_calledOpenPopup;
|
||||
std::stack<std::filesystem::path> m_backHistory, m_forwardHistory;
|
||||
float m_zoom;
|
||||
|
||||
std::vector<std::filesystem::path> m_selections;
|
||||
int m_selectedFileItem;
|
||||
void m_select(const std::filesystem::path& path, bool isCtrlDown = false);
|
||||
|
||||
std::vector<std::filesystem::path> m_result;
|
||||
bool m_finalize(const std::string& filename = "");
|
||||
|
||||
std::string m_filter;
|
||||
std::vector<std::vector<std::string>> m_filterExtensions;
|
||||
size_t m_filterSelection;
|
||||
void m_parseFilter(const std::string& filter);
|
||||
|
||||
std::vector<int> m_iconIndices;
|
||||
std::vector<std::string> m_iconFilepaths; // m_iconIndices[x] <-> m_iconFilepaths[x]
|
||||
std::unordered_map<std::string, void*> m_icons;
|
||||
void* m_getIcon(const std::filesystem::path& path);
|
||||
void m_clearIcons();
|
||||
void m_refreshIconPreview();
|
||||
void m_clearIconPreview();
|
||||
|
||||
std::thread* m_previewLoader;
|
||||
bool m_previewLoaderRunning;
|
||||
void m_stopPreviewLoader();
|
||||
void m_loadPreview();
|
||||
|
||||
std::vector<FileTreeNode*> m_treeCache;
|
||||
void m_clearTree(FileTreeNode* node);
|
||||
void m_renderTree(FileTreeNode* node);
|
||||
|
||||
unsigned int m_sortColumn;
|
||||
unsigned int m_sortDirection;
|
||||
std::vector<FileData> m_content;
|
||||
void m_setDirectory(const std::filesystem::path& p, bool addHistory = true);
|
||||
void m_sortContent(unsigned int column, unsigned int sortDirection);
|
||||
void m_renderContent();
|
||||
|
||||
void m_renderPopups();
|
||||
void m_renderFileDialog();
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="goatcorp" value="https://goatcorp.github.io/nupkg/" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
@@ -0,0 +1,89 @@
|
||||
// CharacterSelectPlugin/Managers/PoseRestorer.cs
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Control;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
using System;
|
||||
|
||||
namespace CharacterSelectPlugin.Managers;
|
||||
|
||||
public unsafe class PoseRestorer
|
||||
{
|
||||
private readonly IClientState clientState;
|
||||
private readonly Plugin plugin;
|
||||
|
||||
public PoseRestorer(IClientState clientState, Plugin plugin)
|
||||
{
|
||||
this.clientState = clientState;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void RestorePosesFor(Character character)
|
||||
{
|
||||
if (clientState.LocalPlayer == null) return;
|
||||
|
||||
Plugin.Framework.RunOnTick(() =>
|
||||
{
|
||||
ApplyPose(character);
|
||||
});
|
||||
}
|
||||
|
||||
private void ApplyPose(Character character)
|
||||
{
|
||||
var local = clientState.LocalPlayer;
|
||||
if (local == null || local.Address == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
var charPtr = (FFXIVClientStructs.FFXIV.Client.Game.Character.Character*)local.Address;
|
||||
|
||||
// This also ensures you're not in cutscene or a bad player state
|
||||
if (charPtr->GameObject.ObjectIndex == 0xFFFF)
|
||||
return;
|
||||
|
||||
TrySetPose(EmoteController.PoseType.Idle, character.IdlePoseIndex, charPtr);
|
||||
TrySetPose(EmoteController.PoseType.Sit, character.SitPoseIndex, charPtr);
|
||||
TrySetPose(EmoteController.PoseType.GroundSit, character.GroundSitPoseIndex, charPtr);
|
||||
TrySetPose(EmoteController.PoseType.Doze, character.DozePoseIndex, charPtr);
|
||||
}
|
||||
|
||||
private void TrySetPose(EmoteController.PoseType type, byte desired, FFXIVClientStructs.FFXIV.Client.Game.Character.Character* charPtr)
|
||||
{
|
||||
if (desired >= 254) return;
|
||||
|
||||
byte current = PlayerState.Instance()->SelectedPoses[(int)type];
|
||||
if (current == desired) return;
|
||||
|
||||
PlayerState.Instance()->SelectedPoses[(int)type] = desired;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case EmoteController.PoseType.Idle:
|
||||
plugin.Configuration.LastIdlePoseAppliedByPlugin = desired;
|
||||
break;
|
||||
case EmoteController.PoseType.Sit:
|
||||
plugin.Configuration.LastSitPoseAppliedByPlugin = desired;
|
||||
break;
|
||||
case EmoteController.PoseType.GroundSit:
|
||||
plugin.Configuration.LastGroundSitPoseAppliedByPlugin = desired;
|
||||
break;
|
||||
case EmoteController.PoseType.Doze:
|
||||
plugin.Configuration.LastDozePoseAppliedByPlugin = desired;
|
||||
break;
|
||||
}
|
||||
|
||||
plugin.Configuration.Save();
|
||||
|
||||
if (TranslatePoseState(charPtr->ModeParam) == type)
|
||||
charPtr->EmoteController.CPoseState = desired;
|
||||
}
|
||||
|
||||
private EmoteController.PoseType TranslatePoseState(byte state)
|
||||
{
|
||||
return state switch
|
||||
{
|
||||
1 => EmoteController.PoseType.GroundSit,
|
||||
2 => EmoteController.PoseType.Sit,
|
||||
3 => EmoteController.PoseType.Doze,
|
||||
_ => EmoteController.PoseType.Idle
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,95 @@
|
||||
using Dalamud.Plugin.Services;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.Control;
|
||||
using FFXIVClientStructs.FFXIV.Client.Game.UI;
|
||||
|
||||
namespace CharacterSelectPlugin.Managers;
|
||||
|
||||
public unsafe class PoseManager
|
||||
{
|
||||
private readonly IClientState clientState;
|
||||
private readonly IFramework framework;
|
||||
private readonly IChatGui chatGui;
|
||||
private readonly ICommandManager commandManager;
|
||||
private readonly Plugin plugin;
|
||||
|
||||
|
||||
public PoseManager(IClientState clientState, IFramework framework, IChatGui chatGui, ICommandManager commandManager, Plugin plugin)
|
||||
{
|
||||
this.clientState = clientState;
|
||||
this.framework = framework;
|
||||
this.chatGui = chatGui;
|
||||
this.commandManager = commandManager;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public void ApplyPose(EmoteController.PoseType type, byte index)
|
||||
{
|
||||
Plugin.Log.Debug($"[ApplyPose] Applying {type} pose {index}");
|
||||
|
||||
if (index >= 7 || clientState.LocalPlayer == null)
|
||||
return;
|
||||
|
||||
var charPtr = (FFXIVClientStructs.FFXIV.Client.Game.Character.Character*)clientState.LocalPlayer.Address;
|
||||
|
||||
// Apply to memory
|
||||
PlayerState.Instance()->SelectedPoses[(int)type] = index;
|
||||
|
||||
if (TranslatePoseState(charPtr->ModeParam) == type)
|
||||
charPtr->EmoteController.CPoseState = index;
|
||||
|
||||
// Persist if plugin-driven
|
||||
switch (type)
|
||||
{
|
||||
case EmoteController.PoseType.Idle:
|
||||
plugin.Configuration.DefaultPoses.Idle = index;
|
||||
plugin.Configuration.LastIdlePoseAppliedByPlugin = index;
|
||||
plugin.lastSeenIdlePose = index;
|
||||
plugin.suppressIdleSaveForFrames = 60; // longer block
|
||||
Plugin.Log.Debug($"[ApplyPose] Idle pose set to {index} and suppressed for 60 frames.");
|
||||
break;
|
||||
|
||||
case EmoteController.PoseType.Sit:
|
||||
plugin.Configuration.DefaultPoses.Sit = index;
|
||||
plugin.lastSeenSitPose = index;
|
||||
plugin.suppressSitSaveForFrames = 60;
|
||||
Plugin.Log.Debug($"[ApplyPose] Sit pose set to {index} and suppressed for 60 frames.");
|
||||
break;
|
||||
|
||||
case EmoteController.PoseType.GroundSit:
|
||||
plugin.Configuration.DefaultPoses.GroundSit = index;
|
||||
plugin.lastSeenGroundSitPose = index;
|
||||
plugin.suppressGroundSitSaveForFrames = 60;
|
||||
Plugin.Log.Debug($"[ApplyPose] Ground Sit pose set to {index} and suppressed for 60 frames.");
|
||||
break;
|
||||
|
||||
case EmoteController.PoseType.Doze:
|
||||
plugin.Configuration.DefaultPoses.Doze = index;
|
||||
plugin.lastSeenDozePose = index;
|
||||
plugin.suppressDozeSaveForFrames = 60;
|
||||
Plugin.Log.Debug($"[ApplyPose] Doze pose set to {index} and suppressed for 60 frames.");
|
||||
break;
|
||||
}
|
||||
|
||||
// This makes the change persist!
|
||||
plugin.Configuration.Save();
|
||||
}
|
||||
|
||||
|
||||
private EmoteController.PoseType TranslatePoseState(byte state)
|
||||
{
|
||||
return state switch
|
||||
{
|
||||
1 => EmoteController.PoseType.GroundSit,
|
||||
2 => EmoteController.PoseType.Sit,
|
||||
3 => EmoteController.PoseType.Doze,
|
||||
_ => EmoteController.PoseType.Idle
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public byte GetPose(EmoteController.PoseType type)
|
||||
=> PlayerState.Instance()->CurrentPose(type);
|
||||
|
||||
public byte GetSelectedPose(EmoteController.PoseType type)
|
||||
=> PlayerState.Instance()->SelectedPoses[(int)type];
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using ImGuiNET;
|
||||
using Dalamud.Interface.Windowing;
|
||||
|
||||
namespace CharacterSelectPlugin.Windows
|
||||
{
|
||||
public class QuickSwitchWindow : Window
|
||||
{
|
||||
private readonly Plugin plugin;
|
||||
private int selectedCharacterIndex = -1;
|
||||
private int selectedDesignIndex = -1;
|
||||
private int lastAppliedCharacterIndex = -1;
|
||||
private bool hasAppliedMacroThisSession = false;
|
||||
|
||||
public QuickSwitchWindow(Plugin plugin)
|
||||
: base("Quick Character Switch", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(360, 75),
|
||||
MaximumSize = new Vector2(360, 75)
|
||||
};
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
// ── Compact Quick Switch toggle ──
|
||||
if (plugin.Configuration.QuickSwitchCompact)
|
||||
{
|
||||
// No title‐bar, no resize, no scrollbar, no background
|
||||
this.Flags = ImGuiWindowFlags
|
||||
.NoTitleBar
|
||||
| ImGuiWindowFlags.NoResize
|
||||
| ImGuiWindowFlags.NoScrollbar
|
||||
| ImGuiWindowFlags.NoBackground;
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new System.Numerics.Vector2(360, 28),
|
||||
MaximumSize = new System.Numerics.Vector2(360, 28),
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
// Full window
|
||||
this.Flags = ImGuiWindowFlags.NoResize
|
||||
| ImGuiWindowFlags.NoScrollbar;
|
||||
SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new System.Numerics.Vector2(360, 55),
|
||||
MaximumSize = new System.Numerics.Vector2(360, 58),
|
||||
};
|
||||
}
|
||||
|
||||
float dropdownWidth = 135;
|
||||
float spacing = 6;
|
||||
|
||||
// Character Dropdown
|
||||
ImGui.SetNextItemWidth(dropdownWidth);
|
||||
int tempCharacterIndex = selectedCharacterIndex;
|
||||
|
||||
if (ImGui.BeginCombo("##CharacterDropdown", GetSelectedCharacterName(), ImGuiComboFlags.HeightRegular))
|
||||
{
|
||||
for (int i = 0; i < plugin.Characters.Count; i++)
|
||||
{
|
||||
var character = plugin.Characters[i];
|
||||
bool isSelected = (tempCharacterIndex == i);
|
||||
|
||||
if (ImGui.Selectable(character.Name, isSelected))
|
||||
{
|
||||
tempCharacterIndex = i;
|
||||
|
||||
if (character.Designs.Count > 0)
|
||||
{
|
||||
var ordered = character.Designs
|
||||
.Select((d, index) => new { Design = d, Index = index })
|
||||
.OrderBy(x => x.Design.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
selectedDesignIndex = ordered[0].Index;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedDesignIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSelected)
|
||||
ImGui.SetItemDefaultFocus();
|
||||
}
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
selectedCharacterIndex = tempCharacterIndex;
|
||||
|
||||
ImGui.SameLine(0, spacing);
|
||||
|
||||
// Design Dropdown
|
||||
if (selectedCharacterIndex >= 0 && selectedCharacterIndex < plugin.Characters.Count)
|
||||
{
|
||||
var selectedCharacter = plugin.Characters[selectedCharacterIndex];
|
||||
int tempDesignIndex = selectedDesignIndex;
|
||||
|
||||
ImGui.SetNextItemWidth(dropdownWidth);
|
||||
if (ImGui.BeginCombo("##DesignDropdown", GetSelectedDesignName(selectedCharacter), ImGuiComboFlags.HeightRegular))
|
||||
{
|
||||
var orderedDesigns = selectedCharacter.Designs
|
||||
.Select((d, index) => new { Design = d, OriginalIndex = index })
|
||||
.OrderBy(x => x.Design.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
for (int j = 0; j < orderedDesigns.Count; j++)
|
||||
{
|
||||
var entry = orderedDesigns[j];
|
||||
bool isSelected = (tempDesignIndex == entry.OriginalIndex);
|
||||
|
||||
if (ImGui.Selectable(entry.Design.Name, isSelected))
|
||||
{
|
||||
tempDesignIndex = entry.OriginalIndex; // store original index to stay consistent
|
||||
}
|
||||
|
||||
if (isSelected)
|
||||
ImGui.SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
selectedDesignIndex = tempDesignIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.BeginDisabled();
|
||||
ImGui.SetNextItemWidth(dropdownWidth);
|
||||
ImGui.Combo("##DesignDropdown", ref selectedDesignIndex, Array.Empty<string>(), 0);
|
||||
ImGui.EndDisabled();
|
||||
}
|
||||
|
||||
ImGui.SameLine(0, spacing);
|
||||
|
||||
// Apply Button
|
||||
if (selectedCharacterIndex >= 0)
|
||||
{
|
||||
if (ImGui.Button("Apply", new Vector2(50, ImGui.GetFrameHeight())))
|
||||
{
|
||||
ApplySelection();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.BeginDisabled();
|
||||
ImGui.Button("Apply", new Vector2(50, ImGui.GetFrameHeight()));
|
||||
ImGui.EndDisabled();
|
||||
}
|
||||
|
||||
// Nameplate Colour Bar (Appears below dropdowns if a character is selected)
|
||||
if (selectedCharacterIndex >= 0)
|
||||
{
|
||||
Vector4 charColor = GetNameplateColor(plugin.Characters[selectedCharacterIndex]);
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.ChildBg, charColor);
|
||||
ImGui.BeginChild("ColorBar", new Vector2(ImGui.GetContentRegionAvail().X, 3), false);
|
||||
ImGui.EndChild();
|
||||
ImGui.PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private Vector4 GetNameplateColor(Character character)
|
||||
{
|
||||
return new Vector4(character.NameplateColor.X, character.NameplateColor.Y, character.NameplateColor.Z, 1.0f);
|
||||
}
|
||||
|
||||
private string GetSelectedCharacterName()
|
||||
{
|
||||
return (selectedCharacterIndex >= 0 && selectedCharacterIndex < plugin.Characters.Count)
|
||||
? plugin.Characters[selectedCharacterIndex].Name
|
||||
: "Select Character";
|
||||
}
|
||||
|
||||
private string GetSelectedDesignName(Character character)
|
||||
{
|
||||
return (selectedDesignIndex >= 0 && selectedDesignIndex < character.Designs.Count)
|
||||
? character.Designs[selectedDesignIndex].Name
|
||||
: "Select Design";
|
||||
}
|
||||
private Vector4 GetContrastingTextColor(Vector4 bgColor)
|
||||
{
|
||||
// Calculate luminance (brightness perception)
|
||||
float brightness = (0.299f * bgColor.X + 0.587f * bgColor.Y + 0.114f * bgColor.Z);
|
||||
return brightness > 0.5f ? new Vector4(0, 0, 0, 1) : new Vector4(1, 1, 1, 1); // Black for bright backgrounds, white for dark
|
||||
}
|
||||
|
||||
|
||||
private void ApplySelection()
|
||||
{
|
||||
if (selectedCharacterIndex < 0 || selectedCharacterIndex >= plugin.Characters.Count)
|
||||
return;
|
||||
|
||||
var character = plugin.Characters[selectedCharacterIndex];
|
||||
|
||||
plugin.ExecuteMacro(character.Macros, character, null);
|
||||
plugin.SetActiveCharacter(character);
|
||||
|
||||
var profileToSend = new RPProfile
|
||||
{
|
||||
Pronouns = character.RPProfile?.Pronouns,
|
||||
Gender = character.RPProfile?.Gender,
|
||||
Age = character.RPProfile?.Age,
|
||||
Race = character.RPProfile?.Race,
|
||||
Orientation = character.RPProfile?.Orientation,
|
||||
Relationship = character.RPProfile?.Relationship,
|
||||
Occupation = character.RPProfile?.Occupation,
|
||||
Abilities = character.RPProfile?.Abilities,
|
||||
Bio = character.RPProfile?.Bio,
|
||||
Tags = character.RPProfile?.Tags,
|
||||
CustomImagePath = !string.IsNullOrEmpty(character.RPProfile?.CustomImagePath)
|
||||
? character.RPProfile.CustomImagePath
|
||||
: character.ImagePath,
|
||||
ImageZoom = character.RPProfile?.ImageZoom ?? 1.0f,
|
||||
ImageOffset = character.RPProfile?.ImageOffset ?? Vector2.Zero,
|
||||
Sharing = character.RPProfile?.Sharing ?? ProfileSharing.AlwaysShare,
|
||||
ProfileImageUrl = character.RPProfile?.ProfileImageUrl,
|
||||
CharacterName = character.Name,
|
||||
NameplateColor = character.NameplateColor
|
||||
};
|
||||
|
||||
_ = Plugin.UploadProfileAsync(profileToSend, character.LastInGameName ?? character.Name);
|
||||
|
||||
// Always apply the design if selected
|
||||
if (selectedDesignIndex >= 0 && selectedDesignIndex < character.Designs.Count)
|
||||
{
|
||||
plugin.ExecuteMacro(character.Designs[selectedDesignIndex].Macro);
|
||||
plugin.Configuration.LastUsedDesignByCharacter[character.Name] = character.Designs[selectedDesignIndex].Name;
|
||||
plugin.Configuration.LastUsedDesignCharacterKey = character.Name;
|
||||
plugin.Configuration.Save();
|
||||
}
|
||||
|
||||
// Always apply idle pose if a valid one is set
|
||||
if (character.IdlePoseIndex < 7)
|
||||
plugin.PoseRestorer.RestorePosesFor(character);
|
||||
else
|
||||
Plugin.Log.Debug("[QuickSwitch] Skipping idle pose restore — IdlePoseIndex is None.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Numerics;
|
||||
|
||||
namespace CharacterSelectPlugin
|
||||
{
|
||||
public class RPProfile
|
||||
{
|
||||
public string? Pronouns { get; set; }
|
||||
public string? Gender { get; set; }
|
||||
public string? Age { get; set; }
|
||||
public string? Orientation { get; set; }
|
||||
public string? Relationship { get; set; }
|
||||
public string? Occupation { get; set; }
|
||||
public string? Abilities { get; set; }
|
||||
public string? Bio { get; set; }
|
||||
public string? Tags { get; set; }
|
||||
|
||||
public string? CustomImagePath { get; set; } // Optional override for profile image
|
||||
public float ImageZoom { get; set; } = 1.0f;
|
||||
public Vector2 ImageOffset { get; set; } = Vector2.Zero;
|
||||
public ProfileSharing Sharing { get; set; } = ProfileSharing.AlwaysShare;
|
||||
public string? ProfileImageUrl { get; set; }
|
||||
public string? CharacterName { get; set; }
|
||||
public Vector3Serializable NameplateColor { get; set; } = new(0.3f, 0.7f, 1f);
|
||||
public string? Race { get; set; }
|
||||
|
||||
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(Pronouns)
|
||||
&& string.IsNullOrWhiteSpace(Gender)
|
||||
&& string.IsNullOrWhiteSpace(Age)
|
||||
&& string.IsNullOrWhiteSpace(Race)
|
||||
&& string.IsNullOrWhiteSpace(Orientation)
|
||||
&& string.IsNullOrWhiteSpace(Relationship)
|
||||
&& string.IsNullOrWhiteSpace(Occupation)
|
||||
&& string.IsNullOrWhiteSpace(Abilities)
|
||||
&& string.IsNullOrWhiteSpace(Bio)
|
||||
&& string.IsNullOrWhiteSpace(Tags);
|
||||
}
|
||||
}
|
||||
public enum ProfileSharing
|
||||
{
|
||||
AlwaysShare,
|
||||
NeverShare
|
||||
}
|
||||
public static class RPProfileJson
|
||||
{
|
||||
public static string Serialize(RPProfile profile)
|
||||
{
|
||||
return JsonConvert.SerializeObject(profile);
|
||||
}
|
||||
|
||||
public static RPProfile? Deserialize(string json)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<RPProfile>(json);
|
||||
}
|
||||
}
|
||||
public struct Vector3Serializable
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
|
||||
public Vector3Serializable(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
public static implicit operator Vector3(Vector3Serializable v) => new(v.X, v.Y, v.Z);
|
||||
public static implicit operator Vector3Serializable(Vector3 v) => new(v.X, v.Y, v.Z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace CharacterSelectPlugin.Windows;
|
||||
|
||||
public class ConfigWindow : Window, IDisposable
|
||||
{
|
||||
private Configuration configuration;
|
||||
|
||||
// We give this window a constant ID using ###
|
||||
// This allows for labels being dynamic, like "{FPS Counter}fps###XYZ counter window",
|
||||
// and the window ID will always be "###XYZ counter window" for ImGui
|
||||
public ConfigWindow(Plugin plugin) : base("A Wonderful Configuration Window###With a constant ID")
|
||||
{
|
||||
Flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar |
|
||||
ImGuiWindowFlags.NoScrollWithMouse;
|
||||
|
||||
Size = new Vector2(232, 90);
|
||||
SizeCondition = ImGuiCond.Always;
|
||||
|
||||
configuration = plugin.Configuration;
|
||||
}
|
||||
|
||||
public void Dispose() { }
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
// Flags must be added or removed before Draw() is being called, or they won't apply
|
||||
if (configuration.IsConfigWindowMovable)
|
||||
{
|
||||
Flags &= ~ImGuiWindowFlags.NoMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
Flags |= ImGuiWindowFlags.NoMove;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
// can't ref a property, so use a local copy
|
||||
var configValue = configuration.SomePropertyToBeSavedAndWithADefault;
|
||||
if (ImGui.Checkbox("Random Config Bool", ref configValue))
|
||||
{
|
||||
configuration.SomePropertyToBeSavedAndWithADefault = configValue;
|
||||
// can save immediately on change, if you don't want to provide a "Save and Close" button
|
||||
configuration.Save();
|
||||
}
|
||||
|
||||
var movable = configuration.IsConfigWindowMovable;
|
||||
if (ImGui.Checkbox("Movable Config Window", ref movable))
|
||||
{
|
||||
configuration.IsConfigWindowMovable = movable;
|
||||
configuration.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,174 @@
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using System.Numerics;
|
||||
|
||||
namespace CharacterSelectPlugin.Windows
|
||||
{
|
||||
public class PatchNotesWindow : Window
|
||||
{
|
||||
private readonly Plugin plugin;
|
||||
|
||||
public PatchNotesWindow(Plugin plugin) : base("Character Select+ – What's New?", ImGuiWindowFlags.AlwaysAutoResize)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
IsOpen = false;
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
ImGui.SetNextWindowSizeConstraints(new Vector2(480, 1051), new Vector2(float.MaxValue, float.MaxValue));
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
ImGui.TextColored(new Vector4(0.2f, 1.0f, 0.2f, 1.0f), $"★ New in v{Plugin.CurrentPluginVersion}");
|
||||
ImGui.Separator();
|
||||
ImGui.Spacing();
|
||||
|
||||
// Latest Patch Notes
|
||||
if (ImGui.CollapsingHeader("v1.1.0.8 - v1.1.1.2 – April 18 2025", ImGuiTreeNodeFlags.DefaultOpen))
|
||||
{
|
||||
// Apply Character on Login
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf4fc"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Apply Character on Login");
|
||||
ImGui.BulletText("New opt-in setting in the plugin options.");
|
||||
ImGui.BulletText("Character Select+ will remember the last applied character.");
|
||||
ImGui.BulletText("Next time you log in, it will automatically apply that character.");
|
||||
ImGui.BulletText("⚠️ May conflict if you are using Glamourer Automations.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Apply Appearance on Job Change
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf4fc"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Apply Appearance on Job Change");
|
||||
ImGui.BulletText("New opt-in setting in the plugin options.");
|
||||
ImGui.BulletText("Character Select+ will remember the last applied character and/or design.");
|
||||
ImGui.BulletText("When you switch between jobs, it will automatically apply that character/design.");
|
||||
ImGui.BulletText("⚠️ WILL 100 percent conflict if you are using Glamourer Automations.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Designs
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf07b"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Design Panel Rework");
|
||||
ImGui.BulletText("Buttons now only appear on hover, keeping the panel clean and focused.");
|
||||
ImGui.BulletText("Reorder designs by dragging the colored handle‐bar on the left — click and drag to move.");
|
||||
ImGui.BulletText("Create new folders inline via the folder icon next to the + button, no extra windows needed.");
|
||||
ImGui.BulletText("Drag-and-drop designs into, out of, and between folders directly within the panel.");
|
||||
ImGui.BulletText("Right-click folders for inline Rename/Delete context menu, with instant application.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Compact Quick Switch
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf0a0"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Compact Quick Character Switch");
|
||||
ImGui.BulletText("Toggleable setting to hide the title bar and window frame for a slim bar.");
|
||||
ImGui.BulletText("Keeps dropdowns and apply button only, preserving full switch functionality.");
|
||||
ImGui.Separator();
|
||||
|
||||
// UI Scaling Option
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf00e"); ImGui.PopFont(); ImGui.SameLine(); // <i class="fas fa-search-plus"></i>
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "UI Scale Setting");
|
||||
ImGui.BulletText("You can now adjust the plugin UI scale from the settings menu.");
|
||||
ImGui.BulletText("Great for users on high-resolution monitors or 4K displays.");
|
||||
ImGui.BulletText("Let me know if there are any issues using this.");
|
||||
ImGui.BulletText("⚠️ If your UI is fine as-is, best to leave this be.");
|
||||
ImGui.Separator();
|
||||
}
|
||||
|
||||
// Previous Patch Notes
|
||||
if (ImGui.CollapsingHeader("v1.1.0.(0-7) – April 09 2025", ImGuiTreeNodeFlags.None))
|
||||
{
|
||||
Draw1100Notes();
|
||||
}
|
||||
|
||||
ImGui.Spacing(); ImGui.Spacing();
|
||||
float windowWidth = ImGui.GetWindowSize().X;
|
||||
float buttonWidth = 90f;
|
||||
ImGui.SetCursorPosX((windowWidth - buttonWidth) * 0.5f);
|
||||
|
||||
if (ImGui.Button("Got it!", new Vector2(buttonWidth, 0)))
|
||||
{
|
||||
plugin.Configuration.LastSeenVersion = Plugin.CurrentPluginVersion;
|
||||
plugin.Configuration.Save();
|
||||
IsOpen = false;
|
||||
plugin.ToggleMainUI();
|
||||
}
|
||||
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
private void Draw1100Notes()
|
||||
{
|
||||
// RP Profile Panel
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf2c2"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "RolePlay Profile Panel");
|
||||
ImGui.BulletText("Add bios, pronouns, orientation, and more for each character.");
|
||||
ImGui.BulletText("Choose a unique image or reuse the character image.");
|
||||
ImGui.BulletText("Use pan and zoom controls to fine-tune the RP portrait.");
|
||||
ImGui.BulletText("Control visibility: keep private or share with others.");
|
||||
ImGui.BulletText("Once applied, that character’s RP profile is active.");
|
||||
ImGui.BulletText("You can view others’ profiles (if shared) and vice versa.");
|
||||
ImGui.BulletText("Use /viewrp self | /t | First Last@World to view.");
|
||||
ImGui.BulletText("Right-click in the party list, friends list, or chat to access shared RP cards.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Glamourer Automations
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf5c3"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Glamourer Automations for Characters & Designs");
|
||||
ImGui.BulletText("Characters & Designs can now trigger specific Glamourer Automation profiles.");
|
||||
ImGui.BulletText("This is *opt-in* — toggle it in plugin settings.");
|
||||
ImGui.BulletText("If no automation is assigned, the design defaults to 'None'.");
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("To avoid errors, set up a 'None' automation:");
|
||||
ImGui.BulletText("1. Open Glamourer > Automations.");
|
||||
ImGui.BulletText("2. Create an Automation named 'None'.");
|
||||
ImGui.BulletText("3. Add your in-game character name beside 'Any World' then Set to Character.");
|
||||
ImGui.BulletText("4. That’s it. Don’t touch anything else, you’re done!");
|
||||
ImGui.Separator();
|
||||
|
||||
// Customize+
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf234"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Customize+ Profiles for Designs");
|
||||
ImGui.BulletText("Each design can now assign its own Customize+ profile.");
|
||||
ImGui.BulletText("This gives you finer control over visual changes per design.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Manual Reordering
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf0b0"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Manual Character Reordering");
|
||||
ImGui.BulletText("Use the 'Reorder Characters' button at the bottom-left.");
|
||||
ImGui.BulletText("Drag and drop profiles, then press Save to lock it in.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Search
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf002"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Character Search Bar");
|
||||
ImGui.BulletText("Click the magnifying glass to search by name instantly.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Tagging
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf07b"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Tagging System");
|
||||
ImGui.BulletText("Add comma-separated 'tags' to organize characters.");
|
||||
ImGui.BulletText("Click the filter icon to filter — characters can appear in multiple tags!");
|
||||
ImGui.Separator();
|
||||
|
||||
// Apply to Target
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf140"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Right-click → Apply to Target");
|
||||
ImGui.BulletText("Right-click a character in Character Select+ with a target selected.");
|
||||
ImGui.BulletText("Apply their setup — or even one of their individual designs — to the target.");
|
||||
ImGui.Separator();
|
||||
|
||||
// Copy Designs
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf0c5"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.8f, 0.95f, 1.0f, 1.0f), "Copy Designs Between Characters");
|
||||
ImGui.BulletText("Hold Shift and click the '+' button in Designs to open the Design Importer.");
|
||||
ImGui.BulletText("Click the + beside a design to copy it. Repeat as needed!");
|
||||
ImGui.Separator();
|
||||
|
||||
// Other changes
|
||||
ImGui.PushFont(UiBuilder.IconFont); ImGui.Text("\uf085"); ImGui.PopFont(); ImGui.SameLine();
|
||||
ImGui.TextColored(new Vector4(0.65f, 0.65f, 0.9f, 1.0f), "Other Changes");
|
||||
ImGui.BulletText("Older Design macros were automatically upgraded.");
|
||||
ImGui.BulletText("Various UI tweaks, bugfixes, and behind-the-scenes improvements.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,363 @@
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using ImGuiScene;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CharacterSelectPlugin.Windows
|
||||
{
|
||||
public class RPProfileViewWindow : Window
|
||||
{
|
||||
private readonly Plugin plugin;
|
||||
private Character? character;
|
||||
private RPProfile? externalProfile = null;
|
||||
private bool showingExternal = false;
|
||||
private bool imageDownloadStarted = false;
|
||||
private bool imageDownloadComplete = false;
|
||||
private string? downloadedImagePath = null;
|
||||
private TextureWrap? cachedTexture;
|
||||
private string? cachedTexturePath;
|
||||
private bool bringToFront = false;
|
||||
private bool firstOpen = true;
|
||||
public RPProfile? CurrentProfile => showingExternal ? externalProfile : character?.RPProfile;
|
||||
|
||||
public RPProfileViewWindow(Plugin plugin)
|
||||
: base("RP Profile", ImGuiWindowFlags.AlwaysAutoResize)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
IsOpen = false;
|
||||
}
|
||||
public void SetCharacter(Character character)
|
||||
{
|
||||
this.character = character;
|
||||
showingExternal = false;
|
||||
bringToFront = true;
|
||||
|
||||
// Clear old cached texture so image reloads properly
|
||||
cachedTexture?.Dispose();
|
||||
cachedTexture = null;
|
||||
cachedTexturePath = null;
|
||||
}
|
||||
public override void PreDraw()
|
||||
{
|
||||
if (IsOpen && bringToFront)
|
||||
{
|
||||
ImGui.SetNextWindowFocus();
|
||||
|
||||
if (firstOpen)
|
||||
{
|
||||
ImGui.SetNextWindowPos(ImGui.GetMainViewport().GetCenter(), ImGuiCond.Appearing, new Vector2(0.5f, 0.5f));
|
||||
firstOpen = false;
|
||||
}
|
||||
|
||||
bringToFront = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
RPProfile? rp = null;
|
||||
Vector3 nameplateColor;
|
||||
string displayName;
|
||||
// Case: Viewing an external profile
|
||||
if (showingExternal && externalProfile != null)
|
||||
{
|
||||
rp = externalProfile;
|
||||
nameplateColor = (Vector3)externalProfile.NameplateColor;
|
||||
displayName = externalProfile.CharacterName ?? "External Profile";
|
||||
}
|
||||
// Case: Viewing a local character's profile
|
||||
else if (character != null && character.RPProfile != null)
|
||||
{
|
||||
rp = character.RPProfile;
|
||||
nameplateColor = character.NameplateColor;
|
||||
displayName = character.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text("No profile available.");
|
||||
return;
|
||||
}
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
// Top Bar
|
||||
var color = ResolveNameplateColor();
|
||||
var topColor = new Vector4(color.X, color.Y, color.Z, 1f);
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var topLeft = ImGui.GetCursorScreenPos();
|
||||
drawList.AddRectFilled(topLeft, topLeft + new Vector2(600, 6), ImGui.ColorConvertFloat4ToU32(topColor));
|
||||
|
||||
ImGui.Dummy(new Vector2(1, 10)); // spacer
|
||||
|
||||
ImGui.BeginChild("ProfileCard", new Vector2(600, 210), false);
|
||||
|
||||
// Left (Image + Tags)
|
||||
ImGui.BeginGroup();
|
||||
|
||||
string fallback = Path.Combine(plugin.PluginDirectory, "Assets", "Default.png");
|
||||
string? imagePath = null;
|
||||
|
||||
// If viewing external profile and has ProfileImageUrl
|
||||
if (showingExternal && !string.IsNullOrEmpty(rp.ProfileImageUrl))
|
||||
{
|
||||
if (!imageDownloadStarted)
|
||||
{
|
||||
imageDownloadStarted = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using var client = new System.Net.Http.HttpClient();
|
||||
var data = client.GetByteArrayAsync(rp.ProfileImageUrl).GetAwaiter().GetResult();
|
||||
|
||||
var hash = Convert.ToBase64String(System.Security.Cryptography.MD5.HashData(System.Text.Encoding.UTF8.GetBytes(rp.ProfileImageUrl)))
|
||||
.Replace("/", "_").Replace("+", "-");
|
||||
string fileName = $"RPImage_{hash}.png";
|
||||
string path = Path.Combine(Plugin.PluginInterface.GetPluginConfigDirectory(), fileName);
|
||||
|
||||
// Save once only if not exists
|
||||
File.WriteAllBytes(path, data);
|
||||
Plugin.Log.Debug($"[RPProfileView] Downloaded image to: {path}");
|
||||
|
||||
|
||||
downloadedImagePath = path;
|
||||
imageDownloadComplete = true;
|
||||
|
||||
// Force window to update and focus
|
||||
bringToFront = true;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Plugin.Log.Error($"[RPProfileViewWindow] Failed to download profile image: {ex.Message}");
|
||||
imageDownloadComplete = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (imageDownloadComplete && File.Exists(downloadedImagePath))
|
||||
{
|
||||
imagePath = downloadedImagePath;
|
||||
}
|
||||
}
|
||||
// Local fallback options
|
||||
else if (!string.IsNullOrEmpty(rp.CustomImagePath) && File.Exists(rp.CustomImagePath))
|
||||
{
|
||||
imagePath = rp.CustomImagePath;
|
||||
}
|
||||
else if (!showingExternal && character?.ImagePath is { Length: > 0 } && File.Exists(character.ImagePath))
|
||||
{
|
||||
imagePath = character.ImagePath;
|
||||
}
|
||||
|
||||
// Final fallback
|
||||
string finalImagePath = !string.IsNullOrEmpty(imagePath) && File.Exists(imagePath) ? imagePath : fallback;
|
||||
|
||||
|
||||
var texture = Plugin.TextureProvider.GetFromFile(finalImagePath).GetWrapOrDefault();
|
||||
if (texture != null)
|
||||
{
|
||||
float previewSize = 150f;
|
||||
float zoom = Math.Clamp(rp.ImageZoom, 0.5f, 5.0f);
|
||||
Vector2 offset = rp.ImageOffset;
|
||||
|
||||
float texAspect = (float)texture.Width / texture.Height;
|
||||
float drawWidth, drawHeight;
|
||||
|
||||
if (texAspect >= 1f)
|
||||
{
|
||||
drawHeight = previewSize * zoom;
|
||||
drawWidth = drawHeight * texAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawWidth = previewSize * zoom;
|
||||
drawHeight = drawWidth / texAspect;
|
||||
}
|
||||
|
||||
Vector2 drawSize = new(drawWidth, drawHeight);
|
||||
Vector2 cursor = ImGui.GetCursorScreenPos();
|
||||
|
||||
// Outer border frame
|
||||
drawList.AddRectFilled(cursor - new Vector2(2, 2), cursor + new Vector2(previewSize + 2), ImGui.ColorConvertFloat4ToU32(topColor), 4);
|
||||
|
||||
// Crop area
|
||||
ImGui.BeginChild("ImageView", new Vector2(previewSize), false, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse);
|
||||
ImGui.SetCursorScreenPos(cursor + offset);
|
||||
ImGui.Image(texture.ImGuiHandle, drawSize);
|
||||
ImGui.EndChild();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
ImGui.Dummy(new Vector2(150, 150));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(rp.Tags))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
var tagColor = new Vector4((color.X + 1f) / 2f, (color.Y + 1f) / 2f, (color.Z + 1f) / 2f, 0.65f);
|
||||
var tags = rp.Tags.Split(',').Select(t => t.Trim()).Where(t => !string.IsNullOrEmpty(t));
|
||||
foreach (var tag in tags)
|
||||
{
|
||||
ImGui.PushStyleColor(ImGuiCol.Button, tagColor);
|
||||
ImGui.Button(tag);
|
||||
ImGui.PopStyleColor();
|
||||
ImGui.SameLine();
|
||||
}
|
||||
ImGui.NewLine();
|
||||
}
|
||||
|
||||
ImGui.EndGroup();
|
||||
|
||||
// Name + Fields
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX(180); // ensure it never touches image
|
||||
|
||||
ImGui.BeginGroup();
|
||||
// Header: Name – Pronouns Roleplay Profile
|
||||
ImGui.TextColored(new Vector4(1f, 0.75f, 0.4f, 1f), displayName);
|
||||
if (!string.IsNullOrWhiteSpace(rp.Pronouns))
|
||||
{
|
||||
ImGui.SameLine();
|
||||
ImGui.Text($"– {rp.Pronouns}");
|
||||
}
|
||||
ImGui.SameLine();
|
||||
ImGui.TextDisabled("Roleplay Profile");
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
// New field layout
|
||||
float colSplit = 200f;
|
||||
DrawFieldRow("▪ Gender", rp.Gender, "▪ Age", rp.Age, colSplit);
|
||||
DrawFieldRow("▪ Race", rp.Race, "▪ Orientation", rp.Orientation, colSplit);
|
||||
DrawFieldRow("▪ Relationship", rp.Relationship, "▪ Occupation", rp.Occupation, colSplit);
|
||||
if (!string.IsNullOrWhiteSpace(rp.Abilities))
|
||||
{
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("Abilities:");
|
||||
|
||||
var abilities = rp.Abilities.Split(',')
|
||||
.Select(a => a.Trim())
|
||||
.Where(a => !string.IsNullOrEmpty(a));
|
||||
|
||||
ImGui.PushTextWrapPos();
|
||||
ImGui.Text(string.Join(" • ", abilities));
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
|
||||
ImGui.EndGroup();
|
||||
ImGui.EndChild();
|
||||
|
||||
// Divider Bar Below Card
|
||||
// Diamond Divider
|
||||
var diamond = "◆";
|
||||
var diamondWidth = ImGui.CalcTextSize(diamond).X;
|
||||
|
||||
float barPadding = 6f;
|
||||
float totalWidth = 600f;
|
||||
float barLength = (totalWidth - diamondWidth - (barPadding * 2)) / 2f;
|
||||
float dividerY = ImGui.GetCursorScreenPos().Y;
|
||||
float dividerX = ImGui.GetCursorScreenPos().X;
|
||||
|
||||
drawList.AddLine(
|
||||
new Vector2(dividerX, dividerY),
|
||||
new Vector2(dividerX + barLength, dividerY),
|
||||
ImGui.ColorConvertFloat4ToU32(topColor), 1f
|
||||
);
|
||||
|
||||
ImGui.SetCursorScreenPos(new Vector2(dividerX + barLength + barPadding, dividerY - ImGui.GetTextLineHeight() / 2));
|
||||
ImGui.TextColored(topColor, diamond);
|
||||
|
||||
drawList.AddLine(
|
||||
new Vector2(dividerX + barLength + barPadding + diamondWidth + barPadding, dividerY),
|
||||
new Vector2(dividerX + totalWidth, dividerY),
|
||||
ImGui.ColorConvertFloat4ToU32(topColor), 1f
|
||||
);
|
||||
|
||||
ImGui.Dummy(new Vector2(1, 8));
|
||||
|
||||
|
||||
// Bio Section
|
||||
ImGui.Text("Bio:");
|
||||
ImGui.PushStyleColor(ImGuiCol.ChildBg, new Vector4(0.15f, 0.15f, 0.15f, 0.7f));
|
||||
ImGui.BeginChild("BioScroll", new Vector2(600, 120), true);
|
||||
ImGui.TextWrapped(string.IsNullOrWhiteSpace(rp.Bio) ? "—" : rp.Bio);
|
||||
ImGui.EndChild();
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
// Centered Edit Button
|
||||
ImGui.Spacing();
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowWidth() - 120) * 0.5f);
|
||||
|
||||
if (!showingExternal && character != null && ImGui.Button("Edit Profile", new Vector2(120, 0)))
|
||||
{
|
||||
plugin.RPProfileEditor.SetCharacter(character);
|
||||
plugin.RPProfileEditor.IsOpen = true;
|
||||
IsOpen = false;
|
||||
}
|
||||
|
||||
|
||||
ImGui.PopTextWrapPos();
|
||||
if (!IsOpen)
|
||||
{
|
||||
showingExternal = false;
|
||||
externalProfile = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFieldRow(string label1, string? val1, string label2, string? val2, float columnSplit)
|
||||
{
|
||||
float rowStartX = ImGui.GetCursorPosX();
|
||||
var labelColor = new Vector4(1f, 1f, 0.85f, 1f);
|
||||
|
||||
// First column
|
||||
ImGui.SetCursorPosX(rowStartX);
|
||||
ImGui.TextColored(labelColor, label1 + ":");
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(string.IsNullOrWhiteSpace(val1) ? "—" : val1);
|
||||
|
||||
// Second column
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosX(rowStartX + columnSplit);
|
||||
ImGui.TextColored(labelColor, label2 + ":");
|
||||
ImGui.SameLine();
|
||||
ImGui.Text(string.IsNullOrWhiteSpace(val2) ? "—" : val2);
|
||||
}
|
||||
public void SetExternalProfile(RPProfile profile)
|
||||
{
|
||||
externalProfile = profile;
|
||||
showingExternal = true;
|
||||
|
||||
imageDownloadStarted = false;
|
||||
imageDownloadComplete = false;
|
||||
downloadedImagePath = null;
|
||||
|
||||
cachedTexture?.Dispose();
|
||||
cachedTexture = null;
|
||||
cachedTexturePath = null;
|
||||
|
||||
bringToFront = true; // Bring the window to front
|
||||
}
|
||||
private Vector3 ResolveNameplateColor()
|
||||
{
|
||||
Vector3 fallback = new(0.3f, 0.6f, 1.0f); // soft blue
|
||||
|
||||
if (showingExternal && externalProfile != null)
|
||||
{
|
||||
var c = (Vector3)externalProfile.NameplateColor;
|
||||
// If the colour is effectively black or unset, fallback
|
||||
if (c.X < 0.01f && c.Y < 0.01f && c.Z < 0.01f)
|
||||
return fallback;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
return character?.NameplateColor ?? fallback;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
using Dalamud.Interface.Windowing;
|
||||
using ImGuiNET;
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CharacterSelectPlugin.Windows
|
||||
{
|
||||
public class RPProfileWindow : Window
|
||||
{
|
||||
private readonly Plugin plugin;
|
||||
private Character? character;
|
||||
private RPProfile profile = new();
|
||||
|
||||
private string pronouns = "";
|
||||
private string gender = "";
|
||||
private string age = "";
|
||||
private string orientation = "";
|
||||
private string relationship = "";
|
||||
private string occupation = "";
|
||||
private string abilities = "";
|
||||
private string bio = "";
|
||||
private string tags = "";
|
||||
private string race = "";
|
||||
|
||||
public RPProfileWindow(Plugin plugin) : base("Roleplay Profile", ImGuiWindowFlags.AlwaysAutoResize)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
IsOpen = false;
|
||||
}
|
||||
|
||||
public void SetCharacter(Character character)
|
||||
{
|
||||
this.character = character;
|
||||
profile = character.RPProfile ??= new RPProfile();
|
||||
|
||||
var rp = character.RPProfile ??= new RPProfile();
|
||||
pronouns = rp.Pronouns ?? "";
|
||||
gender = rp.Gender ?? "";
|
||||
age = rp.Age ?? "";
|
||||
race = rp.Race ?? "";
|
||||
orientation = rp.Orientation ?? "";
|
||||
relationship = rp.Relationship ?? "";
|
||||
occupation = rp.Occupation ?? "";
|
||||
abilities = rp.Abilities ?? "";
|
||||
bio = rp.Bio ?? "";
|
||||
tags = rp.Tags ?? "";
|
||||
}
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
if (character == null)
|
||||
{
|
||||
ImGui.Text("No character selected.");
|
||||
return;
|
||||
}
|
||||
var rp = character.RPProfile ??= new RPProfile();
|
||||
|
||||
// Image Override Section (Top of Window)
|
||||
ImGui.Text("Profile Image:");
|
||||
|
||||
// Choose Image Button
|
||||
if (ImGui.Button("Choose Image"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
using (OpenFileDialog openFileDialog = new OpenFileDialog())
|
||||
{
|
||||
openFileDialog.Filter = "PNG files (*.png)|*.png";
|
||||
openFileDialog.Title = "Select Profile Image";
|
||||
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
rp.CustomImagePath = openFileDialog.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Plugin.Log.Error($"Error opening file picker: {ex.Message}");
|
||||
}
|
||||
});
|
||||
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Plugin.Log.Error($"Critical file picker error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (!string.IsNullOrEmpty(rp.CustomImagePath))
|
||||
{
|
||||
if (ImGui.Button("Clear"))
|
||||
rp.CustomImagePath = "";
|
||||
}
|
||||
|
||||
// Fixed-Frame Image Preview with Zoom & Pan
|
||||
string pluginDir = plugin.PluginDirectory;
|
||||
string fallback = Path.Combine(pluginDir, "Assets", "Default.png");
|
||||
string finalImagePath = !string.IsNullOrEmpty(rp.CustomImagePath) && File.Exists(rp.CustomImagePath)
|
||||
? rp.CustomImagePath
|
||||
: (!string.IsNullOrEmpty(character.ImagePath) && File.Exists(character.ImagePath)
|
||||
? character.ImagePath
|
||||
: fallback);
|
||||
|
||||
if (File.Exists(finalImagePath))
|
||||
{
|
||||
var texture = Plugin.TextureProvider.GetFromFile(finalImagePath).GetWrapOrDefault();
|
||||
if (texture != null)
|
||||
{
|
||||
float frameSize = 150f;
|
||||
float zoom = Math.Clamp(rp.ImageZoom, 0.5f, 5.0f);
|
||||
Vector2 offset = rp.ImageOffset;
|
||||
|
||||
float imgAspect = (float)texture.Width / texture.Height;
|
||||
float drawWidth, drawHeight;
|
||||
|
||||
if (imgAspect >= 1f)
|
||||
{
|
||||
drawHeight = frameSize * zoom;
|
||||
drawWidth = drawHeight * imgAspect;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawWidth = frameSize * zoom;
|
||||
drawHeight = drawWidth / imgAspect;
|
||||
}
|
||||
|
||||
Vector2 drawSize = new(drawWidth, drawHeight);
|
||||
Vector2 drawPos = ImGui.GetCursorScreenPos() + offset;
|
||||
|
||||
// Background border
|
||||
var cursor = ImGui.GetCursorScreenPos();
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
drawList.AddRectFilled(cursor - new Vector2(2, 2), cursor + new Vector2(frameSize + 2), ImGui.ColorConvertFloat4ToU32(new Vector4(0.4f, 0.4f, 0.4f, 1f)), 4);
|
||||
|
||||
// Crop region
|
||||
ImGui.BeginChild("ImageCropFrame", new Vector2(frameSize), false, ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse);
|
||||
ImGui.SetCursorScreenPos(drawPos);
|
||||
ImGui.Image(texture.ImGuiHandle, drawSize);
|
||||
ImGui.EndChild();
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.Text($"⚠ Failed to load: {Path.GetFileName(finalImagePath)}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui.TextDisabled("No Image Available");
|
||||
}
|
||||
|
||||
// Image Offset Sliders
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("Image Position Offset:");
|
||||
ImGui.SameLine();
|
||||
ImGui.TextDisabled("ⓘ");
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("Use these sliders to reposition your image inside the fixed frame.");
|
||||
|
||||
Vector2 newOffset = rp.ImageOffset;
|
||||
ImGui.PushItemWidth(200);
|
||||
ImGui.SliderFloat("X##offset", ref newOffset.X, -300f, 300f, "%.0f");
|
||||
ImGui.SliderFloat("Y##offset", ref newOffset.Y, -300f, 300f, "%.0f");
|
||||
ImGui.PopItemWidth();
|
||||
rp.ImageOffset = newOffset;
|
||||
|
||||
// Zoom
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("Zoom:");
|
||||
ImGui.SameLine();
|
||||
ImGui.TextDisabled("ⓘ");
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("Zoom in or out on your image.");
|
||||
|
||||
float newZoom = rp.ImageZoom;
|
||||
ImGui.PushItemWidth(200);
|
||||
ImGui.SliderFloat("##zoom", ref newZoom, 0.5f, 5.0f, "%.1fx");
|
||||
ImGui.PopItemWidth();
|
||||
rp.ImageZoom = newZoom;
|
||||
|
||||
|
||||
ImGui.Spacing();
|
||||
|
||||
ImGui.PushTextWrapPos();
|
||||
|
||||
ImGui.TextColored(new Vector4(1f, 0.75f, 0.4f, 1f), $"{character.Name} – Roleplay Profile");
|
||||
ImGui.Separator();
|
||||
|
||||
DrawEditableField("Pronouns", ref pronouns);
|
||||
DrawEditableField("Gender", ref gender);
|
||||
DrawEditableField("Age", ref age);
|
||||
DrawEditableField("Race", ref race);
|
||||
DrawEditableField("Sexual Orientation", ref orientation);
|
||||
DrawEditableField("Relationship", ref relationship);
|
||||
DrawEditableField("Occupation", ref occupation);
|
||||
ImGui.Spacing();
|
||||
|
||||
// Abilities (as tag-like input)
|
||||
ImGui.Text("Abilities:");
|
||||
ImGui.SameLine();
|
||||
ImGui.TextDisabled("ⓘ");
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("Separate abilities using commas: e.g. 'alchemy, bardic magic, swordplay'");
|
||||
|
||||
ImGui.InputTextMultiline("##abilities", ref abilities, 1000, new Vector2(-1, 40));
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("Bio:");
|
||||
ImGui.InputTextMultiline("##bio", ref bio, 1000, new Vector2(-1, 100));
|
||||
|
||||
ImGui.Spacing();
|
||||
ImGui.Text("RP Tags:");
|
||||
ImGui.SameLine();
|
||||
ImGui.TextDisabled("ⓘ");
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip("Separate tags using commas: e.g. 'casual, paragraph, lore-heavy'");
|
||||
|
||||
ImGui.InputTextMultiline("##tags", ref tags, 1000, new Vector2(-1, 40));
|
||||
|
||||
ImGui.Text("Profile Sharing:");
|
||||
ImGui.SameLine();
|
||||
|
||||
var sharing = profile.Sharing;
|
||||
string GetSharingDisplayName(ProfileSharing option) => option switch
|
||||
{
|
||||
ProfileSharing.AlwaysShare => "Always Share",
|
||||
ProfileSharing.NeverShare => "Never Share",
|
||||
_ => option.ToString(),
|
||||
};
|
||||
|
||||
if (ImGui.BeginCombo("##SharingSetting", GetSharingDisplayName(sharing)))
|
||||
{
|
||||
foreach (ProfileSharing option in Enum.GetValues(typeof(ProfileSharing)))
|
||||
{
|
||||
bool isSelected = (sharing == option);
|
||||
if (ImGui.Selectable(GetSharingDisplayName(option), isSelected))
|
||||
profile.Sharing = option;
|
||||
if (isSelected)
|
||||
ImGui.SetItemDefaultFocus();
|
||||
}
|
||||
ImGui.EndCombo();
|
||||
}
|
||||
|
||||
ImGui.Spacing();
|
||||
if (ImGui.Button("Save"))
|
||||
{
|
||||
// Save all edits into profile
|
||||
profile.Pronouns = pronouns;
|
||||
profile.Gender = gender;
|
||||
profile.Age = age;
|
||||
profile.Race = race;
|
||||
profile.Orientation = orientation;
|
||||
profile.Relationship = relationship;
|
||||
profile.Occupation = occupation;
|
||||
profile.Abilities = abilities;
|
||||
profile.Bio = bio;
|
||||
profile.Tags = tags;
|
||||
profile.ImageZoom = rp.ImageZoom;
|
||||
profile.ImageOffset = rp.ImageOffset;
|
||||
|
||||
// Save reference back to character and config
|
||||
character.RPProfile = profile;
|
||||
plugin.SaveConfiguration();
|
||||
// Upload profile just like ApplyProfile() does
|
||||
if (!string.IsNullOrWhiteSpace(character.LastInGameName))
|
||||
{
|
||||
character.RPProfile.CharacterName = character.Name;
|
||||
character.RPProfile.NameplateColor = character.NameplateColor;
|
||||
|
||||
_ = Plugin.UploadProfileAsync(character.RPProfile, character.LastInGameName);
|
||||
}
|
||||
|
||||
|
||||
IsOpen = false;
|
||||
|
||||
// Auto-open view window with new profile
|
||||
plugin.RPProfileViewer.SetCharacter(character);
|
||||
plugin.RPProfileViewer.IsOpen = true;
|
||||
}
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGui.Button("Cancel"))
|
||||
{
|
||||
IsOpen = false;
|
||||
// Immediately open the RP profile viewer
|
||||
plugin.RPProfileViewer.SetCharacter(character);
|
||||
plugin.RPProfileViewer.IsOpen = true;
|
||||
}
|
||||
|
||||
ImGui.PopTextWrapPos();
|
||||
}
|
||||
|
||||
private void DrawEditableField(string label, ref string value)
|
||||
{
|
||||
ImGui.Text(label + ":");
|
||||
ImGui.SameLine(130); // Adjust for better alignment
|
||||
ImGui.SetNextItemWidth(200);
|
||||
ImGui.InputText("##" + label, ref value, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": 1,
|
||||
"dependencies": {
|
||||
"net9.0-windows7.0": {
|
||||
"DalamudPackager": {
|
||||
"type": "Direct",
|
||||
"requested": "[12.0.0, )",
|
||||
"resolved": "12.0.0",
|
||||
"contentHash": "J5TJLV3f16T/E2H2P17ClWjtfEBPpq3yxvqW46eN36JCm6wR+EaoaYkqG9Rm5sHqs3/nK/vKjWWyvEs/jhKoXw=="
|
||||
},
|
||||
"DotNet.ReproducibleBuilds": {
|
||||
"type": "Direct",
|
||||
"requested": "[1.2.25, )",
|
||||
"resolved": "1.2.25",
|
||||
"contentHash": "xCXiw7BCxHJ8pF6wPepRUddlh2dlQlbr81gXA72hdk4FLHkKXas7EH/n+fk5UCA/YfMqG1Z6XaPiUjDbUNBUzg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"Author": "Kid Icarus",
|
||||
"Name": "Character Select+",
|
||||
"Description": "Character Select+ allows you to create, save, and instantly apply fully customized character profiles with the press of a button. Switch between your OCs effortlessly using /select CharacterName, applying Penumbra Collections, Glamourer Designs, Customize+ Profiles, and Honorific Titles in one command.\n\nWhile profile switching is its core purpose, Character Select+ includes additional features:\n✔ Advanced Mode – Create custom macro setups for deeper character customization.\n✔ Profile-Specific Designs – Use multiple outfits, styles, and looks per character.\n✔ Favorites & Sorting – Keep profiles organized by name, date, or importance.\n✔ Quick Swap Bar! \n✔ One-Click Macro Execution – Run predefined commands instantly when selecting a character.\n\nWhether you're roleplaying, gposing, or just love quick customization, Character Select+ makes switching between characters faster, easier, and seamless.\n",
|
||||
"Tags": [
|
||||
"Character",
|
||||
"Select"
|
||||
],
|
||||
"InternalName": "CharacterSelectPlugin",
|
||||
"AssemblyVersion": "1.1.1.3",
|
||||
"TestingAssemblyVersion": "1.1.1.3",
|
||||
"RepoUrl": "https://github.com/IcarusXIV/Character-Select-",
|
||||
"ApplicableVersion": "any",
|
||||
"DalamudApiLevel": 12,
|
||||
"IsHide": "False",
|
||||
"IsTestingExclusive": "False",
|
||||
"DownloadLinkInstall": "https://github.com/IcarusXIV/Character-Select-/releases/download/1.1.1.3/CharacterSelectPlugin.zip",
|
||||
"DownloadLinkTesting": "https://github.com/IcarusXIV/Character-Select-/releases/download/1.1.1.3/CharacterSelectPlugin.zip",
|
||||
"DownloadLinkUpdate": "https://github.com/IcarusXIV/Character-Select-/releases/download/1.1.1.3/CharacterSelectPlugin.zip",
|
||||
"IconUrl": "https://raw.githubusercontent.com/IcarusXIV/Character-Select-/master/CharacterSelectPlugin/Assets/Icon.png"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user