Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7079e203a8 | ||
|
|
727062b14b | ||
|
|
df31622f82 | ||
|
|
76d2c03281 | ||
|
|
303e03f4ee | ||
|
|
99bb0721ba | ||
|
|
6f9e6f0d5d | ||
|
|
ccab5e9ab9 | ||
|
|
03c1616364 | ||
|
|
193461abf4 | ||
|
|
f1a9b91a30 | ||
|
|
f3ad8e0e38 | ||
|
|
81ff64ba4f | ||
|
|
33b50a651a | ||
|
|
fdfc249ba8 | ||
|
|
f68646d155 | ||
|
|
6357c54574 | ||
|
|
a8ea3f0e64 | ||
|
|
3fdf7dcaf5 | ||
|
|
105e83699d | ||
|
|
338551b44c | ||
|
|
412261f478 | ||
|
|
988e93a6f1 | ||
|
|
6c4ff75a03 | ||
|
|
362310b863 | ||
|
|
a2002882d6 | ||
|
|
3ebe82ec28 | ||
|
|
42faabeef5 | ||
|
|
21fb5d4974 | ||
|
|
8147e9e32a | ||
|
|
0864f549d1 | ||
|
|
ba5de67e4a | ||
|
|
3bd8e9369d | ||
|
|
e33fd1df8d | ||
|
|
3ef78078c4 | ||
|
|
a1beabe76a | ||
|
|
f12b7ef527 | ||
|
|
ed56d53f1e | ||
|
|
e590c0dee3 | ||
|
|
9fca160de5 | ||
|
|
28e29f2dba | ||
|
|
c30f300b24 | ||
|
|
0d9a714c4a | ||
|
|
87ff93945f | ||
|
|
c13a4e2ffe | ||
|
|
42fcac5cc0 | ||
|
|
01a432f023 | ||
|
|
a47211763c | ||
|
|
8cddc69209 | ||
|
|
b6eb0c17cc | ||
|
|
38b3e4c3d8 | ||
|
|
503a7ed990 | ||
|
|
579485776d | ||
|
|
f5db549052 | ||
|
|
72006a8e7e | ||
|
|
2ca0885741 | ||
|
|
6c6b8604bc | ||
|
|
da28c54652 | ||
|
|
f0b49acbd0 | ||
|
|
58447eb40a | ||
|
|
363a724ed3 | ||
|
|
a122977644 | ||
|
|
51f30e6346 | ||
|
|
82c0201c34 | ||
|
|
3da9a98feb | ||
|
|
ee1bf65766 | ||
|
|
69927a21de | ||
|
|
bb10d54844 | ||
|
|
1adcd0323b | ||
|
|
743bee7424 | ||
|
|
56b55d8370 | ||
|
|
8ec0a389d5 | ||
|
|
a9d6e3482b | ||
|
|
ae9401bf7d | ||
|
|
c818d13e04 | ||
|
|
cf6a99e170 | ||
|
|
516d11a5f7 | ||
|
|
dc96422598 | ||
|
|
e525af97a7 | ||
|
|
60e9bca86d | ||
|
|
8b3f287a49 | ||
|
|
da15ed72e8 | ||
|
|
76e903bb87 | ||
|
|
36b3761977 | ||
|
|
a6da576144 | ||
|
|
a2975d4859 | ||
|
|
a328fc45cd | ||
|
|
38015434e1 | ||
|
|
fe353984c2 | ||
|
|
d31b16200e | ||
|
|
9a526e1427 | ||
|
|
8ddd4f5bae | ||
|
|
1ef6814e9b | ||
|
|
37030d7a55 | ||
|
|
94db7280ff | ||
|
|
50f577470e | ||
|
|
6dd9ab5322 | ||
|
|
1e45c53d38 | ||
|
|
07d9c19b53 | ||
|
|
a79e6f3801 | ||
|
|
1bcc849083 | ||
|
|
31428c8089 | ||
|
|
8f58cb3c9f | ||
|
|
bc287589bb | ||
|
|
de3e914e3d | ||
|
|
e868892f51 | ||
|
|
ce8ef76363 | ||
|
|
06f22be92b | ||
|
|
d12c139829 | ||
|
|
3a8c2f31ba | ||
|
|
051c189fe8 | ||
|
|
6035a0fdb5 | ||
|
|
6539bd5fed | ||
|
|
8780cf5b93 | ||
|
|
a357eab962 | ||
|
|
e2038ed983 | ||
|
|
2469d636f5 | ||
|
|
176f861d2c | ||
|
|
68e9f59267 | ||
|
|
48864ee9fb |
No files matched your search
@@ -7,18 +7,18 @@
|
||||
|
||||
3.0
|
||||
|
||||
|
||||
The future of IRC bots is here! Xelhua gives to you, Auto 3.0, a new version of
|
||||
the popular Auto IRC bot.
|
||||
|
||||
In this alpha9 release, we have added:
|
||||
In this alpha11 release, we have added:
|
||||
|
||||
None
|
||||
* Ping: Speed improvements.
|
||||
* An advanced IRC version of the popular party game Werewolf (AKA Mafia).
|
||||
* Commands with prefixes now work in PM's too.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* UNO: Fixed a formatting issue in duration.
|
||||
* QDB: Fixed an exploit in QDB RAND.
|
||||
* Fixed significant state mismatched data bugs.
|
||||
|
||||
Incompatibilities:
|
||||
|
||||
@@ -32,4 +32,4 @@ created by anyone and uploaded there for everyone to use.
|
||||
Auto's goal is to create an efficient, stable and highly customizable IRC bot
|
||||
in Perl. To offer an alternative to other platforms.
|
||||
|
||||
Enjoy Auto 3.0.0 Alpha 9!
|
||||
Enjoy Auto 3.0.0 Alpha 11!
|
||||
@@ -9,7 +9,6 @@ use strict;
|
||||
use warnings;
|
||||
no feature qw(state);
|
||||
use POSIX;
|
||||
use locale;
|
||||
use English qw(-no_match_vars);
|
||||
use Sys::Hostname;
|
||||
use IO::Socket;
|
||||
@@ -148,14 +147,10 @@ our ($DEBUG, $NUC);
|
||||
my ($opt_help, $opt_version, $USECONFIG);
|
||||
GetOptions(
|
||||
'nuc' => \$NUC,
|
||||
'c=s' => \$USECONFIG,
|
||||
'config=s' => \$USECONFIG,
|
||||
'h' => \$opt_help,
|
||||
'help' => \$opt_help,
|
||||
'd' => \$DEBUG,
|
||||
'debug' => \$DEBUG,
|
||||
'v' => \$opt_version,
|
||||
'version' => \$opt_version
|
||||
'config|c=s' => \$USECONFIG,
|
||||
'h|help' => \$opt_help,
|
||||
'debug|d' => \$DEBUG,
|
||||
'version|v' => \$opt_version,
|
||||
);
|
||||
|
||||
# If we were passed -h, print help.
|
||||
@@ -306,18 +301,6 @@ given (lc((conf_get('database:format'))[0][0])) {
|
||||
(conf_get('database:username'))[0][0], (conf_get('database:password'))[0][0]) or err(2, 'Failed to connect to database!', 1);;
|
||||
}
|
||||
}
|
||||
# CSV no work. :(
|
||||
#when ('csv') {
|
||||
# # CSV.
|
||||
# if ($ENFEAT !~ /csv/) { err(2, 'Auto not built with CSV support.', 1) }
|
||||
# if (!conf_get('database:dir')) { err(2, 'Missing required configuration value database:dir. Aborting.', 1) }
|
||||
#
|
||||
# # Import DBD::CSV.
|
||||
# require DBD::CSV;
|
||||
#
|
||||
# # Connect to database.
|
||||
# $DB = DBI->connect("dbi:CSV:f_dir=$bin{etc}/".(conf_get('database:dir'))[0][0]) or err(2, 'Failed to connect to database!', 1);
|
||||
#}
|
||||
when ('pgsql') {
|
||||
# PostgreSQL.
|
||||
if ($ENFEAT !~ /pgsql/) { err(2, 'Auto not built with PostgreSQL support. Aborting.', 1) }
|
||||
@@ -498,6 +481,7 @@ if (conf_get('aliases:alias')) {
|
||||
while (1) {
|
||||
# Timer check.
|
||||
foreach my $tk (keys %TIMERS) {
|
||||
if (exists $TIMERS{$tk}) {
|
||||
if ($TIMERS{$tk}{time} <= time) {
|
||||
&{ $TIMERS{$tk}{sub} }();
|
||||
if ($TIMERS{$tk}{type} == 1) {
|
||||
@@ -514,6 +498,7 @@ while (1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# Socket check.
|
||||
foreach my $sock ($SELECT->can_read(1)) {
|
||||
# Figure out what network is sending us data.
|
||||
@@ -568,7 +553,7 @@ sub socksnd {
|
||||
my ($svr, $data) = @_;
|
||||
|
||||
if (defined $SOCKET{$svr}) {
|
||||
syswrite $SOCKET{$svr}, $data."\r\n", POSIX::BUFSIZ, 0;
|
||||
syswrite $SOCKET{$svr}, "$data\r\n", POSIX::BUFSIZ, 0;
|
||||
dbug "$svr << $data";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,62 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
===============================================================================
|
||||
* Werewolf 1.07: Various improvements.
|
||||
* Updated Core::IRC::Users to be more efficient.
|
||||
* Added a WerewolfAdmin module for administering the Werewolf IRC game.
|
||||
* Fixed significant state mismatched data bugs.
|
||||
* Added API::IRC::ison for checking if a user is on a channel.
|
||||
* Werewolf: Fixed a bug in harlot staying home.
|
||||
* Werewolf: Various bug fixes.
|
||||
* Werewolf 1.06: Fixed an annoyance and added traitor transformation.
|
||||
* Commands now work with prefixes even in PM.
|
||||
* Ping: Determines end by numeric 315 instead of a 3-second timer now.
|
||||
* Werewolf: Fixed a GUARD issue and made it possible to VISIT yourself.
|
||||
* Possibly fixed a rare fatal error.
|
||||
* Werewolf: Rewrote WAIT to be more decent.
|
||||
* Werewolf: Wounded villagers are now excluded from winning villager count.
|
||||
* Werewolf: Dynamic lynch and no victim messages.
|
||||
* Werewolf 1.05: Added WAIT command.
|
||||
* Werewolf: Improved STATS to be smart.
|
||||
* Werewolf 1.04: Added village drunks and fixed other issues.
|
||||
* Werewolf: Fixed various annoyances. Also raised chance of gun hitting.
|
||||
* Werewolf: Fixed a nasty lynch nick exploit.
|
||||
* Fixed an issue in HELP.
|
||||
* Added a Ping module.
|
||||
* Moved Werewolf back to stable.
|
||||
|
||||
3.0 Alpha 10
|
||||
===============================================================================
|
||||
* Werewolf moved to unstable/ for exclusion from alpha10.
|
||||
* Werewolf: Fixed a bug causing double lynches occasionally.
|
||||
* Werewolf: One bug fix and multiple bullets.
|
||||
* Werewolf: Fixed timeout bug.
|
||||
* Werewolf: Fixed various warnings.
|
||||
* Werewolf: Handful of bugs fixed, timeouts rewritten, wolf assignment
|
||||
rewritten. (see ROLES:Werewolf)
|
||||
* Werewolf: Fixed an annoyance in VOTES.
|
||||
* Werewolf: Fixed another round of bugs.
|
||||
* Werewolf: Fixed a grammatical error. Thanks TAD!
|
||||
* Werewolf: Fixed a bug that occasionally caused a person to get wolf
|
||||
twice in the same game.
|
||||
* Werewolf: Fixed a typo that broke the gun on occasion.
|
||||
* Fixed a minor retract bug in Werewolf.
|
||||
* Fixed two major bugs in Werewolf that messed up game play.
|
||||
* Fixed several bugs and changed around JOIN/START/BEGIN in Werewolf.
|
||||
* Fixed parsing of host masks with / in them. (if it was broken)
|
||||
* Werewolf: Fixed a leave before game begin bug.
|
||||
* Aliases now work in PM's to the bot too.
|
||||
* Added an epic, Werewolf module.
|
||||
* Made slog() saner.
|
||||
* Syntax for mod_init() changed. Package name is no longer required.
|
||||
* Added German translation to Greet help hash. - nridley
|
||||
* Added German translation to FML help hash. - nridley
|
||||
* Added German translation to Eval help hash. - nridley
|
||||
* Added German translation to EightBall help hash. - nridley
|
||||
* Added German translation to Dictionary help hash. - nridley
|
||||
* Added German translation to Calc help hash. - nridley
|
||||
* Added German translation to Bitly help hash. - nridley
|
||||
* Added German translation to AUR help hash. - nridley
|
||||
|
||||
3.0 Alpha 9
|
||||
===============================================================================
|
||||
|
||||
@@ -9,6 +9,10 @@ Chazz "Alexandria" Wolcott <alyx@woomoo.org>
|
||||
|
||||
Matthew "Mab879" Burket <matthew@assignitapp.com>
|
||||
- Spanish translations
|
||||
Noah "nridley" Ridley <nridley44@gmail.com>
|
||||
- Various.
|
||||
Eitan "variable" Adler <lists@eitanadler.com>
|
||||
- Werewolf improvements.
|
||||
|
||||
-----------------------------------------------
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ Legend:
|
||||
|
||||
[ ] Cleanup
|
||||
[ ] Replace println with Perl 5.10's say.
|
||||
[ ] Fix inconsistencies in official modules
|
||||
|
||||
[X] Language
|
||||
[X] Create method of translation.
|
||||
@@ -42,18 +43,18 @@ Legend:
|
||||
|
||||
[!] Features
|
||||
[X] Weather module
|
||||
[!] Urban Dictionary module
|
||||
[ ] Urban Dictionary module
|
||||
[X] UNO module
|
||||
[ ] Google Search module
|
||||
[ ] IRC Relay module
|
||||
[ ] (Google?) News module
|
||||
[X] QDB module
|
||||
[ ] Tumblr module
|
||||
[!] Tumblr module
|
||||
[X] Google Calculator module
|
||||
[ ] YouTube Search module
|
||||
[ ] Twitter module
|
||||
[X] Advanced Topics module
|
||||
[ ] Custom Triggers module
|
||||
[!] Custom Triggers module
|
||||
[X] Shorten URL (bit.ly?) module
|
||||
[?] Bot Talk module
|
||||
[O] Minecraft<->IRC module
|
||||
|
||||
+24
-2
@@ -9,7 +9,7 @@ use Exporter;
|
||||
use base qw(Exporter);
|
||||
|
||||
our @EXPORT_OK = qw(ban cjoin cpart cmode umode kick privmsg notice quit nick names
|
||||
topic who usrc match_mask);
|
||||
topic who whois usrc match_mask ison);
|
||||
|
||||
# Create the on_disconnect event.
|
||||
API::Std::event_add('on_disconnect');
|
||||
@@ -130,6 +130,18 @@ sub act {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Check if a given nickname is on a channel.
|
||||
sub ison {
|
||||
my ($svr, $chan, $nick) = @_;
|
||||
$chan = lc $chan;
|
||||
|
||||
if (!exists $State::IRC::chanusers{$svr}) { return }
|
||||
if (!exists $State::IRC::chanusers{$svr}{$chan}) { return }
|
||||
if (!exists $State::IRC::chanusers{$svr}{$chan}{lc $nick}) { return }
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Change bot nickname.
|
||||
sub nick {
|
||||
my ($svr, $newnick) = @_;
|
||||
@@ -194,6 +206,15 @@ sub who {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Send a WHOIS.
|
||||
sub whois {
|
||||
my ($svr, $nick) = @_;
|
||||
|
||||
Auto::socksnd($svr, "WHOIS $nick");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Get nick, ident and host from a <nick>!<ident>@<host>
|
||||
sub usrc {
|
||||
my ($ex) = @_;
|
||||
@@ -216,9 +237,10 @@ sub match_mask {
|
||||
$mh =~ s/\./\\\./gxsm;
|
||||
$mh =~ s/\?/\./gxsm;
|
||||
$mh =~ s/\*/\.\*/gxsm;
|
||||
$mh =~ s/\//\\\//gxsm;
|
||||
$mh = q{^}.$mh.q{$};
|
||||
|
||||
# Let's grep the user's mask.
|
||||
# Let's match the user's mask.
|
||||
if ($mu =~ m/$mh/xsm) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -113,6 +113,9 @@ sub slog
|
||||
if (conf_get('logchan')) {
|
||||
# It is, continue.
|
||||
|
||||
# Don't even bother with continuing if there are *NO* connections.
|
||||
if (!keys %Auto::SOCKET) { return }
|
||||
|
||||
# Split the network and channel.
|
||||
my ($net, $chan) = split m/[\/]/xsm, (conf_get('logchan'))[0][0];
|
||||
$chan = lc $chan;
|
||||
|
||||
+3
-2
@@ -17,7 +17,8 @@ our @EXPORT_OK = qw(conf_get trans err awarn timer_add timer_del cmd_add
|
||||
|
||||
# Initialize a module.
|
||||
sub mod_init {
|
||||
my ($name, $author, $version, $autover, $pkg) = @_;
|
||||
my ($name, $author, $version, $autover) = @_;
|
||||
my $pkg = caller 0;
|
||||
|
||||
# Log/debug.
|
||||
API::Log::dbug('MODULES: Attempting to load '.$name.' (version '.$version.') by '.$author.'...');
|
||||
@@ -25,7 +26,7 @@ sub mod_init {
|
||||
if (keys %Auto::SOCKET) { API::Log::slog('MODULES: Attempting to load '.$name.' (version '.$version.') by '.$author.'...') }
|
||||
|
||||
# Check if this module is compatible with this version of Auto.
|
||||
if ($autover !~ m/^3\.0\.0a(7|8|9)$/xsm) {
|
||||
if ($autover !~ m/^3\.0\.0a(7|8|9|10|11)$/xsm) {
|
||||
API::Log::dbug('MODULES: Failed to load '.$name.': Incompatible with your version of Auto.');
|
||||
API::Log::alog('MODULES: Failed to load '.$name.': Incompatible with your version of Auto.');
|
||||
if (keys %Auto::SOCKET) { API::Log::slog('MODULES: Failed to load '.$name.': Incompatible with your version of Auto.') }
|
||||
|
||||
+9
-4
@@ -265,9 +265,9 @@ sub cmd_help
|
||||
# Help for a specific command was requested. Lets get it.
|
||||
my $rcm = uc($argv[0]);
|
||||
|
||||
if (defined $API::Std::CMDS{$rcm}{help}) {
|
||||
# If there is help for this command.
|
||||
|
||||
if (exists $API::Std::CMDS{$rcm}) {
|
||||
if (exists $API::Std::CMDS{$rcm}{help}) {
|
||||
# Check for necessary privileges.
|
||||
if ($API::Std::CMDS{$rcm}{priv}) {
|
||||
if (!has_priv(match_user(%$src), $API::Std::CMDS{$rcm}{priv})) {
|
||||
@@ -282,13 +282,13 @@ sub cmd_help
|
||||
# Get the language.
|
||||
my ($lang, undef) = split('_', $Auto::LOCALE);
|
||||
|
||||
if (defined ${ $API::Std::CMDS{$rcm}{help} }{$lang}) {
|
||||
if (exists ${ $API::Std::CMDS{$rcm}{help} }{$lang}) {
|
||||
# If help for this command is available in the configured language.
|
||||
notice($src->{svr}, $src->{nick}, "Help for \002".$rcm."\002: ".${ $API::Std::CMDS{$rcm}{help} }{$lang});
|
||||
}
|
||||
else {
|
||||
# If it isn't, default to English.
|
||||
if (defined ${ $API::Std::CMDS{$rcm}{help} }{en}) {
|
||||
if (exists ${ $API::Std::CMDS{$rcm}{help} }{en}) {
|
||||
# If help for this command is available in English.
|
||||
notice($src->{svr}, $src->{nick}, "Help for \002".$rcm."\002: ".${ $API::Std::CMDS{$rcm}{help} }{en});
|
||||
}
|
||||
@@ -308,6 +308,11 @@ sub cmd_help
|
||||
notice($src->{svr}, $src->{nick}, "No help for \002".$rcm."\002 available.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
# If there is no help, don't give any.
|
||||
notice($src->{svr}, $src->{nick}, "No help for \002".$rcm."\002 available.");
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
+32
-4
@@ -26,7 +26,7 @@ hook_add("on_uprivmsg", "ctcp_version_reply", sub {
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Command alias parsing.
|
||||
# Command alias parsing for channel messages.
|
||||
hook_add('on_cprivmsg', 'irc.commands.aliases', sub {
|
||||
my (($src, $chan, ($cmd, @args))) = @_;
|
||||
|
||||
@@ -61,6 +61,35 @@ hook_add('on_cprivmsg', 'irc.commands.aliases', sub {
|
||||
return 1;
|
||||
});
|
||||
|
||||
# Command alias parsing for private messages.
|
||||
hook_add('on_uprivmsg', 'irc.commands.aliases', sub {
|
||||
my (($src, ($cmd, @args))) = @_;
|
||||
my $cprefix = (conf_get('fantasy_pf'))[0][0];
|
||||
if (substr($cmd, 0, 1) eq $cprefix) { $cmd = substr $cmd, 1 }
|
||||
|
||||
# Check for an alias.
|
||||
if (defined $API::Std::ALIASES{uc $cmd}) {
|
||||
# Get aliased command.
|
||||
my @actual;
|
||||
if ($API::Std::ALIASES{uc $cmd} =~ m/ /xsm) { @actual = split /\s/xsm, $API::Std::ALIASES{uc $cmd} }
|
||||
else { @actual = ($API::Std::ALIASES{uc $cmd}) }
|
||||
# Prepare data.
|
||||
my @msg = (
|
||||
q{:}.$src->{nick}.q{!}.$src->{user}.q{@}.$src->{host},
|
||||
'PRIVMSG',
|
||||
$State::IRC::botinfo{$src->{svr}}{nick},
|
||||
q{:}.$actual[0],
|
||||
);
|
||||
# Rest of the data.
|
||||
if (scalar @actual > 1) { for (1..$#actual) { push @msg, $actual[$_] } }
|
||||
if (defined $args[0]) { foreach (@args) { push @msg, $_ } }
|
||||
# Simulate a PRIVMSG.
|
||||
Proto::IRC::privmsg($src->{svr}, @msg);
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
# QUIT hook; delete user from chanusers.
|
||||
hook_add("on_quit", "quit_update_chanusers", sub {
|
||||
my (($src, undef)) = @_;
|
||||
@@ -68,7 +97,7 @@ hook_add("on_quit", "quit_update_chanusers", sub {
|
||||
|
||||
# Delete the user from all channels.
|
||||
foreach my $ccu (keys %{ $State::IRC::chanusers{$src{svr}}}) {
|
||||
if (defined $State::IRC::chanusers{$src{svr}}{$ccu}{$src{nick}}) { delete $State::IRC::chanusers{$src{svr}}{$ccu}{$src{nick}} }
|
||||
if (defined $State::IRC::chanusers{$src{svr}}{$ccu}{lc $src{nick}}) { delete $State::IRC::chanusers{$src{svr}}{$ccu}{lc $src{nick}} }
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -206,8 +235,7 @@ hook_add('on_isupport', 'core.prefixchanmode.getdata', sub {
|
||||
return 1;
|
||||
});
|
||||
|
||||
sub clear_usercmd_timer
|
||||
{
|
||||
sub clear_usercmd_timer {
|
||||
# If ratelimit is set to 1 in config, add this timer.
|
||||
if ((conf_get('ratelimit'))[0][0] eq 1) {
|
||||
# Clear usercmd hash every X seconds.
|
||||
|
||||
@@ -28,14 +28,8 @@ hook_add('on_rcjoin', 'ircusers.onjoin', sub {
|
||||
hook_add('on_namesreply', 'ircusers.names', sub {
|
||||
my ($svr, $chan, undef) = @_;
|
||||
|
||||
# Iterate through the users for this channel.
|
||||
foreach (keys %{$State::IRC::chanusers{$svr}{$chan}}) {
|
||||
# Check if the user already exists.
|
||||
if (!$users{$svr}{$_}) {
|
||||
# They do not; WHO them.
|
||||
API::IRC::who($svr, $_);
|
||||
}
|
||||
}
|
||||
# WHO the channel.
|
||||
API::IRC::who($svr, $chan);
|
||||
|
||||
return 1;
|
||||
});
|
||||
|
||||
@@ -211,6 +211,7 @@ sub ircsock {
|
||||
$Auto::SOCKET{$svrname} = IO::Socket::INET->new(%conndata) or # Or error.
|
||||
err(2, 'Failed to connect to server ('.$ERRNO.'): '.$svrname.' ['.$cdata->{'host'}[0].q{:}.$cdata->{'port'}[0].']', 0)
|
||||
and delete $Auto::SOCKET{$svrname} and next;
|
||||
binmode($Auto::SOCKET{$svrname}, ':encoding(UTF-8)');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ sub installmods
|
||||
chomp $response;
|
||||
if (lc $response eq 'y') {
|
||||
println 'What modules would you like to install? (separate by commas)';
|
||||
println 'Available modules: AUR, Badwords, Bitly, BotStats, Calc, ChanTopics, Dictionary, EightBall, Eval, FML, Greet, HelloChan, IsItUp, LinkTitle, LOLCAT, Oper, QDB, SASLAuth, UNO, Weather';
|
||||
println 'Available modules: AUR, Badwords, Bitly, BotStats, Calc, ChanTopics, Dictionary, EightBall, Eval, FML, Greet, HelloChan, IsItUp, LinkTitle, LOLCAT, Oper, QDB, SASLAuth, UNO, Weather, Werewolf';
|
||||
print '> ';
|
||||
my $modules = <STDIN>; chomp $modules;
|
||||
$modules =~ s/ //g;
|
||||
|
||||
+17
-15
@@ -359,7 +359,7 @@ sub cjoin {
|
||||
}
|
||||
else {
|
||||
# It isn't. Update chanusers and trigger on_rcjoin.
|
||||
$State::IRC::chanusers{$svr}{lc $chan}{$src{nick}} = 1;
|
||||
$State::IRC::chanusers{$svr}{lc $chan}{lc $src{nick}} = 1;
|
||||
$src{svr} = $svr;
|
||||
API::Std::event_run("on_rcjoin", (\%src, $chan));
|
||||
}
|
||||
@@ -374,9 +374,6 @@ sub kick {
|
||||
my %src = API::IRC::usrc(substr($ex[0], 1));
|
||||
$src{svr} = $svr;
|
||||
|
||||
# Update chanusers.
|
||||
delete $State::IRC::chanusers{$svr}{$ex[2]}{$ex[3]} if defined $State::IRC::chanusers{$svr}{$ex[2]}{$ex[3]};
|
||||
|
||||
# Set $msg to the kick message.
|
||||
my $msg = 0;
|
||||
if (defined $ex[4]) {
|
||||
@@ -393,7 +390,7 @@ sub kick {
|
||||
# We were kicked!
|
||||
|
||||
# Delete channel from botchans.
|
||||
delete $botchans{$svr}{$ex[2]};
|
||||
delete $botchans{$svr}{lc $ex[2]};
|
||||
|
||||
# Log this horrible act.
|
||||
API::Log::alog("I was kicked from ".$svr."/".$ex[2]." by ".$src{nick}."! Reason: ".$msg);
|
||||
@@ -410,7 +407,7 @@ sub kick {
|
||||
}
|
||||
else {
|
||||
# We weren't. Update chanusers and trigger on_kick.
|
||||
if (defined $State::IRC::chanusers{$svr}{$ex[2]}{$ex[3]}) { delete $State::IRC::chanusers{$svr}{$ex[2]}{$ex[3]} }
|
||||
if (defined $State::IRC::chanusers{$svr}{lc $ex[2]}{lc $ex[3]}) { delete $State::IRC::chanusers{$svr}{lc $ex[2]}{lc $ex[3]} }
|
||||
API::Std::event_run("on_kick", (\%src, $ex[2], $ex[3], $msg));
|
||||
}
|
||||
|
||||
@@ -423,7 +420,7 @@ sub mode {
|
||||
|
||||
if ($ex[2] ne $State::IRC::botinfo{$svr}{nick}) {
|
||||
# Set data we'll need later.
|
||||
my $chan = $ex[2];
|
||||
my $chan = lc $ex[2];
|
||||
$ex[3] =~ s/^://xsm;
|
||||
my $modes = $ex[3];
|
||||
my $fmodes = join ' ', @ex[3..$#ex];
|
||||
@@ -467,10 +464,11 @@ sub mode {
|
||||
|
||||
if ($nnt) {
|
||||
# It is a status mode, lets parse changes.
|
||||
my $user = shift(@ex);
|
||||
my $user = lc shift @ex;
|
||||
|
||||
if (defined $State::IRC::chanusers{$svr}{$chan}{$user}) {
|
||||
if ($op == 1) {
|
||||
return if $State::IRC::chanusers{$svr}{$chan}{$user} =~ m/$maf/xsm;
|
||||
if ($State::IRC::chanusers{$svr}{$chan}{$user} eq 1) {
|
||||
$State::IRC::chanusers{$svr}{$chan}{$user} = $maf;
|
||||
}
|
||||
@@ -531,9 +529,9 @@ sub nick {
|
||||
else {
|
||||
# It isn't. Update chanusers and trigger on_nick.
|
||||
foreach my $chk (keys %{ $State::IRC::chanusers{$svr} }) {
|
||||
if (defined $State::IRC::chanusers{$svr}{$chk}{$src{nick}}) {
|
||||
$State::IRC::chanusers{$svr}{$chk}{$nex} = $State::IRC::chanusers{$svr}{$chk}{$src{nick}};
|
||||
delete $State::IRC::chanusers{$svr}{$chk}{$src{nick}};
|
||||
if (defined $State::IRC::chanusers{$svr}{$chk}{lc $src{nick}}) {
|
||||
$State::IRC::chanusers{$svr}{$chk}{lc $nex} = $State::IRC::chanusers{$svr}{$chk}{lc $src{nick}};
|
||||
delete $State::IRC::chanusers{$svr}{$chk}{lc $src{nick}};
|
||||
}
|
||||
}
|
||||
API::Std::event_run("on_nick", (\%src, $nex));
|
||||
@@ -572,13 +570,13 @@ sub part {
|
||||
# Check if it's from us or someone else.
|
||||
if ($src{nick} eq $State::IRC::botinfo{$svr}{nick}) {
|
||||
# Delete this channel from botchans.
|
||||
if ($botchans{$svr}{$ex[2]}) { delete $botchans{$svr}{$ex[2]} }
|
||||
if ($botchans{$svr}{lc $ex[2]}) { delete $botchans{$svr}{lc $ex[2]} }
|
||||
# Trigger on_upart.
|
||||
API::Std::event_run('on_upart', ($svr, $ex[2]));
|
||||
}
|
||||
else {
|
||||
# Delete them from chanusers.
|
||||
delete $State::IRC::chanusers{$svr}{$ex[2]}{$src{nick}} if defined $State::IRC::chanusers{$svr}{$ex[2]}{$src{nick}};
|
||||
delete $State::IRC::chanusers{$svr}{lc $ex[2]}{lc $src{nick}} if defined $State::IRC::chanusers{$svr}{lc $ex[2]}{lc $src{nick}};
|
||||
|
||||
# Set $msg to the part message.
|
||||
my $msg = 0;
|
||||
@@ -624,9 +622,13 @@ sub privmsg {
|
||||
if (lc($ex[2]) eq lc($State::IRC::botinfo{$svr}{nick})) {
|
||||
# It is coming to us in a private message.
|
||||
|
||||
# Check for a prefix.
|
||||
$cprefix = (conf_get('fantasy_pf'))[0][0];
|
||||
|
||||
# Ensure it's a valid length.
|
||||
if (length($ex[3]) > 1) {
|
||||
$cmd = uc(substr($ex[3], 1));
|
||||
if (length($ex[3]) > 2) {
|
||||
$cmd = uc substr $ex[3], 1;
|
||||
if (substr($cmd, 0, 1) eq $cprefix) { $cmd = substr $cmd, 1 }
|
||||
if (defined $API::Std::CMDS{$cmd}) {
|
||||
# If this is indeed a command, continue.
|
||||
if ($API::Std::CMDS{$cmd}{lvl} == 1 or $API::Std::CMDS{$cmd}{lvl} == 2) {
|
||||
|
||||
@@ -10,6 +10,7 @@ our (%chanusers, %botinfo);
|
||||
# Create on_namesreply hook.
|
||||
hook_add('on_namesreply', 'state.irc.names', sub {
|
||||
my ($svr, $chan, @data) = @_;
|
||||
$chan = lc $chan;
|
||||
|
||||
# Delete the old chanusers hash if it exists.
|
||||
if (defined $chanusers{$svr}{$chan}) { delete $chanusers{$svr}{$chan} }
|
||||
|
||||
+5
-3
@@ -26,9 +26,11 @@ sub _void {
|
||||
}
|
||||
|
||||
|
||||
# Help hash for AUR. Spanish, French and German translations needed.
|
||||
# Help hash for AUR. Spanish and French translations needed.
|
||||
our %HELP_AUR = (
|
||||
'en' => "This command allows you to lookup a module in the Arch Linux AUR. \002Syntax:\002 AUR <module>",
|
||||
en => "This command allows you to lookup a module in the Arch Linux AUR. \2Syntax:\2 AUR <module>",
|
||||
de => "Dieser Befehl ermoeglicht du auf nachschlagst ein Modul in der Arch Linux AUR. \2Syntax:\2 AUR <module>",
|
||||
fr => "Cette commande vous permet de rechercher un module dans le Arch Linux AUR. \2Syntaxe:\2 AUR <module>",
|
||||
);
|
||||
|
||||
# Callback for AUR command.
|
||||
@@ -63,7 +65,7 @@ sub cmd_aur {
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('AUR', 'Xelhua', '1.00', '3.0.0a8', __PACKAGE__);
|
||||
API::Std::mod_init('AUR', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=WWW::AUR perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
+2
-2
@@ -70,7 +70,7 @@ sub actonbadword
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('Badwords', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Badwords', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -121,7 +121,7 @@ Changing the obvious to your wish.
|
||||
|
||||
=over
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
+9
-7
@@ -13,8 +13,8 @@ use URI::Escape;
|
||||
sub _init
|
||||
{
|
||||
# Check for required configuration values.
|
||||
if (!(conf_get('bitly:user'))[0][0] or !(conf_get('bitly:key'))[0][0]) {
|
||||
err(2, 'Please verify that you have bitly_user and bitly_key defined in your configuration file.', 0);
|
||||
if (!conf_get('bitly:user') or !conf_get('bitly:key')) {
|
||||
err(2, 'Bitly: Please verify that you have bitly_user and bitly_key defined in your configuration file.', 0);
|
||||
return;
|
||||
}
|
||||
# Create the SHORTEN and REVERSE commands.
|
||||
@@ -38,10 +38,12 @@ sub _void
|
||||
|
||||
# Help hashes.
|
||||
our %HELP_SHORTEN = (
|
||||
'en' => "This command will shorten an URL using Bit.ly. \002Syntax:\002 SHORTEN <url>",
|
||||
en => "This command will shorten an URL using Bit.ly. \2Syntax:\2 SHORTEN <url>",
|
||||
de => "Dieser Befehl wird eine URL verkuerzen. \2Syntax:\2 SHORTEN <url>",
|
||||
);
|
||||
our %HELP_REVERSE = (
|
||||
'en' => "This command will expand a Bit.ly URL. \002Syntax:\002 REVERSE <url>",
|
||||
en => "This command will expand a Bit.ly URL. \2Syntax:\2 REVERSE <url>",
|
||||
de => "Dieser Befehl wird eine URL erweitern. \2Syntax:\2 REVERSE <url>",
|
||||
);
|
||||
|
||||
# Callback for SHORTEN command.
|
||||
@@ -118,7 +120,7 @@ sub reverse
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Bitly', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Bitly', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=LWP::UserAgent,URI::Escape perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -167,7 +169,7 @@ Add Bitly to module auto-load and the following to your configuration file:
|
||||
|
||||
=over
|
||||
|
||||
* Add Spanish, French and German translations for the help hashes.
|
||||
* Add Spanish and German translations for the help hashes.
|
||||
|
||||
=back
|
||||
|
||||
@@ -178,7 +180,7 @@ Add Bitly to module auto-load and the following to your configuration file:
|
||||
This module adds extra dependencies: LWP::UserAgent and URI::Escape. You can
|
||||
get it from the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
+3
-3
@@ -72,7 +72,7 @@ sub stats {
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('BotStats', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('BotStats', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -89,7 +89,7 @@ BotStats - General information about the bot
|
||||
|
||||
<starcoder> !stats
|
||||
<blue> I have been running for 0 days, 0 hours, 1 minutes, and 5 seconds.
|
||||
<blue> I am running Auto IRC Bot (version 3.0.0a7) for Perl v5.12.3 on linux.
|
||||
<blue> I am running Auto IRC Bot (version 3.0.0a10) for Perl v5.12.3 on linux.
|
||||
<blue> I am on 2 channels, across 1 networks.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -97,7 +97,7 @@ BotStats - General information about the bot
|
||||
This module creates the STATS command, for returning general information about
|
||||
the bot such as uptime, version, etc.
|
||||
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
This module is compatible with Auto v3.0.0a10+.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
||||
+5
-4
@@ -32,7 +32,8 @@ sub _void
|
||||
|
||||
# Help hash.
|
||||
our %FHELP_CALC = (
|
||||
'en' => "This command will calculate an expression using Google Calculator. \002Syntax:\002 CALC <expression>",
|
||||
en => "This command will calculate an expression using Google Calculator. \2Syntax:\2 CALC <expression>",
|
||||
de => "Dieser Befehl berechnet einen Ausdruck mit den Google Rechner. \2Syntax:\2 CALC <expression>",
|
||||
);
|
||||
|
||||
# Callback for CALC command.
|
||||
@@ -78,7 +79,7 @@ sub calc
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Calc', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Calc', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=LWP::UserAgent,URI::Escape,JSON,JSON::PP perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -107,7 +108,7 @@ Google Calculator.
|
||||
|
||||
=over
|
||||
|
||||
* Add Spanish, French and German translations for the help hash.
|
||||
* Add Spanish and French translations for the help hash.
|
||||
|
||||
=back
|
||||
|
||||
@@ -118,7 +119,7 @@ Google Calculator.
|
||||
This module requires LWP::UserAgent, URI::Escape and JSON/JSON::PP.
|
||||
All are obtainable from the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ sub _getdata
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('ChanTopics', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('ChanTopics', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -337,7 +337,7 @@ This module adds no extra dependencies.
|
||||
|
||||
This module is not compatible with PostgreSQL, yet.
|
||||
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
This module is compatible with Auto v3.0.0a10+.
|
||||
|
||||
Ported from v1.0.
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ sub _void
|
||||
|
||||
# Help hash for DICT. Spanish, French and German translations needed.
|
||||
our %HELP_DICT = (
|
||||
'en' => "This command allows you to lookup a word through Dict.org. \002Syntax:\002 DICT <word>",
|
||||
en => "This command allows you to lookup a word through Dict.org. \2Syntax:\2 DICT <word>",
|
||||
de => "Dieser Befehl ermoeglicht du auf nachschlagst ein Wort durch Dict.org. \2Syntax:\2 DICT <word>",
|
||||
);
|
||||
|
||||
# Callback for DICT command.
|
||||
@@ -75,7 +76,7 @@ sub cmd_dict
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Dictionary', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Dictionary', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=Net::Dict perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -98,7 +99,7 @@ DICT command.
|
||||
This module adds an extra dependency: Net::Dict. You can get it from the CPAN
|
||||
<http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
This module is compatible with Auto v3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -45,10 +45,12 @@ sub _void {
|
||||
|
||||
# Help hashes.
|
||||
our %HELP_8BALL = (
|
||||
'en' => "This command will ask the magic 8-Ball your question. \002Syntax:\002 8BALL <question>",
|
||||
en => "This command will ask the magic 8-Ball your question. \2Syntax:\2 8BALL <question>",
|
||||
de => "Dieser Befehl fragt die magische 8-Kugel eine Frage. \2Syntax:\2 8BALL <question>",
|
||||
);
|
||||
our %HELP_RIGBALL = (
|
||||
'en' => "This command will \"rig\" (set) the answer of the next 8-Ball question. \002Syntax:\002 RIGBALL <answer>",
|
||||
en => "This command will \"rig\" (set) the answer of the next 8-Ball question. \2Syntax:\2 RIGBALL <answer>",
|
||||
de => "Dieser Befehl wird festgelegt die Antwort der naechsten 8-Kugel Frage. \2Syntax:\2 RIGBALL <answer>",
|
||||
);
|
||||
|
||||
# Callback for 8BALL command.
|
||||
@@ -98,7 +100,7 @@ sub rigball {
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('EightBall', 'Xelhua', '2.00', '3.0.0a8', __PACKAGE__);
|
||||
API::Std::mod_init('EightBall', 'Xelhua', '2.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
+6
-4
@@ -26,9 +26,11 @@ sub _void {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Help hash for EVAL command. Spanish, German and French translations are needed.
|
||||
# Help hash for EVAL command. Spanish and French translations are needed.
|
||||
our %HELP_EVAL = (
|
||||
'en' => "This command allows you to eval Perl code. USE WITH CAUTION. \2Syntax:\2 EVAL <expression>",
|
||||
en => "This command allows you to eval Perl code. USE WITH CAUTION. \2Syntax:\2 EVAL <expression>",
|
||||
de => "Dieser Befehl ermoeglicht du auf bewertst Perl Code. GEBRAUCH MIT VORSICHT. \2Syntax:\2 EVAL <expression>",
|
||||
fr => "Cette commande vous permet d'évaluer du code Perl. UTILISER AVEC PRUDENCE. \2Syntaxe:\2 EVAL <expression>",
|
||||
);
|
||||
|
||||
# Callback for EVAL command.
|
||||
@@ -63,7 +65,7 @@ sub cmd_eval {
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Eval', 'Xelhua', '1.01', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Eval', 'Xelhua', '1.01', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -88,7 +90,7 @@ IRC, returning the output via notice.
|
||||
|
||||
This command requires the cmd.eval privilege.
|
||||
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
This module is compatible with Auto v3.0.0a10+.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
|
||||
+5
-4
@@ -30,7 +30,8 @@ sub _void
|
||||
|
||||
# Help hash.
|
||||
our %HELP_FML = (
|
||||
'en' => "This command will return a random FML quote. \002Syntax:\002 FML",
|
||||
en => "This command will return a random FML quote. \2Syntax:\2 FML",
|
||||
de => "Dieser Befehl liefert eine zufaellige Zitat von FML. \2Syntax:\2 FML",
|
||||
);
|
||||
|
||||
# Callback for FML command.
|
||||
@@ -67,7 +68,7 @@ sub fml
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('FML', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('FML', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=LWP::UserAgent perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -98,7 +99,7 @@ have my hand back?" FML
|
||||
|
||||
=over
|
||||
|
||||
* Add Spanish, French and German translations for the help hash.
|
||||
* Add Spanish and French translations for the help hash.
|
||||
|
||||
=back
|
||||
|
||||
@@ -109,7 +110,7 @@ have my hand back?" FML
|
||||
This module adds an extra dependency: LWP::UserAgent. You can get it from
|
||||
the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
Ported from Auto 2.0.
|
||||
|
||||
|
||||
+6
-5
@@ -37,9 +37,10 @@ sub _void
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Help hash for GREET. Spanish, French and German translation needed.
|
||||
# Help hash for GREET. Spanish and French translation needed.
|
||||
our %HELP_GREET = (
|
||||
'en' => "This command allows management of greets. \002Syntax:\002 GREET (ADD|DEL) [nick] [greet]",
|
||||
en => "This command allows management of greets. \2Syntax:\2 GREET (ADD|DEL) [nick] [greet]",
|
||||
de => "Dieser Befehl ermoeglicht die Verwaltung von Gruesse. \2Syntax:\2 GREET (ADD|DEL) [nick] [greet]",
|
||||
);
|
||||
# Callback for GREET.
|
||||
sub cmd_greet
|
||||
@@ -125,7 +126,7 @@ sub hook_rcjoin
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Greet', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Greet', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -145,7 +146,7 @@ user that has a greet in the database joins a channel the bot is in.
|
||||
|
||||
=over
|
||||
|
||||
* Add Spanish, French and German translations for the help hash.
|
||||
* Add Spanish and French translations for the help hash.
|
||||
|
||||
=back
|
||||
|
||||
@@ -153,7 +154,7 @@ user that has a greet in the database joins a channel the bot is in.
|
||||
|
||||
=over
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ sub hello
|
||||
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('HelloChan', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('HelloChan', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
+3
-2
@@ -31,6 +31,7 @@ sub _void
|
||||
# Help hashes.
|
||||
our %HELP_ISITUP = (
|
||||
'en' => "This command will check if a website appears up or down to the bot. \002Syntax:\002 ISITUP <url>",
|
||||
'fr' => "Cette commande va vérifier si un site Web semble être vers le haut ou vers le bas pour le bot. \002Syntaxe:\002 ISITUP <url>",
|
||||
);
|
||||
|
||||
# Callback for ISITUP command.
|
||||
@@ -69,7 +70,7 @@ sub check
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('IsItUp', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('IsItUp', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=LWP::UserAgent perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -109,7 +110,7 @@ appears up or down to Auto.
|
||||
This module requires LWP::UserAgent. You can get it from
|
||||
the CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ sub _void {
|
||||
# Help for LOLCAT.
|
||||
our %HELP_LOLCAT = (
|
||||
en => "This command will translate English to LOLCAT speak. \2Syntax:\2 LOLCAT <text>",
|
||||
fr => "Cette commande va traduire l'anglais vers LOLCAT parler. \2Syntaxe:\2 LOLCAT <texte",
|
||||
);
|
||||
|
||||
# Callback for LOLCAT command.
|
||||
@@ -46,7 +47,7 @@ sub cmd_lolcat {
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('LOLCAT', 'Xelhua', '1.00', '3.0.0a8', __PACKAGE__);
|
||||
API::Std::mod_init('LOLCAT', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000 cpan=Acme::LOLCAT
|
||||
|
||||
__END__
|
||||
|
||||
@@ -69,7 +69,7 @@ sub gettitle
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('LinkTitle', 'Xelhua', '1.01', '3.0.0a8', __PACKAGE__);
|
||||
API::Std::mod_init('LinkTitle', 'Xelhua', '1.01', '3.0.0a10');
|
||||
# build: cpan=LWP::UserAgent,HTML::Entities perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
+11
-2
@@ -13,7 +13,7 @@ sub _init
|
||||
# Add a hook for when we join a channel.
|
||||
hook_add('on_connect', 'Oper.onconnect', \&M::Oper::on_connect) or return;
|
||||
# Add a hook for when we get numeric 491 (ERR_NOOPERHOST)
|
||||
rchook_add('491', 'Oper.on381', \&M::Oper::on_num491) or return;
|
||||
rchook_add('491', 'Oper.on491', \&M::Oper::on_num491) or return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,17 @@ sub oper {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Deopers Auto on the specified server.
|
||||
sub deoper {
|
||||
my ($svr) = @_;
|
||||
Auto::socksnd($svr, "MODE $State::IRC::botinfo{$svr}{nick} -o");
|
||||
return 1;
|
||||
}
|
||||
|
||||
# End of the API
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Oper', 'Xelhua', '1.01', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Oper', 'Xelhua', '1.01', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
# Module: Ping. See below for documentation.
|
||||
# Copyright (C) 2010-2011 Xelhua Development Group, et al.
|
||||
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||
package M::Ping;
|
||||
use strict;
|
||||
use warnings;
|
||||
use API::Std qw(cmd_add cmd_del hook_add hook_del rchook_add rchook_del);
|
||||
use API::IRC qw(privmsg notice who);
|
||||
my (@PING, $STATE);
|
||||
my $LAST = 0;
|
||||
|
||||
# Initialization subroutine.
|
||||
sub _init {
|
||||
# Create the PING command.
|
||||
cmd_add('PING', 0, 'cmd.ping', \%M::Ping::HELP_PING, \&M::Ping::cmd_ping) or return;
|
||||
# Create the on_whoreply hook.
|
||||
hook_add('on_whoreply', 'ping.who', \&M::Ping::on_whoreply) or return;
|
||||
# Hook onto numeric 315.
|
||||
rchook_add('315', 'ping.eow', \&M::Ping::ping) or return;
|
||||
|
||||
# Success.
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Void subroutine.
|
||||
sub _void {
|
||||
# Delete the PING command.
|
||||
cmd_del('PING') or return;
|
||||
# Delete the on_whoreply hook.
|
||||
hook_del('on_whoreply', 'ping.who') or return;
|
||||
# Delete 315 hook.
|
||||
rchook_del('315', 'ping.eow') or return;
|
||||
|
||||
# Success.
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Help for PING.
|
||||
our %HELP_PING = (
|
||||
en => "This command will ping all non-/away users in the channel. \2Syntax:\2 PING",
|
||||
);
|
||||
|
||||
# Callback for PING command.
|
||||
sub cmd_ping {
|
||||
my ($src, @argv) = @_;
|
||||
|
||||
# Check ratelimit (once every five minutes).
|
||||
if ((time - $LAST) < 300) {
|
||||
notice($src->{svr}, $src->{nick}, 'This command is ratelimited. Please wait a while before using it again.');
|
||||
return;
|
||||
}
|
||||
|
||||
# Set last used time to current time.
|
||||
$LAST = time;
|
||||
# Set state.
|
||||
$STATE = $src->{svr}.'::'.$src->{chan};
|
||||
|
||||
# Ship off a WHO.
|
||||
who($src->{svr}, $src->{chan});
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Callback for WHO reply.
|
||||
sub on_whoreply {
|
||||
my ($svr, $nick, $target, undef, undef, undef, $status, undef, undef) = @_;
|
||||
|
||||
# If it's us, just return.
|
||||
if ($nick eq $State::IRC::botinfo{$svr}{nick}) { return 1 }
|
||||
|
||||
# Check if we're doing a ping right now.
|
||||
if ($STATE) {
|
||||
# Check if this is the target channel.
|
||||
if ($STATE eq $svr.'::'.$target) {
|
||||
# If their status is not away, push to ping array.
|
||||
if ($status !~ m/G/xsm) {
|
||||
push @PING, $nick;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Ping!
|
||||
sub ping {
|
||||
if ($STATE) {
|
||||
my ($svr, $chan) = split '::', $STATE, 2;
|
||||
privmsg($svr, $chan, 'PING! '.join(' ', @PING));
|
||||
@PING = ();
|
||||
$STATE = 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Ping', 'Xelhua', '1.01', '3.0.0a11');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Ping - A module for pinging a channel.
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.01
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
<Hermione> .ping
|
||||
<howlbot> PING! `A` tdubellz Hermione Oakfeather LightToagac shadowm_goat kitten starcoder2 Suiseiseki metabill theknife Trashlord Cam HardDisk_WP nerdshark2 MJ94 JonathanD Julius2 CensoredBiscuit LordVoldemort e36freak alyx mth starcoder
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This merely creates the PING command, which will highlight everyone in the
|
||||
channel, excluding the bot itself and those who are /away.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Elijah Perrault.
|
||||
|
||||
This module is maintained by Xelhua Development Group.
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This module is Copyright 2010-2011 Xelhua Development Group. All rights
|
||||
reserved.
|
||||
|
||||
This module is released under the same licensing terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et ts=4 sw=4:
|
||||
+1
-1
@@ -211,7 +211,7 @@ sub cmd_qdb
|
||||
}
|
||||
|
||||
|
||||
API::Std::mod_init('QDB', 'Xelhua', '1.04', '3.0.0a9', __PACKAGE__);
|
||||
API::Std::mod_init('QDB', 'Xelhua', '1.04', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
+2
-2
@@ -111,7 +111,7 @@ sub handle_906
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('SASLAuth', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('SASLAuth', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -168,7 +168,7 @@ block(s) you wish to use SASL with:
|
||||
This adds an extra dependency: You must build Auto with the
|
||||
--enable-sasl option.
|
||||
|
||||
This module is compatible with Auto v3.0.0a7+.
|
||||
This module is compatible with Auto v3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
+3
-3
@@ -23,7 +23,7 @@ sub _init {
|
||||
return;
|
||||
}
|
||||
$EDITION = (conf_get('uno:edition'))[0][0];
|
||||
$EDITION = uc(substr $EDITION, 0, 1).substr $EDITION, 1;
|
||||
$EDITION = ucfirst $EDITION;
|
||||
|
||||
# Check if the edition is valid.
|
||||
if ($EDITION !~ m/^(Original|Super|Advanced|Any)$/xsm) {
|
||||
@@ -1444,7 +1444,7 @@ sub sendmsg {
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('UNO', 'Xelhua', '1.10', '3.0.0a9', __PACKAGE__);
|
||||
API::Std::mod_init('UNO', 'Xelhua', '1.10', '3.0.0a10');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -1505,7 +1505,7 @@ The commands this adds are:
|
||||
|
||||
All of which describe themselves quite well with just the name.
|
||||
|
||||
This module is compatible with Auto v3.0.0a9+.
|
||||
This module is compatible with Auto v3.0.0a10+.
|
||||
|
||||
=head1 INSTALL
|
||||
|
||||
|
||||
+3
-2
@@ -32,6 +32,7 @@ sub _void
|
||||
# Help hashes.
|
||||
our %HELP_WEATHER = (
|
||||
'en' => "This command will retrieve the weather via Wunderground for the specified location. \002Syntax:\002 WEATHER <location>",
|
||||
'fr' => "Cette commande permet de récupérer la météo via Wunderground pour l'emplacement spécifié. \002Syntaxe:\002 WEATHER <emplacement>",
|
||||
);
|
||||
|
||||
# Callback for Weather command.
|
||||
@@ -78,7 +79,7 @@ sub weather
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('Weather', 'Xelhua', '1.00', '3.0.0a7', __PACKAGE__);
|
||||
API::Std::mod_init('Weather', 'Xelhua', '1.00', '3.0.0a10');
|
||||
# build: cpan=LWP::UserAgent,XML::Simple perl=5.010000
|
||||
|
||||
__END__
|
||||
@@ -120,7 +121,7 @@ From the NE at 9 MPH Gusting to 22 MPH Conditions: Overcast
|
||||
This module requires LWP::UserAgent and XML::Simple. Both are
|
||||
obtainable from CPAN <http://www.cpan.org>.
|
||||
|
||||
This module is compatible with Auto version 3.0.0a7+.
|
||||
This module is compatible with Auto version 3.0.0a10+.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
+2248
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,373 @@
|
||||
# Module: WerewolfAdmin. See below for documentation.
|
||||
# Copyright (C) 2010-2011 Xelhua Development Group, et al.
|
||||
# This program is free software; rights to this code are stated in doc/LICENSE.
|
||||
package M::WerewolfAdmin;
|
||||
use strict;
|
||||
use warnings;
|
||||
use feature qw(switch);
|
||||
use API::Std qw(cmd_add cmd_del timer_add timer_del trans conf_get);
|
||||
use API::IRC qw(privmsg notice cmode ison);
|
||||
|
||||
# Initialization subroutine.
|
||||
sub _init {
|
||||
# Create the WOLFA command.
|
||||
cmd_add('WOLFA', 0, 'werewolf.admin', \%M::WerewolfAdmin::HELP_WOLFA, \&M::WerewolfAdmin::cmd_wolfa) or return;
|
||||
|
||||
# Success.
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Void subroutine.
|
||||
sub _void {
|
||||
# Delete the WOLFA command.
|
||||
cmd_del('WOLFA') or return;
|
||||
|
||||
# Success.
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Help hash for the WOLFA command.
|
||||
our %HELP_WOLFA = (
|
||||
en => "This command allows you to perform various administrative actions in a game of Werewolf (A.K.A. Mafia). \2Syntax:\2 WOLFA (JOIN|WAIT|START|KICK|STOP) [parameters]",
|
||||
);
|
||||
|
||||
# Callback for the WOLFA command.
|
||||
sub cmd_wolfa {
|
||||
my ($src, @argv) = @_;
|
||||
|
||||
# We require at least one parameter.
|
||||
if (!defined $argv[0]) {
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
|
||||
return;
|
||||
}
|
||||
|
||||
# Iterate the parameter.
|
||||
given (uc $argv[0]) {
|
||||
when (/^(JOIN|J)$/) {
|
||||
# WOLFA JOIN
|
||||
|
||||
# Requires an extra parameter.
|
||||
if (!defined $argv[1]) {
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if a game is running.
|
||||
if (!$M::Werewolf::PGAME and !$M::Werewolf::GAME) {
|
||||
notice($src->{svr}, $src->{nick}, 'No game is currently running.');
|
||||
}
|
||||
elsif ($M::Werewolf::GAME) {
|
||||
notice($src->{svr}, $src->{nick}, 'Sorry, but the game is already running. Try again next time.');
|
||||
}
|
||||
else {
|
||||
# Check if this is the game channel.
|
||||
if ($src->{svr}.'/'.$src->{chan} ne $M::Werewolf::GAMECHAN) {
|
||||
notice($src->{svr}, $src->{nick}, "Werewolf is currently running in \2$M::Werewolf::GAMECHAN\2.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if this user exists in channel.
|
||||
if (!ison($src->{svr}, $src->{chan}, lc $argv[1])) {
|
||||
notice($src->{svr}, $src->{nick}, "No such user \2$argv[1]\2 is on the channel.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Make sure they're not already playing.
|
||||
if (exists $M::Werewolf::PLAYERS{lc $argv[1]}) {
|
||||
notice($src->{svr}, $src->{nick}, 'They\'re already playing!');
|
||||
return;
|
||||
}
|
||||
|
||||
# Set variables.
|
||||
$M::Werewolf::PLAYERS{lc $argv[1]} = 0;
|
||||
my $nick = $M::Werewolf::NICKS{lc $argv[1]} = $Core::IRC::Users::users{$src->{svr}}{lc $argv[1]};
|
||||
|
||||
# Send message.
|
||||
my ($gsvr, $gchan) = split '/', $M::Werewolf::GAMECHAN, 2;
|
||||
cmode($gsvr, $gchan, "+v $nick");
|
||||
privmsg($gsvr, $gchan, "\2$nick\2 was forced to join the game by \2$src->{nick}\2.");
|
||||
}
|
||||
}
|
||||
when (/^(WAIT|W)$/) {
|
||||
# WOLFA WAIT
|
||||
|
||||
# Check if a game is running.
|
||||
if (!$M::Werewolf::PGAME) {
|
||||
if (!$M::Werewolf::GAME) {
|
||||
notice($src->{svr}, $src->{nick}, 'No game is currently running.');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
notice($src->{svr}, $src->{nick}, 'Werewolf is already in play.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Check if this is the game channel.
|
||||
if ($src->{svr}.'/'.$src->{chan} ne $M::Werewolf::GAMECHAN) {
|
||||
notice($src->{svr}, $src->{nick}, "Werewolf is currently running in \2$M::Werewolf::GAMECHAN\2.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Increase WAIT.
|
||||
$M::Werewolf::WAIT += 20;
|
||||
# And WAITED.
|
||||
$M::Werewolf::WAITED++;
|
||||
privmsg($src->{svr}, $src->{chan}, "\2$src->{nick}\2 forcibly increased join wait time by 20 seconds.");
|
||||
}
|
||||
when ('START') {
|
||||
# WOLFA START
|
||||
|
||||
# Check if a game is running.
|
||||
if (!$M::Werewolf::PGAME) {
|
||||
if (!$M::Werewolf::GAME) {
|
||||
notice($src->{svr}, $src->{nick}, 'No game is currently running.');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
notice($src->{svr}, $src->{nick}, 'Werewolf is already in play.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
# Check if this is the game channel.
|
||||
if ($src->{svr}.'/'.$src->{chan} ne $M::Werewolf::GAMECHAN) {
|
||||
notice($src->{svr}, $src->{nick}, "Werewolf is currently running in \2$M::Werewolf::GAMECHAN\2.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Need four or more players.
|
||||
if (keys %M::Werewolf::PLAYERS < 4) {
|
||||
privmsg($src->{svr}, $src->{chan}, "$src->{nick}: Four or more players are required to play.");
|
||||
return;
|
||||
}
|
||||
|
||||
# First, determine how many players to declare a wolf.
|
||||
my $cwolves = POSIX::ceil(keys(%M::Werewolf::PLAYERS) * .14);
|
||||
# Only one seer, harlot, guardian angel, traitor and detective.
|
||||
my $cseers = 1;
|
||||
my $charlots = my $cdrunks = my $cangels = my $ctraitors = my $cdetectives = 0;
|
||||
if (keys %M::Werewolf::PLAYERS >= 6) { $charlots++ unless conf_get('werewolf:rated-g') }
|
||||
if (keys %M::Werewolf::PLAYERS >= 7) { $cdrunks++ unless conf_get('werewolf:rated-g') }
|
||||
if (keys %M::Werewolf::PLAYERS >= 9) { $cangels++ unless conf_get('werewolf:no-angels') }
|
||||
if (keys %M::Werewolf::PLAYERS >= 12 and conf_get('werewolf:traitors')) { $ctraitors++ }
|
||||
if (keys %M::Werewolf::PLAYERS >= 16 and conf_get('werewolf:detectives')) { $cdetectives++ }
|
||||
|
||||
# Give all players a role.
|
||||
foreach my $plyr (keys %M::Werewolf::PLAYERS) { $M::Werewolf::PLAYERS{$plyr} = 'v' }
|
||||
# Push players into a temporary array.
|
||||
my @plyrs = keys %M::Werewolf::PLAYERS;
|
||||
|
||||
# Set wolves.
|
||||
while ($cwolves > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} !~ m/^(w|s|g|h|d|t)$/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 'w';
|
||||
$cwolves--;
|
||||
$M::Werewolf::STATIC[0] .= ", \2$M::Werewolf::NICKS{$rpi}\2";
|
||||
}
|
||||
}
|
||||
$M::Werewolf::STATIC[0] = substr $M::Werewolf::STATIC[0], 2;
|
||||
# Set seers.
|
||||
while ($cseers > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} !~ m/^(w|g|h|d|t)$/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 's';
|
||||
$cseers--;
|
||||
$M::Werewolf::STATIC[1] = "\2$M::Werewolf::NICKS{$rpi}\2";
|
||||
}
|
||||
}
|
||||
# Set harlots.
|
||||
while ($charlots > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} !~ m/^(w|g|s|d|t)$/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 'h';
|
||||
$charlots--;
|
||||
$M::Werewolf::STATIC[2] = "\2$M::Werewolf::NICKS{$rpi}\2";
|
||||
}
|
||||
}
|
||||
# Set drunks.
|
||||
while ($cdrunks > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} =~ m/v/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 'vi';
|
||||
$cdrunks--;
|
||||
}
|
||||
}
|
||||
# Set guardian angels.
|
||||
while ($cangels > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} !~ m/^(w|h|s|d|t)$/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 'g';
|
||||
$cangels--;
|
||||
$M::Werewolf::STATIC[3] = "\2$M::Werewolf::NICKS{$rpi}\2";
|
||||
}
|
||||
}
|
||||
# Set traitors.
|
||||
while ($ctraitors > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} !~ m/^(w|h|s|d|g)$/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 't';
|
||||
$ctraitors--;
|
||||
$M::Werewolf::STATIC[4] = "\2$M::Werewolf::NICKS{$rpi}\2";
|
||||
}
|
||||
}
|
||||
# Set detectives.
|
||||
while ($cdetectives > 0) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
if ($M::Werewolf::PLAYERS{$rpi} !~ m/^(w|h|s|g|t)$/xsm) {
|
||||
$M::Werewolf::PLAYERS{$rpi} = 'd';
|
||||
$cdetectives--;
|
||||
$M::Werewolf::STATIC[5] = "\2$M::Werewolf::NICKS{$rpi}\2";
|
||||
}
|
||||
}
|
||||
|
||||
# If there's 8 or more players, give one of them a gun.
|
||||
if (keys %M::Werewolf::PLAYERS >= 8) {
|
||||
my $rpi = $plyrs[int rand scalar @plyrs];
|
||||
while ($M::Werewolf::PLAYERS{$rpi} =~ m/w/xsm || $M::Werewolf::PLAYERS{$rpi} =~ m/t/xsm) { $rpi = $plyrs[int rand scalar @plyrs] }
|
||||
$M::Werewolf::PLAYERS{$rpi} .= 'b';
|
||||
|
||||
# And give them PLAYER COUNT * .12 bullets rounded up.
|
||||
$M::Werewolf::BULLETS = POSIX::ceil(keys(%M::Werewolf::PLAYERS) * .12);
|
||||
|
||||
if ($M::Werewolf::PLAYERS{$rpi} =~ m/i/xsm) { $M::Werewolf::BULLETS = $M::Werewolf::BULLETS * 3 }
|
||||
}
|
||||
|
||||
# Set variables.
|
||||
$M::Werewolf::GAME = 1;
|
||||
$M::Werewolf::PGAME = 0;
|
||||
|
||||
# Set spoke variables.
|
||||
foreach (keys %M::Werewolf::PLAYERS) { $M::Werewolf::SPOKE{$_} = time }
|
||||
|
||||
# All players have their role, so lets begin the game!
|
||||
my ($gsvr, $gchan) = split '/', $M::Werewolf::GAMECHAN, 2;
|
||||
privmsg($gsvr, $gchan, "Game is now starting. (forced start by \2$src->{nick}\2)");
|
||||
cmode($gsvr, $gchan, '+m');
|
||||
# Delete waiting timer.
|
||||
timer_del('werewolf.joinwait');
|
||||
# Start timer for bed checking.
|
||||
timer_add('werewolf.chkbed', 2, 5, \&M::Werewolf::_chkbed);
|
||||
# Initialize the nighttime.
|
||||
M::Werewolf::_init_night();
|
||||
}
|
||||
when (/^(KICK|K)$/) {
|
||||
# WOLFA KICK
|
||||
|
||||
# Check if a game is running.
|
||||
if (!$M::Werewolf::GAME and !$M::Werewolf::PGAME) {
|
||||
notice($src->{svr}, $src->{nick}, 'No game is currently running.');
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if this is the game channel.
|
||||
if ($src->{svr}.'/'.$src->{chan} ne $M::Werewolf::GAMECHAN) {
|
||||
notice($src->{svr}, $src->{nick}, "Werewolf is currently running in \2$M::Werewolf::GAMECHAN\2.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Requires an extra parameter.
|
||||
if (!defined $argv[1]) {
|
||||
notice($src->{svr}, $src->{nick}, trans('Not enough parameters').q{.});
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if the target is playing.
|
||||
if (!exists $M::Werewolf::PLAYERS{lc $argv[1]}) {
|
||||
notice($src->{svr}, $src->{nick}, "\2$argv[1]\2 is not currently playing.");
|
||||
return;
|
||||
}
|
||||
|
||||
# Kill the target.
|
||||
privmsg($src->{svr}, $src->{chan}, "\2$argv[1]\2 died of an unknown disease. He/She was a \2".M::Werewolf::_getrole(lc $argv[1], 2)."\2.");
|
||||
M::Werewolf::_player_del(lc $argv[1]);
|
||||
}
|
||||
when ('STOP') {
|
||||
# WOLFA STOP
|
||||
|
||||
# Check if a game is running.
|
||||
if (!$M::Werewolf::GAME and !$M::Werewolf::PGAME) {
|
||||
notice($src->{svr}, $src->{nick}, 'No game is currently running.');
|
||||
return;
|
||||
}
|
||||
|
||||
# Check if this is the game channel.
|
||||
if ($src->{svr}.'/'.$src->{chan} ne $M::Werewolf::GAMECHAN) {
|
||||
notice($src->{svr}, $src->{nick}, "Werewolf is currently running in \2$M::Werewolf::GAMECHAN\2.");
|
||||
return;
|
||||
}
|
||||
|
||||
# End the game.
|
||||
my ($gsvr, $gchan) = split '/', $M::Werewolf::GAMECHAN, 2;
|
||||
privmsg($gsvr, $gchan, "\2$src->{nick}\2 is forcing the game to end...");
|
||||
M::Werewolf::_gameover('n');
|
||||
}
|
||||
default { notice($src->{svr}, $src->{nick}, trans('Unknown action', $_).q{.}) }
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Start initialization.
|
||||
API::Std::mod_init('WerewolfAdmin', 'Xelhua', '1.00', '3.0.0a11');
|
||||
# build: perl=5.010000
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
WerewolfAdmin - Administrative functions for Werewolf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
1.00
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
None
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This module allows one to administer the Werewolf IRC game, provided by the
|
||||
Werewolf module.
|
||||
|
||||
It provides the following commands:
|
||||
|
||||
WOLFA JOIN|J - Force join.
|
||||
WOLFA WAIT - Force wait.
|
||||
WOLFA START - Force start.
|
||||
WOLFA KICK|K - Kick a player.
|
||||
WOLFA STOP - Stop a game forcibly.
|
||||
|
||||
And requires the werewolf.admin privilege.
|
||||
|
||||
=head1 DEPENDENCIES
|
||||
|
||||
This module depends on the following Auto module(s):
|
||||
|
||||
=over
|
||||
|
||||
=item Werewolf
|
||||
|
||||
The Werewolf module provides the game that this module provides administrative
|
||||
commands for. Using this module without Werewolf will likely cause a fatal
|
||||
error.
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
This module was written by Elijah Perrault.
|
||||
|
||||
This module is maintained by Xelhua Development Group.
|
||||
|
||||
=head1 LICENSE AND COPYRIGHT
|
||||
|
||||
This module is Copyright (C) 2010-2011, Xelhua Development Group.
|
||||
|
||||
This module is released under the same terms as Auto itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set ai et ts=4 sw=4:
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user