X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Commands%2FPA.pm;h=94478e38c20bf174170ce8c819b0ec520efebec7;hb=726b4c0ff9accf03aac73e14d6aee8742bc95c92;hp=ac414ca8542c629ebf6267565e1aaed126df854e;hpb=734f71c099149b73077c64112bbe15ad14f468a2;p=NDIRC.git diff --git a/Commands/PA.pm b/Commands/PA.pm index ac414ca..94478e3 100644 --- a/Commands/PA.pm +++ b/Commands/PA.pm @@ -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 .= " " . $self->target($s,$tn) . ": "; 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 .= " $number $name ($t->{init}:$value),"; } chop $text; @@ -295,13 +295,13 @@ 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 "$string"; } 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'; @@ -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';