diff --git a/README.md b/README.md index 14b2857..2bfdb6e 100644 --- a/README.md +++ b/README.md @@ -23,18 +23,19 @@ This tool makes several HTTP requests to the Lodestone, but they currently are o ## Supported Data -| Data | Supported | Notes | -|---------------------------|-----------|-------------------------------------------------------------| -| Name | ✅ | | -| World/Data Center | ✅ | | -| Race/Subrace/Gender | ✅ | | -| City-state | ✅ | | -| Nameday | ✅ | | -| Guardian | ✅ | | -| Portrait/Full-body Images | ✅ | These are the images displayed on the Lodestone. | -| Playtime | ✅ | 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. | +| Data | Supported | Notes | +|---------------------------|-----------|-----------------------------------------------------------------------------------| +| Name | ✅ | | +| World/Data Center | ✅ | | +| Race/Subrace/Gender | ✅ | | +| City-state | ✅ | | +| Nameday | ✅ | | +| Guardian | ✅ | | +| Portrait/Full-body Images | ✅ | These are the images displayed on the Lodestone. | +| Playtime | ✅ | 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. | +| 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. diff --git a/dalamud/Auracite/MiscStep.cs b/dalamud/Auracite/MiscStep.cs new file mode 100644 index 0000000..070ac49 --- /dev/null +++ b/dalamud/Auracite/MiscStep.cs @@ -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."; + } +} \ No newline at end of file diff --git a/dalamud/Auracite/Plugin.cs b/dalamud/Auracite/Plugin.cs index 1221472..095c5f2 100644 --- a/dalamud/Auracite/Plugin.cs +++ b/dalamud/Auracite/Plugin.cs @@ -16,7 +16,7 @@ public sealed class Plugin : IDalamudPlugin private readonly WindowSystem WindowSystem = new("Auracite"); private readonly List _steps = - [typeof(AppearanceStep), typeof(CurrencyStep), typeof(PlaytimeStep)]; + [typeof(AppearanceStep), typeof(CurrencyStep), typeof(MiscStep), typeof(PlaytimeStep)]; private int _stepIndex; @@ -28,6 +28,11 @@ public sealed class Plugin : IDalamudPlugin public int height; public int bust_size; 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; diff --git a/src/data.rs b/src/data.rs index cdefbc9..f8c3779 100644 --- a/src/data.rs +++ b/src/data.rs @@ -25,6 +25,11 @@ pub struct CharacterData { pub currencies: Currencies, pub playtime: String, 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)] pub face_url: String, diff --git a/src/main.rs b/src/main.rs index 55aced0..bfcec0e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,11 @@ struct Package { height: i32, bust_size: i32, gil: u32, + is_battle_mentor: bool, + is_trade_mentor: bool, + is_novice: bool, + is_returner: bool, + player_commendations: i32, } #[derive(Clone)] @@ -114,7 +119,12 @@ fn main() { char_data.playtime = package.playtime.parse().unwrap(); char_data.appearance.height = package.height; 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();