my $eff = class extends NDIRC::Command {
use ND::Include;
method execute($c,$msg) {
- my ($amount,$ship,$target) = $msg =~ /^(-?\d+(?:\.\d+)?[hkMG]?) (\w+)(?: (\w+))?/
+ my ($amount,$ship,$target) = $msg =~ /^(-?\d+(?:\.\d+)?[hkMG]?) ([\w\%]+)(?: (\w+))?/
or die 'ARGS';
- $ship = "\%$ship\%";
+ $ship = "$ship\%";
$target //= '%';
my $value;
if ($self->name =~ /^v.+$/){
my $feud = '';
my $s= $c->model->selectrow_hashref(q{
-SELECT name,t1,t2,t3,"type",damage
+SELECT ship,t1,t2,t3,"type",damage
,metal+crystal+eonium AS cost
,init,"class",guns,race,eres,armor
-FROM ship_stats WHERE name ILIKE ?
+FROM ship_stats WHERE ship ILIKE ?
}, undef, $ship);
return unless $s;
if (defined $value){
$amount = int(($value*100/$s->{cost}));
- $feud = '(FEUD: '.prettyValue(int($amount/0.86)).') ';
+ $feud = '(Dem/Tot: '.prettyValue(int($amount/0.92)).') ';
}
$value = prettyValue(($amount*$s->{cost}/100));
- my $name = shipColor($s->{name},$s->{type});
+ my $name = shipColor($s->{ship},$s->{type});
my $text = prettyValue($amount)." $feud $name ($s->{init}:$value) :";
for my $tn ('t1','t2','t3'){
next unless defined ($self->target($s,$tn));
$text .= " <b><c03>" . $self->target($s,$tn) . "</c></b>: ";
my $st = $self->query(q{
-SELECT name,"class","type",armor
+SELECT ship,"class","type",armor
,metal+crystal+eonium AS cost
,init,t1,t2,t3,eres,race
,damage,guns
while (my $t = $st->fetchrow_hashref()){
my $number = $self->calcEff($s,$t,$tn,$amount);
$value = prettyValue($number*$t->{cost}/100);
- my $name = shipColor($t->{name},$t->{type});
+ my $name = shipColor($t->{ship},$t->{type});
$text .= " <b>$number</b> $name ($t->{init}:$value),";
}
chop $text;
sub shipColor {
my ($string,$type) = @_;
my $c = 04;
- $c = 12 if $type eq 'Emp';
+ $c = 12 if $type eq 'EMP';
$c = 13 if $type eq 'Steal';
return "<c$c>$string</c>";
}
method amount ($s,$t,$tn,$amount) {
- my $number = $s->{type} eq 'Emp' ?
+ my $number = $s->{type} eq 'EMP' ?
($amount*$s->{guns}*(100-$t->{eres})/100)
: ($amount*$s->{damage}/$t->{armor});
$number *= 0.60 if $tn eq 't2';
}
method amount ($s,$t,$tn,$amount) {
- my $number = $t->{type} eq 'Emp' ?
+ my $number = $t->{type} eq 'EMP' ?
($amount*100/(100 - $s->{eres})/$t->{guns})
: ($amount*$s->{armor}/$t->{damage});
$number /= 0.60 if $tn eq 't2';