Not sure if anyone will use this, but whatever. Here's a method to retreive a user's data from RMRKMon in
JSON format.
JSON Encoder/Decoders for RMVXA exist, maybe someone would like to make a pokemon themed game for the next GIAW that lets RMRK users play with their own pokemon?
Download RMRKMon Images (including pokemon graphics etc) here.
[edit]
Dat documentation:
Pokemon Data DumpAttached to this post you'll find a .json dump of RMRKMon's pokemon info. This includes each pokemon's name, type (fire, steel etc), appearance chance rate, evolution from/to paths and version affinity. It also includes a description of the type array we use (1:Bug all the way to 18:Water), as well as the IDs, names and colours for our Versions (tyria/lisera).
This data is static so you should simply download it and reference it alongside your project. However, occasionally we may tweak chances and eventually we'll add newer generations of pokemon. If you care to be up to date after such changes, you can grab a fresh dump (
)
right here.
Notes On DataPokemon IDs / ShininessAs a collecting / trading minigame, RMRKMon stores pokemon in a trainer's profile literally as a list of pokemon IDs - comparable to a list of trading cards owned. Pokemon do not have unique entries and cannot have unique attributes assigned to them (as if they were real pokemon with levels, names, moves, genders, forms and so on). The only exception to this is shiny status. A shiny pokemon is represented by an additional decimal point. So for example, Pikachu is 25. Shiny pikachu is 25.3.
I would suggest creating a function in your script/app that simply uses floor, intval, round, or some other similar function and compares the result to the input to check if a pokemon is shiny or not. In PHP, RMRKMon's boolean is_shiny() function is this:
Data that may not existWhile all trainers are RMRK members, not every RMRK Member is a trainer. Members automatically get a trainer profile created for them upon their first encounter with a pokemon. A trainer profile is created also in the event that a pokemon is gifted to a user with no profile. Because of this, even if a trainer profile exists, you cannot be sure that it has any owned pokemon or pokedex entries.
Trainers always have a trainer picture set (by default, 1.gif), but favourite pokemon are optional. As are the additional favourite pokemon. A user is not forced to choose 5 extra favourites either, they may choose just one if they wish. However, a user cannot choose extra favourite pokemon until they have a main favourite pokemon.
InventoriesAssuming an active trainer, the trainer will have three similar but distinct inventories. First is
pokemon, which is simply the pokemon they own. Duplicates are allowed, as are shiny pokemon.
Next is
seen, which uniquely logs each pokemon encountered. Shiny pokemon are counted seperate to their normal variants, but no duplicates are allowed.
Dex is only made up of pokemon the user owns or has owned at some point. As in the games, the dex ignores shiny status. Capturing or receiving a shiny Mewtwo will place a 150 in a user's pokedex.
DiscrepanciesCapture and encounter events were not always logged, thus some trainers who were quite active at the start may have
total_encounters and
total_catches that are impossibly low compared to their current inventories. As time goes on this becomes less of an issue - especially with the introduction of trading (which increases neither tally).
Querying User DataIdentifying which user's data you want can can be done through two methods - either their RMRK account ID, or their username. The request parameter is different depending on each one.
A little note for JSON decoders that don't quite meet the spec (such as the RMVXA one by game_guy) - while JSON allows whitespace to make it human readable, some decoders don't account for this and only properly decode json if it's all on a single line. You can force such output from the RMRKMon API with a raw parameter. e.g. http://rmrk.net/pokemon/api.php?trainer=273;rawID Request:
trainer parameterhttp://rmrk.net/pokemon/api.php?trainer=273Name Request:
user parameterhttp://rmrk.net/pokemon/api.php?user=RophWhile it's more user friendly to ask a user for their name than give their ID, inside your game/application you should try to avoid making user requests. This is because usernames may change, or new users may exist with conflicting display names (the API selects the first match found). If your game or app is making a one off request then fine, but if you plan to pull updates in the future, save the
id from the response and then use it for subsequent
trainer requests.
Response StructureError ResponsesYou should check for the existence of an "error" key before proceeding. If an error is encountered, ONLY the error key is returned and no extra information is (or can be) output. The error key has 2 entries, [error][code] (Integer) and [error][description] (String).
1: Missing Parameters, e.g. you made no request or your misspelled one.
2: Trainer Does Not Exist. All trainers are RMRK Members, but not all RMRK Members are trainers.
3: Email Lookup Forbidden. Usernames only are allowed for user requests.
Normal Responseresponse_time (Integer) | Always Set
UNIX Timestamp of when this response was generated. Use it for caching, or to make sure your data is within a certain age boundry.
name (String) | Always Set
Their RMRK Username
id (Integer) | Always Set
Their RMRK Account ID
gender (String) | Always Set, Default: null
Their RMRK Account's gender setting. Male/Female/null
member_since (Integer) | Always Set
UNIX Timestamp of their RMRK registration
trainer_since (Integer) | Always Set
UNIX Timestamp of their first sighting (and thus when they became a trainer)
last_login (Integer) | Always Set
UNIX Timestamp of when they were last active on either RMRKMon or RMRK (whichever is most recent)
last_caught (Integer) | Always Set, Default: 0
UNIX Timestamp of last pokemon capture receival of a gift
is_online (Boolean) | Always Set
Online status, duh
page (String) | Always Set
URL of their RMRKMon trainer page, eg
http://rmrk.net/pokemon/?trainer=273profile (String) | Always Set
The URL of their RMRK profile, eg
http://rmrk.net/index.php?action=profile;u=273picture (Array) | Always Set
Images related to this user
id (Integer) | Always Set, Default: 1
The number of which trainer pic they are using
href (String) | Always Set
URL to said trainer picture (though you should display a local copy)
avatar_href (String) | Always Set, Default: (RMRK's "no avatar" image)
URL to their forum avatar. Typically 105x150, though may be smaller or in some cases
larger.
fave (Numeric) | Optional
The ID of their favourite pokemon, if any.
extrafave (Numeric Array) | Optional
An array of up to 5 extra favourite pokemon. Again optional, though a user cannot choose extra faves without first having a main fave.
total_trades (Integer) | Always Set, Default: 0
A tally of the trainer's completed trades
total_encounters (Integer) | Always Set, Default: 0
A tally of the trainer's encounters on the forum.
total_catches (Integer) | Always Set, Default: 0
A tally of the trainer's successful catch events.
total_pokemon (Integer) | Always Set, Default: 0
A tally of the trainer's pokemon inventory
badges (Incremental Array) | Always Set, Default: Empty Array
Contains as many sub-arrays as the user has badges, each having 2 entries. [0] being the badge's "ID" (aka its filename without the .png),[1] being its description.
total_seen (Integer) | Always Set, Default: 0
The number of unique pokemon the trainer has seen. For instance, seeing a blastoise for the first time and then seeing 5 more blastoises would still only increase this by 1.
total_dex (Integer) | Always Set, Default: 0
How many pokedex entries this trainer has.
pokemon (Array) | Optional
The user's current pokemon inventory
string (String) | Always Set
A comma separated string of their inventory.
raw (Numeric Array) | Always Set
An array of their inventory by ID
named (Associative Array) | Always Set
An ID => Name array of their inventory. For example, [pokemon][named][25.3] = Pikachu (Shiny).
seen (Array) | Optional
Pokemon this user has seen
string (String) | Always Set
A comma separated string of their sighted pokemon.
raw (Numeric Array) | Always Set
An array of their sighted pokemon by ID
named (Associative Array) | Always Set
An ID => Name array of their sighted pokemon. For example, [seen][named][9] = Blastoise.
dex (Array) | Optional
Pokedex entries for this trainer.
string (String) | Always Set
A comma separated string of their dex.
raw (Numeric Array) | Always Set
An array of their dex by ID.
named (Associative Array) | Always Set
An ID => Name array of their dex pokemon. For example, [dex][named][151] = Mew.
percentage (Numeric) | Optional
Their pokedex completion against all pokemon in RMRKMon as a percentage, represented to 2 decimal places. e.g. 29.41
Response Structure Notes[dex][percentage] is calculated based on
all pokemon that
exist in RMRKMon, even those that are disabled. So as of this writing, pokedex percentages are based on 720 pokemon in total, even though gens 5 and 6 (#494 and beyond) are disabled.
the
[named] parts of the [pokemon], [dex] and [seen] arrays, by being associative, cannot represent duplicate pokemon. This is only an issue with [pokemon][named], as a trainer's seen/dex entries forbid duplicates. If a user owns 10 charizards, only one is in this array as charizard's key ([6]) is in use. Thus, don't iterate or foreach( key=>value ) through the [pokemon][named] array thinking you will be showing their full inventory. Use it for reference.