Skip to content

Commit

Permalink
#95 Updated Tol Dagor and Waycrest Manor. Latter still needs some wor…
Browse files Browse the repository at this point in the history
…k, but I need in-game for that. Fixed an issue where some newly created enemies would be marked as Teeming, which then caused the MDT coupling to believe the coupled enemy would be a mismatch. Updated migrations to account for killzones that include a moved pack if they have other enemies, that the killzone is not moved but the offending enemies removed instead.
  • Loading branch information
Wotuu committed Jan 22, 2019
1 parent 15cf513 commit e5196da
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class MoveTolDagorEnemiesToDifferentFloor extends Migration
* Run the migrations.
*
* @return void
* @throws \Exception
*/
public function up()
{
Expand All @@ -26,9 +27,26 @@ public function up()
foreach ($killZones as $killZoneData) {
/** @var \App\Models\KillZone $killZone */
$killZone = \App\Models\KillZone::find($killZoneData->kill_zone_id);
// Should not happen but whatever
if ($killZone !== null) {
// Move it to the next floor and set a decent position for it

// Check if the killzone has other enemies selected, if so, don't move it and just remove the moved enemies
$hasOtherEnemies = false;
foreach ($killZone->enemies as $kzEnemy) {
/** @var $kzEnemy \App\Models\KillZoneEnemy */
if (!in_array($kzEnemy->id, $ids)) {
$hasOtherEnemies = true;
}
}

if ($hasOtherEnemies) {
// Remove the enemies that were moved
foreach ($killZone->enemies as $kzEnemy) {
/** @var $kzEnemy \App\Models\KillZoneEnemy */
if (in_array($kzEnemy->id, $ids)) {
$kzEnemy->delete();
}
}
} else {
// Move the killzone to the next floor and set a decent position for it
$killZone->floor_id = 54;
$killZone->lat = -128.76;
$killZone->lng = 260;
Expand All @@ -44,8 +62,6 @@ public function up()
*/
public function down()
{
Schema::table('different_floor', function (Blueprint $table) {
//
});

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class MoveTolDagorEnemiesToDifferentFloor extends Migration
{
/**
* Run the migrations.
*
* @return void
* @throws \Exception
*/
public function up()
{
// These IDs moved to a different floor altogether (because MDT). So we have to migrate all killzones that use
// this pack (all of them) to the different floor to prevent breaking them all.
$ids = [2076, 2077];

// Select all killzones that need updating
$killZones = DB::table('kill_zone_enemies')
->whereIn('enemy_id', $ids)
->groupBy('kill_zone_id')
->select('kill_zone_id')->get();

foreach ($killZones as $killZoneData) {
/** @var \App\Models\KillZone $killZone */
$killZone = \App\Models\KillZone::find($killZoneData->kill_zone_id);

// Check if the killzone has other enemies selected, if so, don't move it and just remove the moved enemies
$hasOtherEnemies = false;
foreach ($killZone->enemies as $kzEnemy) {
/** @var $kzEnemy \App\Models\KillZoneEnemy */
if (!in_array($kzEnemy->id, $ids)) {
$hasOtherEnemies = true;
}
}

if ($hasOtherEnemies) {
// Remove the enemies that were moved
foreach ($killZone->enemies as $kzEnemy) {
/** @var $kzEnemy \App\Models\KillZoneEnemy */
if (in_array($kzEnemy->id, $ids)) {
$kzEnemy->delete();
}
}
} else {
// Move the killzone to the next floor and set a decent position for it
$killZone->floor_id = 61;
$killZone->lat = -60;
$killZone->lng = 122.38;
$killZone->save();
}
}
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{

}
}
3 changes: 2 additions & 1 deletion resources/assets/js/custom/admin/adminenemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class AdminEnemy extends Enemy {
let connectedEnemy = this.getConnectedEnemy();

return connectedEnemy.faction !== this.faction ||
connectedEnemy.teeming !== this.teeming;
((connectedEnemy.teeming === 'visible' && this.teeming === 'hidden') ||
(connectedEnemy.teeming === 'hidden' && this.teeming === 'visible'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/custom/enemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class Enemy extends MapObject {
npc_name: this.npc.name,
enemy_forces: enemy_forces,
base_health: this.npc.base_health,
teeming: this.teeming === null ? 'no' : (this.teeming === 'hidden' ? 'hidden' : 'yes'),
teeming: (this.teeming === 'visible' ? 'yes' : (this.teeming === 'hidden' ? 'hidden' : 'no')) + ' (' + this.teeming + ')',
infested_yes_votes: this.infested_yes_votes,
infested_no_votes: this.infested_no_votes,
infested_net_votes: netVotes >= 0 ? '+' + netVotes : netVotes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class EnemyVisualMainAggressiveness extends EnemyVisualMain {
_updateIconName() {
if (this.enemyvisual.enemy.is_mdt) {
this.iconName = 'mdt';
if (this.enemyvisual.enemy.getConnectedEnemy() !== null) {
if (this.enemyvisual.enemy.npc === null) {
this.iconName += '_mismatched';
} else if (this.enemyvisual.enemy.getConnectedEnemy() !== null) {
this.iconName += this.enemyvisual.enemy.isMismatched() ? '_mismatched' : '_ok';
}
} else {
Expand Down
43 changes: 43 additions & 0 deletions resources/views/misc/changelog.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@
<li>
Added a few missing Despondent Scallywags in The Brig.
</li>
<li>
Removed a Cutwater Striker from the first pack you encounter when entering the Detention Block,
fixed Teeming enemies for said pack as well.
</li>
<li>
Removed a Teeming Cutwater Striker from the pack with the Block Warden.
</li>
<li>
Added two missing Teeming Ashvane Marines and an Ashvane Officer in the Officers Quarters on the
left side of the area.
</li>
</ul>
</li>
<li>
Expand All @@ -179,6 +190,38 @@
<li>
Corrected an issue where Upstairs was marked as the first floor rather than The Grand Foyer.
</li>
<li>
Removed middle pack of Soul Essences upon entering the dungeon.
</li>
<li>
Added a Heartsbane Runeweaver after taking a left initially, then right again.
</li>
<li>
Unmarked a Heartsbane Runeweaver as Teeming in the room north of the Sister bosses.
</li>
<li>
Removed Heartsbane Runeweaver in The Hunting Lodge.
</li>
<li>
Converted a Maddened Survivalist to a Diseased Mastiff in the upper pack in The Hunting Lodge (yes,
this must've hurt).
</li>
<li>
Converted a Maddened Survivalist to a Crazed Marksman in the lower pack in The Hunting Lodge (this
didn't really hurt).
</li>
<li>
Updated a lot of enemies around the Banquet Hall. Most of the packs, in fact.
</li>
<li>
Upstairs: Converted a Maddened Survivalist to a Crazed Marksman in the pack near the Hunting Lodge.
</li>
<li>
Removed a Teeming Marked Sister in The Cellar in the pack on the top right.
</li>
<li>
Removed a Teeming Coven Thornshaper in The Cellar in the pack on the top left.
</li>
</ul>
</li>
</ul>
Expand Down

0 comments on commit e5196da

Please sign in to comment.