while (my $target = $targets->fetchrow_hashref){
my %target;
$target{Id} = $target->{id};
- $target{Coords} = $target->{id};
my @waves;
for (my $i = 1; $i <= $raid->{waves}; $i++){
my %wave;
$claimers = join '/', @claimers;
if ($owner){
$wave{Command} = 'Unclaim';
- if ($raid->{released_coords}){
- $target{Coords} = $DBH->selectrow_array('SELECT coords(x,y,z) FROM current_planet_stats WHERE id = ?',undef,$target->{planet});
- }
}elsif ($joinable){
$wave{Command} = 'Join';
}else{
return $self->generateClaimXml($BODY,$raid,$from);
}
if ($self->{XML} && param('cmd') eq 'gettargets' ){
- $_ = listTargets();
+ $_ = $self->listTargets();
$BODY->param(TargetList => $_);
}
$target{comment} = parseMarkup($target->{comment}) if ($target->{comment});
my $scans = $DBH->prepare(q{SELECT DISTINCT ON (type) type, tick, scan FROM scans
- WHERE planet = ? AND type ~ 'Unit|Planet|Military|.* Analysis' AND tick + 24 > tick() AND scan is not null
+ WHERE planet = ? AND type ~ 'Unit|Planet|Advanced Unit|.* Analysis' AND tick + 24 > tick() AND scan is not null
GROUP BY type, tick, scan ORDER BY type ,tick DESC});
$scans->execute($target->{planet});
my %scans;
}
my @scans;
- for my $type ('Planet','Unit','Military','Surface Analysis','Technology Analysis'){
+ for my $type ('Planet','Unit','Advanced Unit','Surface Analysis','Technology Analysis'){
next unless exists $scans{$type};
my $scan = $scans{$type};
if ($self->{TICK} - $scan->{tick} > 5){
if ($planet->{x} == $target->{x}){
$target{style} = 'incluster';
}
+ $target{ScoreBash} = 'bash' if ($target->{score}/$planet->{score} < 0.4);
+ $target{ValueBash} = 'bash' if ($target->{value}/$planet->{value} < 0.4);
}
my @roids;
for (my $i = 1; $i <= $raid->{waves}; $i++){
my $roids = floor(0.25*$size);
$size -= $roids;
- my $xp;
+ my $xp = 0;
if ($planet){
- $xp = max(0,floor($roids * 10 * (min(2,$target{Score}/$planet->{score}) + min(2,$target{Value}/$planet->{value})-1)));
+ $xp = pa_xp($roids,$planet->{score},$planet->{value},$target{Score},$target{Value});
}
push @roids,{Wave => $i, Roids => $roids, XP => $xp};
if ($self->{AJAX}){