diff --git a/pokedex/data/csv/move_changelog.csv b/pokedex/data/csv/move_changelog.csv index 10301d3..3295924 100644 --- a/pokedex/data/csv/move_changelog.csv +++ b/pokedex/data/csv/move_changelog.csv @@ -1,12 +1,15 @@ move_id,changed_in_version_group_id,type_id,power,pp,accuracy,priority,target_id,effect_id,effect_chance 2,3,1,,,,,,, 13,5,,,,75,,,, +14,15,,,30,,,,, 16,3,1,,,,,,1, 17,3,,35,,,,,, 18,3,,,,85,,,, +18,15,,,,100,,,, 19,8,,70,,,,,, 20,11,,,,75,,,, 22,8,,,10,,,,, +22,15,,35,15,,,,, 26,8,,70,,,,,, 26,11,,85,25,,,,, 28,3,1,,,,,,, @@ -15,18 +18,29 @@ move_id,changed_in_version_group_id,type_id,power,pp,accuracy,priority,target_id 37,11,,90,20,,,,, 38,3,,100,,,,,49, 40,3,,,,,,,,20 +42,15,,14,,85,,,, 44,3,1,,,,,,,10 +46,15,,,,100,,,, 50,8,,,,55,,,, 50,11,,,,80,,,, +53,15,,95,,,,,, +56,15,,120,,,,,, +57,15,,95,,,,,, +58,15,,95,,,,,, 59,3,,,,90,,,, +59,15,,120,,,,,, +66,15,,,25,,,,, 67,5,,50,,90,,,32,30 71,8,,,20,,,,, 72,8,,,10,,,,, 74,11,,,,,,,14, +74,15,,,40,,,,, 80,8,,70,,,,,, 80,11,,90,20,,,,, 83,11,,15,,70,,,, +85,15,,95,,,,,, 87,3,,,,,,,,10 +87,15,,120,,,,,, 88,3,,,,65,,,, 91,3,,100,,,,,, 91,8,,60,,,,,, @@ -35,49 +49,118 @@ move_id,changed_in_version_group_id,type_id,power,pp,accuracy,priority,target_id 95,8,,,,60,,,, 95,9,,,,70,,,, 105,8,,,20,,,,, +107,15,,,20,,,,, +112,15,,,30,,,,, 120,3,,130,,,,,, +122,15,,20,,,,,, +123,15,,20,,,,,, 126,3,,,,,,,,30 +126,15,,120,,,,,, 128,11,,,10,75,,,, +130,15,,100,15,,,,, 136,8,,85,,,,,, 136,11,,100,20,,,,, 137,11,,,,75,,,, +137,15,,,,90,,,, 139,11,,,,55,,,, +139,15,,,,80,,,, 143,3,,,,,,,,10 +145,15,,20,,,,,, 146,3,,,,,,,1,0 148,8,,,,70,,,, +149,15,,,,80,,,, +151,15,,,40,,,,, 152,11,,,,85,,,, +152,15,,90,,,,,, 153,3,,170,,,,,, 157,3,,,,,,,1,0 161,3,,,,,,,1,0 +165,15,,,,,,10,, +168,15,,40,10,,,,, 170,11,,,40,,,,, +173,15,,40,,,,,, 174,11,10001,,,,,,, 178,11,,,,85,,,, +178,15,,,,,,10,, 184,11,,,,90,,,, +186,15,1,,,,,,, 192,8,,100,,,,,, +195,15,,,,,,12,, 198,11,,,,80,,,, 200,8,,90,,,,,, 200,11,,,15,,,,, 202,8,,,5,,,,, 202,11,,60,,,,,, +204,15,1,,,,,,, 210,11,,10,,,,,, +210,15,,20,,,,,, +215,15,,,,,,4,, +236,15,1,,,,,,, +237,15,,1,,,,,, 248,11,,80,15,90,,,, +248,15,,100,,,,,, 249,8,,20,,,,,, 250,11,,15,,70,,,, 251,11,,10,,,,,, 253,11,,50,,,,,, 254,8,,,10,,,,, +257,15,,100,,,,,, +261,15,,,,75,,,, +265,15,,60,,,,,, +266,15,,,,,3,,, +267,15,,,,,,1,, +282,15,,20,,,,,, 291,8,,60,,,,,, 294,11,,,,,,,54, +305,15,,,,,,,,30 +309,15,,100,,85,,,, +312,15,,,,,,4,, +314,15,,55,,,,,, +315,15,,140,,,,,, +317,15,,50,10,80,,,, +326,15,,,30,,,,, 328,11,,15,,70,,,, +330,15,,95,,,,,, 331,11,,10,,,,,, 333,11,,10,,,,,, 343,11,,40,,,,,, +343,15,,,40,,,,, 348,8,,70,,,,,, 350,11,,,,80,,,, 353,11,,120,,85,,,, +358,15,,60,,,,,, 364,11,,50,,,,,, +366,15,,,30,,,,, +372,15,,50,,,,,, +375,15,,,,90,,,, 382,11,,0,,,,,, 386,11,,60,,,,,, 387,11,,130,,,,,, +396,15,,90,,,,,, +403,15,,,20,,,,, +406,15,,90,,,,,, +408,15,,70,,,,,, 409,11,,60,5,,,,, +412,15,,80,,,,,, +434,15,,140,,,,,, +437,15,,140,,,,,, +441,15,,,,70,,,, +448,15,,60,,,,,, 463,11,,,,70,,,, +463,15,,120,,,,,, +472,15,,,,,-7,,, +476,15,,,,,3,,, +478,15,,,,,-7,,, +480,15,,40,,,,,, +485,15,,70,15,,,,, +490,15,,60,,,,,, +506,15,,50,,,,,, +510,15,,30,,,,,, +518,15,,50,,,,,, +519,15,,50,,,,,, +520,15,,50,,,,,, +522,15,,30,,,,,, +524,15,,40,,,,,, +533,15,,,20,,,,, +542,15,,120,,,,,, +546,15,,85,,,,,, diff --git a/scripts/update-move-changelogs.py b/scripts/update-move-changelogs.py new file mode 100644 index 0000000..356113e --- /dev/null +++ b/scripts/update-move-changelogs.py @@ -0,0 +1,58 @@ +from __future__ import print_function + +import csv +import sys + +fields = ['type_id', 'power', 'pp', 'accuracy', 'priority', 'target_id', 'effect_id', 'effect_chance'] + +def main(): + old = csv.DictReader(open(sys.argv[1], 'rb')) + new = csv.DictReader(open(sys.argv[2], 'rb')) + version_group_id = int(sys.argv[3]) + + moves = {} + + for row in new: + moves[row['id']] = row + + for row in old: + if row['id'] not in moves: + print("move %d disappeared!", file=sys.stderr) + continue + + oldmove = row + newmove = moves[row['id']] + + if int(oldmove['id']) > 10000: + print("skipping shadow moves", file=sys.stderr) + continue + + changed_fields = [] + for field in fields: + if oldmove[field] == newmove[field]: + continue + if field == 'power' and oldmove['power'] in "01": + if newmove['power'] == "": + # expected + # we used to store variable-power moves as 0 or 1, + # now we store NULL + continue + else: + print("%s: %s changed from %s to %s" % (oldmove['identifier'], field, oldmove[field], newmove[field]), file=sys.stderr) + if oldmove[field] == '': + print("%s: %s changed from NULL to %s" % (oldmove['identifier'], field, newmove[field]), file=sys.stderr) + continue + #print("%s: %s changed from %s to %s" % (oldmove['identifier'], field, oldmove[field], sql_list([newmove[field]]))) + changed_fields.append(field) + + if changed_fields: + print("INSERT INTO move_changelog (move_id, changed_in_version_group_id, %s) VALUES (%s, %s, %s); -- %s (%s)" % + (sql_list(changed_fields), row['id'], version_group_id, + sql_list(map(oldmove.__getitem__, changed_fields)), + oldmove['identifier'], + sql_list(map(newmove.__getitem__, changed_fields)))) + +def sql_list(values): + return ", ".join(x if x != "" else "NULL" for x in values) + +main()