1
Fork 0
mirror of https://github.com/redstrate/Auracite.git synced 2025-04-27 22:57:45 +00:00

Support grabbing from misc player state from the plugin

This currently includes mentor status, novice status and player
commendation count.
This commit is contained in:
Joshua Goins 2024-10-05 12:36:36 -04:00
parent a363827903
commit b509e05407
5 changed files with 68 additions and 14 deletions

View file

@ -23,18 +23,19 @@ This tool makes several HTTP requests to the Lodestone, but they currently are o
## Supported Data ## Supported Data
| Data | Supported | Notes | | Data | Supported | Notes |
|---------------------------|-----------|-------------------------------------------------------------| |---------------------------|-----------|-----------------------------------------------------------------------------------|
| Name | ✅ | | | Name | ✅ | |
| World/Data Center | ✅ | | | World/Data Center | ✅ | |
| Race/Subrace/Gender | ✅ | | | Race/Subrace/Gender | ✅ | |
| City-state | ✅ | | | City-state | ✅ | |
| Nameday | ✅ | | | Nameday | ✅ | |
| Guardian | ✅ | | | Guardian | ✅ | |
| Portrait/Full-body Images | ✅ | These are the images displayed on the Lodestone. | | Portrait/Full-body Images | ✅ | These are the images displayed on the Lodestone. |
| Playtime | ✅ | Requires the Dalamud plugin. | | Playtime | ✅ | Requires the Dalamud plugin. |
| Currencies | 〰️ | Only gil is supported, and requires the Dalamud plugin. | | Currencies | 〰️ | Only gil is supported, and requires the Dalamud plugin. |
| Appearance Data | 〰️ | Only some appearance data, and requires the Dalamud plugin. | | Appearance Data | 〰️ | Only some appearance data, and requires the Dalamud plugin. |
| Misc. state | 〰️ | Mentor and novice status, also player commendations. Requires the Dalamud plugin. |
Currently, more types of data is planned to be supported in the future. Currently, more types of data is planned to be supported in the future.

View file

@ -0,0 +1,33 @@
using FFXIVClientStructs.FFXIV.Client.Game;
using FFXIVClientStructs.FFXIV.Client.Game.UI;
namespace Auracite;
public class MiscStep : IStep
{
public event IStep.CompletedDelegate? Completed;
public void Run()
{
unsafe
{
Plugin.package.is_battle_mentor = PlayerState.Instance()->IsBattleMentor();
Plugin.package.is_trade_mentor = PlayerState.Instance()->IsTradeMentor();
Plugin.package.is_novice = PlayerState.Instance()->IsNovice();
Plugin.package.is_returner = PlayerState.Instance()->IsReturner();
Plugin.package.player_commendations = PlayerState.Instance()->PlayerCommendations;
}
Completed?.Invoke();
}
public string StepName()
{
return "Misc Data";
}
public string StepDescription()
{
return "No user action required.";
}
}

View file

@ -16,7 +16,7 @@ public sealed class Plugin : IDalamudPlugin
private readonly WindowSystem WindowSystem = new("Auracite"); private readonly WindowSystem WindowSystem = new("Auracite");
private readonly List<Type> _steps = private readonly List<Type> _steps =
[typeof(AppearanceStep), typeof(CurrencyStep), typeof(PlaytimeStep)]; [typeof(AppearanceStep), typeof(CurrencyStep), typeof(MiscStep), typeof(PlaytimeStep)];
private int _stepIndex; private int _stepIndex;
@ -28,6 +28,11 @@ public sealed class Plugin : IDalamudPlugin
public int height; public int height;
public int bust_size; public int bust_size;
public uint gil; public uint gil;
public bool is_battle_mentor;
public bool is_trade_mentor;
public bool is_novice;
public bool is_returner;
public short player_commendations;
} }
public static Package? package; public static Package? package;

View file

@ -25,6 +25,11 @@ pub struct CharacterData {
pub currencies: Currencies, pub currencies: Currencies,
pub playtime: String, pub playtime: String,
pub appearance: Appearance, pub appearance: Appearance,
pub is_battle_mentor: bool,
pub is_trade_mentor: bool,
pub is_novice: bool,
pub is_returner: bool,
pub player_commendations: i32,
#[serde(skip)] #[serde(skip)]
pub face_url: String, pub face_url: String,

View file

@ -33,6 +33,11 @@ struct Package {
height: i32, height: i32,
bust_size: i32, bust_size: i32,
gil: u32, gil: u32,
is_battle_mentor: bool,
is_trade_mentor: bool,
is_novice: bool,
is_returner: bool,
player_commendations: i32,
} }
#[derive(Clone)] #[derive(Clone)]
@ -114,7 +119,12 @@ fn main() {
char_data.playtime = package.playtime.parse().unwrap(); char_data.playtime = package.playtime.parse().unwrap();
char_data.appearance.height = package.height; char_data.appearance.height = package.height;
char_data.appearance.bust_size = package.bust_size; char_data.appearance.bust_size = package.bust_size;
char_data.currencies.gil = package.gil; char_data.currencies.gil = package.gil; // TODO: also fetch from the lodestone
char_data.is_battle_mentor = package.is_battle_mentor;
char_data.is_trade_mentor = package.is_trade_mentor;
char_data.is_novice = package.is_novice;
char_data.is_returner = package.is_returner;
char_data.player_commendations = package.player_commendations; // TODO: fetch from the lodestone?
} }
let serialized = serde_json::to_string(&char_data).unwrap(); let serialized = serde_json::to_string(&char_data).unwrap();