- $target[0] = "${ND::C}04$target[0]$ND::C" if $target[2] eq 'Norm' || $target[2] eq 'Cloak';
- $target[0] = "${ND::C}12$target[0]$ND::C" if $target[2] eq 'Emp';
- $target[0] = "${ND::C}13$target[0]$ND::C" if $target[2] eq 'Steal';
- $text .= " $ND::B$dead$ND::B $target[0] ($target[5]:$value),";
+ my $st = $ND::DBH->prepare(q{
+ SELECT name,"class","type",armor,metal+crystal+eonium AS cost,init,t1,t2,t3,eres,race
+ FROM ship_stats WHERE "class" = $1 AND ("class" ILIKE $2 OR race ILIKE $2)
+ });
+ $st->execute($s->{$tn},$target);
+ while (my $t = $st->fetchrow_hashref()){
+ my $dead = $s->{type} eq 'Emp' ? int($amount*$s->{guns}*(100-$t->{eres})/100)
+ : int($amount*$s->{damage}/$t->{armor});
+ $value = prettyValue($dead*$t->{cost}/100);
+ for my $tn2 ('t1','t2','t3'){
+ next unless (defined $t->{$tn2});
+ next unless ($t->{$tn2} eq $s->{class});
+
+ if($t->{init} <= $s->{init}){
+ $t->{init} = "${ND::C}04$t->{init}$ND::C";
+ }elsif($t->{init} > $s->{init}){
+ $t->{init} = "${ND::C}12$t->{init}$ND::C";
+ }
+ }
+ $t->{name} = "${ND::C}04$t->{name}$ND::C" if $t->{type} eq 'Norm' || $t->{type} eq 'Cloak';
+ $t->{name} = "${ND::C}12$t->{name}$ND::C" if $t->{type} eq 'Emp';
+ $t->{name} = "${ND::C}13$t->{name}$ND::C" if $t->{type} eq 'Steal';
+ $text .= " $ND::B$dead$ND::B $t->{name} ($t->{init}:$value),";
+ }
+ chop $text;