mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Setup/Scripts
* restructure setup to allow for self contained setup steps to self register (just the sql for now) * should ease adding new scripts in future
This commit is contained in:
@@ -7,32 +7,35 @@ if (!CLI)
|
||||
die('not in cli mode');
|
||||
|
||||
|
||||
$customData = array(
|
||||
);
|
||||
$reqDBC = ['factiontemplate'];
|
||||
|
||||
function factiontemplate()
|
||||
SqlGen::register(new class extends SetupScript
|
||||
{
|
||||
$query = '
|
||||
REPLACE INTO
|
||||
?_factiontemplate
|
||||
SELECT
|
||||
id,
|
||||
factionId,
|
||||
IF(friendFactionId1 = 1 OR friendFactionId2 = 1 OR friendFactionId3 = 1 OR friendFactionId4 = 1 OR friendlyMask & 0x3,
|
||||
1,
|
||||
IF(enemyFactionId1 = 1 OR enemyFactionId2 = 1 OR enemyFactionId3 = 1 OR enemyFactionId4 = 1 OR hostileMask & 0x3, -1, 0)
|
||||
),
|
||||
IF(friendFactionId1 = 2 OR friendFactionId2 = 2 OR friendFactionId3 = 2 OR friendFactionId4 = 2 OR friendlyMask & 0x5,
|
||||
1,
|
||||
IF(enemyFactionId1 = 2 OR enemyFactionId2 = 2 OR enemyFactionId3 = 2 OR enemyFactionId4 = 2 OR hostileMask & 0x5, -1, 0)
|
||||
)
|
||||
FROM
|
||||
dbc_factiontemplate';
|
||||
protected $command = 'factiontemplate';
|
||||
|
||||
DB::Aowow()->query($query);
|
||||
protected $dbcSourceFiles = ['factiontemplate'];
|
||||
|
||||
return true;
|
||||
}
|
||||
public function generate(array $ids = []) : bool
|
||||
{
|
||||
$query = '
|
||||
REPLACE INTO
|
||||
?_factiontemplate
|
||||
SELECT
|
||||
id,
|
||||
factionId,
|
||||
IF(friendFactionId1 = 1 OR friendFactionId2 = 1 OR friendFactionId3 = 1 OR friendFactionId4 = 1 OR friendlyMask & 0x3,
|
||||
1,
|
||||
IF(enemyFactionId1 = 1 OR enemyFactionId2 = 1 OR enemyFactionId3 = 1 OR enemyFactionId4 = 1 OR hostileMask & 0x3, -1, 0)
|
||||
),
|
||||
IF(friendFactionId1 = 2 OR friendFactionId2 = 2 OR friendFactionId3 = 2 OR friendFactionId4 = 2 OR friendlyMask & 0x5,
|
||||
1,
|
||||
IF(enemyFactionId1 = 2 OR enemyFactionId2 = 2 OR enemyFactionId3 = 2 OR enemyFactionId4 = 2 OR hostileMask & 0x5, -1, 0)
|
||||
)
|
||||
FROM
|
||||
dbc_factiontemplate';
|
||||
|
||||
DB::Aowow()->query($query);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user