-
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.
feat: support full champion data (#17)
- Loading branch information
1 parent
bca7c0b
commit 2eaa347
Showing
5 changed files
with
118 additions
and
12 deletions.
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,106 @@ | ||
// Example code that deserializes and serializes the model. | ||
// extern crate serde; | ||
// #[macro_use] | ||
// extern crate serde_derive; | ||
// extern crate serde_json; | ||
// | ||
// use generated_module::ChampionsComplete; | ||
// | ||
// fn main() { | ||
// let json = r#"{"answer": 42}"#; | ||
// let model: ChampionsComplete = serde_json::from_str(&json).unwrap(); | ||
// } | ||
|
||
use serde::{Deserialize, Serialize}; | ||
use std::collections::HashMap; | ||
|
||
use super::{ | ||
champions::{Info, Tag}, | ||
shared::Image, | ||
}; | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct ChampionsFull { | ||
pub format: String, | ||
pub version: String, | ||
pub data: HashMap<String, ChampionFull>, | ||
pub keys: HashMap<String, String>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct ChampionFull { | ||
pub id: String, | ||
pub key: String, | ||
pub name: String, | ||
pub title: String, | ||
pub image: Image, | ||
pub skins: Vec<Skin>, | ||
pub lore: String, | ||
pub blurb: String, | ||
pub allytips: Vec<String>, | ||
pub enemytips: Vec<String>, | ||
pub tags: Vec<Tag>, | ||
pub partype: String, | ||
pub info: Info, | ||
pub stats: HashMap<String, f64>, | ||
pub spells: Vec<Spell>, | ||
pub passive: Passive, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Passive { | ||
pub name: String, | ||
pub description: String, | ||
pub image: Image, | ||
} | ||
|
||
#[derive(Serialize, Deserialize)] | ||
pub struct Skin { | ||
pub id: String, | ||
pub num: i64, | ||
pub name: String, | ||
pub chromas: bool, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug)] | ||
pub struct Spell { | ||
pub id: String, | ||
pub name: String, | ||
pub description: String, | ||
pub tooltip: String, | ||
pub leveltip: Option<Leveltip>, | ||
pub maxrank: i64, | ||
pub cooldown: Vec<f64>, | ||
#[serde(rename = "cooldownBurn")] | ||
pub cooldown_burn: String, | ||
pub cost: Vec<i64>, | ||
#[serde(rename = "costBurn")] | ||
pub cost_burn: String, | ||
pub effect: Vec<Option<Vec<f64>>>, | ||
#[serde(rename = "effectBurn")] | ||
pub effect_burn: Vec<Option<String>>, | ||
#[serde(rename = "costType")] | ||
pub cost_type: String, | ||
pub maxammo: String, | ||
pub range: Vec<i64>, | ||
#[serde(rename = "rangeBurn")] | ||
pub range_burn: String, | ||
pub image: Image, | ||
pub resource: Option<String>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Debug)] | ||
pub struct Leveltip { | ||
pub label: Vec<String>, | ||
pub effect: Vec<String>, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, Clone, Copy, Debug)] | ||
pub enum Type { | ||
#[serde(rename = "champion")] | ||
Champion, | ||
#[serde(rename = "passive")] | ||
Passive, | ||
#[serde(rename = "spell")] | ||
Spell, | ||
} |
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
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