X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=ND%2FIRC%2FPA.pm;h=e5f20bf7b42fa743282232816e77c686efa48329;hb=88bab2dd26fcdb7a49a81e9fe6a74022ce079f52;hp=f1444a247f5610cbcd10351f80f65e624b7e899f;hpb=33379bf7e2909a0f46ccf771a919121e48f9ab41;p=ndwebbie.git diff --git a/ND/IRC/PA.pm b/ND/IRC/PA.pm index f1444a2..e5f20bf 100644 --- a/ND/IRC/PA.pm +++ b/ND/IRC/PA.pm @@ -28,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) = @_; @@ -59,6 +59,7 @@ sub shipEff { $amount = parseValue($amount); $value = parseValue($value); $value *= -1.5 if defined $value and $value < 0; + my $feud = ''; my @ship = $ND::DBH->selectrow_array(q{ SELECT name,target,"type",damage,metal+crystal+eonium,init,"class",guns,race @@ -70,8 +71,9 @@ FROM ship_stats WHERE name ILIKE ? $type = "steal" if ($ship[2] eq 'Steal') or ($ship[2] eq 'Pod'); $amount = int(($value*100/$ship[4])) if $amount eq 'value'; + $feud = '(FEUD: '.int($amount/0.75).') ' if defined $value; $value = prettyValue(($amount*$ship[4]/100)); - my $text = "$amount $ship[0] ($ship[5]:$value) will $type:"; + my $text = "$amount $feud $ship[0] ($ship[5]:$value) will $type:"; my $st = $ND::DBH->prepare(q{ SELECT name,"class","type",armor,metal+crystal+eonium,init,target,eres,race FROM ship_stats WHERE "class" = ? @@ -102,6 +104,7 @@ sub shipStop { $amount = parseValue($amount); $value = parseValue($value); $value *= -1.5 if defined $value and $value < 0; + my $feud = ''; my @ship = $ND::DBH->selectrow_array(q{ SELECT name,target,"type",armor,metal+crystal+eonium,init,"class",eres,race @@ -113,8 +116,9 @@ FROM ship_stats WHERE name ILIKE ? $ship[0] = "${ND::C}13$ship[0]$ND::C" if $ship[2] eq 'Steal'; $amount = int(($value*100/$ship[4])) if $amount eq 'value'; + $feud = '(FEUD: '.int($amount/0.75).') ' if defined $value; $value = prettyValue(($amount*$ship[4]/100)); - my $text = "To stop $amount $ship[0] ($ship[5]:$value) you need:"; + my $text = "To stop $amount $feud $ship[0] ($ship[5]:$value) you need:"; my $st = $ND::DBH->prepare(q{ SELECT name,"class","type",damage,metal+crystal+eonium,init,target,guns,race FROM ship_stats WHERE "target" = ? @@ -140,16 +144,24 @@ FROM ship_stats WHERE name ILIKE ? } sub calcXp { - my ($x,$y,$z,$roids) = @_; + my ($x,$y,$z,$roids,$cap) = @_; my ($avalue,$ascore) = $ND::DBH->selectrow_array(q{ SELECT value,score FROM current_planet_stats WHERE id = (SELECT planet FROM users WHERE hostmask ILIKE ?); }, undef, $ND::address); - my ($tvalue,$tscore) = $ND::DBH->selectrow_array(q{ - SELECT value,score FROM current_planet_stats WHERE - x = ? AND y = ? and z = ?; + my ($tvalue,$tscore,$tsize) = $ND::DBH->selectrow_array(q{ + SELECT value,score,size FROM current_planet_stats WHERE + x = ? AND y = ? and z = ?; }, undef, $x,$y,$z); + $cap = 0.25 unless $cap; + unless($roids){ + $roids = int($tsize*$cap); + }elsif ($roids < 10){ + $tsize = ceil($tsize*.75**($roids-1)); + $roids = int($cap*$tsize); + } + $tsize -= $roids; unless (defined $avalue && defined $ascore){ $ND::server->command("notice $ND::target You don't have a planet specified"); return; @@ -158,9 +170,11 @@ sub calcXp { $ND::server->command("notice $ND::target Doesn't seem to be a planet at $x:$y:$z"); return; } - my $xp = int(max($roids * 10 * (min(2,$tscore/$ascore) + min(2,$tvalue/$avalue) - 1),0)); + my $xp = pa_xp($roids,$ascore,$avalue,$tscore,$tvalue); my $score = 60 * $xp; - $ND::server->command("notice $ND::target You will gain $ND::B$xp$ND::B XP, $ND::B$score$ND::B score, if you steal $roids roids from $x:$y:$z"); + my $value = $roids*200; + my $totscore = prettyValue($score + $value); + $ND::server->command("notice $ND::target You will gain $ND::B$xp$ND::B XP, $ND::B$score$ND::B score, if you steal $roids roids ($ND::B$value$ND::B value), from $ND::B$x:$y:$z$ND::B, who will have $ND::B$tsize$ND::B roids left, total score gain will be: $ND::B$totscore$ND::B in total,"); } 1;