X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=NDWeb%2FPages%2FMemberIntel.pm;h=d8a72cef755ef46fe307005bd8119cd72d619396;hb=6d4dfa134a65a5d19cdad899dc89115b00f5dffc;hp=ae5cb2d8ad83cd7918edc36f10c55849015ef953;hpb=a189765a37d1fcc4a4dfa732a8177dd55844060e;p=ndwebbie.git diff --git a/NDWeb/Pages/MemberIntel.pm b/NDWeb/Pages/MemberIntel.pm index ae5cb2d..d8a72ce 100644 --- a/NDWeb/Pages/MemberIntel.pm +++ b/NDWeb/Pages/MemberIntel.pm @@ -72,8 +72,9 @@ sub render_body { }); $query->execute($user->{uid}) or $error .= $DBH->errstr; my @nd_attacks; - my @retals; my @other_attacks; + my $ndi = 0; + my $oi = 0; while (my $intel = $query->fetchrow_hashref){ my $attack = {target => $intel->{coords}, tick => $intel->{tick}}; if ($intel->{ndtarget}){ @@ -82,14 +83,16 @@ sub render_body { }else{ $attack->{Other} = 'Launched at a tick that was not claimed'; } + $attack->{ODD} = ++$ndi % 2; push @nd_attacks, $attack; }else{ + $attack->{ODD} = ++$oi % 2; push @other_attacks, $attack; } } my @attacks; - push @attacks, {name => 'ND Attacks', list => \@nd_attacks}; - push @attacks, {name => 'Other', list => \@other_attacks}; + push @attacks, {name => 'ND Attacks', list => \@nd_attacks, class => 'AllyDef'}; + push @attacks, {name => 'Other', list => \@other_attacks, class => 'Attack'}; $BODY->param(Attacks => \@attacks); $query = $DBH->prepare(q{ @@ -104,20 +107,26 @@ sub render_body { my @nd_def; my @ingal_def; my @other_def; + $ndi = 0; + $oi = 0; + my $gi = 0; while (my $intel = $query->fetchrow_hashref){ my $def = {target => $intel->{coords}.(defined $intel->{alliance} ? " ($intel->{alliance})" : ''), tick => $intel->{tick}}; if (defined $intel->{alliance_id} && $intel->{alliance_id} == 1){ + $def->{ODD} = ++$ndi % 2; push @nd_def, $def; }elsif($intel->{ingal}){ + $def->{ODD} = ++$gi % 2; push @ingal_def, $def; }else{ + $def->{ODD} = ++$oi % 2; push @other_def, $def; } } my @defenses; - push @defenses, {name => 'ND Def', list => \@nd_def}; - push @defenses, {name => 'Ingal Def', list => \@ingal_def}; - push @defenses, {name => 'Other', list => \@other_def}; + push @defenses, {name => 'ND Def', list => \@nd_def, class => 'AllyDef'}; + push @defenses, {name => 'Ingal Def', list => \@ingal_def, class => 'Defend'}; + push @defenses, {name => 'Other', list => \@other_def, class => 'Attack'}; $BODY->param(Defenses => \@defenses); }else{