X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Commands%2FDef.pm;h=ba077f75ca7f7b971682d936d1ef27586aab8976;hb=e480fb7b3c0528e11d3381939d02db9a3042554b;hp=bdfc6776c9beaba28722f790246f886b40aea2e8;hpb=be6e9d0c7e6b2d13127b1f3be2d482a8da6a6339;p=NDIRC.git
diff --git a/Commands/Def.pm b/Commands/Def.pm
index bdfc677..ba077f7 100644
--- a/Commands/Def.pm
+++ b/Commands/Def.pm
@@ -25,20 +25,6 @@ use feature ':5.10';
use MooseX::Declare;
use NDIRC::Dispatcher;
-command anon => {
- help => q(syntax: .anon nick message),
- type => q(def),
- acl => q(irc_anondef),
-}, class extends NDIRC::Command {
- method execute($c,$msg) {
-
- my ($target,$mess) = $msg =~ /^(\S+) (.*)$/ or die 'ARGS';
-
- $c->message(privmsg => $target, "$mess");
- $c->message(privmsg => $c->channel, "$target << $mess");
- }
-};
-
command defcall => {
help => q(syntax: .defcall [callid] | if a call id is given, then shiptypes and eta will be fetched from the database and added to the message),
type => q(def),
@@ -72,9 +58,8 @@ ORDER BY c.landing_tick;
return;
}
}
- $c->message(notice => $c->disp->targets->{members}, "DEFENSE REQUIRED!! WAKE UP!!");
- $c->message(privmsg => $c->disp->targets->{members}, "DEFENSE REQUIRED "
- ."$mess $callinfo MSG ".$c->nick." TO RESPOND");
+ $c->bot->toTarget(members => "DEFENSE REQUIRED "
+ ."$mess $callinfo RESPOND TO ".$c->username);
}
};
@@ -236,7 +221,7 @@ command report_incs => {
use Try::Tiny;
method execute($c,$msg) {
- $msg =~ /(\d+):(\d+):(\d+)\*?\s+(\d+):(\d+):(\d+)\s+([^:]*\S+)\s+(?:Ter|Cat|Xan|Zik|Etd)\s+([\d,]+)\s+Attack\s+(\d+)/
+ $msg =~ /(\d+):(\d+):(\d+)\*?\s+(\d+):(\d+):(\d+)\s+([^:]*\S+)\s+(?:Ter|Cat|Xan|Zik|Etd)\s+([\d,]+)\s+(?:Attack\s+)?(\d+)/
|| $msg =~ /(\d+):(\d+):(\d+)\s+(\d+):(\d+):(\d+)\s+\((?:Ter|Cat|Xan|Zik|Etd)\)\s+([^,]*\S+)\s+([\d,]+)\s+(\d+)\s+\(\d+\)/
or return;
my $dbh = $c->model;
@@ -296,25 +281,25 @@ INSERT INTO incomings (call,pid,eta,amount,fleet) VALUES(?,?,?,?,?) RETURNING in
},undef,$call[0],$attacker[2],$9,$amount,$7);
@attacker = map ($c->valuecolor(0),@attacker);
if (! $threefleeter || $call[1] ne 'Ignored'){
- $c->reply("New incoming: CallId: $call[0], IncId: $incid $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]) https://nd.ruin.nu/calls/edit/$call[0]");
+ $c->bot->toTarget(def => "New incoming: CallId: $call[0], IncId: $incid $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]) https://nd.ruin.nu/calls/edit/$call[0]");
}else{
- $c->reply("Do not cover, NoDef member is under attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]) https://nd.ruin.nu/calls/edit/$call[0]");
+ $c->bot->toTarget(def => "Do not cover, NoDef member is under attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]) https://nd.ruin.nu/calls/edit/$call[0]");
}
$dbh->do(q{UPDATE planets SET hit_us = hit_us + 1 WHERE pid = ?},undef,$attacker[2]);
if ($call[1] eq 'Covered'){
$dbh->do(q{UPDATE calls SET status = 'Open' WHERE call = ?},undef,$call[0]);
- $c->reply("Call is likely not covered anymore, please recalc! calc: $call[2]");
+ $c->bot->toTarget(def => "Call is likely not covered anymore, please recalc! calc: $call[2]");
}
}else{
@attacker = map ($c->valuecolor(0),@attacker);
- $c->reply("Duplicate call: Callid: $call[0], Status: $call[1] $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]), landing tick: $landing_tick");
+ $c->bot->toTarget(def => "Duplicate call: Callid: $call[0], Status: $call[1] $1:$2:$3 ($user->{defprio}) is under Attack by $4:$5:$6, ($attacker[3]), $attacker[1]($attacker[4]), landing tick: $landing_tick");
}
my ($fleetcatch) = $dbh->selectrow_array(q{
SELECT count(*) FROM launch_confirmations WHERE uid = ? AND back = ?
},undef,$user->{uid},$landing_tick);
if ($fleetcatch > 0){
- $c->reply("THIS IS A POSSIBLE FLEETCATCH!");
+ $c->bot->toTarget(def => "THIS IS A POSSIBLE FLEETCATCH!");
}
$dbh->commit;
} catch {
@@ -322,10 +307,10 @@ SELECT count(*) FROM launch_confirmations WHERE uid = ? AND back = ?
die $_;
};
}else{
- $c->reply("Didn't find any planet with coordinates $4:$5:$6 at this tick");
+ $c->bot->toTarget(def => "Didn't find any planet with coordinates $4:$5:$6 at this tick");
}
}else{
- $c->reply("No member registered with coordinates $1:$2:$3");
+ $c->bot->toTarget(def => "No member registered with coordinates $1:$2:$3");
}
}
};