X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FIRC%2FPA.pm;h=30e7fdc26383a122a0cc7b26d0a59b29c1ca144a;hb=8632250ce1c9cc692486e1f6eecd6994a95975f9;hp=fbe2a8457de9ddd22f44ee1296dfaa66fbed5e69;hpb=55cc621bec16d80555e9e588c731505a8b04e1a9;p=ndwebbie.git diff --git a/ND/IRC/PA.pm b/ND/IRC/PA.pm index fbe2a84..30e7fdc 100644 --- a/ND/IRC/PA.pm +++ b/ND/IRC/PA.pm @@ -20,6 +20,7 @@ package ND::IRC::PA; use strict; use warnings; use ND::DB; +use ND::Include; use ND::IRC::Access; use ND::IRC::Misc; use POSIX; @@ -27,7 +28,7 @@ require Exporter; our @ISA = qw/Exporter/; -our @EXPORT = qw/checkPlanet checkGal shipEff shipStop parseValue prettyValue/; +our @EXPORT = qw/checkPlanet checkGal shipEff shipStop parseValue prettyValue calcXp/; sub checkPlanet { my ($x,$y,$z,$intel) = @_; @@ -138,39 +139,6 @@ FROM ship_stats WHERE name ILIKE ? #print $text; } -sub parseValue { - if (defined $_[0] && $_[0] =~ /^(-?\d+(?:\.\d+)?)([khMG])?$/){ - return $1 unless defined $2; - return $1*100 if $2 eq 'h'; - return $1*1000 if $2 eq 'k'; - return $1*1000000 if $2 eq 'M'; - return $1*1000000000 if $2 eq 'G'; - } - return $_[0]; -} - -sub prettyValue { - my ($value) = @_; - my $unit = ''; - my @units = ('k','M','G','T'); - for (my $i = 0; $value >= 1000;$i++){ - $value /= 1000; - $unit = $units[$i]; - } - return sprintf('%.2f%s', $value,$unit); -} - - -sub min { - my ($x,$y) = @_; - return ($x > $y ? $y : $x); -} - -sub max { - my ($x,$y) = @_; - return ($x < $y ? $y : $x); -} - sub calcXp { my ($x,$y,$z,$roids) = @_;