]> ruin.nu Git - NDIRC.git/blobdiff - Commands/PA.pm
T2 is 70% and T3 is 50% now
[NDIRC.git] / Commands / PA.pm
index ac414ca8542c629ebf6267565e1aaed126df854e..8b64205c7af45f90b7ace83ba4730f7d491c28d2 100644 (file)
@@ -223,10 +223,10 @@ WHERE ps.tick = $1 AND trunc(2000.0*$2*$3/ps.value)::int = $4
 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.+$/){
@@ -239,26 +239,26 @@ my $eff = class extends NDIRC::Command {
                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
@@ -267,7 +267,7 @@ FROM ship_stats
                        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;
@@ -295,17 +295,17 @@ FROM ship_stats
        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';
-               $number *= 0.30 if $tn eq 't3';
+               $number *= 0.70 if $tn eq 't2';
+               $number *= 0.50 if $tn eq 't3';
                return $number;
        }
 
@@ -352,7 +352,7 @@ command stop => {
        }
 
        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';