Compare commits

...

10 Commits

130 changed files with 36710 additions and 7208 deletions

View File

@ -1,18 +1,50 @@
# The Metin2 Website
This is a replica of the old Metin2 website in the pre-2014 era, made in Laravel. Still very much a work in progress,
it aims to be the management centre for the Metin2 stack.
## What works
- Registering a new account
- Account login
- Registering a new account
- Account login
## What's unfinished
- User management
- Complete multilanguage system & English translations
- Item-Shop with Stripe integration
- Populating the database tables with the minimum information to start the server
- Admin panel (which would allow you to post news, customize the navbar, etc. and also manage ingame actions such as bans)
- Docker image
- Ranking (with cache system for fast search)
- Adding Grotto & DC landing pages
- Converting Flash-based media players to HTML5.
- User management
- Complete multilanguage system & English translations
- Item-Shop with Stripe integration
- Populating the database tables with the minimum information to start the server
- Admin panel (which would allow you to post news, customize the navbar, etc. and also manage ingame actions such as bans)
- Docker image
- Ranking (with cache system for fast search)
- Adding Grotto & DC landing pages
- Converting Flash-based media players to HTML5.
## Development
### Image Building
To build the image, checkout the repo and run either of the following build statements
```shell
docker build -t metin2/web:test -f docker/image/prod/apache.Dockerfile .
# or
docker build -t metin2/web:test -f docker/image/prod/frankenphp.Dockerfile .
```
If you want to use this image in your deploy project, ensure to update the `WEB_IMAGE` variable in your `.env` to `metin2/web:test`.
### Testing Migrations
To test newly added migrations, use a temporary docker container that attaches to your existing deploy network.
```shell
docker run --env-file .env --network deploy_default --rm metin2/web:test "php artisan migrate"
```
Ensure that the rollback of your migration is also working as expected.
Adapt the `--step` parameter according to the number of migration files you added.
```shell
docker run --env-file .env --network deploy_default --rm metin2/web:test "php artisan migrate:rollback --step=1"
```

27760
_ide_helper.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,27 +0,0 @@
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}

View File

@ -18,15 +18,12 @@ class RegisterController extends Controller
{
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Validation\Validator
*/
protected function validator(array $data): \Illuminate\Validation\Validator
{
return Validator::make($data, [
'login' => ['required', 'string', 'min:5', 'max:16', 'unique:account.account'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:account.account'],
'login' => ['required', 'string', 'min:5', 'max:16', 'unique:account'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:account'],
'password' => ['required', 'string', 'min:5', 'max:16'],
'tac' => ['required'],
]);
@ -35,13 +32,11 @@ class RegisterController extends Controller
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return Account
* @throws \Throwable
*/
protected function create(array $data): Account
{
$account = new Account();
$account = new Account;
$account->login = $data['login'];
$account->email = $data['email'];
$account->password = Hash::make($data['password']);
@ -54,8 +49,6 @@ class RegisterController extends Controller
/**
* Executes the registration logic on a validator input
*
* @param \Illuminate\Validation\Validator $validator
* @return RedirectResponse
* @throws ValidationException
* @throws \Throwable
*/
@ -82,8 +75,6 @@ class RegisterController extends Controller
/**
* Show the application registration form.
*
* @return View
*/
public function showRegistrationForm(): View
{
@ -93,21 +84,18 @@ class RegisterController extends Controller
/**
* Handle a registration request for the application.
*
* @param Request $request
* @return RedirectResponse
* @throws \Throwable
*/
public function register(Request $request): RedirectResponse
{
$validator = $this->validator($request->all());
return $this->runRegistrationLogic($validator);
}
/**
* Handle a registration request for the application.
*
* @param Request $request
* @return RedirectResponse
* @throws \Throwable
*/
public function registerFromHeader(Request $request): RedirectResponse

View File

@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class LanguageController extends Controller
{
public static array $supportedLanguages = [
"en",
"ro"
];
public function setLanguage(string $language, Request $request): RedirectResponse
{
// Validate the requested language
$validator = Validator::make(
['language' => $language],
['language' => ['required', Rule::in(self::$supportedLanguages)]]
);
$validated = $validator->validated();
// Save the language preference in the session
$request->session()->put(['language' => $validated['language']]);
return redirect()->back();
}
}

View File

@ -1,68 +0,0 @@
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's middleware aliases.
*
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
];
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class Language
{
/**
* Handle an incoming request.
*
* @param Closure(Request): (Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
if ($request->session()->has('language')) {
// Get the language from the session
$language = $request->session()->get('language');
// Set the language
app()->setLocale($language);
}
return $next($request);
}
}

View File

@ -14,13 +14,6 @@ class Account extends User implements MustVerifyEmail
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'account';
/**
* The table associated with the model.
*
@ -60,7 +53,7 @@ class Account extends User implements MustVerifyEmail
protected $hidden = [
'password',
'social_id',
'securitycode'
'securitycode',
];
/**
@ -70,13 +63,11 @@ class Account extends User implements MustVerifyEmail
*/
protected $casts = [
'email_verified_at' => 'datetime',
'status' => AccountStatusEnum::class
'status' => AccountStatusEnum::class,
];
/**
* Determine if the user has verified their email address.
*
* @return bool
*/
public function hasVerifiedEmail(): bool
{
@ -85,8 +76,6 @@ class Account extends User implements MustVerifyEmail
/**
* Mark the given user's email as verified.
*
* @return bool
*/
public function markEmailAsVerified(): bool
{
@ -97,8 +86,6 @@ class Account extends User implements MustVerifyEmail
/**
* Send the email verification notification.
*
* @return void
*/
public function sendEmailVerificationNotification(): void
{
@ -107,8 +94,6 @@ class Account extends User implements MustVerifyEmail
/**
* Get the email address that should be used for verification.
*
* @return string
*/
public function getEmailForVerification(): string
{

View File

@ -13,13 +13,6 @@ class Locale extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'common';
/**
* The table associated with the model.
*
@ -40,7 +33,7 @@ class Locale extends Model
* @var array<int, string>
*/
protected $fillable = [
'mKey', 'mValue'
'mKey', 'mValue',
];
/**

View File

@ -14,13 +14,6 @@ class GuildHighscoreCache extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'website';
/**
* The table associated with the model.
*
@ -60,6 +53,6 @@ class GuildHighscoreCache extends Model
*/
protected $casts = [
'empire' => EmpireEnum::class,
'date' => 'datetime'
'date' => 'datetime',
];
}

View File

@ -15,13 +15,6 @@ class HighscoreCache extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'website';
/**
* The table associated with the model.
*
@ -62,6 +55,6 @@ class HighscoreCache extends Model
protected $casts = [
'job' => CharacterClassEnum::class,
'empire' => EmpireEnum::class,
'date' => 'datetime'
'date' => 'datetime',
];
}

View File

@ -13,13 +13,6 @@ class Banword extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*
@ -40,7 +33,7 @@ class Banword extends Model
* @var array<int, string>
*/
protected $fillable = [
'word'
'word',
];
/**

View File

@ -13,13 +13,6 @@ class ItemAttr extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class ItemAttrRare extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class ItemProto extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class Land extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class ObjectProto extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -18,13 +18,6 @@ class Player extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -3,7 +3,6 @@
namespace App\Models\Game\Player;
use App\Models\Account;
use App\Models\Enums\CharacterJobEnum;
use App\Models\Enums\EmpireEnum;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -17,13 +16,6 @@ class PlayerIndex extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class RefineProto extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class Shop extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class ShopItem extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -13,13 +13,6 @@ class SkillProto extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'player';
/**
* The table associated with the model.
*

View File

@ -14,13 +14,6 @@ class MallCategory extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'website';
/**
* The attributes that are mass assignable.
*
@ -50,8 +43,6 @@ class MallCategory extends Model
/**
* Get the items in this category
*
* @return HasMany
*/
public function items(): HasMany
{

View File

@ -17,13 +17,6 @@ class MallItem extends Model
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'website';
/**
* The attributes that are mass assignable.
*
@ -61,46 +54,45 @@ class MallItem extends Model
/**
* Get the associated item_proto entry
*
* @return HasOne
*/
public function proto(): HasOne
{
return $this->hasOne(ItemProto::class, 'vnum', 'vnum');
}
/**
* @return bool
*/
public function userCanBuy(): bool
{
$user = Auth::user();
if ($this->pricing == MallItemPricingEnum::CASH)
if ($this->pricing == MallItemPricingEnum::CASH) {
return $user->cash >= $this->price;
elseif ($this->pricing == MallItemPricingEnum::MILEAGE)
} elseif ($this->pricing == MallItemPricingEnum::MILEAGE) {
return $user->mileage >= $this->price;
}
return false;
}
public static function getSuggestions(int $maxCount, MallItem $forItem = null, string $frontpageDisplay = null)
public static function getSuggestions(int $maxCount, ?MallItem $forItem = null, ?string $frontpageDisplay = null)
{
$query = MallItem::query();
// Ignore the current item if specified
if ($forItem)
if ($forItem) {
$query = $query->whereNotIn('vnum', [$forItem->vnum]);
}
// Select items that are to be shown on the frontpage
if ($frontpageDisplay)
if ($frontpageDisplay) {
$query = $query->where('other', $frontpageDisplay);
}
$items = $query->get();
// Just return what we selected if we don't have enough items in the database
if ($items->count() <= $maxCount)
if ($items->count() <= $maxCount) {
return $items;
}
return $items->random($maxCount);
}

View File

@ -2,8 +2,6 @@
namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
@ -14,11 +12,7 @@ class EventServiceProvider extends ServiceProvider
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
];
protected $listen = [];
/**
* Register any events for your application.

View File

@ -26,6 +26,9 @@ return Application::configure(basePath: dirname(__DIR__))
Request::HEADER_X_FORWARDED_AWS_ELB
);
})
->withMiddleware(function (Middleware $middleware) {
$middleware->appendToGroup('web', \App\Http\Middleware\Language::class);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

View File

@ -15,6 +15,7 @@
"laravel/tinker": "^2.8"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^3.5",
"fakerphp/faker": "^1.9.1",
"kitloong/laravel-migrations-generator": "^7.0",
"laravel/pint": "^1.0",

1561
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ return [
|
*/
'default' => env('DB_CONNECTION', 'website'),
'default' => env('DB_CONNECTION', 'mariadb'),
/*
|--------------------------------------------------------------------------
@ -35,55 +35,11 @@ return [
'connections' => [
'website' => [
'driver' => 'mysql',
'mariadb' => [
'driver' => 'mariadb',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'website',
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
],
'account' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'account',
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
],
'common' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'common',
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
],
'log' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'log',
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
],
'player' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => 'player',
'database' => env('DB_DATABASE', 'metin2'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8mb4',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('account')->create('account', function (Blueprint $table) {
$table->integer('id', true);
$table->string('login', 30)->default('')->unique('login');
$table->text('password')->default('');
$table->string('social_id', 13)->default('')->index('social_id');
$table->string('email', 64)->default('');
$table->dateTime('create_time')->default('0000-00-00 00:00:00');
$table->string('status', 8)->default('OK');
$table->string('securitycode', 192)->nullable()->default('');
$table->dateTime('availDt')->default('0000-00-00 00:00:00');
$table->integer('mileage')->default(0);
$table->integer('cash')->default(0);
$table->dateTime('gold_expire')->default('0000-00-00 00:00:00');
$table->dateTime('silver_expire')->default('0000-00-00 00:00:00');
$table->dateTime('safebox_expire')->default('0000-00-00 00:00:00');
$table->dateTime('autoloot_expire')->default('0000-00-00 00:00:00');
$table->dateTime('fish_mind_expire')->default('0000-00-00 00:00:00');
$table->dateTime('marriage_fast_expire')->default('0000-00-00 00:00:00');
$table->dateTime('money_drop_rate_expire')->default('0000-00-00 00:00:00');
$table->string('ip')->nullable();
$table->dateTime('last_play');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('account')->dropIfExists('account');
}
};

View File

@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('log')->create('cube', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('pid')->default(0)->index('pid');
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->unsignedInteger('x')->default(0);
$table->unsignedInteger('y')->default(0);
$table->unsignedInteger('item_vnum')->default(0)->index('item_vnum');
$table->unsignedInteger('item_uid')->default(0)->index('item_uid');
$table->unsignedInteger('item_count')->default(0);
$table->boolean('success')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('log')->dropIfExists('cube');
}
};

View File

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('log')->create('hack_crc_log', function (Blueprint $table) {
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->char('login', 16)->default('');
$table->char('name', 24)->default('');
$table->char('ip', 15)->default('');
$table->char('server', 100)->default('');
$table->char('why')->default('');
$table->integer('crc')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('log')->dropIfExists('hack_crc_log');
}
};

View File

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('log')->create('hack_log', function (Blueprint $table) {
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->char('login', 16)->default('');
$table->char('name', 24)->default('');
$table->char('ip', 15)->default('');
$table->char('server', 100)->default('');
$table->char('why')->default('');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('log')->dropIfExists('hack_log');
}
};

View File

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('log')->create('hackshield_log', function (Blueprint $table) {
$table->unsignedInteger('pid')->default(0);
$table->string('login', 32)->nullable();
$table->unsignedInteger('account_id');
$table->string('name', 25)->nullable();
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->string('reason', 25)->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('log')->dropIfExists('hackshield_log');
}
};

View File

@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('log')->create('loginlog', function (Blueprint $table) {
$table->enum('type', ['LOGIN', 'LOGOUT'])->nullable();
$table->dateTime('time')->nullable();
$table->tinyInteger('channel')->nullable();
$table->unsignedInteger('account_id')->nullable();
$table->unsignedInteger('pid')->nullable();
$table->smallInteger('level')->nullable();
$table->tinyInteger('job')->nullable();
$table->unsignedInteger('playtime')->nullable();
$table->index(['pid', 'type'], 'pid');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('log')->dropIfExists('loginlog');
}
};

View File

@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('log')->create('playercount', function (Blueprint $table) {
$table->dateTime('date')->nullable();
$table->integer('count_red')->nullable();
$table->integer('count_yellow')->nullable();
$table->integer('count_blue')->nullable();
$table->integer('count_total')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('log')->dropIfExists('playercount');
}
};

View File

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('player')->create('guild_war_bet', function (Blueprint $table) {
$table->string('login', 24)->default('');
$table->unsignedInteger('gold')->default(0);
$table->integer('guild')->default(0);
$table->unsignedInteger('war_id')->default(0);
$table->primary(['war_id', 'login']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild_war_bet');
}
};

View File

@ -1,32 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('player')->create('monarch_election', function (Blueprint $table) {
$table->unsignedInteger('pid')->default(0)->primary();
$table->unsignedInteger('selectedpid')->nullable()->default(0);
$table->dateTime('electiondata')->nullable()->default('0000-00-00 00:00:00');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('player')->dropIfExists('monarch_election');
}
};

View File

@ -1,33 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('player')->create('monarch', function (Blueprint $table) {
$table->unsignedInteger('empire')->default(0)->primary();
$table->unsignedInteger('pid')->nullable();
$table->dateTime('windate')->nullable();
$table->unsignedBigInteger('money')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('player')->dropIfExists('monarch');
}
};

View File

@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('player')->create('object', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('land_id')->default(0);
$table->unsignedInteger('vnum')->default(0);
$table->integer('map_index')->default(0);
$table->integer('x')->default(0);
$table->integer('y')->default(0);
$table->float('x_rot', null, 0)->default(0);
$table->float('y_rot', null, 0)->default(0);
$table->float('z_rot', null, 0)->default(0);
$table->integer('life')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('player')->dropIfExists('object');
}
};

View File

@ -1,35 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('player')->create('player_index', function (Blueprint $table) {
$table->integer('id')->default(0)->primary();
$table->integer('pid1')->default(0)->index('pid1_key');
$table->integer('pid2')->default(0)->index('pid2_key');
$table->integer('pid3')->default(0)->index('pid3_key');
$table->integer('pid4')->default(0)->index('pid4_key');
$table->tinyInteger('empire')->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('player')->dropIfExists('player_index');
}
};

View File

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('account', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->string('login', 30)->unique('login');
$table->text('password');
$table->string('social_id', 13)->default('')->index('social_id');
$table->string('email', 64);
$table->dateTime('create_time')->useCurrent();
$table->string('status', 8)->default('OK');
$table->string('securitycode', 192)->nullable();
$table->dateTime('availDt')->useCurrent();
$table->integer('mileage')->default(0);
$table->integer('cash')->default(0);
$table->dateTime('gold_expire')->useCurrent();
$table->dateTime('silver_expire')->useCurrent();
$table->dateTime('safebox_expire')->useCurrent();
$table->dateTime('autoloot_expire')->useCurrent();
$table->dateTime('fish_mind_expire')->useCurrent();
$table->dateTime('marriage_fast_expire')->useCurrent();
$table->dateTime('money_drop_rate_expire')->useCurrent();
$table->string('ip')->nullable();
$table->dateTime('last_play')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('account');
}
};

View File

@ -13,12 +13,12 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('player', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('account_id')->default(0)->index('account_id_idx');
$table->string('name', 24)->default('NONAME')->index('name_idx');
$table->unsignedTinyInteger('job')->default(0);
$table->boolean('voice')->unsigned()->default(false);
Schema::create('player', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->unsignedInteger('account_id');
$table->string('name', 24)->default('Noname')->index('name_idx');
$table->unsignedTinyInteger('job');
$table->boolean('voice')->default(false);
$table->tinyInteger('dir')->default(0);
$table->integer('x')->default(0);
$table->integer('y')->default(0);
@ -51,7 +51,7 @@ return new class extends Migration
$table->tinyInteger('skill_group')->default(0);
$table->binary('skill_level')->nullable();
$table->integer('alignment')->default(0);
$table->dateTime('last_play')->default('0000-00-00 00:00:00');
$table->dateTime('last_play')->useCurrent();
$table->boolean('change_name')->default(false);
$table->smallInteger('sub_skill_point')->default(0);
$table->tinyInteger('stat_reset_count')->default(0);
@ -62,6 +62,8 @@ return new class extends Migration
$table->boolean('horse_riding')->default(false);
$table->smallInteger('horse_skill_point')->default(0);
$table->integer('bank_value')->default(0);
$table->foreign('account_id')->references('id')->on('account');
});
}
@ -72,6 +74,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('player');
Schema::dropIfExists('player');
}
};

View File

@ -13,15 +13,15 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('guild', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 12)->default('');
Schema::create('guild', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->string('name', 12);
$table->smallInteger('sp')->default(1000);
$table->unsignedInteger('master')->default(0);
$table->tinyInteger('level')->nullable();
$table->integer('exp')->nullable();
$table->tinyInteger('level');
$table->integer('exp');
$table->tinyInteger('skill_point')->default(0);
$table->binary('skill')->nullable();
$table->binary('skill');
$table->integer('win')->default(0);
$table->integer('draw')->default(0);
$table->integer('loss')->default(0);
@ -37,6 +37,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild');
Schema::dropIfExists('guild');
}
};

View File

@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('affect', function (Blueprint $table) {
Schema::create('affect', function (Blueprint $table) {
$table->unsignedInteger('dwPID')->default(0);
$table->unsignedSmallInteger('bType')->default(0);
$table->unsignedTinyInteger('bApplyOn')->default(0);
@ -23,6 +23,7 @@ return new class extends Migration
$table->integer('lSPCost')->default(0);
$table->primary(['dwPID', 'bType', 'bApplyOn', 'lApplyValue']);
$table->foreign('dwPID')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -33,6 +34,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('affect');
Schema::dropIfExists('affect');
}
};

View File

@ -14,8 +14,8 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('banword', function (Blueprint $table) {
$table->binary('word', length: 24)->default('')->primary();
Schema::create('banword', function (Blueprint $table) {
$table->binary('word', length: 24)->primary();
});
// Populate the table data
@ -30,6 +30,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('banword');
Schema::dropIfExists('banword');
}
};

View File

@ -13,8 +13,8 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('bootlog', function (Blueprint $table) {
$table->dateTime('time')->default('0000-00-00 00:00:00');
Schema::create('bootlog', function (Blueprint $table) {
$table->dateTime('time')->useCurrent();
$table->char('hostname', 128)->default('UNKNOWN');
$table->boolean('channel')->default(false);
});
@ -27,6 +27,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('bootlog');
Schema::dropIfExists('bootlog');
}
};

View File

@ -13,10 +13,12 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('change_empire', function (Blueprint $table) {
$table->integer('account_id')->default(0)->primary();
Schema::create('change_empire', function (Blueprint $table) {
$table->unsignedInteger('account_id');
$table->tinyInteger('change_count')->nullable();
$table->dateTime('timestamp')->nullable();
$table->foreign('account_id')->references('id')->on('account');
});
}
@ -27,6 +29,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('change_empire');
Schema::dropIfExists('change_empire');
}
};

View File

@ -13,12 +13,14 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('change_name', function (Blueprint $table) {
$table->integer('pid')->nullable();
Schema::create('change_name', function (Blueprint $table) {
$table->unsignedInteger('pid');
$table->string('old_name')->nullable();
$table->string('new_name')->nullable();
$table->dateTime('time')->nullable();
$table->string('ip', 20)->nullable();
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -29,6 +31,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('change_name');
Schema::dropIfExists('change_name');
}
};

View File

@ -13,15 +13,17 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('command_log', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('userid')->default(0);
$table->integer('server')->default(0);
$table->string('ip', 15)->default('');
Schema::create('command_log', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->unsignedInteger('userid');
$table->integer('server');
$table->string('ip', 15);
$table->integer('port')->default(0);
$table->string('username', 50)->default('');
$table->string('username', 50);
$table->text('command');
$table->dateTime('date')->default('0000-00-00 00:00:00');
$table->dateTime('date')->useCurrent();
$table->foreign('userid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -32,6 +34,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('command_log');
Schema::dropIfExists('command_log');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cube', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('pid');
$table->dateTime('time')->useCurrent();
$table->unsignedInteger('x');
$table->unsignedInteger('y');
// Can't reference due to item_proto being reloaded
$table->unsignedInteger('item_vnum')->index('item_vnum');
$table->unsignedInteger('item_uid')->index('item_uid');
$table->unsignedInteger('item_count');
$table->boolean('success')->default(false);
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cube');
}
};

View File

@ -13,11 +13,13 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('dragon_slay_log', function (Blueprint $table) {
Schema::create('dragon_slay_log', function (Blueprint $table) {
$table->unsignedInteger('guild_id');
$table->unsignedInteger('vnum');
$table->timestamp('start_time')->default('0000-00-00 00:00:00');
$table->timestamp('end_time')->default('0000-00-00 00:00:00');
$table->timestamp('start_time')->useCurrent();
$table->timestamp('end_time')->useCurrent();
$table->foreign('guild_id')->references('id')->on('guild')->cascadeOnDelete();
});
}
@ -28,6 +30,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('dragon_slay_log');
Schema::dropIfExists('dragon_slay_log');
}
};

View File

@ -13,15 +13,17 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('fish_log', function (Blueprint $table) {
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->unsignedInteger('player_id')->default(0);
Schema::create('fish_log', function (Blueprint $table) {
$table->dateTime('time')->useCurrent();
$table->unsignedInteger('player_id');
$table->tinyInteger('map_index')->default(0);
$table->unsignedInteger('fish_id')->default(0);
$table->integer('fishing_level')->default(0);
$table->integer('waiting_time')->default(0);
$table->tinyInteger('success')->default(0);
$table->unsignedInteger('fish_id')->index('fish_id');
$table->integer('fishing_level');
$table->integer('waiting_time');
$table->boolean('success')->default(false);
$table->smallInteger('size')->default(0);
$table->foreign('player_id')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -32,6 +34,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('fish_log');
Schema::dropIfExists('fish_log');
}
};

View File

@ -13,8 +13,8 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('common')->create('gmhost', function (Blueprint $table) {
$table->string('mIP', 16)->default('');
Schema::create('gmhost', function (Blueprint $table) {
$table->string('mIP', 16);
});
}
@ -25,6 +25,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('common')->dropIfExists('gmhost');
Schema::dropIfExists('gmhost');
}
};

View File

@ -13,13 +13,16 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('common')->create('gmlist', function (Blueprint $table) {
Schema::create('gmlist', function (Blueprint $table) {
$table->increments('mID');
$table->string('mAccount', 32)->default('');
$table->string('mName', 32)->default('');
$table->string('mContactIP', 16)->default('');
$table->string('mAccount', 30);
$table->string('mName', 32);
$table->string('mContactIP', 16)->default('0.0.0.0');
$table->string('mServerIP', 16)->default('ALL');
$table->enum('mAuthority', ['IMPLEMENTOR', 'HIGH_WIZARD', 'GOD', 'LOW_WIZARD', 'PLAYER'])->nullable()->default('PLAYER');
$table->foreign('mAccount')->references('login')->on('account')->cascadeOnDelete();
$table->foreign('mName')->references('name')->on('player')->cascadeOnUpdate()->cascadeOnDelete();
});
}
@ -30,6 +33,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('common')->dropIfExists('gmlist');
Schema::dropIfExists('gmlist');
}
};

View File

@ -13,13 +13,16 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('goldlog', function (Blueprint $table) {
Schema::create('goldlog', function (Blueprint $table) {
// TODO Using strings here is weird
$table->string('date', 10)->default('0000-00-00')->index('date_idx');
$table->string('time', 8)->default('00:00:00');
$table->unsignedInteger('pid')->default(0)->index('pid_idx');
$table->integer('what')->default(0)->index('what_idx');
$table->unsignedInteger('pid');
$table->integer('what')->index('what_idx');
$table->set('how', ['BUY', 'SELL', 'SHOP_SELL', 'SHOP_BUY', 'EXCHANGE_TAKE', 'EXCHANGE_GIVE', 'QUEST'])->nullable()->index('how_idx');
$table->string('hint', 50)->nullable();
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -30,6 +33,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('goldlog');
Schema::dropIfExists('goldlog');
}
};

View File

@ -13,15 +13,17 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('guild_comment', function (Blueprint $table) {
$table->integer('id', true);
$table->unsignedInteger('guild_id')->nullable()->index('guild_id');
// TODO Source doesn't seem like it is working
Schema::create('guild_comment', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->unsignedInteger('guild_id');
$table->string('name', 8)->nullable();
$table->tinyInteger('notice')->nullable();
$table->string('content', 50)->nullable();
$table->dateTime('time')->nullable();
$table->index(['notice', 'id', 'guild_id'], 'aaa');
$table->foreign('guild_id')->references('id')->on('guild')->cascadeOnDelete();
});
}
@ -32,6 +34,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild_comment');
Schema::dropIfExists('guild_comment');
}
};

View File

@ -13,13 +13,14 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('guild_grade', function (Blueprint $table) {
$table->integer('guild_id')->default(0);
$table->tinyInteger('grade')->default(0);
$table->string('name', 8)->default('');
Schema::create('guild_grade', function (Blueprint $table) {
$table->unsignedInteger('guild_id');
$table->tinyInteger('grade');
$table->string('name', 8);
$table->set('auth', ['ADD_MEMBER', 'REMOVE_MEMEBER', 'NOTICE', 'USE_SKILL'])->nullable();
$table->primary(['guild_id', 'grade']);
$table->foreign('guild_id')->references('id')->on('guild')->cascadeOnDelete();
});
}
@ -30,6 +31,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild_grade');
Schema::dropIfExists('guild_grade');
}
};

View File

@ -11,8 +11,8 @@ return new class extends Migration
*/
public function up(): void
{
Schema::connection('website')->create('guild_highscore_cache', function (Blueprint $table) {
$table->bigInteger('id', true);
Schema::create('guild_highscore_cache', function (Blueprint $table) {
$table->id();
$table->text('name');
$table->text('master');
$table->integer('empire');
@ -27,6 +27,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::connection('website')->dropIfExists('guild_highscore_cache');
Schema::dropIfExists('guild_highscore_cache');
}
};

View File

@ -13,14 +13,16 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('guild_member', function (Blueprint $table) {
$table->unsignedInteger('pid')->default(0)->unique('pid');
$table->unsignedInteger('guild_id')->default(0);
$table->tinyInteger('grade')->nullable();
Schema::create('guild_member', function (Blueprint $table) {
$table->unsignedInteger('pid');
$table->unsignedInteger('guild_id');
$table->tinyInteger('grade');
$table->boolean('is_general')->default(false);
$table->unsignedInteger('offer')->nullable();
$table->unsignedInteger('offer');
$table->primary(['guild_id', 'pid']);
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('guild_id')->references('id')->on('guild')->cascadeOnDelete();
});
}
@ -31,6 +33,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild_member');
Schema::dropIfExists('guild_member');
}
};

View File

@ -13,9 +13,10 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('guild_war', function (Blueprint $table) {
$table->integer('id_from')->default(0);
$table->integer('id_to')->default(0);
// TODO Check
Schema::create('guild_war', function (Blueprint $table) {
$table->unsignedInteger('id_from')->default(0);
$table->unsignedInteger('id_to')->default(0);
$table->primary(['id_from', 'id_to']);
});
@ -28,6 +29,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild_war');
Schema::dropIfExists('guild_war');
}
};

View File

@ -13,11 +13,11 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('guild_war_reservation', function (Blueprint $table) {
Schema::create('guild_war_reservation', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('guild1')->default(0);
$table->unsignedInteger('guild2')->default(0);
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->unsignedInteger('guild1');
$table->unsignedInteger('guild2');
$table->dateTime('time')->useCurrent();
$table->unsignedTinyInteger('type')->default(0);
$table->unsignedInteger('warprice')->default(0);
$table->unsignedInteger('initscore')->default(0);
@ -30,6 +30,9 @@ return new class extends Migration
$table->integer('handicap')->default(0);
$table->integer('result1')->default(0);
$table->integer('result2')->default(0);
$table->foreign('guild1')->references('id')->on('guild')->cascadeOnDelete();
$table->foreign('guild2')->references('id')->on('guild')->cascadeOnDelete();
});
}
@ -40,6 +43,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('guild_war_reservation');
Schema::dropIfExists('guild_war_reservation');
}
};

View File

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('guild_war_bet', function (Blueprint $table) {
$table->string('login', 30);
$table->unsignedInteger('gold');
$table->unsignedInteger('guild');
$table->unsignedInteger('war_id');
$table->primary(['war_id', 'login']);
$table->foreign('login')->references('login')->on('account')->cascadeOnDelete();
$table->foreign('guild')->references('id')->on('guild')->cascadeOnDelete();
$table->foreign('war_id')->references('id')->on('guild_war_reservation')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('guild_war_bet');
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hack_log', function (Blueprint $table) {
$table->dateTime('time')->useCurrent();
$table->string('login', 30);
$table->string('name', 24);
$table->string('ip', 15);
$table->string('server', 100);
$table->string('why')->default('');
$table->foreign('login')->references('login')->on('account');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('hack_log');
}
};

View File

@ -11,8 +11,8 @@ return new class extends Migration
*/
public function up(): void
{
Schema::connection('website')->create('highscore_cache', function (Blueprint $table) {
$table->bigInteger('id', true);
Schema::create('highscore_cache', function (Blueprint $table) {
$table->id();
$table->text('name');
$table->integer('job');
$table->integer('empire');
@ -27,6 +27,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::connection('website')->dropIfExists('highscore_cache');
Schema::dropIfExists('highscore_cache');
}
};

View File

@ -13,9 +13,11 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('horse_name', function (Blueprint $table) {
$table->integer('id')->default(0)->primary();
$table->string('name', 24)->default('NONAME');
Schema::create('horse_name', function (Blueprint $table) {
$table->unsignedInteger('id');
$table->string('name', 24)->default('Noname');
$table->foreign('id')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -26,6 +28,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('horse_name');
Schema::dropIfExists('horse_name');
}
};

View File

@ -14,22 +14,22 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('item_attr_rare', function (Blueprint $table) {
Schema::create('item_attr_rare', function (Blueprint $table) {
$table->enum('apply', ['MAX_HP', 'MAX_SP', 'CON', 'INT', 'STR', 'DEX', 'ATT_SPEED', 'MOV_SPEED', 'CAST_SPEED', 'HP_REGEN', 'SP_REGEN', 'POISON_PCT', 'STUN_PCT', 'SLOW_PCT', 'CRITICAL_PCT', 'PENETRATE_PCT', 'ATTBONUS_HUMAN', 'ATTBONUS_ANIMAL', 'ATTBONUS_ORC', 'ATTBONUS_MILGYO', 'ATTBONUS_UNDEAD', 'ATTBONUS_DEVIL', 'STEAL_HP', 'STEAL_SP', 'MANA_BURN_PCT', 'DAMAGE_SP_RECOVER', 'BLOCK', 'DODGE', 'RESIST_SWORD', 'RESIST_TWOHAND', 'RESIST_DAGGER', 'RESIST_BELL', 'RESIST_FAN', 'RESIST_BOW', 'RESIST_FIRE', 'RESIST_ELEC', 'RESIST_MAGIC', 'RESIST_WIND', 'REFLECT_MELEE', 'REFLECT_CURSE', 'POISON_REDUCE', 'KILL_SP_RECOVER', 'EXP_DOUBLE_BONUS', 'GOLD_DOUBLE_BONUS', 'ITEM_DROP_BONUS', 'POTION_BONUS', 'KILL_HP_RECOVER', 'IMMUNE_STUN', 'IMMUNE_SLOW', 'IMMUNE_FALL', 'SKILL', 'BOW_DISTANCE', 'ATT_GRADE_BONUS', 'DEF_GRADE_BONUS', 'MAGIC_ATT_GRADE', 'MAGIC_DEF_GRADE', 'CURSE_PCT', 'MAX_STAMINA', 'ATT_BONUS_TO_WARRIOR', 'ATT_BONUS_TO_ASSASSIN', 'ATT_BONUS_TO_SURA', 'ATT_BONUS_TO_SHAMAN', 'ATT_BONUS_TO_MONSTER', 'NORMAL_HIT_DEFEND_BONUS', 'SKILL_DEFEND_BONUS', 'NOUSE2\'\'NOUSE3', 'NOUSE4', 'NOUSE5', 'NOUSE6', 'NOUSE7', 'NOUSE8', 'NOUSE9', 'NOUSE10', 'NOUSE11', 'NOUSE12', 'NOUSE13', 'NOUSE14', 'RESIST_WARRIOR', 'RESIST_ASSASSIN', 'RESIST_SURA', 'RESIST_SHAMAN'])->default('MAX_HP');
$table->string('prob', 100)->default('');
$table->string('lv1', 100)->default('');
$table->string('lv2', 100)->default('');
$table->string('lv3', 100)->default('');
$table->string('lv4', 100)->default('');
$table->string('lv5', 100)->default('');
$table->string('weapon', 100)->default('');
$table->string('body', 100)->default('');
$table->string('wrist', 100)->default('');
$table->string('foots', 100)->default('');
$table->string('neck', 100)->default('');
$table->string('head', 100)->default('');
$table->string('shield', 100)->default('');
$table->string('ear', 100)->default('');
$table->string('prob', 100);
$table->string('lv1', 100);
$table->string('lv2', 100);
$table->string('lv3', 100);
$table->string('lv4', 100);
$table->string('lv5', 100);
$table->string('weapon', 100);
$table->string('body', 100);
$table->string('wrist', 100);
$table->string('foots', 100);
$table->string('neck', 100);
$table->string('head', 100);
$table->string('shield', 100);
$table->string('ear', 100);
});
// Populate the table data
@ -44,6 +44,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('item_attr_rare');
Schema::dropIfExists('item_attr_rare');
}
};

View File

@ -14,22 +14,22 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('item_attr', function (Blueprint $table) {
Schema::create('item_attr', function (Blueprint $table) {
$table->enum('apply', ['MAX_HP', 'MAX_SP', 'CON', 'INT', 'STR', 'DEX', 'ATT_SPEED', 'MOV_SPEED', 'CAST_SPEED', 'HP_REGEN', 'SP_REGEN', 'POISON_PCT', 'STUN_PCT', 'SLOW_PCT', 'CRITICAL_PCT', 'PENETRATE_PCT', 'ATTBONUS_HUMAN', 'ATTBONUS_ANIMAL', 'ATTBONUS_ORC', 'ATTBONUS_MILGYO', 'ATTBONUS_UNDEAD', 'ATTBONUS_DEVIL', 'STEAL_HP', 'STEAL_SP', 'MANA_BURN_PCT', 'DAMAGE_SP_RECOVER', 'BLOCK', 'DODGE', 'RESIST_SWORD', 'RESIST_TWOHAND', 'RESIST_DAGGER', 'RESIST_BELL', 'RESIST_FAN', 'RESIST_BOW', 'RESIST_FIRE', 'RESIST_ELEC', 'RESIST_MAGIC', 'RESIST_WIND', 'REFLECT_MELEE', 'REFLECT_CURSE', 'POISON_REDUCE', 'KILL_SP_RECOVER', 'EXP_DOUBLE_BONUS', 'GOLD_DOUBLE_BONUS', 'ITEM_DROP_BONUS', 'POTION_BONUS', 'KILL_HP_RECOVER', 'IMMUNE_STUN', 'IMMUNE_SLOW', 'IMMUNE_FALL', 'SKILL', 'BOW_DISTANCE', 'ATT_GRADE_BONUS', 'DEF_GRADE_BONUS', 'MAGIC_ATT_GRADE', 'MAGIC_DEF_GRADE', 'CURSE_PCT', 'MAX_STAMINA', 'ATTBONUS_WARRIOR', 'ATTBONUS_ASSASSIN', 'ATTBONUS_SURA', 'ATTBONUS_SHAMAN', 'ATTBONUS_MONSTER', 'MALL_ATTBONUS', 'MALL_DEFBONUS', 'MALL_EXPBONUS', 'MALL_ITEMBONUS', 'MALL_GOLDBONUS', 'MAX_HP_PCT', 'MAX_SP_PCT', 'SKILL_DAMAGE_BONUS', 'NORMAL_HIT_DAMAGE_BONUS', 'SKILL_DEFEND_BONUS', 'NORMAL_HIT_DEFEND_BONUS', 'PC_BANG_EXP_BONUS', 'PC_BANG_DROP_BONUS', 'EXTRACT_HP_PCT', 'RESIST_WARRIOR', 'RESIST_ASSASSIN', 'RESIST_SURA', 'RESIST_SHAMAN', 'ENERGY', 'DEF_GRADE', 'COSTUME_ATTR_BONUS', 'MAGIC_ATTBONUS_PER', 'MELEE_MAGIC_ATTBONUS_PER', 'RESIST_ICE', 'RESIST_EARTH', 'RESIST_DARK', 'ANTI_CRITICAL_PCT', 'ANTI_PENETRATE_PCT'])->default('MAX_HP');
$table->string('prob', 100)->default('');
$table->string('lv1', 100)->default('');
$table->string('lv2', 100)->default('');
$table->string('lv3', 100)->default('');
$table->string('lv4', 100)->default('');
$table->string('lv5', 100)->default('');
$table->string('weapon', 100)->default('');
$table->string('body', 100)->default('');
$table->string('wrist', 100)->default('');
$table->string('foots', 100)->default('');
$table->string('neck', 100)->default('');
$table->string('head', 100)->default('');
$table->string('shield', 100)->default('');
$table->string('ear', 100)->default('');
$table->string('prob', 100);
$table->string('lv1', 100);
$table->string('lv2', 100);
$table->string('lv3', 100);
$table->string('lv4', 100);
$table->string('lv5', 100);
$table->string('weapon', 100);
$table->string('body', 100);
$table->string('wrist', 100);
$table->string('foots', 100);
$table->string('neck', 100);
$table->string('head', 100);
$table->string('shield', 100);
$table->string('ear', 100);
});
// Populate the table data
@ -44,6 +44,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('item_attr');
Schema::dropIfExists('item_attr');
}
};

View File

@ -13,13 +13,13 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('item_award', function (Blueprint $table) {
$table->integer('id', true);
$table->unsignedInteger('pid')->default(0)->index('pid_idx');
$table->string('login', 30)->default('');
$table->unsignedInteger('vnum')->default(0);
$table->unsignedInteger('count')->default(0);
$table->dateTime('given_time')->default('0000-00-00 00:00:00')->index('given_time_idx');
Schema::create('item_award', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->unsignedInteger('pid');
$table->string('login', 30);
$table->unsignedInteger('vnum');
$table->unsignedInteger('count');
$table->dateTime('given_time')->useCurrent()->index('given_time_idx');
$table->dateTime('taken_time')->nullable()->index('taken_time_idx');
$table->integer('item_id')->nullable();
$table->string('why', 128)->nullable();
@ -27,6 +27,9 @@ return new class extends Migration
$table->integer('socket1')->default(0);
$table->integer('socket2')->default(0);
$table->boolean('mall')->default(false);
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('login')->references('login')->on('account');
});
}
@ -37,6 +40,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('item_award');
Schema::dropIfExists('item_award');
}
};

View File

@ -13,10 +13,10 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('item_proto', function (Blueprint $table) {
$table->unsignedInteger('vnum')->default(0)->primary();
$table->binary('name', length: 24)->default('Noname');
$table->binary('locale_name', length: 24)->default('Noname');
Schema::create('item_proto', function (Blueprint $table) {
$table->unsignedInteger('vnum')->primary();
$table->varchar('name', length: 255)->default('Noname');
$table->varchar('locale_name', length: 255)->default('Noname');
$table->tinyInteger('type')->default(0);
$table->tinyInteger('subtype')->default(0);
$table->tinyInteger('weight')->nullable()->default(0);
@ -55,7 +55,7 @@ return new class extends Migration
$table->tinyInteger('socket5')->nullable()->default(-1);
$table->tinyInteger('specular')->default(0);
$table->tinyInteger('socket_pct')->default(0);
$table->smallInteger('addon_type')->default(0);
$table->unsignedSmallInteger('addon_type')->default(0);
});
}
@ -66,6 +66,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('item_proto');
Schema::dropIfExists('item_proto');
}
};

View File

@ -13,9 +13,9 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('item', function (Blueprint $table) {
Schema::create('item', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('owner_id')->default(0)->index('owner_id_idx');
$table->unsignedInteger('owner_id')->index('owner_id_idx');
$table->enum('window', ['INVENTORY', 'EQUIPMENT', 'SAFEBOX', 'MALL', 'DRAGON_SOUL_INVENTORY', 'BELT_INVENTORY'])->default('INVENTORY');
$table->unsignedSmallInteger('pos')->default(0);
$table->unsignedTinyInteger('count')->default(0);
@ -50,6 +50,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('item');
Schema::dropIfExists('item');
}
};

View File

@ -14,17 +14,19 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('land', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('map_index')->default(0);
$table->integer('x')->default(0);
$table->integer('y')->default(0);
$table->integer('width')->default(0);
$table->integer('height')->default(0);
$table->unsignedInteger('guild_id')->default(0);
$table->tinyInteger('guild_level_limit')->default(0);
Schema::create('land', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->integer('map_index');
$table->integer('x');
$table->integer('y');
$table->integer('width');
$table->integer('height');
$table->unsignedInteger('guild_id')->nullable();
$table->tinyInteger('guild_level_limit');
$table->unsignedInteger('price')->default(0);
$table->enum('enable', ['YES', 'NO'])->default('NO');
$table->foreign('guild_id')->references('id')->on('guild')->cascadeOnDelete();
});
// Populate the table data
@ -39,6 +41,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('land');
Schema::dropIfExists('land');
}
};

View File

@ -13,15 +13,17 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('levellog', function (Blueprint $table) {
Schema::create('levellog', function (Blueprint $table) {
$table->char('name', 24)->default('');
$table->tinyInteger('level')->default(0);
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->dateTime('time')->useCurrent();
$table->integer('playtime')->default(0);
$table->integer('account_id');
$table->integer('pid');
$table->unsignedInteger('account_id');
$table->unsignedInteger('pid');
$table->primary(['name', 'level']);
$table->foreign('account_id')->references('id')->on('account');
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -32,6 +34,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('levellog');
Schema::dropIfExists('levellog');
}
};

View File

@ -14,9 +14,9 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('common')->create('locale', function (Blueprint $table) {
$table->string('mKey')->default('')->primary();
$table->string('mValue')->default('');
Schema::create('locale', function (Blueprint $table) {
$table->string('mKey')->primary();
$table->string('mValue');
});
// Populate the table data
@ -31,6 +31,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('common')->dropIfExists('locale');
Schema::dropIfExists('locale');
}
};

View File

@ -13,9 +13,9 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('log', function (Blueprint $table) {
Schema::create('log', function (Blueprint $table) {
$table->enum('type', ['ITEM', 'CHARACTER'])->default('ITEM');
$table->dateTime('time')->default('0000-00-00 00:00:00');
$table->dateTime('time')->useCurrent();
$table->unsignedInteger('who')->default(0)->index('who_idx');
$table->unsignedInteger('x')->default(0);
$table->unsignedInteger('y')->default(0);
@ -34,6 +34,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('log');
Schema::dropIfExists('log');
}
};

View File

@ -13,18 +13,22 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('loginlog2', function (Blueprint $table) {
$table->integer('id', true);
// TODO Check if this is useless, doesn't seem to be getting used at all
Schema::create('loginlog', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->text('type')->nullable();
$table->integer('is_gm')->nullable();
$table->boolean('is_gm')->default(false);
$table->dateTime('login_time')->nullable();
$table->integer('channel')->nullable();
$table->integer('account_id')->nullable();
$table->integer('pid')->nullable();
$table->unsignedInteger('account_id')->nullable();
$table->unsignedInteger('pid')->nullable();
$table->text('client_version')->nullable();
$table->text('ip')->nullable();
$table->dateTime('logout_time')->nullable();
$table->integer('playtime')->default(0);
$table->foreign('account_id')->references('id')->on('account');
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -35,6 +39,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('loginlog2');
Schema::dropIfExists('loginlog2');
}
};

View File

@ -13,11 +13,13 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('lotto_list', function (Blueprint $table) {
$table->increments('id');
Schema::create('lotto_list', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->string('server', 20)->nullable();
$table->unsignedInteger('pid')->nullable();
$table->dateTime('time')->nullable();
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -28,6 +30,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('lotto_list');
Schema::dropIfExists('lotto_list');
}
};

View File

@ -12,8 +12,8 @@ return new class extends Migration
*/
public function up(): void
{
Schema::connection('website')->create('mall_categories', function (Blueprint $table) {
$table->integer('id', true);
Schema::create('mall_categories', function (Blueprint $table) {
$table->id();
$table->text('name');
});
@ -27,6 +27,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::connection('website')->dropIfExists('mall_categories');
Schema::dropIfExists('mall_categories');
}
};

View File

@ -11,8 +11,8 @@ return new class extends Migration
*/
public function up(): void
{
Schema::connection('website')->create('mall_data', function (Blueprint $table) {
$table->unsignedInteger('vnum')->default(0)->primary();
Schema::create('mall_data', function (Blueprint $table) {
$table->unsignedInteger('vnum')->primary();
$table->unsignedInteger('socket0')->default(0);
$table->unsignedInteger('socket1')->default(0);
$table->unsignedInteger('socket2')->default(0);
@ -27,6 +27,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::connection('website')->dropIfExists('mall_data');
Schema::dropIfExists('mall_data');
}
};

View File

@ -12,10 +12,10 @@ return new class extends Migration
*/
public function up(): void
{
Schema::connection('website')->create('mall_items', function (Blueprint $table) {
$table->integer('id', true);
Schema::create('mall_items', function (Blueprint $table) {
$table->id();
$table->integer('vnum');
$table->integer('category_id');
$table->unsignedBigInteger('category_id');
$table->integer('old_price')->nullable();
$table->integer('price');
$table->enum('pricing', ['CASH', 'MILEAGE'])->default('CASH');
@ -23,6 +23,8 @@ return new class extends Migration
$table->text('image')->nullable();
$table->text('description')->nullable();
$table->enum('other', ['recommend', 'recommend_desc'])->nullable();
$table->foreign('category_id')->references('id')->on('mall_categories');
});
// Populate the table data
@ -35,6 +37,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::connection('website')->dropIfExists('mall_items');
Schema::dropIfExists('mall_items');
}
};

View File

@ -11,11 +11,11 @@ return new class extends Migration
*/
public function up(): void
{
Schema::connection('website')->create('mall_storage', function (Blueprint $table) {
$table->bigInteger('id', true);
$table->unsignedInteger('owner_id')->default(0)->index('owner_id_idx');
$table->unsignedTinyInteger('count')->default(0);
$table->unsignedInteger('vnum')->default(0)->index('item_vnum_index');
Schema::create('mall_storage', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('owner_id')->index('owner_id_idx');
$table->unsignedTinyInteger('count')->default(1);
$table->unsignedInteger('vnum')->index('item_vnum_index');
$table->unsignedInteger('socket0')->default(0);
$table->unsignedInteger('socket1')->default(0);
$table->unsignedInteger('socket2')->default(0);
@ -44,6 +44,6 @@ return new class extends Migration
*/
public function down(): void
{
Schema::connection('website')->dropIfExists('mall_storage');
Schema::dropIfExists('mall_storage');
}
};

View File

@ -13,14 +13,16 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('marriage', function (Blueprint $table) {
$table->tinyInteger('is_married')->default(0);
$table->unsignedInteger('pid1')->default(0);
$table->unsignedInteger('pid2')->default(0);
Schema::create('marriage', function (Blueprint $table) {
$table->boolean('is_married')->default(false);
$table->unsignedInteger('pid1');
$table->unsignedInteger('pid2');
$table->unsignedInteger('love_point')->nullable();
$table->unsignedInteger('time')->default(0);
$table->unsignedInteger('time');
$table->primary(['pid1', 'pid2']);
$table->foreign('pid1')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('pid2')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -31,6 +33,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('marriage');
Schema::dropIfExists('marriage');
}
};

View File

@ -13,11 +13,13 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('messenger_list', function (Blueprint $table) {
$table->string('account', 16)->default('');
$table->string('companion', 16)->default('');
Schema::create('messenger_list', function (Blueprint $table) {
$table->string('account', 24);
$table->string('companion', 24);
$table->primary(['account', 'companion']);
$table->foreign('account')->references('name')->on('player')->cascadeOnDelete()->cascadeOnUpdate();
$table->foreign('companion')->references('name')->on('player')->cascadeOnDelete()->cascadeOnUpdate();
});
}
@ -28,6 +30,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('messenger_list');
Schema::dropIfExists('messenger_list');
}
};

View File

@ -13,10 +13,10 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('mob_proto', function (Blueprint $table) {
$table->integer('vnum')->default(0)->primary();
$table->binary('name', length: 24)->default('Noname');
$table->binary('locale_name', length: 24)->default('Noname');
Schema::create('mob_proto', function (Blueprint $table) {
$table->integer('vnum')->primary();
$table->varchar('name', length: 255)->default('Noname');
$table->varchar('locale_name', length: 255)->default('Noname');
$table->tinyInteger('rank')->default(0);
$table->tinyInteger('type')->default(0);
$table->boolean('battle_type')->default(false);
@ -96,6 +96,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('mob_proto');
Schema::dropIfExists('mob_proto');
}
};

View File

@ -13,11 +13,14 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('monarch_candidacy', function (Blueprint $table) {
$table->unsignedInteger('pid')->default(0)->primary();
$table->dateTime('date')->nullable()->default('0000-00-00 00:00:00');
Schema::create('monarch_candidacy', function (Blueprint $table) {
$table->unsignedInteger('pid');
$table->dateTime('date')->useCurrent();
// TODO Check if these two below are ever used
$table->string('name', 16)->nullable();
$table->dateTime('windate')->nullable();
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -28,6 +31,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('monarch_candidacy');
Schema::dropIfExists('monarch_candidacy');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('monarch_election', function (Blueprint $table) {
$table->unsignedInteger('pid');
$table->unsignedInteger('selectedpid');
$table->dateTime('electiondata')->useCurrent();
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('selectedpid')->references('id')->on('player')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('monarch_election');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('monarch', function (Blueprint $table) {
$table->unsignedInteger('empire')->primary();
$table->unsignedInteger('pid');
$table->dateTime('windate');
$table->unsignedBigInteger('money');
$table->foreign('pid')->references('id')->on('player')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('monarch');
}
};

View File

@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('money_log', function (Blueprint $table) {
Schema::create('money_log', function (Blueprint $table) {
$table->dateTime('time')->nullable();
$table->enum('type', ['MONSTER', 'SHOP', 'REFINE', 'QUEST', 'GUILD', 'MISC', 'KILL', 'DROP'])->nullable();
$table->integer('vnum')->default(0);
@ -30,6 +30,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('money_log');
Schema::dropIfExists('money_log');
}
};

View File

@ -13,12 +13,13 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('myshop_pricelist', function (Blueprint $table) {
$table->unsignedInteger('owner_id')->default(0);
$table->unsignedInteger('item_vnum')->default(0);
$table->unsignedInteger('price')->default(0);
Schema::create('myshop_pricelist', function (Blueprint $table) {
$table->unsignedInteger('owner_id');
$table->unsignedInteger('item_vnum');
$table->unsignedInteger('price');
$table->unique(['owner_id', 'item_vnum'], 'list_id');
$table->foreign('owner_id')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -29,6 +30,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('myshop_pricelist');
Schema::dropIfExists('myshop_pricelist');
}
};

View File

@ -14,11 +14,11 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('object_proto', function (Blueprint $table) {
$table->unsignedInteger('vnum')->default(0)->primary();
$table->string('name', 32)->default('');
$table->unsignedInteger('price')->default(0);
$table->string('materials', 64)->default('');
Schema::create('object_proto', function (Blueprint $table) {
$table->unsignedInteger('vnum')->primary();
$table->string('name', 32);
$table->unsignedInteger('price');
$table->string('materials', 64);
$table->unsignedInteger('upgrade_vnum')->default(0);
$table->unsignedInteger('upgrade_limit_time')->default(0);
$table->integer('life')->default(0);
@ -27,6 +27,7 @@ return new class extends Migration
$table->integer('reg_3')->default(0);
$table->integer('reg_4')->default(0);
$table->unsignedInteger('npc')->default(0);
// TODO Check the items below as they might be indexeable
$table->unsignedInteger('group_vnum')->default(0);
$table->unsignedInteger('dependent_group')->default(0);
});
@ -43,6 +44,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('object_proto');
Schema::dropIfExists('object_proto');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('object', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->unsignedInteger('land_id');
$table->unsignedInteger('vnum');
$table->integer('map_index');
$table->integer('x');
$table->integer('y');
$table->float('x_rot', null, 0);
$table->float('y_rot', null, 0);
$table->float('z_rot', null, 0);
$table->integer('life')->default(0);
$table->foreign('land_id')->references('id')->on('land')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('object');
}
};

View File

@ -13,10 +13,10 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('player_deleted', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('account_id')->default(0)->index('account_id_idx');
$table->string('name', 24)->default('NONAME')->index('name_idx');
Schema::create('player_deleted', function (Blueprint $table) {
$table->unsignedInteger('id', true)->primary();
$table->unsignedInteger('account_id');
$table->string('name', 24)->default('Noname')->index('name_idx');
$table->unsignedTinyInteger('job')->default(0);
$table->boolean('voice')->unsigned()->default(false);
$table->tinyInteger('dir')->default(0);
@ -51,7 +51,7 @@ return new class extends Migration
$table->tinyInteger('skill_group')->default(0);
$table->binary('skill_level')->nullable();
$table->integer('alignment')->default(0);
$table->dateTime('last_play')->default('0000-00-00 00:00:00');
$table->dateTime('last_play')->useCurrent();
$table->boolean('change_name')->default(false);
$table->smallInteger('sub_skill_point')->default(0);
$table->tinyInteger('stat_reset_count')->default(0);
@ -62,6 +62,8 @@ return new class extends Migration
$table->boolean('horse_riding')->default(false);
$table->smallInteger('horse_skill_point')->default(0);
$table->integer('bank_value')->nullable()->default(0);
$table->foreign('account_id')->references('id')->on('account');
});
}
@ -72,6 +74,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('player_deleted');
Schema::dropIfExists('player_deleted');
}
};

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('player_index', function (Blueprint $table) {
$table->unsignedInteger('id');
$table->unsignedInteger('pid1')->nullable();
$table->unsignedInteger('pid2')->nullable();
$table->unsignedInteger('pid3')->nullable();
$table->unsignedInteger('pid4')->nullable();
$table->tinyInteger('empire')->default(0);
$table->foreign('id')->references('id')->on('account');
$table->foreign('pid1')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('pid2')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('pid3')->references('id')->on('player')->cascadeOnDelete();
$table->foreign('pid4')->references('id')->on('player')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('player_index');
}
};

View File

@ -13,14 +13,16 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('log')->create('quest_reward_log', function (Blueprint $table) {
Schema::create('quest_reward_log', function (Blueprint $table) {
$table->string('quest_name', 32)->nullable();
$table->unsignedInteger('player_id')->nullable()->index('player_id');
$table->tinyInteger('player_level')->nullable();
$table->unsignedInteger('player_id');
$table->tinyInteger('player_level');
$table->enum('reward_type', ['EXP', 'ITEM'])->nullable();
$table->unsignedInteger('reward_value1')->nullable();
$table->integer('reward_value2')->nullable();
$table->unsignedInteger('reward_value1');
$table->integer('reward_value2');
$table->dateTime('time')->nullable();
$table->foreign('player_id')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -31,6 +33,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('log')->dropIfExists('quest_reward_log');
Schema::dropIfExists('quest_reward_log');
}
};

View File

@ -13,13 +13,14 @@ return new class extends Migration
*/
public function up()
{
Schema::connection('player')->create('quest', function (Blueprint $table) {
$table->unsignedInteger('dwPID')->default(0)->index('pid_idx');
$table->string('szName', 32)->default('')->index('name_idx');
Schema::create('quest', function (Blueprint $table) {
$table->unsignedInteger('dwPID')->nullable();
$table->string('szName', 32)->index('name_idx');
$table->string('szState', 64)->default('')->index('state_idx');
$table->integer('lValue')->default(0);
$table->primary(['dwPID', 'szName', 'szState']);
$table->index(['dwPID', 'szName', 'szState']);
$table->foreign('dwPID')->references('id')->on('player')->cascadeOnDelete();
});
}
@ -30,6 +31,6 @@ return new class extends Migration
*/
public function down()
{
Schema::connection('player')->dropIfExists('quest');
Schema::dropIfExists('quest');
}
};

Some files were not shown because too many files have changed in this diff Show More