added item support and team registration #4
@@ -2,6 +2,7 @@
|
||||
all(not(debug_assertions), target_os = "windows"),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
use serde_json::json;
|
||||
@@ -241,7 +242,7 @@ fn search(index: i64) -> SearchResult {
|
||||
name: row.read::<&str, _>("name").to_string(),
|
||||
types: serde_json::from_str(row.read::<&str, _>("types")).unwrap_or(vec![0]),
|
||||
thumbnail: row.read::<&str, _>("thumbnail").to_string(),
|
||||
abilities: row.read::<&str, _>("abilities").to_string(),
|
||||
abilities: serde_json::from_str(row.read::<&str, _>("abilities")).unwrap_or(HashMap::new()),
|
||||
hp: row.read::<i64, _>("hp"),
|
||||
attack: row.read::<i64, _>("attack"),
|
||||
defense: row.read::<i64, _>("defense"),
|
||||
@@ -257,7 +258,7 @@ fn search(index: i64) -> SearchResult {
|
||||
name: "Missigno".to_string(),
|
||||
types: vec![],
|
||||
thumbnail: "".to_string(),
|
||||
abilities: "{}".to_string(),
|
||||
abilities: HashMap::new(),
|
||||
hp: 0,
|
||||
attack: 0,
|
||||
defense: 0,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
@@ -11,7 +13,7 @@ pub struct SearchResult {
|
||||
pub special_attack: i64,
|
||||
pub special_defense: i64,
|
||||
pub speed: i64,
|
||||
pub abilities: String,
|
||||
pub abilities: HashMap<String, String>,
|
||||
pub thumbnail: String,
|
||||
pub learnset: Vec<PokemonDataLearnset>,
|
||||
}
|
||||
@@ -82,7 +84,7 @@ pub struct PokemonDataToLoad {
|
||||
pub name: String,
|
||||
pub types: Vec<i64>,
|
||||
pub thumbnail: String,
|
||||
pub abilities: String,
|
||||
pub abilities: HashMap<String, String>,
|
||||
pub hp: i64,
|
||||
pub attack: i64,
|
||||
pub defense: i64,
|
||||
|
||||
@@ -135,8 +135,8 @@
|
||||
} else if (!pokemonData.speed_plus && !!pokemonData.speed_minus) {
|
||||
spd_p = 0.9;
|
||||
}
|
||||
abilities = Object.keys(JSON.parse(pokemonData.abilities));
|
||||
abilities_description = Object.values(JSON.parse(pokemonData.abilities));
|
||||
abilities = Object.keys(pokemonData.abilities);
|
||||
abilities_description = Object.values(pokemonData.abilities);
|
||||
hp_final = calculate_hp(
|
||||
pokemonData.hp,
|
||||
pokemonData.hp_v,
|
||||
|
||||
@@ -3,7 +3,7 @@ export interface PokemonDBData {
|
||||
name: string;
|
||||
types: number[];
|
||||
thumbnail: string;
|
||||
abilities: string;
|
||||
abilities: Record<string, string>;
|
||||
hp: number;
|
||||
attack: number;
|
||||
defense: number;
|
||||
@@ -17,7 +17,7 @@ export interface PokemonData {
|
||||
name: string;
|
||||
types: number[];
|
||||
thumbnail: string;
|
||||
abilities: string;
|
||||
abilities: Record<string, string>;
|
||||
hp: number;
|
||||
attack: number;
|
||||
defense: number;
|
||||
|
||||
Reference in New Issue
Block a user