Skip to content

Commit

Permalink
Lots of changes - tests are failing out and I am not sure why
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamKyle committed Nov 13, 2023
1 parent 81df126 commit c48e94d
Show file tree
Hide file tree
Showing 53 changed files with 2,721 additions and 1,855 deletions.
27 changes: 27 additions & 0 deletions app/Flare/GameImporter/Console/Commands/MassImportCustomData.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace App\Flare\GameImporter\Console\Commands;

use App\Flare\Models\GameMap;
use App\Flare\Models\InfoPage;
use App\Game\Events\Values\EventType;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Storage;

class MassImportCustomData extends Command {

Expand Down Expand Up @@ -43,7 +45,32 @@ public function handle() {
Artisan::call('import:game-data Npcs');
Artisan::call('import:game-data Quests');
Artisan::call('import:game-data Raids');
Artisan::call('import:game-data "Admin Section"');

$this->importInformationSection();

Artisan::call('generate:monster-cache');
}

protected function importInformationSection(): void {
$data = Storage::disk('data-imports')->get('Admin Section/information.json');

$data = json_decode(trim($data), true);

foreach ($data as $modelEntry) {
InfoPage::updateOrCreate(['id' => $modelEntry['id']], $modelEntry);
}

$sourceDirectory = resource_path('backup/info-sections-images');
$destinationDirectory = storage_path('app/public');

$command = 'cp -R ' . escapeshellarg($sourceDirectory) . ' ' . escapeshellarg($destinationDirectory);
exec($command, $output, $exitCode);

if ($exitCode === 0) {
$this->line('Information section images directory copied to public successfully. Information section is now set up.');
} else {
$this->line('Failed to copy the information images directory over. You can do this manually from the resources/backup/information-sections-images. Copy the entire directory to app/public');
}
}
}
5 changes: 5 additions & 0 deletions app/Flare/Models/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Flare\Models;

use App\Flare\Values\LocationEffectValue;
use App\Flare\Values\LocationType;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Database\Factories\LocationFactory;
Expand Down Expand Up @@ -72,6 +73,10 @@ public function requiredQuestItem() {
return $this->hasOne(Item::class, 'id', 'required_quest_item_id');
}

public function locationType() {
return new LocationType($this->type);
}

/**
* Return the drop chance for a location.
*
Expand Down
1 change: 1 addition & 0 deletions app/Flare/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class User extends Authenticatable {
'chat_text_color',
'chat_is_bold',
'chat_is_italic',
'name_tag'
];

/**
Expand Down
8 changes: 8 additions & 0 deletions app/Flare/Values/FeatureTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class FeatureTypes {

const COSMETIC_TEXT = 2;

const NAME_TAGS = 3;

/**
* @var int $value
*/
Expand All @@ -24,12 +26,14 @@ class FeatureTypes {
0 => self::MERCENARY,
1 => self::REINCARNATION,
2 => self::COSMETIC_TEXT,
3 => self::NAME_TAGS,
];

protected static array $valueNames = [
self::MERCENARY => 'Mercenary',
self::REINCARNATION => 'Reincarnation',
self::COSMETIC_TEXT => 'Cosmetic Text',
self::NAME_TAGS => 'Name Tags',
];

/**
Expand Down Expand Up @@ -65,4 +69,8 @@ public function isReincarnation(): bool {
public function isCosmeticText(): bool {
return $this->value === self::COSMETIC_TEXT;
}

public function isNameTab(): bool {
return $this->value === self::NAME_TAGS;
}
}
55 changes: 55 additions & 0 deletions app/Flare/Values/NameTags.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace App\Flare\Values;

use Exception;

class NameTags {

const ICE_QUEEN_SLAYER = 'ice-queen-slayer';
const EXPLORER = 'explorer';
const RULER = 'ruler';
const DEMON_SLAYER = 'demon-slayer';
const QUEEN_OF_HEARTS = 'queen-of-hearts';
const GAMBLING_ADDICT = 'gambling-addict';

/**
* @var string $value
*/
private string $value;

/**
* @var string[] $values
*/
protected static array $values = [
self::ICE_QUEEN_SLAYER => self::ICE_QUEEN_SLAYER,
self::EXPLORER => self::EXPLORER,
self::RULER => self::RULER,
self::DEMON_SLAYER => self::DEMON_SLAYER,
self::QUEEN_OF_HEARTS => self::QUEEN_OF_HEARTS,
self::GAMBLING_ADDICT => self::GAMBLING_ADDICT,
];

public static array $valueNames = [
self::ICE_QUEEN_SLAYER => 'Slayer of the Queen of Ice',
self::EXPLORER => 'Explorer of Tlessa',
self::RULER => 'Ruler of Tlessa',
self::DEMON_SLAYER => 'Twisted Demon Slayer of Galidoth',
self::QUEEN_OF_HEARTS => 'Lover to the Queen of Hearts',
self::GAMBLING_ADDICT => 'Gambling Addict',
];

/**
* Throws if the value does not exist in the array of const values.
*
* @param string $value
* @throws Exception
*/
public function __construct(string $value) {
if (!in_array($value, self::$values)) {
throw new Exception($value . ' does not exist.');
}

$this->value = $value;
}
}
56 changes: 56 additions & 0 deletions app/Flare/View/Livewire/Info/Items/CorruptedIce.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace App\Flare\View\Livewire\Info\Items;

use App\Flare\Models\Item;
use App\Flare\Values\ItemSpecialtyType;
use Illuminate\Database\Eloquent\Builder;
use Rappasoft\LaravelLivewireTables\Views\Column;
use Rappasoft\LaravelLivewireTables\DataTableComponent;

class CorruptedIce extends DataTableComponent {
public function configure(): void {
$this->setPrimaryKey('id');
}

public function builder(): Builder {
return Item::whereNull('item_prefix_id')
->whereNull('item_suffix_id')
->where('specialty_type', ItemSpecialtyType::CORRUPTED_ICE);
}

public function columns(): array {
return [
Column::make('Name')->searchable()->format(function ($value, $row) {
$itemId = Item::where('name', $value)->first()->id;

return '<a href="/items/'. $itemId.'" >'.$row->name . '</a>';
})->html(),
Column::make('Type')->searchable()->format(function ($value) {
return ucfirst(str_replace('-', ' ', $value));
}),

Column::make('Damage', 'base_damage')->sortable()->format(function ($value) {
return number_format($value);
}),
Column::make('AC', 'base_ac')->sortable()->format(function ($value) {
return number_format($value);
}),
Column::make('Healing', 'base_healing')->sortable()->format(function ($value) {
return number_format($value);
}),
Column::make('Gold Cost', 'cost')->sortable()->format(function ($value) {
return number_format($value);
}),
Column::make('Gold Dust Cost', 'gold_dust_cost')->sortable()->format(function ($value) {
return number_format($value);
}),
Column::make('Shard Cost', 'shards_cost')->sortable()->format(function ($value) {
return number_format($value);
}),
Column::make('Copper Coin Cost', 'copper_coin_cost')->sortable()->format(function ($value) {
return number_format($value);
})
];
}
}
10 changes: 1 addition & 9 deletions app/Game/Battle/Controllers/Api/BattleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,22 @@
use App\Game\Battle\Request\AttackTypeRequest;
use App\Flare\Services\BuildMonsterCacheService;
use App\Flare\Values\ItemEffectsValue;
use App\Game\Battle\Handlers\BattleEventHandler;
use App\Game\Battle\Events\UpdateCharacterStatus;
use App\Game\Battle\Services\MonsterFightService;

class BattleController extends Controller {

/**
* @var BattleEventHandler $battleEventHandler
*/
private BattleEventHandler $battleEventHandler;

/**
* @var MonsterFightService
*/
private MonsterFightService $monsterFightService;

/**
* @param BattleEventHandler $battleEventHandler
* @param MonsterFightService $monsterFightService
*/
public function __construct(BattleEventHandler $battleEventHandler, MonsterFightService $monsterFightService) {
public function __construct(MonsterFightService $monsterFightService) {
$this->middleware('is.character.dead')->except(['revive', 'index']);

$this->battleEventHandler = $battleEventHandler;
$this->monsterFightService = $monsterFightService;
}

Expand Down
43 changes: 8 additions & 35 deletions app/Game/Battle/Providers/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,30 @@

namespace App\Game\Battle\Providers;

use App\Flare\Services\CharacterXPService;
use App\Game\Battle\Services\RankFightService;
use App\Game\Skills\Services\DisenchantService;
use Illuminate\Support\ServiceProvider as ApplicationServiceProvider;
use App\Flare\Builders\BuildMythicItem;
use App\Flare\Builders\Character\CharacterCacheData;
use App\Flare\Builders\RandomAffixGenerator;
use App\Flare\Builders\RandomItemDropBuilder;
use App\Flare\Models\GlobalEventParticipation;
use App\Flare\ServerFight\Monster\BuildMonster;
use App\Flare\ServerFight\MonsterPlayerFight;
use App\Flare\ServerFight\Pvp\PvpAttack;
use App\Flare\Services\BuildMonsterCacheService;
use App\Flare\Services\CharacterRewardService;
use App\Flare\Services\CharacterXPService;
use App\Game\Battle\Console\Commands\ClearCelestials;
use App\Game\Battle\Handlers\BattleEventHandler;
use App\Game\Battle\Handlers\FactionHandler;
use App\Game\Battle\Services\BattleDrop;
use App\Game\Battle\Services\CelestialFightService;
use App\Game\Battle\Services\ConjureService;
use App\Game\Battle\Services\MonthlyPvpFightService;
use App\Game\Battle\Services\MonthlyPvpService;
use App\Game\Battle\Services\PvpService;
use App\Game\Battle\Services\RaidBattleService;
use App\Game\Battle\Services\RankFightService;
use App\Game\BattleRewardProcessing\Handlers\BattleEventHandler;
use App\Game\Core\Services\GoldRush;
use App\Game\Maps\Values\MapTileValue;
use App\Game\Battle\Services\ConjureService;
use App\Game\Battle\Services\RaidBattleService;
use App\Game\BattleRewardProcessing\Services\BattleRewardService;
use App\Game\BattleRewardProcessing\Services\SecondaryRewardService;
use App\Game\Messages\Builders\NpcServerMessageBuilder;
use App\Game\GuideQuests\Services\GuideQuestService;
use App\Game\Skills\Services\DisenchantService;
use Illuminate\Support\ServiceProvider as ApplicationServiceProvider;

class ServiceProvider extends ApplicationServiceProvider
{
Expand All @@ -48,19 +42,6 @@ public function register()
);
});

$this->app->bind(FactionHandler::class, function($app) {
return new FactionHandler(
$app->make(RandomAffixGenerator::class),
$app->make(GuideQuestService::class),
);
});

$this->app->bind(GlobalEventParticipation::class, function($app) {
return new GlobalEventParticipation(
$app->make(RandomAffixGenerator::class),
);
});

$this->app->bind(GoldRush::class, function($app) {
return new GoldRush();
});
Expand All @@ -72,13 +53,6 @@ public function register()
);
});

$this->app->bind(BattleEventHandler::class, function($app) {
return new BattleEventHandler(
$app->make(BattleRewardService::class),
$app->make(SecondaryRewardService::class)
);
});

$this->app->bind(CelestialFightService::class, function($app) {
return new CelestialFightService($app->make(BattleEventHandler::class), $app->make(CharacterCacheData::class), $app->make(MonsterPlayerFight::class));
});
Expand Down Expand Up @@ -135,8 +109,7 @@ public function register()
*
* @return void
*/
public function boot()
{
public function boot() {
// ...
}
}
14 changes: 7 additions & 7 deletions app/Game/Battle/Services/CelestialFightService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
namespace App\Game\Battle\Services;

use App\Flare\Builders\Character\CharacterCacheData;
use App\Flare\Models\CelestialFight;
use App\Flare\Models\Character;
use App\Flare\Models\CharacterInCelestialFight;
use App\Flare\ServerFight\MonsterPlayerFight;
use App\Flare\Values\MaxCurrenciesValue;
use App\Game\Battle\Events\UpdateCelestialFight;
use App\Game\Battle\Events\UpdateCharacterStatus;
use App\Game\Battle\Jobs\CelestialTimeOut;
use App\Game\Battle\Values\CelestialConjureType;
use App\Game\BattleRewardProcessing\Handlers\BattleEventHandler;
use App\Game\BattleRewardProcessing\Jobs\BattleAttackHandler;
use App\Game\Core\Events\UpdateCharacterCelestialTimeOut;
use App\Game\Core\Events\UpdateTopBarEvent;
use App\Game\Core\Traits\MercenaryBonus;
use Facades\App\Flare\Cache\CoordinatesCache;
use App\Flare\Models\CelestialFight;
use App\Flare\Models\Character;
use App\Flare\Models\CharacterInCelestialFight;
use App\Game\Battle\Events\UpdateCelestialFight;
use App\Game\Battle\Handlers\BattleEventHandler;
use App\Game\Battle\Jobs\BattleAttackHandler;
use App\Game\Core\Traits\ResponseBuilder;
use App\Game\Messages\Events\GlobalMessageEvent;
use App\Game\Messages\Events\ServerMessageEvent;
use Facades\App\Flare\Cache\CoordinatesCache;

class CelestialFightService {

Expand Down
9 changes: 4 additions & 5 deletions app/Game/Battle/Services/MonsterFightService.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
namespace App\Game\Battle\Services;

use App\Flare\Models\Character;
use Illuminate\Support\Facades\Cache;
use App\Game\Core\Traits\ResponseBuilder;
use App\Flare\ServerFight\MonsterPlayerFight;
use App\Game\Battle\Jobs\BattleAttackHandler;
use App\Game\Battle\Handlers\BattleEventHandler;
use Hamcrest\Arrays\IsArray;
use App\Game\BattleRewardProcessing\Handlers\BattleEventHandler;
use App\Game\BattleRewardProcessing\Jobs\BattleAttackHandler;
use App\Game\Core\Traits\ResponseBuilder;
use Illuminate\Support\Facades\Cache;

class MonsterFightService {

Expand Down
Loading

0 comments on commit c48e94d

Please sign in to comment.