diff options
| author | Dennis Brentjes <d.brentjes@gmail.com> | 2015-09-10 23:01:37 +0200 |
|---|---|---|
| committer | Dennis Brentjes <d.brentjes@gmail.com> | 2015-09-10 23:05:09 +0200 |
| commit | 90a1fb391c29c1165baab5021a167d42e841534a (patch) | |
| tree | bd3512a16ca1cd829f0468e32dea1f837b6f3a67 | |
| download | hearthstone-90a1fb391c29c1165baab5021a167d42e841534a.tar.gz hearthstone-90a1fb391c29c1165baab5021a167d42e841534a.tar.bz2 hearthstone-90a1fb391c29c1165baab5021a167d42e841534a.zip | |
initial commit.
| -rw-r--r-- | .gitignore | 6 | ||||
| -rwxr-xr-x | check.pl | 22 | ||||
| -rw-r--r-- | data | 517 | ||||
| -rwxr-xr-x | deckcomposer.pl | 116 | ||||
| -rw-r--r-- | decks/koray/koray.hs | 21 | ||||
| -rw-r--r-- | decks/mage-starter/mage-starter.hs | 19 | ||||
| -rw-r--r-- | decks/testdeck/deck1.hs | 6 | ||||
| -rwxr-xr-x | getresources.pl | 166 |
8 files changed, 873 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe574ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +auxilary +decks +html +images +sounds + diff --git a/check.pl b/check.pl new file mode 100755 index 0000000..02fa8fb --- /dev/null +++ b/check.pl @@ -0,0 +1,22 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +my $file = 'data'; +open my $info, $file or die "Could not open $file: $!"; + +my @list; + +while( my $line = <$info>) { + chomp $line; + if(! -e "images/$line.png") { + print "Found missing: $line\n"; + } + if ($line ~~ @list) + { + print "Found duplicate: $line\n" + } + push(@list, $line) +} + +close $info; @@ -0,0 +1,517 @@ +Garrosh Hellscream +Mind Control +Prophet Velen +Mana Addict +Barrel +Inner Rage +Bane of Doom +Kor'kron Elite +Thoughtsteal +Rexxar +Al'Akir the Windlord +Silvermoon Guardian +Cenarius +Pint-Sized Summoner +Frostwolf Grunt +Tauren Warrior +Voidwalker +Windfury +Emboldener 3000 +Whelp +Mechanical Dragonling +Summon a Panther +Spiteful Smith +Cat Form +Swipe +Silverback Patriarch +Stranglethorn Tiger +Silver Hand Knight +Blessing of Might +Brawl +Imp +Polymorph +Starfall +Chillwind Yeti +Nourish +Bear Form +Huffer +Defender +Counterspell +Voodoo Doctor +Ravenholdt Assassin +Wrath +Doomsayer +Redemption +Hunter's Mark +Mindgames +Poultryizer +Shadowflame +Ancestral Healing +Mark of Nature +Lord of the Arena +Secretkeeper +Sacrificial Pact +Ice Lance +Dalaran Mage +Windspeaker +Wisp +Backstab +Uproot +Ancient Brewmaster +Fire Elemental +Murloc Raider +Ice Block +Mirror Entity +Vanish +Defias Ringleader +Snake +Ironbark Protector +Ancient Secrets +Sea Giant +Mark of the Wild +Bloodfen Raptor +Nightmare +Shadow Madness +Leokk +Homing Chicken +Steady Shot +Repentance +Naturalize +Auchenai Soulpriest +Feral Spirit +Rockbiter Weapon +Abusive Sergeant +Hammer of Wrath +Loot Hoarder +Wrath +Innervate +Razorfen Hunter +Chicken +Cold Blood +Cabal Shadow Priest +Malfurion Stormrage +Holy Smite +Argent Commander +Betrayal +Novice Engineer +Cruel Taskmaster +Vaporize +Kidnapper +Wolfrider +Ironbeak Owl +Holy Light +Multi-Shot +Kill Command +Boar +Forked Lightning +Life Tap +Ysera Awakens +Arcanite Reaper +Edwin VanCleef +Gnomish Inventor +Gladiator's Longbow +Ancient Teachings +Fireball +Bananas +Baine Bloodhoof +Dispel +Nourish +Repair Bot +Devilsaur +Baron Geddon +Grommash Hellscream +Ironforge Rifleman +Laughing Sister +Charge +Assassinate +Dark Iron Dwarf +Master Swordsmith +Doomhammer +Treant +Onyxia +Shan'do's Lesson +Shadowstep +Spellbender +Ragnaros the Firelord +Inner Fire +Violet Apprentice +Soul of the Forest +Light's Justice +Elven Archer +Perdition's Blade +Explosive Shot +Water Elemental +Flesheating Ghoul +Battle Rage +Fiery War Axe +Ancestral Spirit +Mana Wyrm +Nozdormu +Stormpike Commando +Youthful Brewmaster +Cairne Bloodhoof +Assassin's Blade +Priestess of Elune +Cone of Cold +Holy Wrath +Malygos +Animal Companion +Abomination +Hungry Crab +Reckless Rocketeer +Arcane Explosion +Nourish +Coldlight Seer +Snake Trap +Captain Greenskin +Blizzard +Wrath of Air Totem +Deadly Poison +Gnoll +Sap +Eye for an Eye +Arcane Golem +Moonfire +Mark of Nature +Blood Imp +Damaged Golem +Reinforce +Murloc Tidecaller +Consecration +Lesser Heal +Savagery +Squire +Wicked Knife +Defias Bandit +Emerald Drake +Hidden Gnome +Lord Jaraxxus +Force of Nature +Frostwolf Warlord +Power of the Wild +Lightning Bolt +Grimscale Oracle +Upgrade! +Frost Elemental +Mana Tide Totem +Felguard +Freezing Trap +Dragonling Mechanic +Archmage +Gruul +Captain's Parrot +Faceless Manipulator +Spirit Wolf +Searing Totem +Arathi Weaponsmith +Mind Blast +Shield Slam +Frog +Arcane Intellect +Illidan Stormrage +Leeroy Jenkins +Arcane Missiles +Windfury Harpy +Tinkmaster Overspark +Shiv +Bite +Rooted +Alexstrasza +Darkscale Healer +Noble Sacrifice +Explosive Trap +Frost Nova +Succubus +Lay on Hands +Armorsmith +Treant +Keeper of the Grove +Fen Creeper +Ancient Watcher +Timber Wolf +Shattered Sun Cleric +Faerie Dragon +Power Word: Shield +Sorcerer's Apprentice +Dust Devil +Ice Barrier +Stormwind Knight +Lightning Storm +Sprint +Doomguard +Sen'jin Shieldmasta +Whirlwind +Jaina Proudmoore +Hogger +Young Dragonhawk +Scarlet Crusader +Sword of Justice +Stonetusk Boar +Frothing Berserker +Leper Gnome +Frostbolt +Fan of Knives +Nightblade +Uther Lightbringer +Kobold Geomancer +Treant +Divine Favor +Southsea Captain +Totemic Call +Mark of Nature +Druid of the Claw +Tundra Rhino +Mogu'shan Warden +Headcrack +Sinister Strike +War Golem +Mana Wraith +Southsea Deckhand +Armor Up! +Hand of Protection +Dagger Mastery +Mind Control Tech +Old Murk-Eye +Bluegill Warrior +Savage Roar +Kirin Tor Mage +Bloodmage Thalnos +Stormwind Champion +Spellbreaker +Blood Knight +Equality +Argent Squire +Sunwalker +Mad Bomber +Defender of Argus +Healing Totem +Thrallmar Farseer +Hex +Earth Shock +Gurubashi Berserker +Healing Touch +Unbound Elemental +Lord Jaraxxus +Harvest Golem +Pit Lord +Barrel Toss +Execute +Amani Berserker +Questing Adventurer +Sheep +Lightwell +Crazed Alchemist +Mortal Strike +Fireblast +Dream +Gorehowl +Cult Master +Panther +Anduin Wrynn +Snipe +Far Sight +Starfire +Azure Drake +Totemic Might +Deathwing +Leader of the Pack +Wrath +Holy Nova +Power Overwhelming +Truesilver Champion +Stoneclaw Totem +Humility +Millhouse Manastorm +Gelbin Mekkatorque +Twisting Nether +Sense Demons +Lava Burst +Shieldbearer +Arcane Shot +Dread Corsair +Lightspawn +Master of Disguise +Tirion Fordring +Sunfury Protector +Gul'dan +Flare +Bestial Wrath +Eviscerate +Acidic Swamp Ooze +Harrison Jones +Shadow Bolt +Ancient Mage +Drain Life +Ancient of Lore +Jungle Panther +Goldshire Footman +Imp Master +Starfall +Valeera Sanguinar +Gadgetzan Auctioneer +Cleave +Blessing of Kings +Hellfire +Misha +Stormforged Axe +The Beast +Mirror Image +Summoning Portal +Frost Shock +Soulfire +Murloc Tidehunter +Demolisher +Corruption +Dire Wolf Alpha +Moonfire +Stomp +Conceal +Mountain Giant +Worgen Infiltrator +Ogre Magi +Bloodsail Corsair +Bloodsail Raider +Houndmaster +Flamestrike +Finkle Einhorn +Heroic Strike +Flametongue Totem +Warsong Commander +Wild Pyromancer +Coldlight Oracle +Dread Infernal +Argent Protector +Shield Block +Commanding Shout +Violet Teacher +Ancient of War +Twilight Drake +Tracking +Claw +Murloc Warleader +Blade Flurry +Thrall +Guardian of Kings +Knife Juggler +Slam +Skeleton +Murloc Scout +Archmage Antonidas +Mirror Image +Spellbender +Pyroblast +Flame Imp +Misdirection +Mortal Coil +Deadly Shot +Emperor Cobra +Mind Vision +Siphon Soul +Rampage +Injured Blademaster +SI:7 Agent +Venture Co. Mercenary +Shapeshift +Wild Growth +Patient Assassin +Lorewalker Cho +Booty Bay Bodyguard +Earth Elemental +Demonfire +Infernal +King Krush +Demigod's Favor +Nat Pagle +Raging Worgen +Preparation +Starfall +Aldor Peacekeeper +Bloodlust +Avenging Wrath +INFERNO! +Ironfur Grizzly +Ysera +Silence +Squirrel +Void Terror +Starving Buzzard +Unleash the Hounds +Savannah Highmane +Scavenging Hyena +Hogger +Riverpaw Gnoll +Gnoll +Hogger SMASH! +Massive Gnoll +Jaina Proudmoore +Divine Spirit +Circle of Healing +Fade +Temple Enforcer +Greater Heal +Mass Dispel +Shadow Word: Pain +Shadowform +River Crocolisk +Oasis Snapjaw +Stampeding Kodo +Molten Giant +Blessing of Wisdom +Millhouse Manastorm +Raid Leader +King Mukla +Mukla's Big Brother +Blessed Champion +Will of Mukla +Hemet Nesingwary +Crazed Hunter +Mind Spike +Mind Shatter +Hyena +Young Priestess +Illidan Stormrage +Flames of Azzinoth +Naga Myrmidon +Warglaive of Azzinoth +Flame Burst +Metamorphosis +Dual Warglaives +Flame of Azzinoth +Northshire Cleric +Earthen Ring Farseer +Silver Hand Recruit +Magma Rager +Lightwarden +The Black Knight +Big Game Hunter +Alarm-o-Bot +Acolyte of Pain +Blood Fury +Heavy Axe +Eaglehorn Bow +Lorewalker Cho +Pandaren Scout +Shado-Pan Monk +Legacy of the Emperor +Brewmaster +Transcendence +Crazy Monkey +Druid of the Claw +Druid of the Claw +Shotgun Blast +Boulderfist Ogre +Core Hound +Angry Chicken +King Mukla +Bananas +Battle Axe +Shadow of Nothing +Sylvanas Windrunner +Worthless Imp +Excess Mana +Ashbringer +Avatar of the Coin +Ethereal Arcanist +The Coin +NOOOOOOOOOOOO +Flame of Azzinoth diff --git a/deckcomposer.pl b/deckcomposer.pl new file mode 100755 index 0000000..9efd229 --- /dev/null +++ b/deckcomposer.pl @@ -0,0 +1,116 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +package deckcomposer; + +use File::Basename; + +my ($deckfile) = @ARGV; +my($deckname, $deckdir, $suffix) = fileparse($deckfile, ".hs"); + +my $latexpreamble = <<END; + +\\documentclass{article} + +\\usepackage{graphicx} +\\usepackage[top=-.5in, bottom=.1in, left=.3in, right=.1in]{geometry} + + +\\newcommand\\Page[1]{ + \\begin{figure}[p] + \\center + \\includegraphics[height=8in, width=6in]{"#1"} + \\end{figure} + \\pagebreak +} + +END + +open my $deck, $deckfile or die "Could not open $deckfile: $!"; + +sub start_document { + my $begin = <<END; + +\\begin{document} +\\thispagestyle{empty} + +END + return "${latexpreamble}\n${begin}"; +} + +sub end_document { + my ($doc) = @_; + my $end = <<END; + +\\end{document} + +END + return "$doc\n$end"; +} + +my $image_ph = "images/%s.png"; +my $image_magick_command = <<END; +convert \\( \\( "$image_ph" -crop 307x433+0+16\\! \\) \\( "$image_ph" -crop 307x433+0+16\\! \\) -append \\) \\( \\( "$image_ph" -crop 307x433+0+16\\! \\) \\( "$image_ph" -crop 307x433+0+16\\! \\) -append \\) +append "$deckdir/%s" +END + +my $page_nr = 0; +sub add_to_page { + my ($idoc, @list) = @_; + + my $compositefile = "image${page_nr}.png"; + push(@list, $compositefile); + + print @list; + my $imageline = sprintf($image_magick_command, @list); + $page_nr += 1; + + print "$imageline\n"; + system($imageline); + + my ($name, undef, undef) = fileparse($compositefile, ".png"); + my $teximagepath = "$deckdir/$name"; + $idoc = "$idoc\n\\Page{$teximagepath}\n"; + return $idoc; +} + +my $doc = start_document(); +my @list = (); + +while( my $line = <$deck>) { + if ($line =~ m/(\d+)\s*:\s*(.+)\n/) { + my $nr = int($1); + my $name = $2; + + for(my $i=0; $i < $nr; $i++) + { + push(@list, $name); + print "@list\n"; + if( @list == 4 ) { + $doc = add_to_page($doc, @list); + @list = (); + } + } + } +} + +if (@list > 0) { + while (@list < 4) { + push(@list, "Empty"); + } + $doc = add_to_page($doc, @list); +} + +$doc = end_document($doc); + +close $deck; + +my $texfilename = "$deckdir/${deckname}_base.tex"; +open my $texfile, '>', $texfilename or die "Could not open $texfilename for writing: $!"; + +print {$texfile} $doc; + +system("pdflatex -output-directory $deckdir $texfilename"); +system("pdfunite auxilary/auximage.pdf $deckdir/${deckname}_base.pdf $deckdir/$deckname.pdf"); +system("xdg-open $deckdir/$deckname.pdf"); + diff --git a/decks/koray/koray.hs b/decks/koray/koray.hs new file mode 100644 index 0000000..7385ece --- /dev/null +++ b/decks/koray/koray.hs @@ -0,0 +1,21 @@ +2:Bloodfen Raptor +1:Boulderfist Ogre +2:Claw +2:Magma Rager +2:Innervate +1:Healing Touch +2:Mark of the Wild +2:Murloc Raider +1:Nightblade +1:Raid Leader +1:Oasis Snapjaw +2:Novice Engineer +1:Reckless Rocketeer +2:River Crocolisk +1:Sen'jin Shieldmasta +2:Wild Growth +2:Voodoo Doctor +2:Stonetusk Boar +1:Wolfrider +1:Malfurion Stormrage +1:Shapeshift diff --git a/decks/mage-starter/mage-starter.hs b/decks/mage-starter/mage-starter.hs new file mode 100644 index 0000000..b1272d6 --- /dev/null +++ b/decks/mage-starter/mage-starter.hs @@ -0,0 +1,19 @@ +2:Arcane Missiles +2:Fireball +2:Novice Engineer +2:Polymorph +2:Sheep +2:Archmage +2:Cone of Cold +2:Dalaran Mage +2:Flamestrike +2:Frostbolt +2:Ice Barrier +2:Ice Lance +2:Mirror Entity +4:Mirror Image +2:Mirror Image_1 +2:Ogre Magi +2:Sorcerer's Apprentice +1:Jaina Proudmoore_premium +1:Fireblast diff --git a/decks/testdeck/deck1.hs b/decks/testdeck/deck1.hs new file mode 100644 index 0000000..a3c9bf0 --- /dev/null +++ b/decks/testdeck/deck1.hs @@ -0,0 +1,6 @@ +4:Al'Akir the Windlord_premium +4:Al'Akir the Windlord +4:Mirror Image +1 :Ironfur Grizzly +1: Ironfur Grizzly +1 : Ironfur Grizzly diff --git a/getresources.pl b/getresources.pl new file mode 100755 index 0000000..87ee7b6 --- /dev/null +++ b/getresources.pl @@ -0,0 +1,166 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +package getimg; + +my ($htmldir, $imagedir, $sounddir, $lower, $upper) = @ARGV; + +if(!($htmldir && $imagedir && $sounddir && $lower && $upper)) { + print "Usage $0 html-dir image-dir sound-dir lower-bound upper-bound\n"; + #die; +} + +if(! -d $htmldir) { + mkdir $htmldir or die "could not create ${htmldir}\n"; +} + +if(! -d $imagedir) { + mkdir $imagedir or die "could not create ${imagedir}\n"; +} + +if(! -d $sounddir) { + mkdir $imagedir or die "could not create ${imagedir}\n"; +} + +sub rand_range { + my ($x, $y) = @_; + return int(rand($y - $x)) + $x; +} + +my %imagehash; + +for(my $i = $lower; $i <= $upper; $i++) { + + our $rand_value = rand_range(0, 5); + print "going to sleep for $rand_value seconds\n"; + #sleep($rand_value); + print "slept\n"; + + our $htmlfile = "${htmldir}/${i}.html"; + + my $useragent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17"; + my $cmd = "curl -A \"$useragent\" \"http://www.hearthhead.com/card=$i\" > \"$htmlfile\""; + + if (! -e $htmlfile) { + system($cmd); + } else { + print "using cached html file: \"${htmlfile}\"\n" + } + + my $document = do { + local $/ = undef; + open my $fh, "<", $htmlfile + or die "could not open $htmlfile: ${!}\n"; + <$fh>; + }; + + my $name = undef; + my $normalimagefile = undef; + my $premiumimagefile = undef; + my $sound1file = undef; + my $sound2file = undef; + my $sound3file = undef; + + if ($document =~ /_\[${i}\]={name_enus:'(.+?)',icon:'/) { + $name = $1; + $name =~ s/\\(.)/$1/g; + $name =~ s/"/\\"/g; + print "Name: " . $name . "\n"; + } else { + print "No name found\n"; + next; + } + + if ( ! exists $imagehash{$name} ) { + $normalimagefile = "${imagedir}/${name}.png"; + $premiumimagefile = "${imagedir}/${name}_premium.gif"; + $sound1file = "${sounddir}/${name}_battlecry.ogg"; + $sound2file = "${sounddir}/${name}_attack.ogg"; + $sound3file = "${sounddir}/${name}_death.ogg"; + $imagehash{$name} = 1; + } else { + print $imagehash{$name}; + $normalimagefile = "${imagedir}/${name}_" . $imagehash{$name} . ".png"; + $premiumimagefile = "${imagedir}/${name}_" . $imagehash{$name} . "_premium.gif"; + $sound1file = "${sounddir}/${name}_" . $imagehash{$name} . "_battlecry.ogg"; + $sound2file = "${sounddir}/${name}_" . $imagehash{$name} . "_attack.ogg"; + $sound3file = "${sounddir}/${name}_" . $imagehash{$name} . "_death.ogg"; + $imagehash{$name}++; + } + + + my $get_normal_cmd = undef; + my $get_premium_cmd = undef; + my $get_sound1file_cmd = undef; + my $get_sound2file_cmd = undef; + my $get_sound3file_cmd = undef; + + + if ($document =~ /_\[${i}\]\.tooltip_enus = '<img src="(.+?)"/) { + $get_normal_cmd = "curl -A \"$useragent\" \"$1\" > \"${normalimagefile}\""; + print "Normal: " . $1 . "\n"; + } else { + print "Could not find normal version of ${name}\n"; + } + + if ($document =~ /_\[${i}\]\.tooltip_premium_enus = '<img src="(.+?)"/) { + $get_premium_cmd = "curl -A \"$useragent\" \"$1\" > \"${premiumimagefile}\""; + print "Premium: $1 \n"; + } else { + print "Could not find premium version of ${name}\n"; + } + + if ($document =~ /<audio id="cardsound0"><source src="(.+?)"/) { + $get_sound1file_cmd = "curl -A \"$useragent\" \"$1\" > \"${sound1file}\""; + print "BattleCry: $1 \n"; + } else { + print "Could not find the BattleCry sound of ${name}\n"; + } + + if ($document =~ /<audio id="cardsound1"><source src="(.+?)"/) { + $get_sound2file_cmd = "curl -A \"$useragent\" \"$1\" > \"${sound2file}\""; + print "Attack: $1 \n"; + } else { + print "Could not find the Attack sound of ${name}\n"; + } + + if ($document =~ /<audio id="cardsound2"><source src="(.+?)"/) { + $get_sound3file_cmd = "curl -A \"$useragent\" \"$1\" > \"${sound3file}\""; + print "Death: $1 \n"; + } else { + print "Could not find the Death sound of ${name}\n"; + } + + if (! -e $normalimagefile) { + system($get_normal_cmd); + } else { + print "normal $name already downloaded\n"; + } + + if (! -e $premiumimagefile) { + system($get_premium_cmd); + } else { + print "premium $name already downloaded\n"; + } + + if (! -e $sound1file) { + system($get_sound1file_cmd); + } else { + print "Battlecry $name already downloaded\n"; + } + + if (! -e $sound2file) { + system($get_sound2file_cmd); + } else { + print "Attack $name already downloaded\n"; + } + + if (! -e $sound3file) { + system($get_sound3file_cmd); + } else { + print "Death $name already downloaded\n"; + } +} + + |
