Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SectorPlayers.inc: change color of protected allies #136

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions templates/Default/engine/Default/includes/SectorPlayers.inc
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<?php
function getPlayerOptionClass(&$player, &$other) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename this to something like getDiplomaticStatus or something and add it to SmrPlayer as eg $player->getDiplomaticStatus($otherPlayer), as it's something that would make sense to live there, and gets this logic out of the template

// Returns the CSS relational class of player "other" relative to "player".
if ($other->canFight()) {
if ($player->traderNAPAlliance($other)) {
return "friendly";
} else {
return "enemy";
}
} else {
return "neutral";
}
}
?>

<div id="players_cs" class="ajax"><?php
if($PlayersContainer->hasOtherTraders($ThisPlayer)) {
$Players =& $PlayersContainer->getOtherTraders($ThisPlayer);
Expand Down Expand Up @@ -58,29 +73,13 @@
if($PlayersContainer instanceof SmrPlanet) {
if($ThisPlanet->getOwnerID() == $ThisPlayer->getAccountID()) {
?><a href="<?php echo $Player->getPlanetKickHREF() ?>" class="<?php
if(!$ThisPlayer->traderNAPAlliance($Player)){
if ($Player->canFight()) {
?> enemy<?php
} else {
?> neutral<?php
}
} else {
?> friendly<?php
}
echo getPlayerOptionClass($ThisPlayer, $Player);
?>"> Kick </a><?php
}
}
else {
?><a href="<?php echo $Player->getExamineTraderHREF() ?>" class="<?php
if(!$ThisPlayer->traderNAPAlliance($Player)){
if ($Player->canFight()) {
?> enemy<?php
} else {
?> neutral<?php
}
} else {
?> friendly<?php
}
echo getPlayerOptionClass($ThisPlayer, $Player);
?>"> Examine </a><?php
} ?>
</div>
Expand All @@ -94,4 +93,4 @@
?><span class="red bold">WARNING:</span> Sensors have detected the presence of cloaked vessels in this sector<?php
}
} ?>
</div><br />
</div><br />