about summary refs log tree commit diff stats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/deserialize.c67
1 files changed, 67 insertions, 0 deletions
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)
211 pki->unownLetter); 211 pki->unownLetter);
212 } 212 }
213 213
214 cJSON_AddNumberToObject(jPoke, "coolRibbons", pki->coolRibbons);
215 cJSON_AddNumberToObject(jPoke, "beautyRibbons", pki->beautyRibbons);
216 cJSON_AddNumberToObject(jPoke, "cuteRibbons", pki->cuteRibbons);
217 cJSON_AddNumberToObject(jPoke, "smartRibbons", pki->smartRibbons);
218 cJSON_AddNumberToObject(jPoke, "toughRibbons", pki->toughRibbons);
219
220 u16 miscRibbons = __builtin_bswap16(pki->miscRibbons);
221 if (miscRibbons & CHAMPION_RIBBON)
222 {
223 cJSON_AddBoolToObject(jPoke, "championRibbon", true);
224 }
225
226 if (miscRibbons & WINNING_RIBBON)
227 {
228 cJSON_AddBoolToObject(jPoke, "winningRibbon", true);
229 }
230
231 if (miscRibbons & VICTORY_RIBBON)
232 {
233 cJSON_AddBoolToObject(jPoke, "victoryRibbon", true);
234 }
235
236 if (miscRibbons & ARTIST_RIBBON)
237 {
238 cJSON_AddBoolToObject(jPoke, "artistRibbon", true);
239 }
240
241 if (miscRibbons & EFFORT_RIBBON)
242 {
243 cJSON_AddBoolToObject(jPoke, "effortRibbon", true);
244 }
245
246 if (miscRibbons & MARINE_RIBBON)
247 {
248 cJSON_AddBoolToObject(jPoke, "marineRibbon", true);
249 }
250
251 if (miscRibbons & LAND_RIBBON)
252 {
253 cJSON_AddBoolToObject(jPoke, "landRibbon", true);
254 }
255
256 if (miscRibbons & SKY_RIBBON)
257 {
258 cJSON_AddBoolToObject(jPoke, "skyRibbon", true);
259 }
260
261 if (miscRibbons & COUNTRY_RIBBON)
262 {
263 cJSON_AddBoolToObject(jPoke, "countryRibbon", true);
264 }
265
266 if (miscRibbons & NATIONAL_RIBBON)
267 {
268 cJSON_AddBoolToObject(jPoke, "nationalRibbon", true);
269 }
270
271 if (miscRibbons & EARTH_RIBBON)
272 {
273 cJSON_AddBoolToObject(jPoke, "earthRibbon", true);
274 }
275
276 if (miscRibbons & WORLD_RIBBON)
277 {
278 cJSON_AddBoolToObject(jPoke, "worldRibbon", true);
279 }
280
214 return jPoke; 281 return jPoke;
215} 282}