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
Show file tree
Hide file tree
Changes from all 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
21 changes: 11 additions & 10 deletions lib/Default/SmrPlayer.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -465,16 +465,17 @@ class SmrPlayer extends AbstractSmrPlayer {
$this->hasChanged=true;
}

function getAttackColour() {
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 readd these or remove them completely please (I know these functions are not used, but if we're gonna have the db fields/class properties then it would be nice to keep the methods available to make use of, or just get rid of it altogether). For reference these were a 1.5 thing where you could choose the colour of the flashing screen when you get attacked

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, do you prefer re-adding them or removing them completely?

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have one vote for keeping it (and even re-implementing the ability to customize the color), so unless you object I'll keep that code in there.

Copy link
Member

Choose a reason for hiding this comment

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

Keeping it works for me

return $this->attackColour;
}

function setAttackColour($colour) {
if($this->attackColour == $colour)
return;
$this->attackColour=$colour;
$this->hasChanged=true;
// $this->db->query('UPDATE player SET attack_warning = ' . $this->db->escapeString($this->attackColour) . ' WHERE ' . $this->SQL . ' LIMIT 1');
function getPlayerRelationship(&$otherPlayer) {
// Returns the CSS class for the relationship between two players
if ($otherPlayer->canFight()) {
if ($this->traderNAPAlliance($otherPlayer)) {
return "friendly";
} else {
return "enemy";
}
} else {
return "neutral";
}
}

function getBank() {
Expand Down
22 changes: 3 additions & 19 deletions templates/Default/engine/Default/includes/SectorPlayers.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,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 $ThisPlayer->getPlayerRelationship($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 $ThisPlayer->getPlayerRelationship($Player);
?>"> Examine </a><?php
} ?>
</div>
Expand All @@ -94,4 +78,4 @@
?><span class="red bold">WARNING:</span> Sensors have detected the presence of cloaked vessels in this sector<?php
}
} ?>
</div><br />
</div><br />