forked from corowne/lorekeeper
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add guaranteed (pity) loot drops to tables
- Loading branch information
1 parent
c645eb8
commit f1bb2c7
Showing
9 changed files
with
246 additions
and
7 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,50 @@ | ||
<?php | ||
|
||
namespace App\Models\User; | ||
|
||
use App\Models\Model; | ||
|
||
class UserLootDropProgress extends Model { | ||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'user_id', 'loot_table_id', 'rolls' | ||
]; | ||
|
||
/** | ||
* The table associated with the model. | ||
* | ||
* @var string | ||
*/ | ||
protected $table = 'user_loot_drop_progress'; | ||
|
||
/** | ||
* The primary key of the model. | ||
* | ||
* @var string | ||
*/ | ||
public $primaryKey = 'user_id'; | ||
|
||
/********************************************************************************************** | ||
RELATIONS | ||
**********************************************************************************************/ | ||
|
||
/** | ||
* Get the user this set of progress belongs to. | ||
*/ | ||
public function user() { | ||
return $this->belongsTo('App\Models\User\User'); | ||
} | ||
|
||
/** | ||
* Get the loot table this progress belongs to. | ||
*/ | ||
public function lootTable() { | ||
return $this->belongsTo('App\Models\Loot\LootTable'); | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
database/migrations/2023_10_12_112308_add_guaranteed_loot_drops_tables.php
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,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::table('loots', function (Blueprint $table) { | ||
$table->boolean('is_guaranteed')->default(false); | ||
}); | ||
|
||
Schema::table('loot_tables', function (Blueprint $table) { | ||
$table->integer('rolls')->default(null)->nullable(); | ||
}); | ||
|
||
Schema::create('user_loot_drop_progress', function (Blueprint $table) { | ||
$table->id(); | ||
$table->integer('user_id'); | ||
$table->integer('loot_table_id'); | ||
$table->integer('rolls'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
// | ||
Schema::table('loots', function (Blueprint $table) { | ||
$table->dropColumn('is_guaranteed'); | ||
}); | ||
Schema::table('loot_tables', function (Blueprint $table) { | ||
$table->dropColumn('rolls'); | ||
}); | ||
Schema::dropIfExists('user_loot_drop_progress'); | ||
} | ||
}; |
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