- if (defined $value){
- $amount = int(($value*100/$ship[4]));
- $feud = '(FEUD: '.prettyValue(int($amount/0.85)).') ';
- }
- $value = prettyValue(($amount*$ship[4]/100));
- 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" = ?
- });
- $st->execute($ship[6]);
- while (my @stopper = $st->fetchrow()){
- my $needed = $stopper[2] eq 'Emp' ? ceil($amount*100/(100-$ship[7])/$stopper[7]) : ceil($amount*$ship[3]/$stopper[3]);
- $value = prettyValue($needed*$stopper[4]/100);
- if (($stopper[1] eq $ship[1]) and ($ship[5] <= $stopper[5])){
- $stopper[5] = "${ND::C}04$stopper[5]$ND::C";
- }elsif(($stopper[1] eq $ship[1]) and ($ship[5] > $stopper[5])){
- $stopper[5] = "${ND::C}12$stopper[5]$ND::C";
- }
- $stopper[0] = "${ND::C}04$stopper[0]$ND::C" if $stopper[2] eq 'Norm' || $stopper[2] eq 'Cloak';
- $stopper[0] = "${ND::C}12$stopper[0]$ND::C" if $stopper[2] eq 'Emp';
- $stopper[0] = "${ND::C}13$stopper[0]$ND::C" if $stopper[2] eq 'Steal';
- $text .= " $ND::B$needed$ND::B $stopper[0] ($stopper[5]:$value),";