Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 17.48 KB | None | 0 0
  1. #!/usr/bin/perl
  2. print "Introducing, Caaz's shitty Wolfbot! Enjoy.\n";
  3. #chomp($Connect = <STDIN>);
  4. use lib '/Users/Caaz/lib';
  5. use POE::Component::IRC;
  6. use POE;
  7. use List::Util 'shuffle';
  8. BOTVARS: {
  9.     $BotNick = "PerlWolf";      # Nick
  10.     $BotUser = "Were";      # Username "indent"
  11.     $BotName = "a Perl bot.";   # Real Name
  12.     $BotPass = "Pass";      # Nickserv Password
  13.     $BotOwner = "Caaz";     # Owner of the Bot
  14.     $BotPath = "/Users/Caaz/Desktop/Perl/BOT/";     # Path to any files.
  15.     $BotVersion = POE::Component::IRC::Common::MAGENTA."\[ Werewolf 0 \]"; # Skeleton.Commands.Wwolf
  16.     $WW{"Mode"} = "Off";
  17. }
  18. @WWRoles = ("Wolf!Darkrai!Troowl!Kira~", "Seer!Lucario!AnonymouStalker!L~", "Finder!Azelf!AnonymouSpy!Near", "Doppleganger!Ditto!Trap!Kira Supporter", "Angel!Cresslia!Bawxxy!Shinigami", "Village Idiot!Magikarp!Boxy!Mastuda", "Villager!Psyduck!Boxxy!ICPO agent");
  19. @Msg = (
  20. "A game of werewolf has begun! \"/msg ".$BotNick." join\" to well, join you idiot.:ELSE:A pokemon themed game of werewolf has started! \"/msg ".$BotNick." join\" to play!:ELSE:HAY THIS IS FROM BAWXXY TO YOU GUIZE, CAN YOU LIEK, FIND THE TROOWL? CAUSE I AM NO TROOWL, I AM BAWXXY YOU SEE? \"/msg ".$BotNick." join\" TO JOIN YAWL".
  21. ":ELSE:Deathnote themed werewolf has begun! \"/msg ".$BotNick." join\" to join.",
  22. " has joined.:ELSE: has joined.:ELSE: HAS JOINED THE BRAWL:ELSE: joins the ICPO.",
  23. "As the sun set, the villagers return to their homes, unknowing of when the wolf will strike next...:ELSE:The Pokemon, unable to stay awake much longer, fall asleep...:ELSE:AS EVERYONE GOES ONTO THE INTERBLAGZ, THE TROLL STAWLKS HIS PREY.:ELSE:The investigators keep an eye on the Kira murders as night falls...",
  24. "You are a wolf! At night, use \"/msg ".$BotNick." target NICK\" to kill your prey, or if it's a full moon, it turns them into a wolf!:ELSE:You are a Darkrai! At night, use \"/msg ".$BotNick." target NICK\" to make the Pokemon have nightmares!:ELSE:YOU IZ TROWL. \"/MSG ".$BotNick." target NAME\" KGO.".
  25. ":ELSE:You are Kira! use \"/msg ".$BotNick." target NICK\" to write them in your Deathnote.",
  26. "You are a seer! At night, use \"/msg ".$BotNick." target NICK\" to find out what role they play.:ELSE:You are a Lucario! At night, use \"/msg ".$BotNick." target NICK\" to find out what role they play.:ELSE:YOU ARE ANONYMOUS, YOU KNOW ALL. BUT FURST YOU MUST SEE ALL.\"/msg ".$BotNick." target NICK\"".
  27. ":ELSE:You are L! At night, you have the ability to see what roles the players play with \"/msg ".$BotNick." target NICK\".",
  28. "You are a finder! At night, use \"/msg ".$BotNick." target NICK\" to see if they've targeted anyone.:ELSE:You are an Azelf! At night, use \"/msg ".$BotNick." target NICK\" to see if they've targeted anyone.:ELSE:ANONYMOUS CAN ALSO FIND ALL \"/msg ".$BotNick." target NICK\"".
  29. ":ELSE:You are Near, At night, you can see who targeted who with \"/msg ".$BotNick." target NICK\".",
  30. "You are a doppleganger! At night, use \"/msg ".$BotNick." target NICK\" to transform into their role!:ELSE:You are a ditto! At night, use \"/msg ".$BotNick." target NICK\" to transform into their role!:ELSE:ANONYMOUS CAN BE ANYONE \"/msg ".$BotNick." target NICK\"".
  31. ":ELSE:You are a Kira Supporter! Pick a user and you get to be their role with \"/msg ".$BotNick." target NICK\".",
  32. "You are an Angel! At night, use \"/msg ".$BotNick." target NICK\" to protect them from being killed by the wolf!:ELSE:You are a Cresslia! At night, use \"/msg ".$BotNick." target NICK\" to protect them from being dragged into a nightmare!:ELSE:FUCK BEING ANGEL, BOXXY IS GAWD. \"/msg ".$BotNick." target NICK\"".
  33. ":ELSE:You are a shinigami! Use \"/msg ".$BotNick." target NICK\" to protect someone from being killed by the deathnote.",
  34. "You're a village idiot! You're main goal is to get Lynched. Kbestupid.:ELSE:You are a Magikarp! SPLASH. SPLASH AND TALK IN CAPS... you're main goal is to get caught!:ELSE:I WAZ GONNA MAKE BOXXY WOLF, BUT THEN MAKING HER IDIOT WOULD FUCK THE WHOLE THING. UP SO YEAH.".
  35. ":ELSE:You are Matsuda! If you get arrested for being Kira, you win!",
  36. "was killed by the wolf!:ELSE:is in a coma from nightmare!:ELSE:HAZ LEFT THE INTERBLAGZ DUE TO BEING TROLLED SO BADLY:ELSE:has died of a heart attack! Could this be the work of Kira?",
  37. "targeted:ELSE:targeted:ELSE:TARGATTED:ELSE:targeted",
  38. "Wolves are victorious!:ELSE:Darkrai has eliminated everyone!:ELSE:LOOL, YOU GUIZE GOT PWNED BY TROOWLZ:ELSE:Kira has one, and can continue making a wold based on his judgement.",
  39. "Villagers win! They've Lynched the wolfs!:ELSE:The Darkrai were stopped! Woo.:ELSE:HA YOU GUIZE GOT THE TROWL, BUT WHO WILL GET YOU?:ELSE:The ICPO wins! Ridding the world of Kira's judgement.",
  40. "was Lynched.:ELSE:Gawt caught!:ELSE:SAID CANDLEJACK ON ACCI\n:ELSE:was arrested for being Kira.",
  41. "Idiots win!:ELSE:Magikarp got caught, it wins!:ELSE:Aww damn, you arrested Matsuda!"
  42. );
  43. my ($irc) = POE::Component::IRC->spawn();
  44. POE::Session->create(inline_states => {
  45.     _start     => sub {
  46.         $irc->yield(register => "all");
  47.         $irc->yield( connect => {
  48.             Nick     => $BotNick,
  49.             Username => $BotUser,
  50.             Ircname  => $BotName,
  51.             Server   => "irc.purplesurge.com",
  52.             Port     => "6667"
  53.         });
  54.     },
  55.     irc_001 => sub {
  56.         $irc->yield(mode => $BotNick." +B");
  57.         #$irc->yield(privmsg => "Nickserv" => "id ".$BotPass);
  58.         my $alarm_id = $irc->delay( [ join => "#Powerplant" ], 2 );
  59.     },
  60.     irc_error => sub {
  61.         my ($kernel, $IRCWhat) = @_[KERNEL, ARG0];
  62.         print $IRCWhat."\n";
  63.     },
  64.     irc_ctcp_action => sub {
  65.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  66.         $IRCWhere = $where->[0];
  67.         print GetTime()."$IRCWhere >    * ".(split /!/, $IRCWho)[0]." $IRCWhat\n";
  68.         Bot("ACTION",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  69.     },
  70.     irc_ctcp_version => sub {
  71.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  72.         $IRCWhere = $where->[0];
  73.         print GetTime()."CTCP > * Got CTCP VERSION from ".(split /!/, $IRCWho)[0]."\n";
  74.         $irc->yield(ctcpreply => (split /!/, $IRCWho)[0] => $BotVersion);
  75.     },
  76.     irc_join => sub {
  77.         my ($kernel, $IRCWho, $IRCWhere) = @_[KERNEL, ARG0, ARG1];
  78.         print GetTime()."Join       * ".(split /!/, $IRCWho)[0]." joins $IRCWhere\n";
  79.         Bot("JOIN",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere);
  80.     },
  81.     irc_invite => sub {
  82.         my ($kernel, $IRCWho, $IRCWhere) = @_[KERNEL, ARG0, ARG1];
  83.         print GetTime()."Invi       * ".(split /!/, $IRCWho)[0]." invites you to $IRCWhere\n";
  84.         Bot("INVITE", (split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere);
  85.     },
  86.     irc_kick => sub {
  87.         my ($kernel, $IRCWho, $IRCWhere, $IRCWhoElse, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2, ARG3];
  88.         print GetTime()."Kick       * ".(split /!/, $IRCWho)[0]." kicks $IRCWhoElse out of $IRCWhere ($IRCWhat)\n";
  89.         Bot("KICK",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhoElse,$IRCWhat);
  90.     },
  91.     irc_msg => sub {
  92.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  93.         $IRCWhere = $where->[0];
  94.         print GetTime()."Priv\a>        <".(split /!/, $IRCWho)[0].">   $IRCWhat\n";
  95.         Bot("PRIVMSG",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  96.     },
  97.     irc_nick => sub {
  98.         my ($kernel, $IRCWho, $IRCWhoElse) = @_[KERNEL, ARG0, ARG1];
  99.         print GetTime()."Nick       * ".(split /!/, $IRCWho)[0]." changes nick to $IRCWhoElse\n";
  100.         Bot("NICK", (split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhoElse);
  101.     },
  102.     irc_notice => sub {
  103.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  104.         $IRCWhere = $where->[0];
  105.         print GetTime()."Noti       <".(split /!/, $IRCWho)[0].">   $IRCWhat\n" if((split /!/, $IRCWho)[0] !~ /WolfBot/i);
  106.         Bot("NOTICE",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  107.     },
  108.     irc_part => sub {
  109.         my ($kernel, $IRCWho, $IRCWhere, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  110.         print GetTime()."Part       * ".(split /!/, $IRCWho)[0]." left channel $IRCWhere \(".$IRCWhat."\)\n";
  111.         Bot("PART",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  112.     },
  113.     irc_public => sub {
  114.         my ($kernel, $IRCWho, $where, $IRCWhat) = @_[KERNEL, ARG0, ARG1, ARG2];
  115.         $IRCWhere = $where->[0];
  116.         print GetTime()."$IRCWhere >    <".(split /!/, $IRCWho)[0].">   $IRCWhat\n";
  117.         Bot("CHANMSG",(split /!/, $IRCWho)[0],(split /!/, $IRCWho)[1],$IRCWhere,$IRCWhat);
  118.     },
  119.     irc_disconnected => sub { print "Disconnected.\n"; exit 1; }, # Ends on disconnect.
  120. },);
  121. sub Bot {
  122.     $Event = $_[0];
  123.     if($Event =~ /CHANMSG/) { $Com = "privmsg ".$_[3]." "; $UserMsg = $_[4]; $Where = $_[3]; }
  124.     elsif($Event =~ /NOTICE/) { $Com = "notice ".$_[1]." "; $UserMsg = $_[4]; $Where = $_[1]; }
  125.     elsif($Event =~ /PRIVMSG/) { $Com = "notice ".$_[1]." "; $UserMsg = $_[4]; $Where = $_[1]; }
  126.     elsif($Event =~ /INVITE/) { $Com = "notice ".$_[1]." "; $UserMsg = $_[3]; $Where = $_[1]; if ($UserMsg !~ /Spp/i) { $irc->yield(join => $UserMsg); }} # Joins on invite, if it's not spp. heh.
  127.     elsif($Event =~ /JOIN/) { $Com = "notice ".$_[3]." "; $UserMsg = $_[3]; $Where = $_[1]; }
  128.     elsif($Event =~ /NICK/) { if($_[1] =~ /^$BotOwner$/i) { print "Owner changing...\n"; $BotOwner = Nickit($_[3]) } }
  129.     $UserNick = Nickit($_[1]);
  130.     $UserHost = $_[2];
  131.     $CurSec = SpamProtect();
  132.     $UserMsg = POE::Component::IRC::Common::strip_formatting(POE::Component::IRC::Common::strip_color($UserMsg));
  133.     if($Event =~ /(NOTICE|PRIVMSG)/) {
  134.         #####################
  135.         #   Owner commands  #
  136.         #####################
  137.         if($_[4] =~ /^~Do (.*)/i) {
  138.             @rray = split / > /, $1;
  139.             if($UserNick =~ /^$BotOwner$/i) {
  140.                 $irc->yield(@rray);
  141.             }
  142.         }
  143.         #####################
  144.         #        Wwolf      #
  145.         #####################
  146.         elsif($UserMsg =~ /^Start(.*)/i) {
  147.             ($tring = $1) =~ s/ //gs;
  148.             if($WW{"Mode"} =~ /Off/i) {
  149.                 if($tring =~ /^Pokemon$/i) {
  150.                     $WW{"Theme"} = 1;
  151.                 }
  152.                 elsif($tring =~ /^Boxxy$/i) {
  153.                     $WW{"Theme"} = 2;
  154.                 }
  155.                 elsif($tring =~ /^Deathnote$/i) {
  156.                     $WW{"Theme"} = 3;
  157.                 }
  158.                 else {
  159.                     $WW{"Theme"} = 0;
  160.                 }
  161.                 $WW{"Mode"} = "Starting";
  162.                 Command("privmsg #Powerplant ".(split /:ELSE:/, $Msg[0])[$WW{"Theme"}]);
  163.                 $Tmplayrs = join ":", @WWPlayers;
  164.                 ($Tmplayrs = $Tmplayrs.":".$UserNick) =~ s/^://gs;
  165.                 @WWPlayers = split /:/, $Tmplayrs;
  166.                 Command("privmsg #Powerplant ".$UserNick.(split /:ELSE:/, $Msg[1])[$WW{"Theme"}]);
  167.             }
  168.         }
  169.         elsif($UserMsg =~ /^target (.*)/i) {
  170.             $tring = Nickit($1);
  171.             $Tmplayrs = ":".(join ":", @WWPlayers).":";
  172.             if(($WW{"Mode"} =~ /Night/i) && ($Tmplayrs =~ /:${UserNick}:/i) && ($Tmplayrs =~ /:${tring}:/i)) {
  173.                 $Target{$UserNick} = $tring;
  174.                 Command($Com."You have set your target to ".$tring);
  175.             }
  176.         }
  177.         elsif($UserMsg =~ /^vote (.*)/i) {
  178.             $tring = Nickit($1);
  179.             $Tmplayrs = ":".(join ":", @WWPlayers).":";
  180.             if(($WW{"Mode"} =~ /Day/i) && ($Tmplayrs =~ /:${UserNick}:/i) && ($Tmplayrs =~ /:${tring}:/i)) {
  181.                 $Vote{$tring} = $Vote{$tring} + 1 + rand(0.5);
  182.                 Command("privmsg #Powerplant ".$tring." has been voted for!");
  183.             }
  184.         }
  185.         elsif(($UserMsg =~ /^Join$/i) && ($WW{"Mode"} =~ /Starting/i) && ($Tmplayrs !~ /$UserNick/i)){
  186.             $Tmplayrs = join ":", @WWPlayers;
  187.             ($Tmplayrs = $Tmplayrs.":".$UserNick) =~ s/^://gs;
  188.             @WWPlayers = split /:/, $Tmplayrs;
  189.             Command("privmsg #Powerplant ".$UserNick.(split /:ELSE:/, $Msg[1])[$WW{"Theme"}]);
  190.         }
  191.         elsif(($UserMsg =~ /^Begin$/i) && ($WW{"Mode"} =~ /Starting/i)){
  192.             &Begin();
  193.         }
  194.         elsif(($UserMsg =~ /^TimeDay$/i) && ($WW{"Mode"} =~ /Night/i)){
  195.             &Day();
  196.         }
  197.         elsif(($UserMsg =~ /^TimeNight$/i) && ($WW{"Mode"} =~ /Day/i)){
  198.             &Night();
  199.         }
  200.         elsif($UserMsg =~ /^Reset$/i){
  201.             while ( ($key, $value) = each %WW ) {
  202.                 $WW{$key} = "";
  203.             }
  204.             $Tmplayrs = "";
  205.             $WW{"Mode"} = "Off";
  206.             @WWPlayers = ("");
  207.         }
  208.         #####################
  209.         #        END        #
  210.         #####################
  211.     }
  212. }
  213. sub Begin {
  214.     if(@WWPlayers >= 4) {
  215.         Command("privmsg #Powerplant Enough players to start! Generating roles...");
  216.         $Wolfs = int(@WWPlayers/4);
  217.         foreach(@WWPlayers) {
  218.             $WWRole{$_} = (split /!/, $WWRoles[6])[$WW{"Theme"}];
  219.         }
  220.         @WWPlayers = shuffle(@WWPlayers);
  221.         $WWRole{$WWPlayers[0]} = (split /!/, $WWRoles[int(rand(@WWRoles))])[$WW{"Theme"}];
  222.         @WWPlayers = shuffle(@WWPlayers);
  223.         $WWRole{$WWPlayers[0]} = (split /!/, $WWRoles[int(rand(@WWRoles))])[$WW{"Theme"}];
  224.         @WWPlayers = shuffle(@WWPlayers);
  225.         $WWRole{$WWPlayers[0]} = (split /!/, $WWRoles[int(rand(@WWRoles))])[$WW{"Theme"}];
  226.         while($Wolfs > 0) {
  227.             @WWPlayers = shuffle(@WWPlayers);
  228.             $WWRole{$WWPlayers[0]} = (split /!/, $WWRoles[0])[$WW{"Theme"}];
  229.             $Wolfs--;
  230.         }
  231.         Command("privmsg #Powerplant If you got no notice, assume you are ".(split /!/, $WWRoles[6])[$WW{"Theme"}]);
  232.         &Night();
  233.     }
  234.     else {
  235.         Command("privmsg #Powerplant Not enough players ;o;");
  236.         while ( ($key, $value) = each %WW ) {
  237.             $WW{$key} = "";
  238.         }
  239.         $Tmplayrs = "";
  240.         $WW{"Mode"} = "Off";
  241.         @WWPlayers = ("");
  242.         $Wolf=0;
  243.     }
  244. }
  245. sub Night {
  246.     $Lynch{"Name"} = "!";
  247.     $Lynch{"Votes"} = 0;
  248.     while ( ($key, $value) = each %Vote ) {
  249.         if($Lynch{"Votes"} <= $value) {
  250.             $Lynch{"Votes"} = $value;
  251.             $Lynch{"Name"} = $key;
  252.         }
  253.     }
  254.     if($Lynch{"Name"} !~ /!/) {
  255.         Command("privmsg #Powerplant ".$Lynch{"Name"}." ".(split /:ELSE:/, $Msg[13])[$WW{"Theme"}]." ".$Lynch{"Name"}." was ".$WWRole{$Lynch{"Name"}}.".");
  256.         if($WWRoles[5] =~ /$WWRole{$Lynch{"Name"}}/) {
  257.             &End("Idiot");
  258.             return 0
  259.         }
  260.         delete $WWRole{$Lynch{"Name"}};
  261.         delete $Target{$Lynch{"Name"}};
  262.         chomp(@WWPlayers = grep(!/^$Lynch{"Name"}$/i, @WWPlayers));
  263.     }
  264.     &RolesxPlayers();
  265.     Command("privmsg #Powerplant ".(split /:ELSE:/, $Msg[2])[$WW{"Theme"}]);
  266.     while ( ($key, $value) = each %WWRole ) {
  267.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[3])[$WW{"Theme"}]) if($WWRoles[0] =~ /$value/i);
  268.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[4])[$WW{"Theme"}]) if($WWRoles[1] =~ /$value/i);
  269.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[5])[$WW{"Theme"}]) if($WWRoles[2] =~ /$value/i);
  270.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[6])[$WW{"Theme"}]) if($WWRoles[3] =~ /$value/i);
  271.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[7])[$WW{"Theme"}]) if($WWRoles[4] =~ /$value/i);
  272.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[8])[$WW{"Theme"}]) if($WWRoles[5] =~ /$value/i);
  273.     }
  274.     $WW{"Mode"} = "Night";
  275. }
  276. sub Day {
  277.     while ( ($key, $value) = each %Target ) {
  278.         Command("privmsg #Powerplant ".$value." ".(split /:ELSE:/, $Msg[9])[$WW{"Theme"}]." ".$value." was ".$WWRole{$value}.".") if($WWRoles[0] =~ /$WWRole{$key}/i);
  279.         delete $WWRole{$value} if($WWRoles[0] =~ /$WWRole{$key}/i);
  280.         delete $Target{$value} if($WWRoles[0] =~ /$WWRole{$key}/i);
  281.         chomp(@WWPlayers = grep(!/^$value$/i, @WWPlayers)) if($WWRoles[0] =~ /$WWRole{$key}/i);
  282.        
  283.         Command("notice ".$key." ".$value." is ".$WWRole{$value}) if($WWRoles[1] =~ /$WWRole{$key}/i);
  284.         Command("notice ".$key." ".(split /:ELSE:/, $Msg[10])[$WW{"Theme"}]." ".$Target{$key}) if($WWRoles[2] =~ /$WWRole{$key}/i);
  285.         Command("notice ".$key." You turn into ".$WWRole{$value}) if($WWRoles[3] =~ /$WWRole{$key}/i);
  286.         $WWRole{$key} = $WWRole{$value} if($WWRoles[3] =~ /$WWRole{$key}/i);
  287.     }
  288.     while ( ($key, $value) = each %Target ) {
  289.         delete $Target{$key};
  290.     }
  291.     &RolesxPlayers();
  292.     Command("privmsg #Powerplant It is now Daytime, here's the part where you vote.");
  293.     $WW{"Mode"} = "Day";
  294. }
  295. sub RolesxPlayers {
  296.     $tring = "";
  297.     while ( ($key, $value) = each %WWRole ) {
  298.         $Count{$value}++;
  299.         if($WWRoles[0] =~ /$value/i) {
  300.             $Wolf++;
  301.         }
  302.         else {
  303.             $Vill++;
  304.         }
  305.     }
  306.     while ( ($key, $value) = each %Count ) {
  307.         $tring = $tring.$key." x".$value.", ";
  308.     }
  309.     $tring =~ s/, $//gs;
  310.     Command("privmsg #Powerplant Living players, ".@WWPlayers." : ".(join ", ", @WWPlayers).".");
  311.     Command("privmsg #Powerplant Active roles, ".$tring.".");
  312.     $tring = "";
  313.     while ( ($key, $value) = each %Count ) {
  314.         delete $Count{$key};
  315.     }
  316.     if($Wolf == 0) { &End("Vill"); }
  317.     elsif($Vill == 1) { &End("Wolf"); }
  318.     $Wolf = 0;
  319.     $Vill = 0;
  320. }
  321. sub End {
  322.     if($_[0] =~ /Wolf/) {
  323.         Command("privmsg #Powerplant ".(split /:ELSE:/, $Msg[11])[$WW{"Theme"}]);
  324.         while ( ($key, $value) = each %WW ) {
  325.             $WW{$key} = "";
  326.         }
  327.         $Tmplayrs = "";
  328.         $WW{"Mode"} = "Off";
  329.         @WWPlayers = ("");
  330.         $Wolf=0;
  331.     }
  332.     if($_[0] =~ /Idiot/) {
  333.         Command("privmsg #Powerplant ".(split /:ELSE:/, $Msg[14])[$WW{"Theme"}]);
  334.         while ( ($key, $value) = each %WW ) {
  335.             $WW{$key} = "";
  336.         }
  337.         $Tmplayrs = "";
  338.         $WW{"Mode"} = "Off";
  339.         @WWPlayers = ("");
  340.         $Wolf=0;
  341.     }
  342.     else {
  343.         Command("privmsg #Powerplant ".(split /:ELSE:/, $Msg[12])[$WW{"Theme"}]);
  344.         while ( ($key, $value) = each %WW ) {
  345.             $WW{$key} = "";
  346.         }
  347.         $Tmplayrs = "";
  348.         $WW{"Mode"} = "Off";
  349.         @WWPlayers = ("");
  350.         $Wolf=0;
  351.     }
  352. }
  353. sub SpamProtect {
  354.     my($Sec, $Min, $Hour, $Day, $mon, $year, $WDay, $YDay) = localtime;
  355.     return (((($YDay * 24) * 60) * 60) + (($Hour * 60) * 60) + ($Min * 60) + $Sec);
  356. }
  357. sub Regexit {
  358.     ($Reg = $_[0]) =~ s/\\/\\\\/gs;
  359.     $Reg =~ s/(\?|\(|\)|\||\[|\|\.)/\\$1/gs;
  360.     $Reg =~ s/\*/\(\.\*\)/gs;
  361.     return $Reg;
  362. }
  363. sub Nickit {
  364.     ($Reg = $_[0]) =~ s/\\/_/gs;
  365.     $Reg =~ s/(\?|\(|\)|\||\[|\|\{|\}|\.)/_/gs;
  366.     return $Reg;
  367. }
  368. sub Command {
  369.     $PrivmsgA = $_[0];
  370.     @PrivmsgB = split / /, $PrivmsgA;
  371.     $ComA = shift(@PrivmsgB);
  372.     $ComB = shift(@PrivmsgB);
  373.     if($BotNick =~ /Luka/i) { $BotFont = "〜"; $irc->yield($ComA => $ComB => POE::Component::IRC::Common::MAGENTA.(join " ", @PrivmsgB)." 〜"); }
  374.     else { $irc->yield($ComA => $ComB => POE::Component::IRC::Common::TEAL.(join " ", @PrivmsgB).""); }
  375. }
  376. sub GetTime { # This is just for timestamps, just leave it.
  377.     my($Sec, $Min, $Hour, $Day, $Mon, $Year, $WDay, $YDay) = localtime;
  378.     my $APM = "AM";
  379.     if($Hour > 12) { $Hour -= 12; $APM = "PM"; }
  380.     if($Hour < 10) { $Hour = "0".$Hour; }
  381.     if($Min < 10) { $Min = "0".$Min; }
  382.     if($Sec < 10) { $Sec = "0".$Sec; }
  383.     return "[ $Hour:$Min:$Sec $APM ]    ";
  384. }
  385. # Caaz was here.
  386. $poe_kernel->run();
  387. exit 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement