From: Michael Andreen Date: Sat, 13 Jan 2007 12:31:45 +0000 (+0000) Subject: moved functions to include file X-Git-Url: https://ruin.nu/git/?a=commitdiff_plain;ds=sidebyside;h=c8fb9b040a31b4c7b5d9439f7d79516869c20b4d;p=NDIRC.git moved functions to include file --- diff --git a/PA.pm b/PA.pm index fbe2a84..f1444a2 100644 --- a/PA.pm +++ b/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; @@ -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) = @_;