-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from DubskySteam/dev
v0.3
- Loading branch information
Showing
6 changed files
with
124 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[package] | ||
name = "ffxiv-raidcompletion" | ||
version = "0.3.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
reqwest = {version = "0.11.18", features = ["json"]} | ||
serde = {version = "1.0.166", features = ["derive"]} | ||
tokio = { version = "1.29.1", features = ["full"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# FFXIV-RaidCompletion | ||
Tracks a players dungeon, trial & raid achievements | ||
##### A fast and lightweight tracker for dungeon, trial & raid achievements | ||
##### Made & maintained in my free-time, therefore no guarantee for instant bug fixes, updates etc. | ||
 | ||
 | ||
## Features [WIP] | ||
- Show progression of pve content | ||
## Screenshots [WIP] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
use serde::Deserialize; | ||
|
||
use crate::player::PlayerData; | ||
|
||
#[derive(Deserialize, Debug)] | ||
struct Player { | ||
Character: Box<p_character>, | ||
Achievements: Box<p_achievements> | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
struct p_achievements { | ||
List: Vec<ListElement> | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
struct ListElement { | ||
ID: i32 | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
struct ActiveClassJob { | ||
UnlockedState: Box<UnlockedState>, | ||
Level: i32 | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
struct UnlockedState { | ||
Name: String | ||
} | ||
|
||
#[derive(Deserialize, Debug)] | ||
struct p_character { | ||
ActiveClassJob: Box<ActiveClassJob>, | ||
DC: String, | ||
Name: String, | ||
Server: String, | ||
Title: i32 | ||
} | ||
|
||
pub async fn fetch_data(id: &str, P_DATA: &mut PlayerData) -> Result<(), Box<dyn std::error::Error>> { | ||
println!("STARTING TO FETCH"); | ||
let p_data = reqwest::get("https://xivapi.com/character/".to_owned() + id + "?data=AC") | ||
.await? | ||
.json::<Player>() | ||
.await?; | ||
|
||
//println!("pdata:\n{:?}", p_data); | ||
P_DATA.name = p_data.Character.Name; | ||
P_DATA.server = p_data.Character.Server; | ||
P_DATA.datacenter = p_data.Character.DC; | ||
P_DATA.level = p_data.Character.ActiveClassJob.Level; | ||
P_DATA.class = p_data.Character.ActiveClassJob.UnlockedState.Name; | ||
for i in p_data.Achievements.List.iter() { | ||
P_DATA.achievements.push(i.ID) | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#![allow(dead_code)] | ||
#![allow(non_camel_case_types)] | ||
#![allow(non_snake_case)] | ||
#![allow(unused_imports)] | ||
|
||
mod player; | ||
mod fetch; | ||
use player::PlayerData; | ||
|
||
static P_ID: &str = "48486396"; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
//Initial player data | ||
let mut P_DATA: PlayerData = PlayerData { | ||
name: String::new(), | ||
level: 0, | ||
class: String::new(), | ||
datacenter: String::new(), | ||
server: String::new(), | ||
achievements: Vec::new() | ||
}; | ||
|
||
//fetch data from api and do provisional print | ||
let _ = fetch::fetch_data(P_ID, &mut P_DATA).await; | ||
println!("Char: {}\nLevel: {}\nClass: {}\nDC: {}\nServer: {}\nAchievements: {:?}", | ||
P_DATA.name, | ||
P_DATA.level, | ||
P_DATA.class, | ||
P_DATA.datacenter, | ||
P_DATA.server, | ||
P_DATA.achievements | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub struct PlayerData { | ||
pub name: String, | ||
pub level: i32, | ||
pub class: String, | ||
pub datacenter: String, | ||
pub server: String, | ||
pub achievements: Vec<i32> | ||
} |