diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..146ab09 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 07df76c..0eb4975 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,4 @@ edition = "2021" [dependencies] serde = "1.0.140" serde_json = "1.0.82" +teloxide = "0.10.1" \ No newline at end of file diff --git a/src/data/mod.rs b/src/data/mod.rs new file mode 100644 index 0000000..f509f36 --- /dev/null +++ b/src/data/mod.rs @@ -0,0 +1 @@ +mod schema; \ No newline at end of file diff --git a/src/data/schema.rs b/src/data/schema.rs new file mode 100644 index 0000000..84b2591 --- /dev/null +++ b/src/data/schema.rs @@ -0,0 +1,164 @@ +/// A single Legends of Runeterra card as represented in the data files from [Data Dragon](https://developer.riotgames.com/docs/lor). +#[derive(serde::Serialize, serde::Deserialize, Debug)] +#[serde(rename_all="camelCase")] +struct Card { + /// Localized names of the cards associated with this one. + /// For some reason, might not match what is contained in `associated_card_refs`. + associated_cards: Vec, + /// `card_code`s of the cards associated with this one. + associated_card_refs: Vec, + + /// Art assets of this card. + assets: Vec, + + /// Localized names of the regions this card belongs to. + regions: Vec, + /// IDs of the regions this card belongs to. + region_refs: Vec, + + /// Base attack of the card. + attack: i8, + /// Base cost of the card. + cost: i8, + /// Base health of the card. + health: i8, + + /// Localized description of the card, in XML. + description: String, + /// Localized description of the card, in plain text. + description_raw: String, + + /// Localized level up text of the card, in XML. + levelup_description: String, + /// Localized level up text of the card, in plain text. + levelup_description_raw: String, + + /// Flavor text of the card, displayed when its image is inspected. + flavor_text: String, + /// Name of the artist who drew the card. + artist_name: String, + + /// Localized name of the card. + name: String, + /// Unique seven-character identifier of the card. + card_code: [char; 7], + + /// List of keywords of this card, with their localized names. + keywords: Vec, + /// List of keywords of this card, with their internal names. + keyword_refs: Vec, + + /// Localized spell speed. + spell_speed: String, + /// [SpellSpeed] of the card. + spell_speed_ref: SpellSpeed, + + /// Localized rarity of the card. + rarity: String, + /// [CardRarity] of the card. + rarity_ref: CardRarity, + + /// The subtypes the card has, such as `PORO`. + subtypes: Vec, + /// The [CardSupertype] the card belongs to, such as `Champion`. + supertype: CardSupertype, + + /// If `true`, the card can be found in chests, crafted, or used in decks. + /// If `false`, the card is not available for direct use, as it is probably created by another card. + collectible: bool, + + /// The [CardSet] the card belongs to. + set: String, + + #[serde(rename(serialize = "type", deserialize = "type"))] + card_type: CardType, +} + + +/// An art asset associated with a given card. +#[derive(serde::Serialize, serde::Deserialize, Debug)] +#[serde(rename_all="camelCase")] +struct Asset { + /// URL to the card art as it is displayed in-game. + game_absolute_path: String, + /// URL to the full-size card art as it is displayed when the card is inspected. + full_absolute_path: String, +} + + +/// Possible card types. +#[non_exhaustive] +#[derive(serde::Serialize, serde::Deserialize, Debug)] +enum CardType { + /// A spell. + Spell, + /// An unit: either a minion, or a champion. + /// Champions have their `supertype` set to `Champion`. + Unit, + /// An ability triggered by an unit. + Ability, + /// A landmark. + Landmark, +} + + +/// Possible card supertypes. +#[non_exhaustive] +#[derive(serde::Serialize, serde::Deserialize, Debug)] +enum CardSupertype { + #[serde(alias = "")] + None, + + Champion, +} + + +/// Possible card rarities. +#[non_exhaustive] +#[derive(serde::Serialize, serde::Deserialize, Debug)] +enum CardRarity { + #[serde(alias = "NONE")] + None, + #[serde(alias = "COMMON")] + Common, + #[serde(alias = "RARE")] + Rare, + #[serde(alias = "EPIC")] + Epic, + #[serde(alias = "CHAMPION")] + Champion, +} + + +/// Possible spell speeds. +#[non_exhaustive] +#[derive(serde::Serialize, serde::Deserialize, Debug)] +enum SpellSpeed { + /// Non-spell cards have this speed. + #[serde(alias = "")] + None, + + Slow, + Fast, + Focus, + Burst, +} + + +/// Release sets [Card]s may belong to. +#[non_exhaustive] +#[derive(serde::Serialize, serde::Deserialize, Debug)] +enum CardSet { + #[serde(rename = "Set1")] + Foundations, + #[serde(rename = "Set2")] + RisingTides, + #[serde(rename = "Set3")] + CallOfTheMountain, + #[serde(rename = "Set4")] + EmpiresOfTheAscended, + #[serde(rename = "Set5")] + BeyondTheBandlewood, + #[serde(rename = "Set6")] + Worldwalker, +} diff --git a/src/main.rs b/src/main.rs index e7a11a9..afeeb3c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +mod data; + fn main() { println!("Hello, world!"); }