Hyphen-ated / RebirthItemTracker

Uses the log.txt file to track item pickups in Binding of Isaac: Rebirth.
BSD 2-Clause "Simplified" License
121 stars 26 forks source link

So bad #137

Closed sillypears closed 6 years ago

sillypears commented 6 years ago

I guess we are lucky that these were the only ones.

beelzebub: 16 bob: 4 bookworm: 7 conjoined: 7 delay: 12 delay_x: 8 dmg: 33 dmg_x: 8 funguy: 7 guppy: 6 health: 30 health_only: 11 height: 26 in_summary: 41 introduced_in: 743 leviathan: 8 luck: 6 name: 745 ohcrap: 3 range: 29 seraphim: 9 shot_speed: 15 shown: 745 sin_hearts: 8 soul_hearts: 13 space: 119 speed: 28 spiderbaby: 6 spun: 7 summary_condition: 1 summary_name: 28 superbum: 3 tears: 22 text: 742 yesmother: 16

Also here's a quick test to make sure everything is serialized based on the changes that I made and what was already here. Will need to update if anything new gets added.

import json
import os
import pprint

valid_options = {
    "beelzebub",
    "bob",
    "bookworm",
    "conjoined",
    "delay",
    "delay_x",
    "dmg",
    "dmg_x",
    "funguy",
    "guppy",
    "health",
    "health_only",
    "height",
    "in_summary",
    "introduced_in",
    "leviathan",
    "luck",
    "name",
    "ohcrap",
    "range",
    "seraphim",
    "shot_speed",
    "shown",
    "sin_hearts",
    "soul_hearts",
    "space",
    "speed",
    "spiderbaby",
    "spun",
    "summary_condition",
    "summary_name",
    "superbum",
    "tears",
    "text",
    "yesmother"
}

data = json.load(open('items.json'))

items = {}

for item in data:
    for key in data[item]:
        if key in valid_options:
            if key in items:
                items[key] += 1
            else:
                items[key] = 1
        else:
            print "Found invalid item: ID# {}: {}".format(item, data[item])
Hyphen-ated commented 6 years ago

thanks. I put in this fix and added similar validation code at program startup.

I rebased your commits though because the commit messages are so bad