.
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
**/target
|
||||||
|
**/*.lock
|
||||||
7
resource_api/Cargo.toml
Normal file
7
resource_api/Cargo.toml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "resource_api"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = { version = "1.0.228", features = ["derive"] }
|
||||||
7
resource_api/src/main.rs
Normal file
7
resource_api/src/main.rs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
mod res_parser;
|
||||||
|
mod singleton;
|
||||||
|
mod types;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
println!("Hello, world!");
|
||||||
|
}
|
||||||
1
resource_api/src/res_parser/mod.rs
Normal file
1
resource_api/src/res_parser/mod.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
1
resource_api/src/singleton/mod.rs
Normal file
1
resource_api/src/singleton/mod.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
49
resource_api/src/types/character.rs
Normal file
49
resource_api/src/types/character.rs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
use super::common::{
|
||||||
|
Ascension, Count, Desc, Element, Id, Level, Path, Rarity, StatType, StatValue, Uri,
|
||||||
|
};
|
||||||
|
use super::item::ItemMini;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct Eidolon {
|
||||||
|
pub name: String,
|
||||||
|
pub desc: Desc,
|
||||||
|
pub img_url: Uri,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct CharacterSearch(pub BTreeMap<Id, CharacterMini>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct CharacterMini {
|
||||||
|
pub name: String,
|
||||||
|
pub path: Path,
|
||||||
|
pub rarity: Rarity,
|
||||||
|
pub element: Element,
|
||||||
|
pub img_url: Uri,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct CharacterDetail(pub HashMap<Id, CharacterFull>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct CharacterFull {
|
||||||
|
pub name: String,
|
||||||
|
pub path: Path,
|
||||||
|
pub rarity: Rarity,
|
||||||
|
pub element: Element,
|
||||||
|
pub img_url: String,
|
||||||
|
pub max_hp: StatValue,
|
||||||
|
pub max_def: StatValue,
|
||||||
|
pub max_atk: StatValue,
|
||||||
|
pub speed: StatValue,
|
||||||
|
pub aggro: StatValue,
|
||||||
|
pub c_rate: StatValue,
|
||||||
|
pub c_dmg: StatValue,
|
||||||
|
pub eidolons: BTreeMap<Level, Eidolon>,
|
||||||
|
pub minor_traces: BTreeMap<StatType, StatValue>,
|
||||||
|
pub major_traces: BTreeMap<Ascension, Desc>,
|
||||||
|
pub skills: BTreeMap<Id, HashMap<Level, Desc>>,
|
||||||
|
pub max_mats: BTreeMap<Id, (ItemMini, Count)>,
|
||||||
|
}
|
||||||
92
resource_api/src/types/common.rs
Normal file
92
resource_api/src/types/common.rs
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
pub type Id = i32;
|
||||||
|
pub type Level = i32;
|
||||||
|
pub type Count = i32;
|
||||||
|
pub type Desc = String;
|
||||||
|
pub type Uri = String;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||||
|
pub enum StatValue {
|
||||||
|
Flat(f32),
|
||||||
|
Percent(f32),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum StatType {
|
||||||
|
Aggro = 1,
|
||||||
|
AtkFlat = 2,
|
||||||
|
AtkPercent = 3,
|
||||||
|
BreakEffect = 4,
|
||||||
|
CritDamage = 5,
|
||||||
|
CritRate = 6,
|
||||||
|
DamageRes = 7,
|
||||||
|
DebuffRes = 8,
|
||||||
|
DefFlat = 9,
|
||||||
|
DefPercent = 10,
|
||||||
|
DmgBoost = 11,
|
||||||
|
DmgMitigation = 12,
|
||||||
|
EffectHitRate = 13,
|
||||||
|
EffectRes = 14,
|
||||||
|
Elation = 15,
|
||||||
|
Energy = 16,
|
||||||
|
EnergyRegenerationRate = 17,
|
||||||
|
HpFlat = 18,
|
||||||
|
HpPercent = 19,
|
||||||
|
Merrymake = 20,
|
||||||
|
OutgoingHealingBoost = 21,
|
||||||
|
Punchline = 22,
|
||||||
|
Speed = 23,
|
||||||
|
Toughness = 24,
|
||||||
|
Vulnerability = 25,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum Ascension {
|
||||||
|
A2 = 1,
|
||||||
|
A4 = 2,
|
||||||
|
A6 = 3,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum Path {
|
||||||
|
Destruction = 1,
|
||||||
|
Hunt = 2,
|
||||||
|
Erudition = 3,
|
||||||
|
Harmony = 4,
|
||||||
|
Nihility = 5,
|
||||||
|
Preservation = 6,
|
||||||
|
Abundance = 7,
|
||||||
|
Remembrance = 8,
|
||||||
|
Elation = 9,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum Rarity {
|
||||||
|
ThreeStar = 3,
|
||||||
|
FourStar = 4,
|
||||||
|
FiveStar = 5,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum Element {
|
||||||
|
Physical = 1,
|
||||||
|
Fire = 2,
|
||||||
|
Ice = 3,
|
||||||
|
Lightning = 4,
|
||||||
|
Wind = 5,
|
||||||
|
Quantum = 6,
|
||||||
|
Imaginary = 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
#[repr(u8)]
|
||||||
|
pub enum RelicType {
|
||||||
|
Relic = 1,
|
||||||
|
Planar = 2,
|
||||||
|
}
|
||||||
1
resource_api/src/types/enemy.rs
Normal file
1
resource_api/src/types/enemy.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
1
resource_api/src/types/game_mode/aa.rs
Normal file
1
resource_api/src/types/game_mode/aa.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
1
resource_api/src/types/game_mode/apoc.rs
Normal file
1
resource_api/src/types/game_mode/apoc.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
1
resource_api/src/types/game_mode/moc.rs
Normal file
1
resource_api/src/types/game_mode/moc.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
11
resource_api/src/types/game_mode/mod.rs
Normal file
11
resource_api/src/types/game_mode/mod.rs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
|
pub mod aa;
|
||||||
|
pub mod apoc;
|
||||||
|
pub mod moc;
|
||||||
|
pub mod pf;
|
||||||
|
|
||||||
|
pub use aa::*;
|
||||||
|
pub use apoc::*;
|
||||||
|
pub use moc::*;
|
||||||
|
pub use pf::*;
|
||||||
1
resource_api/src/types/game_mode/pf.rs
Normal file
1
resource_api/src/types/game_mode/pf.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
// TODO
|
||||||
12
resource_api/src/types/item.rs
Normal file
12
resource_api/src/types/item.rs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
use super::common::{Id, Uri};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct ItemSearch(pub BTreeMap<Id, ItemMini>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct ItemMini {
|
||||||
|
pub name: String,
|
||||||
|
pub img_url: Uri,
|
||||||
|
}
|
||||||
32
resource_api/src/types/lightcone.rs
Normal file
32
resource_api/src/types/lightcone.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
use super::common::{Count, Desc, Id, Level, Path, Rarity, StatValue, Uri};
|
||||||
|
use super::item::ItemMini;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct LightconeSearch(pub BTreeMap<Id, LightconeMini>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct LightconeMini {
|
||||||
|
pub name: String,
|
||||||
|
pub path: Path,
|
||||||
|
pub rarity: Rarity,
|
||||||
|
pub img_url: Uri,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct LightconeDetail(pub HashMap<Id, LightconeFull>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct LightconeFull {
|
||||||
|
pub name: String,
|
||||||
|
pub path: Path,
|
||||||
|
pub rarity: Rarity,
|
||||||
|
pub img_url: Uri,
|
||||||
|
pub max_hp: StatValue,
|
||||||
|
pub max_def: StatValue,
|
||||||
|
pub max_atk: StatValue,
|
||||||
|
// superimpose -> desc
|
||||||
|
pub skill: HashMap<Level, Desc>,
|
||||||
|
pub max_mats: BTreeMap<Id, (ItemMini, Count)>,
|
||||||
|
}
|
||||||
15
resource_api/src/types/mod.rs
Normal file
15
resource_api/src/types/mod.rs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#![allow(unused)]
|
||||||
|
|
||||||
|
pub mod character;
|
||||||
|
pub mod common;
|
||||||
|
pub mod game_mode;
|
||||||
|
pub mod item;
|
||||||
|
pub mod lightcone;
|
||||||
|
pub mod relic;
|
||||||
|
|
||||||
|
pub use character::*;
|
||||||
|
pub use common::*;
|
||||||
|
pub use game_mode::*;
|
||||||
|
pub use item::*;
|
||||||
|
pub use lightcone::*;
|
||||||
|
pub use relic::*;
|
||||||
25
resource_api/src/types/relic.rs
Normal file
25
resource_api/src/types/relic.rs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
use super::common::{Desc, Id, RelicType, Uri};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct RelicSearch(pub BTreeMap<Id, RelicMini>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct RelicMini {
|
||||||
|
pub name: String,
|
||||||
|
pub r#type: RelicType,
|
||||||
|
pub img_url: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct RelicDetail(pub HashMap<Id, RelicFull>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
pub struct RelicFull {
|
||||||
|
pub name: String,
|
||||||
|
pub r#type: RelicType,
|
||||||
|
pub img_url: Uri,
|
||||||
|
pub two_pc: Desc,
|
||||||
|
pub four_pc: Option<Desc>,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user