Skip to content

Commit

Permalink
fix: suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed Aug 22, 2024
1 parent 3b68245 commit b7c6568
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config.lua.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ toggleMaintainMode = false
maintainModeMessage = ""

-- Combat settings
-- NOTE: World id is 1 as default, new worlds must have different ids always greater than 1
-- NOTE: valid values for worldType are: "pvp", "no-pvp" and "pvp-enforced"
-- NOTE: removeBeginningWeaponAmmunition: spears, arrows, bolt have endless ammo (allows training for paladins)
-- NOTE: refundManaOnBeginningWeapons: wand of vortex and snakebite refund mana used (allows training for mages)
-- NOTE: World id is 1 as default, new worlds must have different ids.
worldId = 1
worldType = "pvp"
hotkeyAimbotEnabled = true
Expand Down
2 changes: 2 additions & 0 deletions data-otservbr-global/migrations/46.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function onUpdateDatabase()
]])

db.query("ALTER TABLE `server_config` ADD `worldId` int(3) UNSIGNED NOT NULL DEFAULT 1;")
db.query("ALTER TABLE `server_config` DROP PRIMARY KEY;")
db.query("ALTER TABLE `server_config` ADD PRIMARY KEY (`id`, `worldId`);")
db.query("ALTER TABLE `server_config` ADD FOREIGN KEY (`worldId`) REFERENCES `worlds` (`id`) ON DELETE CASCADE;")

db.query("ALTER TABLE `players_online` ADD `worldId` int(3) UNSIGNED NOT NULL DEFAULT 1;")
Expand Down
2 changes: 1 addition & 1 deletion src/database/databasemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool DatabaseManager::isDatabaseSetup() {
int32_t DatabaseManager::getDatabaseVersion() {
if (!tableExists("server_config")) {
Database &db = Database::getInstance();
db.executeQuery("CREATE TABLE `server_config` (`worldId` INT(11) NOT NULL DEFAULT '0', `config` VARCHAR(50) NOT NULL, `value` VARCHAR(256) NOT NULL DEFAULT '', UNIQUE(`config`)) ENGINE = InnoDB");
db.executeQuery("CREATE TABLE `server_config` (`config` VARCHAR(50) NOT NULL, `value` VARCHAR(256) NOT NULL DEFAULT '', `worldId` INT(11) NOT NULL DEFAULT '1', UNIQUE(`config`, `worldId`)) ENGINE = InnoDB");
db.executeQuery(fmt::format("INSERT INTO `server_config` (`config`, `value`) VALUES ('db_version', 0)"));
return 0;
}
Expand Down

0 comments on commit b7c6568

Please sign in to comment.