<commit_before><?php

// creates a new player object for attacker and defender
require_once(get_file_loc('SmrForce.class.inc'));
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);

// first check if both ship and forces are in same sector
if ($player->getSectorID() != $forces->getSectorID())
{
	create_error('Those forces are no longer here!');
}

$forces_owner =& $forces->getOwner();

$template->assign('PageTopic','Examine Forces');

// should we display an attack button
if (($ship->getAttackRating() > 0 || $ship->getCDs() > 0) &&
	!$player->hasFederalProtection() &&
	!$player->hasNewbieTurns() &&
	!$player->isLandedOnPlanet() &&
	!$player->forceNAPAlliance($forces_owner)) {

	$container = array();
	$container['url'] = 'forces_attack_processing.php';
	transfer('target');
	transfer('owner_id');
	$PHP_OUTPUT.=create_echo_form($container);
	$PHP_OUTPUT.=create_submit('Attack Forces (3)');
	$PHP_OUTPUT.=('</form><br />');

} elseif ($player->hasFederalProtection())
	$PHP_OUTPUT.=('<p><big style="color:#3333FF;">You are under federal protection! That wouldn\'t be fair.</big></p>');
elseif ($player->hasNewbieTurns())
	$PHP_OUTPUT.=('<p><big style="color:#33FF33;">You are under newbie protection!</big></p>');
elseif ($forces_owner->getAccountID() == $player->getAccountID())
	$PHP_OUTPUT.=('<p><big style="color:#33FF33;">These are your forces!</big></p>');
elseif ($player->forceNAPAlliance($forces_owner))
	$PHP_OUTPUT.=('<p><big style="color:#33FF33;">These are allied forces!</big></p>');

$PHP_OUTPUT.=('<div align="center">');
$PHP_OUTPUT.=('<table class="standard" width="95%">');
$PHP_OUTPUT.=('<tr>');
$PHP_OUTPUT.=('<th width="50%">Attacker</th>');
$PHP_OUTPUT.=('<th width="50%">Forces</th>');
$PHP_OUTPUT.=('</tr>');
$PHP_OUTPUT.=('<tr>');

// ********************************
// *
// * A t t a c k e r
// *
// ********************************

$sector =& $player->getSector();
$attackers =& $sector->getFightingTradersAgainstForces($player, $forces);

$PHP_OUTPUT.=('<td valign="top">');

foreach($attackers as &$attacker)<commit_msg>Always show current player when examining forces, even if they can't actually shoot the forces.<commit_after><?php

// creates a new player object for attacker and defender
require_once(get_file_loc('SmrForce.class.inc'));
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);

// first check if both ship and forces are in same sector
if ($player->getSectorID() != $forces->getSectorID())
{
	create_error('Those forces are no longer here!');
}

$forces_owner =& $forces->getOwner();

$template->assign('PageTopic','Examine Forces');

// should we display an attack button
if (($ship->getAttackRating() > 0 || $ship->getCDs() > 0) &&
	!$player->hasFederalProtection() &&
	!$player->hasNewbieTurns() &&
	!$player->isLandedOnPlanet() &&
	!$player->forceNAPAlliance($forces_owner)) {

	$container = array();
	$container['url'] = 'forces_attack_processing.php';
	transfer('target');
	transfer('owner_id');
	$PHP_OUTPUT.=create_echo_form($container);
	$PHP_OUTPUT.=create_submit('Attack Forces (3)');
	$PHP_OUTPUT.=('</form><br />');

} elseif ($player->hasFederalProtection())
	$PHP_OUTPUT.=('<p><big style="color:#3333FF;">You are under federal protection! That wouldn\'t be fair.</big></p>');
elseif ($player->hasNewbieTurns())
	$PHP_OUTPUT.=('<p><big style="color:#33FF33;">You are under newbie protection!</big></p>');
elseif ($forces_owner->getAccountID() == $player->getAccountID())
	$PHP_OUTPUT.=('<p><big style="color:#33FF33;">These are your forces!</big></p>');
elseif ($player->forceNAPAlliance($forces_owner))
	$PHP_OUTPUT.=('<p><big style="color:#33FF33;">These are allied forces!</big></p>');

$PHP_OUTPUT.=('<div align="center">');
$PHP_OUTPUT.=('<table class="standard" width="95%">');
$PHP_OUTPUT.=('<tr>');
$PHP_OUTPUT.=('<th width="50%">Attacker</th>');
$PHP_OUTPUT.=('<th width="50%">Forces</th>');
$PHP_OUTPUT.=('</tr>');
$PHP_OUTPUT.=('<tr>');

// ********************************
// *
// * A t t a c k e r
// *
// ********************************

$sector =& $player->getSector();
$attackers =& $sector->getFightingTradersAgainstForces($player, $forces);
$attackers[$player->getAccountID()] =& $player;

$PHP_OUTPUT.=('<td valign="top">');

foreach($attackers as &$attacker)
{'fraction_non_alphanumeric': 0.2551867219917012, 'fraction_numerical': 0.011526048870447211, 'mean_word_length': 7.095149253731344, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 102, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6180619', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1431, 'n_words': 275}