Skip to content

Commit

Permalink
Merge branch 'release/0.5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ta2edchimp committed Oct 6, 2015
2 parents 5dd62a6 + df67906 commit eb3d257
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 18 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Release 0.5.4

- 66726cb Versionbump
- 19c2f97 Hide non-existent loss values. Closes #90
- 8cea944 Bugfix: correctly update already existing battleparty members, if died in the meanwhile. Closes #92
- a5bc17d Bugfix: correctly check for existing array property.
- b0a3dc4 Merge branch 'release/0.5.3' into develop

# Release 0.5.3

- c703842 Versionbump
Expand Down
47 changes: 33 additions & 14 deletions classes/Battle.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,28 +346,47 @@ public function append($importedKills, $importMode = false) {
if ($kill->victim->corporationID == BR_OWNERCORP_ID)
$tgt = "teamA";

// To be sure: If in "append mode", the victim must NOT be in any of the teams already
if ($importMode === false && ($this->teamA->getMember($kill->victim) !== null || $this->teamB->getMember($kill->victim) !== null || $this->teamC->getMember($kill->victim) !== null))
continue;

if ($importMode)
if ($importMode) {
// In import mode, simply append victim as combatant to the designated battle party ...
$this->$tgt->addOrUpdate($kill->victim);
else
$this->$tgt->add($kill->victim);
} else {
// When just appending, first check whether to update a battle party's existing member ...
$tempMember = $this->teamA->getMember($kill->victim);
if ($tempMember === null) {
$tempMember = $this->teamB->getMember($kill->victim);
if ($tempMember === null) {
$tempMember = $this->teamC->getMember($kill->victim);
}
}
if ($tempMember === null) {
$this->$tgt->add($kill->victim);
} else {
$tempMember->update($kill->victim);
}
}

foreach ($kill->attackers as $attacker) {
$tgt = "teamB";
if ($attacker->corporationID == BR_OWNERCORP_ID)
$tgt = "teamA";

// Again, be sure to not readd a combatant in *append mode*
if ($importMode === false && ($this->teamA->getMember($kill->victim) !== null || $this->teamB->getMember($kill->victim) !== null || $this->teamC->getMember($kill->victim) !== null))
continue;

if ($importMode)
// Same distinguishing of import / append mode as above, but for the attacking combatants
if ($importMode) {
$this->$tgt->addOrUpdate($attacker);
else
$this->$tgt->add($attacker);
} else {
$tempMember = $this->teamA->getMember($attacker);
if ($tempMember === null) {
$tempMember = $this->teamB->getMember($attacker);
if ($tempMember === null) {
$tempMember = $this->teamC->getMember($attacker);
}
}
if ($tempMember === null) {
$this->$tgt->add($attacker);
} else {
$tempMember->update($attacker);
}
}
}

if (isset($kill->killTime)) {
Expand Down
3 changes: 2 additions & 1 deletion classes/BattleParty.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public function add(Combatant $combatant, $updateOnExistence = false) {
// If this char is already on the list in the same ship,
// but this time is the victim, replace him.
if ($member->died === false && $combatant->died === true) {
// Replace the existing member
// Update newer combatant object with exising member's props
$combatant->update($member);
$member = $combatant;
return;
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Combatant.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public function update($props = null) {
$props = \Utils::arrayToObject($props);

if (!empty($props->damageComposition)) {
if ($this->damageComposition === 0)
if ($this->damageComposition === null)
$this->damageComposition = array();
if (count($this->damageComposition) === 0) {
$this->damageComposition = $props->damageComposition;
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

define('BR_VERSION', '0.5.3');
define('BR_VERSION', '0.5.4');

require_once('vendor/autoload.php');

Expand Down
2 changes: 1 addition & 1 deletion public/themes/default/components/brCombatant.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{% if combatant.allianceID > 0 %}<br>{{ combatant.allianceName }}{% endif %}</small><br>
{% endif %}
{{ combatant.shipTypeName }}<br>
{% if not combatantDetailMode is defined or combatantDetailMode == 'normal' or combatantDetailMode == '' and combatant.priceTag > 0 %}
{% if (not combatantDetailMode is defined or combatantDetailMode == 'normal' or combatantDetailMode == '') and combatant.priceTag > 0 %}
({{ (combatant.priceTag / 1000000)|number_format(2, '.', ',') }} million ISK)
{% else %}
&nbsp;
Expand Down

0 comments on commit eb3d257

Please sign in to comment.