X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=Commands%2FPA.pm;h=8b64205c7af45f90b7ace83ba4730f7d491c28d2;hb=HEAD;hp=8a40007e0485c7c78b3ac2d612752d778bc81904;hpb=82565659237ad7e2d279a19bac94d5d6a9335478;p=NDIRC.git diff --git a/Commands/PA.pm b/Commands/PA.pm index 8a40007..8b64205 100644 --- a/Commands/PA.pm +++ b/Commands/PA.pm @@ -34,6 +34,7 @@ command bcalc => { command p => { help => q(usage: .p X:Y:Z | or .p nick with high enough access), + type => 'member', }, class extends NDIRC::Command { method execute($c,$msg) { @@ -222,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.+$/){ @@ -238,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 @@ -266,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; @@ -294,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 "$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'; - $number *= 0.30 if $tn eq 't3'; + $number *= 0.70 if $tn eq 't2'; + $number *= 0.50 if $tn eq 't3'; return $number; } @@ -351,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';