-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#95 Updated Tol Dagor and Waycrest Manor. Latter still needs some wor…
…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
Showing
6 changed files
with
138 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
database/migrations/2019_01_22_212350_move_waycrest_manor_enemies_to_different_floor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters