-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
97 additions
and
2 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
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,93 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\ScTools; | ||
|
||
use App\Models\SC\Char\Clothing\Clothes; | ||
|
||
class CreateClothingPages extends CreateArmorVariantPages | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'sc-tools:create-clothing-pages {--base}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Command description'; | ||
|
||
protected string $template = <<<'TEMPLATE' | ||
{{Item | ||
|uuid = <UUID> | ||
|image = | ||
|name = <ITEM NAME> | ||
|manufacturer = <MANUFACTURER CODE> | ||
}} | ||
The '''<ITEM NAME>''' is a <ARMOR CLASS> <ITEM TYPE> manufactured by [[{{subst:MFURN|<MANUFACTURER CODE>}}]].<VARIANTINFO><ref name="ig3221">{{Cite game|build=[[Star Citizen Alpha 3.22.1|Alpha 3.22.1]]|accessdate=<CURDATE>}}</ref> | ||
== Description == | ||
{{Item description}} | ||
== Acquisition == | ||
{{Item availability}} | ||
== Model == | ||
=== Variants === | ||
{{Item variants}} | ||
== References == | ||
<references /> | ||
{{Navplate manufacturers|<MANUFACTURER CODE>}} | ||
TEMPLATE; | ||
|
||
protected array $typeMapping = [ | ||
'Char_Clothing_Torso_1' => 'Jacket', | ||
'Char_Clothing_Legs' => 'Pants', | ||
'Char_Clothing_Torso_0' => 'Shirt', | ||
'Char_Clothing_Feet' => 'Shoes', | ||
'Char_Clothing_Hat' => 'Hat', | ||
'Char_Clothing_Hands' => 'Gloves', | ||
'Char_Clothing_Torso_2' => 'Belt', | ||
'Char_Clothing_Backpack' => 'Backpack', | ||
]; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$this->init(); | ||
|
||
$query = Clothes::query() | ||
->where('name', '<>', '<= PLACEHOLDER =>') | ||
->where('class_name', 'NOT LIKE', '%test%'); | ||
|
||
if ($this->option('base')) { | ||
$this->baseQuery['createonly'] = true; | ||
$query->whereNull('base_id'); | ||
} else { | ||
$query->whereNotNull('base_id'); | ||
|
||
} | ||
$this->withProgressBar($query->get(), function (Clothes $model) { | ||
$this->createPage($model); | ||
}); | ||
} | ||
|
||
protected function prepareTemplate($armor): string | ||
{ | ||
$template = parent::prepareTemplate($armor); | ||
|
||
if (in_array($armor->type, ['Char_Clothing_Legs', 'Char_Clothing_Feet', 'Char_Clothing_Hands'], true)) { | ||
$template = str_replace('is a', 'are', $template); | ||
} | ||
|
||
return $template; | ||
} | ||
} |
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