$c->reply("You will gain <b>$xp</b> XP, <b>$score</b> score, if you steal $roids roids (<b>$value</b> value), from <b>$x:$y:$z</b>, who will have <b>$tsize</b> roids left, total score gain will be: <b>$totscore</b> in total,");
}
+sub fco
+ : Help(syntax: .fco agents stolen [tick] | tick can be omitted if you're doing this the same tick you got cov opped, if you have different amount of your resources stolen, specify the highest amount. Only works if less than 10% of your resources and < 10,000*agents were stolen)
+{
+ my ($self, $c, $msg) = @_;
+
+ my ($agents,$stolen,$tick) = $msg =~ /^(\d+)\s+(\d+)\s*(\d+)?$/ or die 'ARGS';
+
+ $tick //= $c->model->selectrow_array(q{SELECT tick()});
+
+ my ($value,$score) = $c->model->selectrow_array(q{
+SELECT value,score FROM planet_stats WHERE tick = $2 AND
+ id = (SELECT planet FROM users WHERE hostmask ILIKE $1)
+ }, undef, $c->host,$tick);
+ unless ($value){
+ $c->reply("You don't have a planet registered.");
+ return;
+ }
+ my $attackers = $c->model->prepare(q{
+SELECT coords(p.x,p.y,p.z), ruler, planet FROM current_planet_stats p
+ JOIN planet_stats ps using (id)
+WHERE ps.tick = $1 AND (2000.0*$2*$3/ps.value)::int = $4
+ });
+ $attackers->execute($tick,$agents,$value,$stolen);
+ if ($attackers->rows == 0){
+ $c->reply("No cov opper found, did you specify the right tick, and was the stolen amount not capped?");
+ }else{
+ my $coords = '';
+ while (my $attacker = $attackers->fetchrow_hashref){
+ $coords .= " ($attacker->{coords} : $attacker->{ruler} OF $attacker->{planet})";
+ }
+ $c->reply("The planet that cov opped you is one of: $coords");
+ }
+}
+
1;
return "$ND::C$c$string$ND::O";
}
-sub findCovOpper {
- my ($stolen, $command) = @_;
-
- my $tick = $ND::tick;
- my $agents;
-
- if (defined $stolen && $stolen =~ /(\d+) (\d+) (\d+)/){
- $tick = $1;
- $agents = $2;
- $stolen = $3;
- }elsif (defined $stolen && $stolen =~ /(\d+) (\d+)/){
- $agents = $1;
- $stolen = $2;
- }else{
- $ND::server->command("notice $ND::nick syntax: .$command [tick] agents stolen | tick can be omitted if you're doing this the same tick you got cov opped, if you have different amount of your resources stolen, specify the highest amount. Only works if less than 10% of your resources and < 10,000*agents were stolen");
- return;
- }
-
- my ($value,$score) = $ND::DBH->selectrow_array(q{
- SELECT value,score FROM planet_stats WHERE
- id = (SELECT planet FROM users WHERE hostmask ILIKE ?) AND tick = ?;
- }, undef, $ND::address,$tick);
- unless ($value){
- $ND::server->command("notice $ND::nick No value found for tick $tick, can't find your cov opper.");
- return;
- }
- my $attackers = $ND::DBH->prepare(q{
- SELECT coords(p.x,p.y,p.z), ruler, planet FROM current_planet_stats p JOIN planet_stats ps using (id) WHERE
- ps.tick = $1 AND (2000.0*$2*$3/ps.value)::int = $4 ;
- });
- $attackers->execute($tick,$agents,$value,$stolen);
- if ($attackers->rows == 0){
- $ND::server->command("notice $ND::nick No cov opper found, did you specify the right tick, and was the stolen amount not capped?");
- return;
- }
- my $coords = '';
- while (my $attacker = $attackers->fetchrow_hashref){
- $coords .= " ($attacker->{coords} : $attacker->{ruler} OF $attacker->{planet})";
- }
- $ND::server->command("notice $ND::nick The planet that cov opped you is one of: $coords");
-}
-
1;