forked from corowne/lorekeeper
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/corowne/lorekeeper into …
…extension/claymores-and-companions # Conflicts: # app/Console/Commands/AddSiteSettings.php # app/Helpers/Helpers.php # app/Http/Controllers/Admin/Characters/CharacterController.php # app/Http/Controllers/Admin/Data/LootTableController.php # app/Http/Controllers/Admin/SubmissionController.php # app/Http/Controllers/Characters/CharacterController.php # app/Http/Controllers/ShopController.php # app/Http/Controllers/Users/SubmissionController.php # app/Http/Controllers/Users/UserController.php # app/Http/Kernel.php # app/Services/CharacterManager.php # app/Services/DesignUpdateManager.php # app/Services/SubmissionManager.php # app/Services/UserService.php # composer.lock # package-lock.json # public/css/lorekeeper.css # resources/views/admin/reports/report.blade.php # resources/views/admin/users/_create_edit_rank.blade.php # resources/views/character/_image_info.blade.php # resources/views/home/create_submission.blade.php # resources/views/shops/_stock_modal.blade.php # resources/views/shops/shop.blade.php # resources/views/widgets/_loot_select.blade.php # resources/views/widgets/_loot_select_row.blade.php # resources/views/world/species_features.blade.php # routes/lorekeeper/admin.php # routes/lorekeeper/browse.php # yarn.lock
- Loading branch information
Showing
344 changed files
with
31,637 additions
and
2,282 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Lint & Build Mix Assets | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
lint: | ||
uses: itinerare/github-actions/.github/workflows/lint.yml@main | ||
with: | ||
php-version: '8.1' | ||
concurrency: | ||
group: ci-${{ github.head_ref || github.ref_name }} | ||
|
||
rebuild-mix-assets: | ||
uses: itinerare/github-actions/.github/workflows/mix_build.yml@main | ||
concurrency: | ||
group: ci-${{ github.head_ref }} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ yarn-error.log | |
*.env | ||
/composer.phar | ||
*.cache | ||
/.vs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\Character\CharacterDesignUpdate; | ||
use App\Models\Character\CharacterImage; | ||
use App\Models\Character\CharacterImageSubtype; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class ConvertCharacterSubtype extends Command { | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'convert-character-subtype'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Converts the subtype_id columns in the character_images table to a new row in character_image_subtype table.'; | ||
|
||
/** | ||
* Create a new command instance. | ||
*/ | ||
public function __construct() { | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() { | ||
if (Schema::hasColumn('character_images', 'subtype_id')) { | ||
// Check for second subtype columns up front to save on some redundant checks | ||
$secondSubtype = false; | ||
$thirdSubtype = false; | ||
if (Schema::hasColumn('character_images', 'subtype_id_2') && Schema::hasColumn('design_updates', 'subtype_id_2')) { | ||
$secondSubtype = true; | ||
if (Schema::hasColumn('character_images', 'subtype_id_3') && Schema::hasColumn('design_updates', 'subtype_id_3')) { | ||
$thirdSubtype = true; | ||
} | ||
} | ||
|
||
// DESIGN UPDATES | ||
$updates = CharacterDesignUpdate::where(function ($query) use ($secondSubtype, $thirdSubtype) { | ||
if ($thirdSubtype) { | ||
$query->whereNotNull('subtype_id')->orWhereNotNull('subtype_id_2')->orWhereNotNull('subtype_id_3'); | ||
} elseif ($secondSubtype) { | ||
$query->whereNotNull('subtype_id')->orWhereNotNull('subtype_id_2'); | ||
} else { | ||
$query->whereNotNull('subtype_id'); | ||
} | ||
})->get(); | ||
|
||
$this->info('Converting '.count($updates).' updates\' subtypes...'); | ||
$updateBar = $this->output->createProgressBar(count($updates)); | ||
|
||
foreach ($updates as $update) { | ||
$updateSubtypes = []; | ||
if ($update->subtype_id) { | ||
$updateSubtypes[] = $update->subtype_id; | ||
} | ||
if ($secondSubtype && $update->subtype_id_2) { | ||
$updateSubtypes[] = $update->subtype_id_2; | ||
} | ||
if ($thirdSubtype && $update->subtype_id_3) { | ||
$updateSubtypes[] = $update->subtype_id_3; | ||
} | ||
|
||
$update->update([ | ||
'subtype_ids' => $updateSubtypes, | ||
]); | ||
$updateBar->advance(); | ||
} | ||
|
||
$updateBar->finish(); | ||
$this->info("\n".'Dropping subtype ID column'.($secondSubtype ? 's' : '').' from the design updates table...'); | ||
|
||
Schema::table('design_updates', function (Blueprint $table) { | ||
$table->dropColumn('subtype_id'); | ||
}); | ||
if ($secondSubtype) { | ||
Schema::table('design_updates', function (Blueprint $table) { | ||
$table->dropColumn('subtype_id_2'); | ||
}); | ||
} | ||
if ($thirdSubtype) { | ||
Schema::table('design_updates', function (Blueprint $table) { | ||
$table->dropColumn('subtype_id_3'); | ||
}); | ||
} | ||
|
||
// CHARACTER IMAGES | ||
$characterImages = CharacterImage::where(function ($query) use ($secondSubtype, $thirdSubtype) { | ||
if ($thirdSubtype) { | ||
$query->whereNotNull('subtype_id')->orWhereNotNull('subtype_id_2')->orWhereNotNull('subtype_id_3'); | ||
} elseif ($secondSubtype) { | ||
$query->whereNotNull('subtype_id')->orWhereNotNull('subtype_id_2'); | ||
} else { | ||
$query->whereNotNull('subtype_id'); | ||
} | ||
})->get(); | ||
|
||
$this->info('Converting '.count($characterImages).' character images\' subtypes...'); | ||
$imageBar = $this->output->createProgressBar(count($characterImages)); | ||
foreach ($characterImages as $characterImage) { | ||
if ($characterImage->subtype_id) { | ||
CharacterImageSubtype::create([ | ||
'character_image_id' => $characterImage->id, | ||
'subtype_id' => $characterImage->subtype_id, | ||
]); | ||
} | ||
|
||
if ($secondSubtype && $characterImage->subtype_id_2) { | ||
CharacterImageSubtype::create([ | ||
'character_image_id' => $characterImage->id, | ||
'subtype_id' => $characterImage->subtype_id_2, | ||
]); | ||
} | ||
|
||
if ($thirdSubtype && $characterImage->subtype_id_3) { | ||
CharacterImageSubtype::create([ | ||
'character_image_id' => $characterImage->id, | ||
'subtype_id' => $characterImage->subtype_id_3, | ||
]); | ||
} | ||
$imageBar->advance(); | ||
} | ||
|
||
$imageBar->finish(); | ||
$this->info("\n".'Dropping subtype ID column'.($secondSubtype ? 's' : '').' from the character images table...'); | ||
|
||
Schema::table('character_images', function (Blueprint $table) { | ||
$table->dropColumn('subtype_id'); | ||
}); | ||
if ($secondSubtype) { | ||
Schema::table('character_images', function (Blueprint $table) { | ||
$table->dropColumn('subtype_id_2'); | ||
}); | ||
} | ||
if ($thirdSubtype) { | ||
Schema::table('character_images', function (Blueprint $table) { | ||
$table->dropColumn('subtype_id_3'); | ||
}); | ||
} | ||
|
||
$this->info('Done!'); | ||
} else { | ||
$this->info('This command will not execute, as it has already been run.'); | ||
} | ||
} | ||
} |
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,94 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use App\Models\Item\Item; | ||
use App\Models\Rarity; | ||
use Illuminate\Console\Command; | ||
|
||
class ConvertItemRarities extends Command { | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'convert-item-rarities'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Converts previously arbitrary item rarities (numeric format) to utilise existing rarity model'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() { | ||
// | ||
if (!config('lorekeeper.extensions.item_entry_expansion.extra_fields')) { | ||
$this->info('Item Entry Expansion is not enabled. Exiting.'); | ||
|
||
return; | ||
} | ||
$rarityItems = Item::whereNotNull('data->rarity')->get(); | ||
// pluck the rarity values from the items | ||
$rarityValues = $rarityItems->pluck('data.rarity')->unique(); | ||
foreach ($rarityValues as $rarityValue) { | ||
$this->info("\nCreating rarity for value: ".$rarityValue.'...'); | ||
$nearestRarity = Rarity::where('sort', $rarityValue)->first(); | ||
if (!$nearestRarity) { | ||
$nearestRarity = Rarity::where('sort', $rarityValue - 1)->first(); | ||
} | ||
|
||
if ($nearestRarity) { | ||
$this->info('Closest rarity (based on sort) found: '.$nearestRarity->name); | ||
$this->info('If this rarity is not correct, please enter "n" and choose the correct rarity.'); | ||
$ask = $this->ask('Do you want to use this rarity for the value '.$rarityValue.'? (y/n)', 'y'); | ||
if ($ask === 'y') { | ||
$rarityItems->where('data.rarity', $rarityValue)->each(function ($item) use ($nearestRarity) { | ||
$item->data = array_merge($item->data, ['rarity_id' => $nearestRarity->id]); | ||
$item->save(); | ||
}); | ||
$this->info('Items with rarity value '.$rarityValue.' have been updated to use rarity '.$nearestRarity->name); | ||
} else { | ||
$rarityName = $this->ask('Enter the name of the rarity you want to use for the value '.$rarityValue); | ||
$rarity = Rarity::where('name', 'LIKE', '%'.$rarityName.'%')->first(); | ||
if ($rarity) { | ||
$check = $this->ask('Do you want to use the rarity '.$rarity->name.' for the value '.$rarityValue.'? (y/n)', 'y'); | ||
if ($check === 'y') { | ||
$rarityItems->where('data.rarity', $rarityValue)->each(function ($item) use ($rarity) { | ||
$item->data = array_merge($item->data, ['rarity_id' => $rarity->id]); | ||
$item->save(); | ||
}); | ||
$this->info('Items with rarity value '.$rarityValue.' have been updated to use rarity '.$rarity->name); | ||
} else { | ||
$this->info('No changes made for rarity value '.$rarityValue.'.'); | ||
} | ||
} else { | ||
$this->info('No matching rarity found for name '.$rarityName.'.'); | ||
} | ||
} | ||
} else { | ||
$this->info('No matching rarity found for value '.$rarityValue.'.'); | ||
$rarityName = $this->ask('Enter the name of the rarity you want to use for the value '.$rarityValue.':'); | ||
$rarity = Rarity::whereRaw('LOWER(name) LIKE ?', ['%'.strtolower($rarityName).'%'])->first(); | ||
if ($rarity) { | ||
$check = $this->ask('Do you want to use the rarity '.$rarity->name.' for the value '.$rarityValue.'? (y/n)', 'y'); | ||
if ($check === 'y') { | ||
$rarityItems->where('data.rarity', $rarityValue)->each(function ($item) use ($rarity) { | ||
$item->data = array_merge($item->data, ['rarity_id' => $rarity->id]); | ||
$item->save(); | ||
}); | ||
$this->info('Items with rarity value '.$rarityValue.' have been updated to use rarity '.$rarity->name); | ||
} else { | ||
$this->info('No changes made for rarity value '.$rarityValue.'.'); | ||
} | ||
} else { | ||
$this->info('No matching rarity found for name '.$rarityName.'.'); | ||
$this->info('Feel free to re-run the command to try again.'); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.