add: ShopEx.
parent
b5cd61adca
commit
ef842f99c6
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\Game\Player;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ShopEx extends Model
|
||||
{
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'shopex';
|
||||
|
||||
/**
|
||||
* The primary key for the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'vnum';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models\Game\Player;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ShopExItem extends Model
|
||||
{
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'shopex_item';
|
||||
|
||||
/**
|
||||
* The primary key for the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = '';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
{
|
||||
"vnum": 61,
|
||||
"name": "Armor",
|
||||
"npc_vnum": 20082
|
||||
},
|
||||
{
|
||||
"vnum": 62,
|
||||
"name": "Armor",
|
||||
"npc_vnum": 20082
|
||||
}
|
||||
]
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
[
|
||||
{
|
||||
"shop_vnum": 61,
|
||||
"item_vnum": 12019,
|
||||
"count": 1,
|
||||
"price": 250,
|
||||
"price_vnum": 0,
|
||||
"price_type": "GOLD",
|
||||
"attrtype1": 1,
|
||||
"attrvalue1": 2000
|
||||
},
|
||||
{
|
||||
"shop_vnum": 61,
|
||||
"item_vnum": 12029,
|
||||
"count": 1,
|
||||
"price": 25000,
|
||||
"price_vnum": 0,
|
||||
"price_type": "GOLD",
|
||||
"attrtype1": 0,
|
||||
"attrvalue1": 0
|
||||
},
|
||||
{
|
||||
"shop_vnum": 62,
|
||||
"item_vnum": 299,
|
||||
"count": 1,
|
||||
"price": 5000,
|
||||
"price_vnum": 0,
|
||||
"price_type": "GOLD",
|
||||
"attrtype1": 0,
|
||||
"attrvalue1": 0
|
||||
},
|
||||
{
|
||||
"shop_vnum": 62,
|
||||
"item_vnum": 279,
|
||||
"count": 1,
|
||||
"price": 1,
|
||||
"price_vnum": 299,
|
||||
"price_type": "ITEM",
|
||||
"attrtype1": 0,
|
||||
"attrvalue1": 0
|
||||
},
|
||||
{
|
||||
"shop_vnum": 62,
|
||||
"item_vnum": 189,
|
||||
"count": 1,
|
||||
"price": 5000,
|
||||
"price_vnum": 0,
|
||||
"price_type": "EXP",
|
||||
"attrtype1": 0,
|
||||
"attrvalue1": 0
|
||||
}
|
||||
]
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Game\Player\SkillProto;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
|
@ -54,7 +55,8 @@ return new class extends Migration
|
|||
// Decode szName from the base64 encoding
|
||||
$value['szName'] = base64_decode($value['szName']);
|
||||
}
|
||||
\App\Models\Game\Player\SkillProto::upsert($data, ['dwVnum']);
|
||||
|
||||
SkillProto::upsert($data, ['dwVnum']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Game\Player\ShopEx;
|
||||
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::create('shopex', function (Blueprint $table) {
|
||||
$table->unsignedInteger('vnum')->primary()->autoIncrement();
|
||||
$table->string('name', 32)->default('NoName');
|
||||
$table->smallInteger('npc_vnum')->index(); // This should reference mob_proto
|
||||
});
|
||||
|
||||
// Populate the table data
|
||||
$data = File::json(database_path('data/shopex.json'));
|
||||
|
||||
ShopEx::upsert($data, ['vnum']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('shopex');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Game\Player\ShopExItem;
|
||||
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::create('shopex_item', function (Blueprint $table) {
|
||||
$table->unsignedInteger('shop_vnum');
|
||||
$table->unsignedInteger('item_vnum');
|
||||
|
||||
$table->unsignedTinyInteger('count')->default(1);
|
||||
$table->unsignedInteger('price')->default(0);
|
||||
$table->unsignedInteger('price_vnum')->default(0);
|
||||
$table->enum('price_type', ['GOLD', 'SECONDCOIN', 'ITEM', 'EXP'])->default('GOLD');
|
||||
|
||||
$table->unsignedInteger('socket0')->default(0);
|
||||
$table->unsignedInteger('socket1')->default(0);
|
||||
$table->unsignedInteger('socket2')->default(0);
|
||||
$table->unsignedInteger('socket3')->default(0);
|
||||
$table->unsignedInteger('socket4')->default(0);
|
||||
|
||||
$table->tinyInteger('attrtype0')->default(0);
|
||||
$table->smallInteger('attrvalue0')->default(0);
|
||||
$table->tinyInteger('attrtype1')->default(0);
|
||||
$table->smallInteger('attrvalue1')->default(0);
|
||||
$table->tinyInteger('attrtype2')->default(0);
|
||||
$table->smallInteger('attrvalue2')->default(0);
|
||||
$table->tinyInteger('attrtype3')->default(0);
|
||||
$table->smallInteger('attrvalue3')->default(0);
|
||||
$table->tinyInteger('attrtype4')->default(0);
|
||||
$table->smallInteger('attrvalue4')->default(0);
|
||||
$table->tinyInteger('attrtype5')->default(0);
|
||||
$table->smallInteger('attrvalue5')->default(0);
|
||||
$table->tinyInteger('attrtype6')->default(0);
|
||||
$table->smallInteger('attrvalue6')->default(0);
|
||||
|
||||
$table->unique(
|
||||
['shop_vnum', 'item_vnum', 'count', 'price', 'price_vnum', 'price_type'],
|
||||
'vnum_unique'
|
||||
);
|
||||
$table->foreign('shop_vnum')->references('vnum')->on('shopex')->cascadeOnDelete();
|
||||
});
|
||||
|
||||
// Populate the table data
|
||||
$data = File::json(database_path('data/shopex_item.json'));
|
||||
|
||||
ShopExItem::upsert($data, ['shop_vnum', 'item_vnum']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('shopex_item');
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue