From 62be650076d6ea83e9822be56eaa59ab4195202c Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Fri, 29 Sep 2017 18:39:52 -0400 Subject: Extractor now gets ribbons --- source/deserialize.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'source/deserialize.c') diff --git a/source/deserialize.c b/source/deserialize.c index da2d919..b37cb72 100644 --- a/source/deserialize.c +++ b/source/deserialize.c @@ -211,5 +211,72 @@ cJSON* pokemonToJson(const struct PokemonIntermediate* pki) pki->unownLetter); } + cJSON_AddNumberToObject(jPoke, "coolRibbons", pki->coolRibbons); + cJSON_AddNumberToObject(jPoke, "beautyRibbons", pki->beautyRibbons); + cJSON_AddNumberToObject(jPoke, "cuteRibbons", pki->cuteRibbons); + cJSON_AddNumberToObject(jPoke, "smartRibbons", pki->smartRibbons); + cJSON_AddNumberToObject(jPoke, "toughRibbons", pki->toughRibbons); + + u16 miscRibbons = __builtin_bswap16(pki->miscRibbons); + if (miscRibbons & CHAMPION_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "championRibbon", true); + } + + if (miscRibbons & WINNING_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "winningRibbon", true); + } + + if (miscRibbons & VICTORY_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "victoryRibbon", true); + } + + if (miscRibbons & ARTIST_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "artistRibbon", true); + } + + if (miscRibbons & EFFORT_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "effortRibbon", true); + } + + if (miscRibbons & MARINE_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "marineRibbon", true); + } + + if (miscRibbons & LAND_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "landRibbon", true); + } + + if (miscRibbons & SKY_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "skyRibbon", true); + } + + if (miscRibbons & COUNTRY_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "countryRibbon", true); + } + + if (miscRibbons & NATIONAL_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "nationalRibbon", true); + } + + if (miscRibbons & EARTH_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "earthRibbon", true); + } + + if (miscRibbons & WORLD_RIBBON) + { + cJSON_AddBoolToObject(jPoke, "worldRibbon", true); + } + return jPoke; } -- cgit 1.4.1