| 1 | package Net::Halo::Status; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use IO::Socket::INET; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Encode; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | require Exporter; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 13 | 1 | our @EXPORT = qw(); | |||||||||||||||||||||||||||
| 14 | 1 | our %EXPORT_TAGS = (all => []); | |||||||||||||||||||||||||||
| 15 | 1 | our @EXPORT_OK = (@{$EXPORT_TAGS{all}}); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | our $VERSION = '0.02'; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | our $player_flags = { | |||||||||||||||||||||||||||
| 20 | 'NumberOfLives' => ['Infinite', 1, 3, 5], | ||||||||||||||||||||||||||||
| 21 | 'MaximumHealth' => ['50%', '100%', '150%', '200%', '300%', '400%'], | ||||||||||||||||||||||||||||
| 22 | 'Shields' => [1, 0], | ||||||||||||||||||||||||||||
| 23 | 'RespawnTime' => [0, 5, 10, 15], | ||||||||||||||||||||||||||||
| 24 | 'RespawnGrowth' => [0, 5, 10, 15], | ||||||||||||||||||||||||||||
| 25 | 'OddManOut' => [0, 1], | ||||||||||||||||||||||||||||
| 26 | 'InvisiblePlayers' => [0, 1], | ||||||||||||||||||||||||||||
| 27 | 'SuicidePenalty' => [0, 5, 10, 15], | ||||||||||||||||||||||||||||
| 28 | 'InfiniteGrenades' => [0, 1], | ||||||||||||||||||||||||||||
| 29 | 'WeaponSet' => [ | ||||||||||||||||||||||||||||
| 30 | 'Normal', 'Pistols', 'Rifles', 'Plasma', 'Sniper', 'No Sniping', | ||||||||||||||||||||||||||||
| 31 | 'Rocket Launchers', 'Shotguns', 'Short Range', 'Human', 'Covenant', | ||||||||||||||||||||||||||||
| 32 | 'Classic', 'Heavy Weapons' | ||||||||||||||||||||||||||||
| 33 | ], | ||||||||||||||||||||||||||||
| 34 | 'StartingEquipment' => ['Custom', 'Generic'], | ||||||||||||||||||||||||||||
| 35 | 'Indicator' => ['Motion Tracker', 'Nav Points', 'None'], | ||||||||||||||||||||||||||||
| 36 | 'OtherPlayersOnRadar' => ['No', 'All', undef, 'Friends'], | ||||||||||||||||||||||||||||
| 37 | 'FriendIndicators' => [0, 1], | ||||||||||||||||||||||||||||
| 38 | 'FriendlyFire' => ['Off', 'On', 'Shields Only', 'Explosives Only'], | ||||||||||||||||||||||||||||
| 39 | 'FriendlyFirePenalty' => [0, 5, 10, 15], | ||||||||||||||||||||||||||||
| 40 | 'AutoTeamBalance' => [0, 1], | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | # Team Flags | ||||||||||||||||||||||||||||
| 43 | 'VehicleRespawn' => [0, 30, 60, 90, 120, 180, 300], | ||||||||||||||||||||||||||||
| 44 | 'RedVehicleSet' => [ | ||||||||||||||||||||||||||||
| 45 | 'Default', undef, 'Warthogs', 'Ghosts', 'Scorpions', 'Rocket Warthogs', | ||||||||||||||||||||||||||||
| 46 | 'Banshees', 'Gun Turrets', 'Custom' | ||||||||||||||||||||||||||||
| 47 | ], | ||||||||||||||||||||||||||||
| 48 | 'BlueVehicleSet' => [ | ||||||||||||||||||||||||||||
| 49 | 'Default', undef, 'Warthogs', 'Ghosts', 'Scorpions', 'Rocket Warthogs', | ||||||||||||||||||||||||||||
| 50 | 'Banshees', 'Gun Turrets', 'Custom' | ||||||||||||||||||||||||||||
| 51 | ], | ||||||||||||||||||||||||||||
| 52 | }; | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 1 | our $game_flags = { | |||||||||||||||||||||||||||
| 55 | 'GameType' => [ | ||||||||||||||||||||||||||||
| 56 | 'Capture the Flag', 'Slayer', 'Oddball', 'King of the Hill', 'Race' | ||||||||||||||||||||||||||||
| 57 | ], | ||||||||||||||||||||||||||||
| 58 | # CTF | ||||||||||||||||||||||||||||
| 59 | 'Assault' => [0, 1], | ||||||||||||||||||||||||||||
| 60 | 'FlagMustReset' => [0, 1], | ||||||||||||||||||||||||||||
| 61 | 'FlagAtHomeToScore' => [0, 1], | ||||||||||||||||||||||||||||
| 62 | 'SingleFlag' => [0, 60, 120, 180, 300, 600], | ||||||||||||||||||||||||||||
| 63 | # Slayer | ||||||||||||||||||||||||||||
| 64 | 'DeathBonus' => [1, 0], | ||||||||||||||||||||||||||||
| 65 | 'KillPenalty' => [1, 0], | ||||||||||||||||||||||||||||
| 66 | 'KillInOrder' => [0, 1], | ||||||||||||||||||||||||||||
| 67 | # Oddball | ||||||||||||||||||||||||||||
| 68 | 'RandomStart' => [0, 1], | ||||||||||||||||||||||||||||
| 69 | 'SpeedWithBall' => ['Slow', 'Normal', 'Fast'], | ||||||||||||||||||||||||||||
| 70 | 'TraitWithBall' => ['None', 'Invisible', 'Extra Damage', 'Damage Resistant'], | ||||||||||||||||||||||||||||
| 71 | 'TraitWithoutBall' => ['None', 'Invisible', 'Extra Damage', 'Damage Resistant'], | ||||||||||||||||||||||||||||
| 72 | 'BallType' => ['Normal', 'Reverse Tag', 'Juggernaut'], | ||||||||||||||||||||||||||||
| 73 | 'BallSpawnCount' => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], | ||||||||||||||||||||||||||||
| 74 | # King of the Hill | ||||||||||||||||||||||||||||
| 75 | 'MovingHill' => [0, 1], | ||||||||||||||||||||||||||||
| 76 | # Race | ||||||||||||||||||||||||||||
| 77 | 'RaceType' => ['Normal', 'Any Order', 'Rally'], | ||||||||||||||||||||||||||||
| 78 | 'TeamScoring' => ['Minimum', 'Maximum', 'Sum'], | ||||||||||||||||||||||||||||
| 79 | }; | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=10 SCAR=25.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 82 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 83 | 1 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 1 | ▶ | croak "$class requires an even number of parameters" if @_ % 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | my %params = @_; | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 1 | my $timeout = delete $params{Timeout}; | |||||||||||||||||||||||||||
| 90 | 1 | ▶ | $timeout = 15 unless defined $timeout and $timeout >= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $timeout and $timeout >= 0
MC/DC0%0/2
defined $timeout and $timeout >= 0
defined $timeout
$timeout >= 0
Truth table33%1/3
A and B
A= defined $timeoutB= $timeout >= 0
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 1 | my $retry = delete $params{Retry}; | |||||||||||||||||||||||||||
| 93 | 1 | ▶ | $retry = 2 unless defined $retry and $retry >= 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $retry and $retry >= 0
MC/DC0%0/2
defined $retry and $retry >= 0
defined $retry
$retry >= 0
Truth table33%1/3
A and B
A= defined $retryB= $retry >= 0
| |||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 1 | my $server = delete $params{Server}; | |||||||||||||||||||||||||||
| 96 | 1 | ▶ | $self->server($server) if defined $server; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 1 | my $port = delete $params{Port}; | |||||||||||||||||||||||||||
| 99 | 1 | ▶ | $self->port(2302) unless defined $port; # Default to 2302. | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 1 | ▶ | $self->port($port) if defined $port; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 1 | ▶ | croak "$class doesn't know these parameters: ", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | join(', ', sort(keys(%params))) if scalar(keys(%params)); | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 1 | return $self; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 2 | ▶ | sub server ($) { | ||||||||||||||||||||||||||
|
Subroutine
server: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 109 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 110 | 2 | ▶ | if (@_) { $self->{Server} = shift }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | 2 | return $self->{Server}; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 2 | ▶ | sub port ($) { | ||||||||||||||||||||||||||
|
Subroutine
port: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 115 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 116 | 2 | ▶ | if (@_) { $self->{Port} = shift }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 117 | 2 | return $self->{Port}; | |||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 1 | ▶ | sub query () { | ||||||||||||||||||||||||||
|
Subroutine
query: called CC=7 SCAR=23.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 122 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 123 | 1 | my $data = ''; # Receiving data buffer. | |||||||||||||||||||||||||||
| 124 | 1 | my %data = (); | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 1 | eval { | |||||||||||||||||||||||||||
| 127 | 0 | ▶ | local $SIG{ALRM} = sub { die "Timed Out\n" }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 128 | 1 | alarm 1; | |||||||||||||||||||||||||||
| 129 | 1 | ▶ | my $sock = new IO::Socket::INET ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | PeerAddr => $self->server(), | ||||||||||||||||||||||||||||
| 131 | PeerPort => $self->port(), | ||||||||||||||||||||||||||||
| 132 | Proto => 'udp', | ||||||||||||||||||||||||||||
| 133 | Type => SOCK_DGRAM, | ||||||||||||||||||||||||||||
| 134 | ReuseAddr => 1, | ||||||||||||||||||||||||||||
| 135 | Blocking => 1, | ||||||||||||||||||||||||||||
| 136 | ) or croak "IO::Socket::INET->new() failed to bind: $@\n"; | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 1 | $sock->send("\xFE\xFD\x00\x33\x8f\x02\x00\xff\xff\xff"); | |||||||||||||||||||||||||||
| 139 | 1 | $sock->recv($data, 16384); | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | alarm 0; | |||||||||||||||||||||||||||
| 142 | }; | ||||||||||||||||||||||||||||
| 143 | 1 | alarm 0; | |||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 1 | ▶ | if ($@) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 0 | $data{ERROR} = $@; | |||||||||||||||||||||||||||
| 147 | 0 | return \%data; | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 1 | ▶ | if ($data eq '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | 1 | $data{ERROR} = 'DOWN'; | |||||||||||||||||||||||||||
| 152 | } else { | ||||||||||||||||||||||||||||
| 153 | 0 | $data =~ s/\x00+$//; | |||||||||||||||||||||||||||
| 154 | 0 | my ($rules, $players, $score) = ($data =~ /^.{5}(.+?)\x00{3}[\x00-\x10](.+)\x00{2}[\x02\x00](.+$)/); | |||||||||||||||||||||||||||
| 155 | 0 | my @parts = split(/\x00/, $data); | |||||||||||||||||||||||||||
| 156 | 0 | %{$data{'Rules'}} = split(/\x00/, $rules); | |||||||||||||||||||||||||||
| 157 | 0 | $data{'PlayerFlags'} = $self->decode_player_flags($data{'Rules'}{'player_flags'}); | |||||||||||||||||||||||||||
| 158 | 0 | $data{'GameFlags'} = $self->decode_game_flags($data{'Rules'}{'game_flags'}); | |||||||||||||||||||||||||||
| 159 | 0 | $data{'Players'} = $self->process_segment($players); | |||||||||||||||||||||||||||
| 160 | 0 | $data{'Score'} = $self->process_segment($score); | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 1 | foreach my $_Pflag (keys %{$data{PlayerFlags}->{Player}}) { | |||||||||||||||||||||||||||
| 164 | 0 | $data{PlayerFlags}->{Player}->{$_Pflag} = $self->halo_player_flag($_Pflag, $data{PlayerFlags}->{Player}->{$_Pflag}); | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | 1 | foreach my $_Tflag (keys %{$data{PlayerFlags}->{Team}}) { | |||||||||||||||||||||||||||
| 167 | 0 | $data{PlayerFlags}->{Player}->{$_Tflag} = $self->halo_player_flag($_Tflag, $data{PlayerFlags}->{Team}->{$_Tflag}); | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | 1 | foreach my $_Gflag (keys %{$data{GameFlags}}) { | |||||||||||||||||||||||||||
| 170 | 0 | $data{GameFlags}->{$_Gflag} = $self->halo_game_flag($_Gflag, $data{GameFlags}->{$_Gflag}); | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | 1 | return \%data; | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 0 | ▶ | sub decode_player_flags { | ||||||||||||||||||||||||||
|
Subroutine
decode_player_flags: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 177 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 178 | 0 | my $str = shift; | |||||||||||||||||||||||||||
| 179 | 0 | my $flags = { }; | |||||||||||||||||||||||||||
| 180 | 0 | ▶ | return $flags if $str eq '' || $str !~ /^\d+\,\d+$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$str eq "" or not $str =~ /^\d+\,\d+$/
MC/DC0%0/2
$str eq "" or not $str =~ /^\d+\,\d+$/
$str eq ""
not $str =~ /^\d+\,\d+$/
Truth table0%0/3
A or not(B)
A= $str eq ""B= not $str =~ /^\d+\,\d+$/
| |||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 0 | my ($player, $vehicle) = split(/\,/, $str); | |||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | 0 | $flags->{'Player'}->{'NumberOfLives'} = $player & 3; | |||||||||||||||||||||||||||
| 185 | 0 | $flags->{'Player'}->{'MaximumHealth'} = ($player >> 2) & 7; | |||||||||||||||||||||||||||
| 186 | 0 | $flags->{'Player'}->{'Shields'} = ($player >> 5) & 1; | |||||||||||||||||||||||||||
| 187 | 0 | $flags->{'Player'}->{'RespawnTime'} = ($player >> 6) & 3; | |||||||||||||||||||||||||||
| 188 | 0 | $flags->{'Player'}->{'RespawnGrowth'} = ($player >> 8) & 3; | |||||||||||||||||||||||||||
| 189 | 0 | $flags->{'Player'}->{'OddManOut'} = ($player >> 10) & 1; | |||||||||||||||||||||||||||
| 190 | 0 | $flags->{'Player'}->{'InvisiblePlayers'} = ($player >> 11) & 1; | |||||||||||||||||||||||||||
| 191 | 0 | $flags->{'Player'}->{'SuicidePenalty'} = ($player >> 12) & 3; | |||||||||||||||||||||||||||
| 192 | 0 | $flags->{'Player'}->{'InfiniteGrenades'} = ($player >> 14) & 1; | |||||||||||||||||||||||||||
| 193 | 0 | $flags->{'Player'}->{'WeaponSet'} = ($player >> 15) & 15; | |||||||||||||||||||||||||||
| 194 | 0 | $flags->{'Player'}->{'StartingEquipment'} = ($player >> 19) & 1; | |||||||||||||||||||||||||||
| 195 | 0 | $flags->{'Player'}->{'Indicator'} = ($player >> 20) & 3; | |||||||||||||||||||||||||||
| 196 | 0 | $flags->{'Player'}->{'OtherPlayersOnRadar'} = ($player >> 22) & 3; | |||||||||||||||||||||||||||
| 197 | 0 | $flags->{'Player'}->{'FriendIndicators'} = ($player >> 24) & 1; | |||||||||||||||||||||||||||
| 198 | 0 | $flags->{'Player'}->{'FriendlyFire'} = ($player >> 25) & 3; | |||||||||||||||||||||||||||
| 199 | 0 | $flags->{'Player'}->{'FriendlyFirePenalty'} = ($player >> 27) & 3; | |||||||||||||||||||||||||||
| 200 | 0 | $flags->{'Player'}->{'AutoTeamBalance'} = ($player >> 29) & 1; | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 0 | $flags->{'Team'}->{'VehicleRespawn'} = ($vehicle & 7); | |||||||||||||||||||||||||||
| 203 | 0 | $flags->{'Team'}->{'RedVehicleSet'} = ($vehicle >> 3) & 15; | |||||||||||||||||||||||||||
| 204 | 0 | $flags->{'Team'}->{'BlueVehicleSet'} = ($vehicle >> 7) & 15; | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | return $flags; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 0 | ▶ | sub decode_game_flags { | ||||||||||||||||||||||||||
|
Subroutine
decode_game_flags: not called CC=24 SCAR=64.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 210 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 211 | 0 | my $str = shift; | |||||||||||||||||||||||||||
| 212 | 0 | my $flags = { }; | |||||||||||||||||||||||||||
| 213 | 0 | ▶ | return $flags if $str eq '' || $str !~ /^\d+$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$str eq "" or not $str =~ /^\d+$/
MC/DC0%0/2
$str eq "" or not $str =~ /^\d+$/
$str eq ""
not $str =~ /^\d+$/
Truth table0%0/3
A or not(B)
A= $str eq ""B= not $str =~ /^\d+$/
| |||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | $flags->{'GameType'} = $str & 7; | |||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ($flags->{'GameType'} == 1) { # CTF | ||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||
| 217 | 0 | ▶ | $flags->{'Assault'} = ($str >> 3) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 3 && 1
MC/DC0%0/1
$str >> 3 && 1
$str >> 3
Truth table0%0/2
A
A= $str >> 3
| |||||||||||||||||||||||||||||
| 218 | 0 | ▶ | $flags->{'FlagMustReset'} = ($str >> 5) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 5 && 1
MC/DC0%0/1
$str >> 5 && 1
$str >> 5
Truth table0%0/2
A
A= $str >> 5
| |||||||||||||||||||||||||||||
| 219 | 0 | ▶ | $flags->{'FlagAtHomeToScore'} = ($str >> 6) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 6 && 1
MC/DC0%0/1
$str >> 6 && 1
$str >> 6
Truth table0%0/2
A
A= $str >> 6
| |||||||||||||||||||||||||||||
| 220 | 0 | ▶ | $flags->{'SingleFlag'} = ($str >> 7) && 7; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 7 && 7
MC/DC0%0/1
$str >> 7 && 7
$str >> 7
Truth table0%0/2
A
A= $str >> 7
| |||||||||||||||||||||||||||||
| 221 | } elsif ($flags->{'GameType'} == 2) { # Slayer | ||||||||||||||||||||||||||||
| 222 | 0 | ▶ | $flags->{'DeathBonus'} = ($str >> 3) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 3 && 1
MC/DC0%0/1
$str >> 3 && 1
$str >> 3
Truth table0%0/2
A
A= $str >> 3
| |||||||||||||||||||||||||||||
| 223 | 0 | ▶ | $flags->{'KillPenalty'} = ($str >> 5) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 5 && 1
MC/DC0%0/1
$str >> 5 && 1
$str >> 5
Truth table0%0/2
A
A= $str >> 5
| |||||||||||||||||||||||||||||
| 224 | 0 | ▶ | $flags->{'KillInOrder'} = ($str >> 6) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 6 && 1
MC/DC0%0/1
$str >> 6 && 1
$str >> 6
Truth table0%0/2
A
A= $str >> 6
| |||||||||||||||||||||||||||||
| 225 | } elsif ($flags->{'GameType'} == 3) { # Oddball | ||||||||||||||||||||||||||||
| 226 | 0 | ▶ | $flags->{'RandomStart'} = ($str >> 3) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 3 && 1
MC/DC0%0/1
$str >> 3 && 1
$str >> 3
Truth table0%0/2
A
A= $str >> 3
| |||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $flags->{'SpeedWithBall'} = ($str >> 5) && 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 5 && 3
MC/DC0%0/1
$str >> 5 && 3
$str >> 5
Truth table0%0/2
A
A= $str >> 5
| |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | $flags->{'TraitWithBall'} = ($str >> 7) && 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 7 && 3
MC/DC0%0/1
$str >> 7 && 3
$str >> 7
Truth table0%0/2
A
A= $str >> 7
| |||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $flags->{'TraitWithoutBall'} = ($str >> 9) && 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 9 && 3
MC/DC0%0/1
$str >> 9 && 3
$str >> 9
Truth table0%0/2
A
A= $str >> 9
| |||||||||||||||||||||||||||||
| 230 | 0 | ▶ | $flags->{'BallType'} = ($str >> 11) && 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 11 && 3
MC/DC0%0/1
$str >> 11 && 3
$str >> 11
Truth table0%0/2
A
A= $str >> 11
| |||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $flags->{'BallSpawnCount'} = ($str >> 13) && 31; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 13 && 31
MC/DC0%0/1
$str >> 13 && 31
$str >> 13
Truth table0%0/2
A
A= $str >> 13
| |||||||||||||||||||||||||||||
| 232 | } elsif ($flags->{'GameType'} == 4) { # Hill | ||||||||||||||||||||||||||||
| 233 | 0 | ▶ | $flags->{'MovingHill'} = ($str >> 3) && 1; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 3 && 1
MC/DC0%0/1
$str >> 3 && 1
$str >> 3
Truth table0%0/2
A
A= $str >> 3
| |||||||||||||||||||||||||||||
| 234 | } elsif ($flags->{'GameType'} == 5) { # Race | ||||||||||||||||||||||||||||
| 235 | 0 | ▶ | $flags->{'RaceType'} = ($str >> 3) && 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 3 && 3
MC/DC0%0/1
$str >> 3 && 3
$str >> 3
Truth table0%0/2
A
A= $str >> 3
| |||||||||||||||||||||||||||||
| 236 | 0 | ▶ | $flags->{'TeamScoring'} = ($str >> 5) && 3; | ||||||||||||||||||||||||||
|
Condition0%0/2
$str >> 5 && 3
MC/DC0%0/1
$str >> 5 && 3
$str >> 5
Truth table0%0/2
A
A= $str >> 5
| |||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 0 | return $flags; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 0 | ▶ | sub halo_player_flag { | ||||||||||||||||||||||||||
|
Subroutine
halo_player_flag: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 243 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 244 | 0 | my $flag_name = shift; | |||||||||||||||||||||||||||
| 245 | 0 | my $flag_value = shift; | |||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if (defined($player_flags->{$flag_name}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $Net::Halo::Status::player_flags->{$flag_name} and defined $Net::Halo::Status::player_flags->{$flag_name}[$flag_value]
MC/DC0%0/2
defined $Net::Halo::Status::player_flags->{$flag_name} and defined $Net::Halo::Status::player_flags->{$flag_name}[$flag_value]
defined $Net::Halo::Status::player_flags->{$flag_name}
defined $Net::Halo::Status::player_flags->{$flag_name}[$flag_value]
Truth table0%0/3
A and B
A= defined $Net::Halo::Status::player_flags->{$flag_name}B= defined $Net::Halo::Status::player_flags->{$flag_name}[$flag_value]
| |||||||||||||||||||||||||||||
| 248 | defined($player_flags->{$flag_name}->[$flag_value])) { | ||||||||||||||||||||||||||||
| 249 | 0 | return $player_flags->{$flag_name}->[$flag_value]; | |||||||||||||||||||||||||||
| 250 | } else { | ||||||||||||||||||||||||||||
| 251 | 0 | return $flag_value; | |||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | ▶ | sub halo_game_flag { | ||||||||||||||||||||||||||
|
Subroutine
halo_game_flag: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 256 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 257 | 0 | my $flag_name = shift; | |||||||||||||||||||||||||||
| 258 | 0 | my $flag_value = shift; | |||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if(defined($game_flags->{$flag_name}) && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $Net::Halo::Status::game_flags->{$flag_name} and defined $Net::Halo::Status::game_flags->{$flag_name}[$flag_value]
MC/DC0%0/2
defined $Net::Halo::Status::game_flags->{$flag_name} and defined $Net::Halo::Status::game_flags->{$flag_name}[$flag_value]
defined $Net::Halo::Status::game_flags->{$flag_name}
defined $Net::Halo::Status::game_flags->{$flag_name}[$flag_value]
Truth table0%0/3
A and B
A= defined $Net::Halo::Status::game_flags->{$flag_name}B= defined $Net::Halo::Status::game_flags->{$flag_name}[$flag_value]
| |||||||||||||||||||||||||||||
| 261 | defined($game_flags->{$flag_name}->[$flag_value])) { | ||||||||||||||||||||||||||||
| 262 | 0 | return $game_flags->{$flag_name}->[$flag_value]; | |||||||||||||||||||||||||||
| 263 | } else { | ||||||||||||||||||||||||||||
| 264 | 0 | return $flag_value; | |||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | sub process_segment { | ||||||||||||||||||||||||||
|
Subroutine
process_segment: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 269 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 270 | 0 | my $str = shift; | |||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 0 | my @parts = split(/\x00/, $str); | |||||||||||||||||||||||||||
| 273 | 0 | my @fields = (); | |||||||||||||||||||||||||||
| 274 | 0 | foreach (@parts) { | |||||||||||||||||||||||||||
| 275 | 0 | ▶ | last if $_ eq ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | 0 | s/_.*$//; | |||||||||||||||||||||||||||
| 277 | 0 | push @fields, $_; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 0 | my $info = {}; | |||||||||||||||||||||||||||
| 281 | 0 | my $ctr = 0; | |||||||||||||||||||||||||||
| 282 | 0 | my $cur_item = ''; | |||||||||||||||||||||||||||
| 283 | 0 | ▶ | foreach (splice(@parts, scalar(@fields) + (scalar(@parts) == scalar(@fields) ? 0 : 1))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if($ctr % scalar(@fields) == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 285 | 0 | $cur_item = $_; | |||||||||||||||||||||||||||
| 286 | 0 | $info->{$cur_item}->{$fields[0]} = $cur_item; | |||||||||||||||||||||||||||
| 287 | } else { | ||||||||||||||||||||||||||||
| 288 | 0 | $info->{$cur_item}->{$fields[$ctr % scalar(@fields)]} = $_; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | 0 | $ctr++; | |||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 0 | return $info; | |||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | 1 | 1; | |||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | __END__ | ||||||||||||||||||||||||||||