Skip to content

Commit

Permalink
#2711 WIP exclusive enemies
Browse files Browse the repository at this point in the history
  • Loading branch information
Wotuu committed Feb 5, 2025
1 parent 6e3abda commit 31c107d
Show file tree
Hide file tree
Showing 62 changed files with 1,547 additions and 734 deletions.
6 changes: 5 additions & 1 deletion app/Http/Controllers/Ajax/AjaxEnemyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
class AjaxEnemyController extends AjaxMappingModelBaseController
{
/**
* @param APIEnemyFormRequest $request
* @param CoordinatesServiceInterface $coordinatesService
* @param MappingVersion $mappingVersion
* @param Enemy|null $enemy
* @return Enemy|Model
*
* @throws Throwable
Expand All @@ -38,7 +42,7 @@ public function store(
CoordinatesServiceInterface $coordinatesService,
MappingVersion $mappingVersion,
?Enemy $enemy = null
): Enemy {
): Enemy|Model {
$validated = $request->validated();

$previousFloor = null;
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/Enemy/APIEnemyFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function rules(): array
'npc_id' => ['nullable', Rule::exists(Npc::class, 'id')],
'mdt_id' => 'nullable|int',
'mdt_npc_id' => 'nullable|int',
'exclusive_enemy_id' => ['nullable', Rule::exists(Enemy::class, 'id')],
'seasonal_index' => 'nullable|int',
'seasonal_type' => [Rule::in(array_merge(Enemy::SEASONAL_TYPE_ALL, ['', null]))],
'teeming' => [Rule::in(array_merge(Enemy::TEEMING_ALL, ['', null]))],
Expand Down
39 changes: 19 additions & 20 deletions app/Models/Enemy.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* @property int $floor_id
* @property int|null $mdt_id The ID in MDT (clone index) that this enemy is coupled to
* @property int|null $mdt_npc_id The ID of the NPC in MDT that this enemy is coupled to. Usually this will be the same - but MDT sometimes makes mistakes which will require a different NPC to be coupled.
* @property int|null $exclusive_enemy_id The ID of the enemy that this enemy is exclusive to. This means that this enemy will not be selectable if the exclusive enemy is selected in a pull.
* @property int|null $mdt_scale The scale that MDT assigned to this particular enemy.
* @property string|null $mdt_x The X position that MDT assigned to this enemy on import.
* @property string|null $mdt_y The Y position that MDT assigned to this enemy on import.
Expand All @@ -44,10 +45,12 @@
* @property int|null $dungeon_difficulty Show this enemy only in this difficulty setting (null is show always)
* @property float $lat
* @property float $lng
*
* @property EnemyPack|null $enemyPack
* @property Npc|null $npc
* @property Floor $floor
* @property EnemyPatrol|null $enemyPatrol
* @property Enemy|null $exclusiveEnemy
* @property MappingVersion $mappingVersion
* @property Collection<EnemyActiveAura> $enemyActiveAuras
*
Expand All @@ -69,6 +72,7 @@ class Enemy extends CacheModel implements MappingModelCloneableInterface, Mappin
'npc_id',
'mdt_id',
'mdt_npc_id',
'exclusive_enemy_id',
'mdt_scale',
'mdt_x',
'mdt_y',
Expand Down Expand Up @@ -122,25 +126,16 @@ class Enemy extends CacheModel implements MappingModelCloneableInterface, Mappin
'kill_priority' => 'integer',
];

public const SEASONAL_TYPE_BEGUILING = 'beguiling';

public const SEASONAL_TYPE_AWAKENED = 'awakened';

public const SEASONAL_TYPE_INSPIRING = 'inspiring';

public const SEASONAL_TYPE_PRIDEFUL = 'prideful';

public const SEASONAL_TYPE_TORMENTED = 'tormented';

public const SEASONAL_TYPE_ENCRYPTED = 'encrypted';

public const SEASONAL_TYPE_MDT_PLACEHOLDER = 'mdt_placeholder';

public const SEASONAL_TYPE_SHROUDED = 'shrouded';

public const SEASONAL_TYPE_BEGUILING = 'beguiling';
public const SEASONAL_TYPE_AWAKENED = 'awakened';
public const SEASONAL_TYPE_INSPIRING = 'inspiring';
public const SEASONAL_TYPE_PRIDEFUL = 'prideful';
public const SEASONAL_TYPE_TORMENTED = 'tormented';
public const SEASONAL_TYPE_ENCRYPTED = 'encrypted';
public const SEASONAL_TYPE_MDT_PLACEHOLDER = 'mdt_placeholder';
public const SEASONAL_TYPE_SHROUDED = 'shrouded';
public const SEASONAL_TYPE_SHROUDED_ZUL_GAMUX = 'shrouded_zul_gamux';

public const SEASONAL_TYPE_NO_SHROUDED = 'no_shrouded';
public const SEASONAL_TYPE_NO_SHROUDED = 'no_shrouded';

public const SEASONAL_TYPE_ALL = [
self::SEASONAL_TYPE_BEGUILING,
Expand All @@ -156,8 +151,7 @@ class Enemy extends CacheModel implements MappingModelCloneableInterface, Mappin
];

public const TEEMING_VISIBLE = 'visible';

public const TEEMING_HIDDEN = 'hidden';
public const TEEMING_HIDDEN = 'hidden';

public const TEEMING_ALL = [
self::TEEMING_VISIBLE,
Expand Down Expand Up @@ -211,6 +205,11 @@ public function enemyActiveAuras(): HasMany
return $this->hasMany(EnemyActiveAura::class);
}

public function exclusiveEnemy(): BelongsTo
{
return $this->belongsTo(Enemy::class, 'exclusive_enemy_id');
}

public function getDungeonId(): ?int
{
return $this->floor?->dungeon_id ?? null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

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

return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('enemies', function (Blueprint $table) {
$table->integer('exclusive_enemy_id')->after('mdt_npc_id')->nullable();
$table->index('exclusive_enemy_id');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('enemies', function (Blueprint $table) {
$table->dropColumn('exclusive_enemy_id');
});
}
};
7 changes: 5 additions & 2 deletions lang/de_DE/breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
'changelog' => '',
'routes' => '',
'routes_expansion' => '',
'dungeon' => [
'explore' => '',
'gameversion' => [
'update' => '',
'dungeon' => [
'explore' => '',
],
],
'dungeonroute' => [
'new' => '',
Expand Down
4 changes: 2 additions & 2 deletions lang/de_DE/combatlogeventtypes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return [
'npc_death' => '',
'player_death' => '',
'enemy_killed' => '',
'spell_cast' => '',
'player_spell' => '',
];
Loading

0 comments on commit 31c107d

Please sign in to comment.