-
-
Save PauloDuarte43/536f53c0bb449adddf77d1a9503741bb to your computer and use it in GitHub Desktop.
Script to export all moves from POGO GAME_MASTER
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script to export all moves from POGO GAME_MASTER | |
# Shout out to pekingduck on github https://github.com/pekingduck - This script will run off the file provided by pekingduck found here: https://github.com/pekingduck/pogo-game-master/blob/master/current.json | |
# Written with ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16] | |
# ran on MacOS 10.12.5 | |
# | |
# run script from directory using `ruby pogo_moves.rb` | |
require "open-uri" | |
require "json" | |
require "csv" | |
# read current GAME_MASTER | |
url = "https://raw.githubusercontent.com/pekingduck/pogo-game-master/master/current.json" | |
gm = JSON.parse(open(url).read) # GAME_MASTER as json data | |
headers = ["Name", "Pokemon Type", "Move Type", "Power"] | |
moves = [] | |
gm["item_templates"].each do |template| | |
move_settings = template["move_settings"] | |
if move_settings | |
move_name = template["template_id"].split("_MOVE_")[1] # whatever is after VXXXX_MOVE_ should be the move name | |
name = move_name.gsub("_FAST", "") | |
pokemon_type = move_settings["pokemon_type"].split("POKEMON_TYPE_")[1] # get value without POKEMON_TYPE_ prefix | |
move_type = move_name.include?("_FAST") ? "FAST" : "CHARGE" # fast moves include _FAST while charge moves have no suffix | |
moves << [name, pokemon_type, move_type, move_settings["power"]] | |
end | |
end | |
moves.sort_by!{ |move| move[0]} | |
CSV.open("pogo_moves.csv", "wb", {write_headers: true, headers: headers}) do |csv| | |
moves.each do |move| | |
csv << move | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment