This commit is contained in:
yuvlian
2026-02-14 17:25:23 +07:00
commit d16cfd2494
17 changed files with 259 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
**/target
**/*.lock

7
resource_api/Cargo.toml Normal file
View 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
View File

@@ -0,0 +1,7 @@
mod res_parser;
mod singleton;
mod types;
fn main() {
println!("Hello, world!");
}

View File

@@ -0,0 +1 @@
// TODO

View File

@@ -0,0 +1 @@
// TODO

View 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)>,
}

View 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,
}

View File

@@ -0,0 +1 @@
// TODO

View File

@@ -0,0 +1 @@
// TODO

View File

@@ -0,0 +1 @@
// TODO

View File

@@ -0,0 +1 @@
// TODO

View 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::*;

View File

@@ -0,0 +1 @@
// TODO

View 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,
}

View 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)>,
}

View 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::*;

View 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>,
}