Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # file: optdota2.pl
- use FileHandle;
- ### big hero map
- my %bans = (
- Abaddon=>"[url=http://wiki.teamliquid.net/dota2/Abaddon][img]http://i.imgur.com/ktBKtNJ.png[/img][/url]",
- Alchemist=>"[url=http://wiki.teamliquid.net/dota2/Alchemist][h]alchemist[/h][/url]",
- AncientApparition=>"[url=http://wiki.teamliquid.net/dota2/Ancient_Apparition][h]ancient[/h][/url]",
- Antimage=>"[url=http://wiki.teamliquid.net/dota2/Antimage][h]antimage[/h][/url]",
- Axe=>"[url=http://wiki.teamliquid.net/dota2/Axe][h]axe[/h][/url]",
- Bane=>"[url=http://wiki.teamliquid.net/dota2/Bane][h]bane[/h][/url]",
- Batrider=>"[url=http://wiki.teamliquid.net/dota2/Batrider][h]batrider[/h][/url]",
- Beastmaster=>"[url=http://wiki.teamliquid.net/dota2/Beastmaster][h]beastmaster[/h][/url]",
- Bloodseeker=>"[url=http://wiki.teamliquid.net/dota2/Bloodseeker][h]bloodseeker[/h][/url]",
- BountyHunter=>"[url=http://wiki.teamliquid.net/dota2/Bounty_Hunter][h]bounty[/h][/url]",
- Brewmaster=>"[url=http://wiki.teamliquid.net/dota2/Brewmaster][h]brewmaster[/h][/url]",
- Bristleback=>"[url=http://wiki.teamliquid.net/dota2/Bristleback][h]bristleback[/h][/url]",
- Broodmother=>"[url=http://wiki.teamliquid.net/dota2/Broodmother][img]http://i.imgur.com/bVzNEjn.png[/img][/url]",
- Centaur=>"[url=http://wiki.teamliquid.net/dota2/Centaur_Warrunner][h]centaur[/h][/url]",
- ChaosKnight=>"[url=http://wiki.teamliquid.net/dota2/Chaos_Knight][h]chaos[/h][/url]",
- Chen=>"[url=http://wiki.teamliquid.net/dota2/Chen][h]chen[/h][/url]",
- Clinkz=>"[url=http://wiki.teamliquid.net/dota2/Clinkz][h]clinkz[/h][/url]",
- Clockwerk=>"[url=http://wiki.teamliquid.net/dota2/Clockwerk][h]clockwerk[/h][/url]",
- CrystalMaiden=>"[url=http://wiki.teamliquid.net/dota2/Crystal_Maiden][h]crystal[/h][/url]",
- DarkSeer=>"[url=http://wiki.teamliquid.net/dota2/Dark_Seer][h]darkseer[/h][/url]",
- Dazzle=>"[url=http://wiki.teamliquid.net/dota2/Dazzle][h]dazzle[/h][/url]",
- DeathProphet=>"[url=http://wiki.teamliquid.net/dota2/Death_Prophet][h]death[/h][/url]",
- Disruptor=>"[url=http://wiki.teamliquid.net/dota2/Disruptor][h]disruptor[/h][/url]",
- Doom=>"[url=http://wiki.teamliquid.net/dota2/Doom][h]doom[/h][/url]",
- DragonKnight=>"[url=http://wiki.teamliquid.net/dota2/Dragon_Knight][h]dragon[/h][/url]",
- Drow=>"[url=http://wiki.teamliquid.net/dota2/Drow_Ranger][h]drow[/h][/url]",
- Earth=>"[url=http://wiki.teamliquid.net/dota2/Earth_Spirit][img]http://i.imgur.com/oXFNyJS.png[/img][/url]",
- Earthshaker=>"[url=http://wiki.teamliquid.net/dota2/Earthshaker][h]earthshaker[/h][/url]",
- ElderTitan=>"[url=http://wiki.teamliquid.net/dota2/Elder_Titan][img]http://i.imgur.com/MkLSGDo.png[/img][/url]",
- Ember=>"[url=http://wiki.teamliquid.net/dota2/Ember_Spirit][img]http://i.imgur.com/ILnRXSb.png[/img][/url]",
- Enchantress=>"[url=http://wiki.teamliquid.net/dota2/Enchantress][h]enchantress[/h][/url]",
- Enigma=>"[url=http://wiki.teamliquid.net/dota2/Enigma][h]enigma[/h][/url]",
- Faceless=>"[url=http://wiki.teamliquid.net/dota2/Faceless_Void][h]faceless[/h][/url]",
- Gyrocopter=>"[url=http://wiki.teamliquid.net/dota2/Gyrocopter][h]gyrocopter[/h][/url]",
- Huskar=>"[url=http://wiki.teamliquid.net/dota2/Huskar][h]huskar[/h][/url]",
- Invoker=>"[url=http://wiki.teamliquid.net/dota2/Invoker][h]invoker[/h][/url]",
- Io=>"[url=http://wiki.teamliquid.net/dota2/Io][h]io[/h][/url]",
- Jakiro=>"[url=http://wiki.teamliquid.net/dota2/Jakiro][h]jakiro[/h][/url]",
- Juggernaut=>"[url=http://wiki.teamliquid.net/dota2/Juggernaut][h]juggernaut[/h][/url]",
- Keeper=>"[url=http://wiki.teamliquid.net/dota2/Keeper_of_the_Light][h]keeper[/h][/url]",
- Kunkka=>"[url=http://wiki.teamliquid.net/dota2/Kunkka][h]kunkka[/h][/url]",
- Legion=>"[url=http://wiki.teamliquid.net/dota2/Legion_Commander][img]http://i.imgur.com/Jfdfzde.png[/img][/url]",
- Leshrac=>"[url=http://wiki.teamliquid.net/dota2/Leshrac][h]leshrac[/h][/url]",
- Lich=>"[url=http://wiki.teamliquid.net/dota2/Lich][h]lich[/h][/url]",
- Lifestealer=>"[url=http://wiki.teamliquid.net/dota2/Lifestealer][h]lifestealer[/h][/url]",
- Lina=>"[url=http://wiki.teamliquid.net/dota2/Lina][h]lina[/h][/url]",
- Lion=>"[url=http://wiki.teamliquid.net/dota2/Lion][img]http://i.imgur.com/UIBEKN7.png[/img][/url]",
- LoneDruid=>"[url=http://wiki.teamliquid.net/dota2/Lone_Druid][h]lone[/h][/url]",
- Luna=>"[url=http://wiki.teamliquid.net/dota2/Luna][h]luna[/h][/url]",
- Lycan=>"[url=http://wiki.teamliquid.net/dota2/Lycanthrope][h]lycanthrope[/h][/url]",
- Magnus=>"[url=http://wiki.teamliquid.net/dota2/Magnus][h]magnus[/h][/url]",
- Medusa=>"[url=http://wiki.teamliquid.net/dota2/Medusa][h]medusa[/h][/url]",
- Meepo=>"[url=http://wiki.teamliquid.net/dota2/Meepo][h]meepo[/h][/url]",
- Mirana=>"[url=http://wiki.teamliquid.net/dota2/Mirana][h]mirana[/h][/url]",
- Morphling=>"[url=http://wiki.teamliquid.net/dota2/Morphling][h]morphling[/h][/url]",
- Naga=>"[url=http://wiki.teamliquid.net/dota2/Naga_Siren][h]naga[/h][/url]",
- Natures=>"[url=http://wiki.teamliquid.net/dota2/Natures_Prophet][h]natures[/h][/url]",
- Necro=>"[url=http://wiki.teamliquid.net/dota2/Necrolyte][h]necrolyte[/h][/url]",
- Night=>"[url=http://wiki.teamliquid.net/dota2/Night_Stalker][h]night[/h][/url]",
- Nyx=>"[url=http://wiki.teamliquid.net/dota2/Nyx_Assassin][h]nyx[/h][/url]",
- OgreMagi=>"[url=http://wiki.teamliquid.net/dota2/Ogre_Magi][h]ogre[/h][/url]",
- Omni=>"[url=http://wiki.teamliquid.net/dota2/Omniknight][h]omniknight[/h][/url]",
- Outworld=>"[url=http://wiki.teamliquid.net/dota2/Outworld_Devourer][h]outworld[/h][/url]",
- PhantomAssassin=>"[url=http://wiki.teamliquid.net/dota2/Phantom_Assassin][h]phantomassassin[/h][/url]",
- PhantomLancer=>"[url=http://wiki.teamliquid.net/dota2/Phantom_Lancer][h]phantomlancer[/h][/url]",
- Phoenix=>"[url=http://wiki.teamliquid.net/dota2/Phoenix][img]http://i.imgur.com/4n7fnMh.png[/img][/url]",
- Puck=>"[url=http://wiki.teamliquid.net/dota2/Puck][h]puck[/h][/url]",
- Pudge=>"[url=http://wiki.teamliquid.net/dota2/Pudge][h]pudge[/h][/url]",
- Pugna=>"[url=http://wiki.teamliquid.net/dota2/Pugna][h]pugna[/h][/url]",
- Queen=>"[url=http://wiki.teamliquid.net/dota2/Queen_of_Pain][h]queen[/h][/url]",
- Razor=>"[url=http://wiki.teamliquid.net/dota2/Razor][h]razor[/h][/url]",
- Riki=>"[url=http://wiki.teamliquid.net/dota2/Riki][h]riki[/h][/url]",
- Rubick=>"[url=http://wiki.teamliquid.net/dota2/Rubick][h]rubick[/h][/url]",
- SandKing=>"[url=http://wiki.teamliquid.net/dota2/Sand_King][h]sand[/h][/url]",
- ShadowDemon=>"[url=http://wiki.teamliquid.net/dota2/Shadow_Demon][h]shadowdemon[/h][/url]",
- ShadowFiend=>"[url=http://wiki.teamliquid.net/dota2/Shadow_Fiend][h]shadowfiend[/h][/url]",
- ShadowShaman=>"[url=http://wiki.teamliquid.net/dota2/Shadow_Shaman][h]shadowshaman[/h][/url]",
- Silencer=>"[url=http://wiki.teamliquid.net/dota2/Silencer][img]http://i.imgur.com/VJUI4S9.png[/img][/url]",
- Skywrath=>"[url=http://wiki.teamliquid.net/dota2/Skywrath_Mage][img]http://i.imgur.com/I6HXI9F.png[/img][/url]",
- Slardar=>"[url=http://wiki.teamliquid.net/dota2/Slardar][h]slardar[/h][/url]",
- Slark=>"[url=http://wiki.teamliquid.net/dota2/Slark][h]slark[/h][/url]",
- Sniper=>"[url=http://wiki.teamliquid.net/dota2/Sniper][h]sniper[/h][/url]",
- Spectre=>"[url=http://wiki.teamliquid.net/dota2/Spectre][h]spectre[/h][/url]",
- SpiritBreaker=>"[url=http://wiki.teamliquid.net/dota2/Spirit_Breaker][h]spirit[/h][/url]",
- Storm=>"[url=http://wiki.teamliquid.net/dota2/Storm_Spirit][img]http://i.imgur.com/cyTlhAk.png[/img][/url]",
- Sven=>"[url=http://wiki.teamliquid.net/dota2/Sven][h]sven[/h][/url]",
- Templar=>"[url=http://wiki.teamliquid.net/dota2/Templar_Assassin][h]templar[/h][/url]",
- Terrorblade=>"[url=http://wiki.teamliquid.net/dota2/Terrorblade][img]http://i.imgur.com/8OT6Tyx.png[/img][/url]",
- Tidehunter=>"[url=http://wiki.teamliquid.net/dota2/Tidehunter][h]tidehunter[/h][/url]",
- Timbersaw=>"[url=http://wiki.teamliquid.net/dota2/Timbersaw][h]timbersaw[/h][/url]",
- Tinker=>"[url=http://wiki.teamliquid.net/dota2/Tinker][h]tinker[/h][/url]",
- Tiny=>"[url=http://wiki.teamliquid.net/dota2/Tiny][h]tiny[/h][/url]",
- Treant=>"[url=http://wiki.teamliquid.net/dota2/Treant_Protector][h]treant[/h][/url]",
- Troll=>"[url=http://wiki.teamliquid.net/dota2/Troll_Warlord][h]troll[/h][/url]",
- Tusk=>"[url=http://wiki.teamliquid.net/dota2/Tusk][h]tusk[/h][/url]",
- Undying=>"[url=http://wiki.teamliquid.net/dota2/Undying][h]undying[/h][/url]",
- Ursa=>"[url=http://wiki.teamliquid.net/dota2/Ursa][h]ursa[/h][/url]",
- Vengeful=>"[url=http://wiki.teamliquid.net/dota2/Vengeful_Spirit][h]vengeful[/h][/url]",
- Venomancer=>"[url=http://wiki.teamliquid.net/dota2/Venomancer][img]http://i.imgur.com/5mI8G4v.png[/img][/url]",
- Viper=>"[url=http://wiki.teamliquid.net/dota2/Viper][img]http://i.imgur.com/2PJPJv0.png[/img][/url]",
- Visage=>"[url=http://wiki.teamliquid.net/dota2/Visage][h]visage[/h][/url]",
- Warlock=>"[url=http://wiki.teamliquid.net/dota2/Warlock][h]warlock[/h][/url]",
- Weaver=>"[url=http://wiki.teamliquid.net/dota2/Weaver][h]weaver[/h][/url]",
- Windranger=>"[url=http://wiki.teamliquid.net/dota2/Windrunner][h]windrunner[/h][/url]",
- WitchDoctor=>"[url=http://wiki.teamliquid.net/dota2/Witch_Doctor][h]witchdoctor[/h][/url]",
- WraithKing=>"[url=http://wiki.teamliquid.net/dota2/Wraith_King][img]http://i.imgur.com/JOwHsVC.png[/img][/url]",
- Zeus=>"[url=http://wiki.teamliquid.net/dota2/Zeus][h]zeus[/h][/url]",
- );
- ########################################################################
- ### side and first pick
- ### this is from arguments
- $pick1st=$ARGV[0];
- printf("$pick1st First Pick\n");
- $pick2nd="Dire";
- $side1st=$ARGV[1];
- printf("$side1st on Left\n");
- $filename=$ARGV[2];
- if ($pick1st eq "Dire")
- {
- $pick2nd="Radi";
- }
- elsif ($pick1st eq "Radi")
- {
- $pick2nd="Dire";
- }
- else
- {
- printf("HALP!!! Tell me which side has first pick. \"Radi\"|\"Dire\" \n");
- exit 0;
- }
- if ($side1st eq "Dire")
- {
- }
- elsif ($side1st eq "Radi")
- {
- }
- else
- {
- printf("HALP!!! Tell me which side should be on left. \"Radi\"|\"Dire\" \n");
- exit 0;
- }
- my $outfile;
- if ($filename eq "")
- {
- printf("Writing output to stdout.\n");
- $outfile=\*STDOUT;
- }
- else
- {
- printf("Opening file $filename for writing.\n");
- $outfile=FileHandle->new("$filename", "a+");
- if (!defined $outfile)
- {
- printf("HALP!!! Could not open $filename for writing\n");
- exit 0;
- }
- }
- ### end side and first pick
- ########################################################################
- ########################################################################
- ### hero acquisition
- ### ban pick process in order appearance
- @bpProcess=(
- ["1","Ban"],
- ["2","Ban"],
- ["1","Ban"],
- ["2","Ban"],
- ["1","Pick"],
- ["2","Pick"],
- ["2","Pick"],
- ["1","Pick"],
- ["1","Ban"],
- ["2","Ban"],
- ["1","Ban"],
- ["2","Ban"],
- ["2","Pick"],
- ["1","Pick"],
- ["2","Pick"],
- ["1","Pick"],
- ["2","Ban"],
- ["1","Ban"],
- ["2","Pick"],
- ["1","Pick"],
- );
- sub initSideAssign {
- $picknum=0;
- while ($picknum < 20) {
- if ($bpProcess[$picknum][0] eq "1") {
- $bpProcess[$picknum][0] = $_[0];
- }
- if ($bpProcess[$picknum][0] eq "2") {
- $bpProcess[$picknum][0] = $_[1];
- }
- $picknum++;
- }
- }
- ### prompt for heroes
- sub getAHeroName {
- my $newname;
- do {
- print "$_[0]: $bpProcess[$_[0]][0] $bpProcess[$_[0]][1]: ";
- $newname = <STDIN>;
- chomp $newname;
- } while (!exists $bans{$newname} );
- #verify hero
- return $newname;
- }
- ### initialize the picking sides
- initSideAssign($pick1st,$pick2nd);
- @heronames;
- $pick=0;
- while ($pick < 20) {
- $heronames[$pick]=getAHeroName($pick);
- $pick++;
- }
- printf("\npicks/bans entry completed\n");
- ### end hero acquisition
- ########################################################################
- ########################################################################
- ### pick sorting
- @radipicks;
- @direpicks;
- @radibans;
- @direbans;
- $radipick=0;
- $direpick=0;
- $radiban=0;
- $direban=0;
- $pick=0;
- while ($pick < 20) {
- $side=$bpProcess[$pick][0];
- $type=$bpProcess[$pick][1];
- $link=$bans{$heronames[$pick]};
- if ($type eq "Ban")
- {
- if ($side eq "Dire")
- {
- $direbans[$direban]=$link;
- $direban++;
- }
- else
- {
- $radibans[$radiban]=$link;
- $radiban++;
- }
- }
- else
- {
- if ($side eq "Dire")
- {
- $direpicks[$direpick]=$link;
- $direpick++;
- }
- else
- {
- $radipicks[$radipick]=$link;
- $radipick++;
- }
- }
- $pick++;
- }
- ### end pick sorting
- ########################################################################
- ########################################################################
- ### output formatting
- sub makeRadiPickLine {
- return $radipicks[0]." ".$radipicks[1]." ".$radipicks[2]." ".$radipicks[3]." ".$radipicks[4]."[img]http://i.imgur.com/H1j7SBU.png[/img]".$direpicks[0]." ".$direpicks[1]." ".$direpicks[2]." ".$direpicks[3]." ".$direpicks[4];
- }
- sub makeRadiBanLine {
- return $radibans[0]." ".$radibans[1]." ".$radibans[2]." ".$radibans[3]." ".$radibans[4]."[img]http://i.imgur.com/4HTXS8I.png[/img]".$direbans[0]." ".$direbans[1]." ".$direbans[2]." ".$direbans[3]." ".$direbans[4];
- }
- sub makeDirePickLine {
- return $direpicks[0]." ".$direpicks[1]." ".$direpicks[2]." ".$direpicks[3]." ".$direpicks[4]."[img]http://i.imgur.com/H1j7SBU.png[/img]".$radipicks[0]." ".$radipicks[1]." ".$radipicks[2]." ".$radipicks[3]." ".$radipicks[4];
- }
- sub makeDireBanLine {
- return $direbans[0]." ".$direbans[1]." ".$direbans[2]." ".$direbans[3]." ".$direbans[4]."[img]http://i.imgur.com/4HTXS8I.png[/img]".$radibans[0]." ".$radibans[1]." ".$radibans[2]." ".$radibans[3]." ".$radibans[4];
- }
- if ($side1st eq "Radi")
- {
- print $outfile "[center]\n";
- $pickline=makeRadiPickLine();
- print $outfile "$pickline\n";
- $divider="[img]http://i.imgur.com/vvshEHz.png[/img]";
- print $outfile "$divider\n";
- $banline=makeRadiBanLine();
- print $outfile "$banline\n";
- print $outfile "[/center]\n";
- }
- else
- {
- print $outfile "[center]\n";
- $pickline=makeDirePickLine();
- print $outfile "$pickline\n";
- $divider="[img]http://i.imgur.com/M0IcDHl.png[/img]";
- print $outfile "$divider\n";
- $banline=makeDireBanLine();
- print $outfile "$banline\n";
- print $outfile "[/center]\n";
- }
- undef $outfile;
- ### end output formatting
- ########################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement