mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- Removed Klaas, Elf Friend; Tortuga; Test Destroy
- Added cardsScript.py a python script to synchronize cards.txt with appropriate pictures and rarity entries. Directions for Python are inside the script - Updated about 30 different pictures/rarities that the script found and added to the different files to the BOTTOM of each file. (Note: I eyeballed the results and they looked good. If someone can double check them that'd be great.)
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -14,6 +14,7 @@ res/booster-decks -text svneol=unset#unset
|
||||
res/card-pictures-token.txt -text svneol=native#text/plain
|
||||
res/card-pictures.txt -text svneol=native#text/plain
|
||||
res/cards.txt -text svneol=native#text/plain
|
||||
res/cardsScript.py -text svneol=native#text/x-python
|
||||
res/common.txt -text svneol=native#text/plain
|
||||
res/draft/common.txt -text svneol=native#text/plain
|
||||
res/draft/draft.properties -text svneol=native#text/plain
|
||||
|
||||
@@ -3744,3 +3744,35 @@ zodiac_snake.jpg http://resources.wizards.com/magic/cards/pk/en-us/card10608.jp
|
||||
zodiac_tiger.jpg http://resources.wizards.com/magic/cards/pk/en-us/card10594.jpg
|
||||
zombify.jpg http://resources.wizards.com/magic/cards/9ed/en-us/card83342.jpg
|
||||
zur_the_enchanter.jpg http://www.wizards.com/global/images/magic/general/zur_the_enchanter.jpg
|
||||
spitting_sliver.jpg http://www.wizards.com/global/images/magic/general/spitting_sliver.jpg
|
||||
righteous_war.jpg http://www.wizards.com/global/images/magic/general/righteous_war.jpg
|
||||
rhox_pikemaster.jpg http://www.wizards.com/global/images/magic/general/rhox_pikemaster.jpg
|
||||
aysen_highway.jpg http://www.wizards.com/global/images/magic/general/aysen_highway.jpg
|
||||
akromas_devoted.jpg http://www.wizards.com/global/images/magic/general/akromas_devoted.jpg
|
||||
urborg_shambler.jpg http://www.wizards.com/global/images/magic/general/urborg_shambler.jpg
|
||||
stronghold_taskmaster.jpg http://www.wizards.com/global/images/magic/general/stronghold_taskmaster.jpg
|
||||
dread_of_night.jpg http://www.wizards.com/global/images/magic/general/dread_of_night.jpg
|
||||
blessed_orator.jpg http://www.wizards.com/global/images/magic/general/blessed_orator.jpg
|
||||
sigil_of_the_new_dawn.jpg http://www.wizards.com/global/images/magic/general/sigil_of_the_new_dawn.jpg
|
||||
yomiji_who_bars_the_way.jpg http://www.wizards.com/global/images/magic/general/yomiji_who_bars_the_way.jpg
|
||||
subversion.jpg http://www.wizards.com/global/images/magic/general/subversion.jpg
|
||||
deathmask_nezumi.jpg http://www.wizards.com/global/images/magic/general/deathmask_nezumi.jpg
|
||||
zodiac_dragon.jpg http://www.wizards.com/global/images/magic/general/zodiac_dragon.jpg
|
||||
rushwood_elemental.jpg http://www.wizards.com/global/images/magic/general/rushwood_elemental.jpg
|
||||
rumbling_slum.jpg http://www.wizards.com/global/images/magic/general/rumbling_slum.jpg
|
||||
kyren_sniper.jpg http://www.wizards.com/global/images/magic/general/kyren_sniper.jpg
|
||||
onslaught.jpg http://www.wizards.com/global/images/magic/general/onslaught.jpg
|
||||
soultether_golem.jpg http://www.wizards.com/global/images/magic/general/soultether_golem.jpg
|
||||
recumbent_bliss.jpg http://www.wizards.com/global/images/magic/general/recumbent_bliss.jpg
|
||||
harrier_griffin.jpg http://www.wizards.com/global/images/magic/general/harrier_griffin.jpg
|
||||
goblin_war_wagon.jpg http://www.wizards.com/global/images/magic/general/goblin_war_wagon.jpg
|
||||
piranha_marsh.jpg http://www.wizards.com/global/images/magic/general/piranha_marsh.jpg
|
||||
kitsune_dawnblade.jpg http://www.wizards.com/global/images/magic/general/kitsune_dawnblade.jpg
|
||||
somnomancer.jpg http://www.wizards.com/global/images/magic/general/somnomancer.jpg
|
||||
long_forgotten_gohei.jpg http://www.wizards.com/global/images/magic/general/long_forgotten_gohei.jpg
|
||||
roughshod_mentor.jpg http://www.wizards.com/global/images/magic/general/roughshod_mentor.jpg
|
||||
primal_rage.jpg http://www.wizards.com/global/images/magic/general/primal_rage.jpg
|
||||
hidden_path.jpg http://www.wizards.com/global/images/magic/general/hidden_path.jpg
|
||||
lumbering_satyr.jpg http://www.wizards.com/global/images/magic/general/lumbering_satyr.jpg
|
||||
spinneret_sliver.jpg http://www.wizards.com/global/images/magic/general/spinneret_sliver.jpg
|
||||
territorial_baloth.jpg http://www.wizards.com/global/images/magic/general/territorial_baloth.jpg
|
||||
|
||||
@@ -21661,11 +21661,6 @@ no text
|
||||
2/2
|
||||
Flying
|
||||
|
||||
Klaas, Elf Friend
|
||||
3 G G
|
||||
Enchantment
|
||||
At the beginning of your upkeep, if you control 10 or more Elves, you win the game.
|
||||
|
||||
Treetop Village
|
||||
no cost
|
||||
Land
|
||||
@@ -22085,13 +22080,6 @@ Boil
|
||||
Instant
|
||||
Destroy all Islands.
|
||||
|
||||
Tortuga
|
||||
no cost
|
||||
Land MTG Cast Promo
|
||||
no text
|
||||
tap: add 1
|
||||
tap: Discard a card, then draw a card.
|
||||
|
||||
Dryad Arbor
|
||||
no cost
|
||||
Land Creature Forest Dryad
|
||||
@@ -23992,11 +23980,6 @@ no text
|
||||
tap: add B
|
||||
tap: add G
|
||||
|
||||
Test Destroy
|
||||
1
|
||||
Instant
|
||||
Destroy target permanent.
|
||||
|
||||
Royal Assassin
|
||||
1 B B
|
||||
Creature Human Assassin
|
||||
|
||||
137
res/cardsScript.py
Normal file
137
res/cardsScript.py
Normal file
@@ -0,0 +1,137 @@
|
||||
# This script parses through cards.txt and makes sure there are matching entries in card-pictures.txt and the different rarity files
|
||||
# It appends any new entries to the bottom of the current lists. I(Sol) can fix this later
|
||||
# Check for errors in cardsScript.log
|
||||
|
||||
# To Install Python check out: http://www.python.org/download/ The latest Python 2 should do the trick (2.7 as of July 27, 2010)
|
||||
# Once installed, just run the script from the location. Double Click on PC. Or run through a command prompt.
|
||||
|
||||
|
||||
from httplib import HTTP
|
||||
from urlparse import urlparse
|
||||
from urllib import urlopen
|
||||
|
||||
def clean(name):
|
||||
return name.lower().replace('-',' ').replace(',','').replace('_', ' ').replace('\'', '').replace('\"', '').replace('.', '').strip()
|
||||
|
||||
def getRarity(fileName, cardDict, quest):
|
||||
file = open(fileName)
|
||||
line = clean(file.readline())
|
||||
while line != '':
|
||||
if cardDict.has_key(line):
|
||||
if quest:
|
||||
cardDict[line].qRarity = True
|
||||
else:
|
||||
cardDict[line].rarity = True
|
||||
line = clean(file.readline())
|
||||
file.close()
|
||||
|
||||
def writeRarity(fileName, card):
|
||||
if card.rarity == False:
|
||||
rarity = open(fileName, 'a')
|
||||
rarity.write(card.name+'\n')
|
||||
rarity.close()
|
||||
if card.qRarity == False:
|
||||
rarity = open("quest/"+fileName, 'a')
|
||||
rarity.write(card.name+'\n')
|
||||
rarity.close()
|
||||
|
||||
def checkURL(url):
|
||||
p = urlparse(url)
|
||||
h = HTTP(p[1])
|
||||
h.putrequest('HEAD', p[2])
|
||||
h.endheaders()
|
||||
if h.getreply()[0] == 200: return 1
|
||||
else: return 0
|
||||
|
||||
def getURL(url):
|
||||
return urlopen(url).read()
|
||||
|
||||
|
||||
class Card:
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.cleanName = clean(name)
|
||||
self.picture = False
|
||||
self.rarity = False
|
||||
self.qRarity = False
|
||||
self.picURL = ''
|
||||
|
||||
|
||||
#get master card list and drop into a dictionary
|
||||
file = open('cards.txt')
|
||||
line = file.readline().strip()
|
||||
cardDict = {}
|
||||
|
||||
while line != 'End':
|
||||
temp = Card(line)
|
||||
cardDict[temp.cleanName] = temp
|
||||
skip = file.readline()
|
||||
while skip.strip() != '':
|
||||
skip = file.readline()
|
||||
line = file.readline().strip()
|
||||
|
||||
file.close()
|
||||
|
||||
#compare entires to card pictures
|
||||
file = open('card-pictures.txt')
|
||||
|
||||
line = file.readline()
|
||||
while line != '':
|
||||
start = line.find('.jpg')
|
||||
picName = clean(line[0:start])
|
||||
if cardDict.has_key(picName):
|
||||
cardDict[picName].picture = True
|
||||
line = file.readline()
|
||||
|
||||
file.close()
|
||||
|
||||
#compre to rarity fies
|
||||
getRarity('common.txt', cardDict, False)
|
||||
getRarity('uncommon.txt', cardDict, False)
|
||||
getRarity('rare.txt', cardDict, False)
|
||||
getRarity('quest/common.txt', cardDict, True)
|
||||
getRarity('quest/uncommon.txt', cardDict, True)
|
||||
getRarity('quest/rare.txt', cardDict, True)
|
||||
|
||||
#output
|
||||
picFile = open('card-pictures.txt', 'a')
|
||||
errFile = open('cardsScript.log', 'w')
|
||||
|
||||
cards = cardDict.values()
|
||||
cards.sort()
|
||||
|
||||
for i in range(len(cards)):
|
||||
c = cards[i]
|
||||
# skip basic land
|
||||
if (c.name == "Swamp" or c.name == "Forest" or c.name == "Plains" or c.name == "Mountain" or c.name == "Island" or c.name == "Snow-Covered Swamp" or c.name == "Snow-Covered Forest" or c.name == "Snow-Covered Plains" or c.name == "Snow-Covered Mountain" or c.name == "Snow-Covered Island"):
|
||||
continue;
|
||||
|
||||
if c.picture == False:
|
||||
urlName = c.cleanName.replace(' ', '_')
|
||||
picUrl ='http://www.wizards.com/global/images/magic/general/' + urlName + '.jpg'
|
||||
if checkURL(picUrl):
|
||||
c.picURL = picUrl
|
||||
picFile.write(urlName + '.jpg\t\t' + c.picURL + '\n')
|
||||
else:
|
||||
errFile.write("Bad Picture URL " + c.name + '\n')
|
||||
# generally for portal cards, where the primary URL doesn't work
|
||||
|
||||
if c.rarity == False or c.qRarity == False:
|
||||
html = getURL('http://magiccards.info/query?q=!'+c.name)
|
||||
# magiccards.info uses (<rarity>) on the page for rarity.
|
||||
# since older editions had funky things like c2, and u1, only use open parenthesis for this search
|
||||
commonCount = html.count("(Common")
|
||||
uncommonCount = html.count("(Uncommon")
|
||||
rareCount = html.count("(Rare") + html.count("(Mythic Rare)")
|
||||
if (commonCount == 0 and uncommonCount == 0 and rareCount == 0):
|
||||
errFile.write("Bad magiccards.info Query: " + c.name + '\n')
|
||||
elif (commonCount >= uncommonCount and commonCount >= rareCount):
|
||||
writeRarity("common.txt", c)
|
||||
elif (commonCount < uncommonCount and uncommonCount >= rareCount):
|
||||
writeRarity("uncommon.txt", c)
|
||||
else:
|
||||
writeRarity("rare.txt", c)
|
||||
|
||||
|
||||
picFile.close()
|
||||
errFile.close()
|
||||
@@ -1684,3 +1684,15 @@ Zombie Goliath
|
||||
Zombie Outlander
|
||||
Zulaport Enforcer
|
||||
Zuran Spellcaster
|
||||
Spitting Sliver
|
||||
Deathmask Nezumi
|
||||
Kyren Sniper
|
||||
Onslaught
|
||||
Recumbent Bliss
|
||||
Goblin War Wagon
|
||||
Piranha Marsh
|
||||
Kitsune Dawnblade
|
||||
Somnomancer
|
||||
Spinneret Sliver
|
||||
Keldon Marauders
|
||||
Furious Assault
|
||||
|
||||
@@ -1684,3 +1684,15 @@ Zombie Goliath
|
||||
Zombie Outlander
|
||||
Zulaport Enforcer
|
||||
Zuran Spellcaster
|
||||
Spitting Sliver
|
||||
Deathmask Nezumi
|
||||
Kyren Sniper
|
||||
Onslaught
|
||||
Recumbent Bliss
|
||||
Goblin War Wagon
|
||||
Piranha Marsh
|
||||
Kitsune Dawnblade
|
||||
Somnomancer
|
||||
Spinneret Sliver
|
||||
Keldon Marauders
|
||||
Furious Assault
|
||||
|
||||
@@ -975,3 +975,16 @@ Zhou Yu, Chief Commander
|
||||
Zuberi, Golden Feather
|
||||
Zuo Ci, the Mocking Sage
|
||||
Zur the Enchanter
|
||||
Righteous War
|
||||
Sigil of the New Dawn
|
||||
Yomiji, Who Bars the Way
|
||||
Subversion
|
||||
Zodiac Dragon
|
||||
Rushwood Elemental
|
||||
Rumbling Slum
|
||||
Long-Forgotten Gohei
|
||||
Sunrise Sovereign
|
||||
Rage Reflection
|
||||
Boartusk Liege
|
||||
Aysen Highway
|
||||
Hidden Path
|
||||
|
||||
@@ -1027,3 +1027,18 @@ Zodiac Pig
|
||||
Zodiac Tiger
|
||||
Zombify
|
||||
Zuran Orb
|
||||
Rhox Pikemaster
|
||||
Akroma's Devoted
|
||||
Urborg Shambler
|
||||
Stronghold Taskmaster
|
||||
Dread of Night
|
||||
Blessed Orator
|
||||
Soultether Golem
|
||||
Harrier Griffin
|
||||
Roughshod Mentor
|
||||
Primal Rage
|
||||
Lumbering Satyr
|
||||
Keldon Champion
|
||||
Bloodmark Mentor
|
||||
Kobold Drill Sergeant
|
||||
Kobold Taskmaster
|
||||
|
||||
13
res/rare.txt
13
res/rare.txt
@@ -975,3 +975,16 @@ Zhou Yu, Chief Commander
|
||||
Zuberi, Golden Feather
|
||||
Zuo Ci, the Mocking Sage
|
||||
Zur the Enchanter
|
||||
Righteous War
|
||||
Sigil of the New Dawn
|
||||
Yomiji, Who Bars the Way
|
||||
Subversion
|
||||
Zodiac Dragon
|
||||
Rushwood Elemental
|
||||
Rumbling Slum
|
||||
Long-Forgotten Gohei
|
||||
Sunrise Sovereign
|
||||
Rage Reflection
|
||||
Boartusk Liege
|
||||
Aysen Highway
|
||||
Hidden Path
|
||||
|
||||
@@ -1027,3 +1027,18 @@ Zodiac Pig
|
||||
Zodiac Tiger
|
||||
Zombify
|
||||
Zuran Orb
|
||||
Rhox Pikemaster
|
||||
Akroma's Devoted
|
||||
Urborg Shambler
|
||||
Stronghold Taskmaster
|
||||
Dread of Night
|
||||
Blessed Orator
|
||||
Soultether Golem
|
||||
Harrier Griffin
|
||||
Roughshod Mentor
|
||||
Primal Rage
|
||||
Lumbering Satyr
|
||||
Keldon Champion
|
||||
Bloodmark Mentor
|
||||
Kobold Drill Sergeant
|
||||
Kobold Taskmaster
|
||||
|
||||
Reference in New Issue
Block a user