Skip to content

Commit

Permalink
refactor: remove custom db loader, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sogladev committed Jan 11, 2025
1 parent 280d1a2 commit 7685bbc
Show file tree
Hide file tree
Showing 21 changed files with 21 additions and 194 deletions.
10 changes: 5 additions & 5 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If you encounter any issues or have suggestions, please post them as Github issu
* Restores no longer accessible NPCs, quests and items related to the original Naxxramas
* Restore flying Naxxramas in Plaguewood
* Enter from either Stratholme instance, through a teleporter located in Plaguewood near the original entrance or the original entrance with an optional patch
* Power level adjustments (WIP) to vanilla values
* Power level adjustments to vanilla values

![See Wiki for a summary of changes with pictures](https://github.com/sogladev/mod-vanilla-naxxramas/wiki/02-Summary-of-changes-with-pictures)

Expand All @@ -32,10 +32,10 @@ https://github.com/sogladev/mod-vanilla-naxxramas/assets/46423958/2b56a239-001a-

Some are due to being limited by 335a client. Some of these could be fixed by client-side patch

- [ ] When using `expansion=0`, players cannot enter the vanilla version of Naxxramas. See https://github.com/sogladev/mod-vanilla-naxxramas/issues/17
- [ ] Icons are different for some spells e.g. Mark of Mograine, Loatheb's Deathbloom
- [ ] Setting `Expansion = 2` in your `worldserver.conf` is required. Similarly, players must have an account with expansion set to 2. For details see https://github.com/sogladev/mod-vanilla-naxxramas/issues/17
- [ ] Plaguewood Entrance was replaced with a Cauldron. The original entrance can be reintroduced with optional/PlaguewoodHub
- [ ] Icons are different for some spells e.g. Mark of Mograine, Loatheb's Deathbloom
- [ ] Mechanics: Sapphiron's frost aura should tick every 1s instead of 2s, Blaumeux' Void Zone range should be 3yd instead of 2yd
- [ ] Plaguewood Entrance was replaced with a Cauldron
- [ ] Some models like Deathknight's use wrath death knight starter gear instead of the original armor set

Not all vanilla mechanics are yet implemented yet due to scripts being ported from Azerothcore's WOTLK Naxx
Expand All @@ -56,7 +56,7 @@ The same instance is used for both the vanilla, 10 and 25 man difficulties. This
## Module compatibility

[See Wiki for Module Compatibility](https://github.com/sogladev/mod-vanilla-naxxramas/wiki/06-Module-Compatibility#scaling-modules
)
)

## Acknowledgements
- [cmangos](https://github.com/cmangos), [vmangos](https://github.com/vmangos) for vanilla game data
Expand Down
32 changes: 0 additions & 32 deletions conf/conf.sh.dist

This file was deleted.

54 changes: 4 additions & 50 deletions conf/vanilla_naxxramas.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,6 @@

[worldserver]

#
# VanillaNaxxramas.Enable
# Description: Enable Vanilla Naxxramas Module
# Please note that like all AzerothCore modules, database changes cannot be undone through config settings.
# This means that world changes like restoring Vanilla quests and NPC stats will remain in place even if disabled.
# Disabling the module will disable functionality like access restrictions, level caps, damage adjustments, etc.
# Default: 1 - Enabled
# 0 - Disabled
#

VanillaNaxxramas.Enable = 1

#
# VanillaNaxxramas.LoadScripts
# Description: Enable loading scripts
# Default: 1 - Enabled
# 0 - Disabled
#

VanillaNaxxramas.LoadScripts = 1

#
# VanillaNaxxramas.LoadDatabase
# Description: Enable loading SQL files
# Default: 1 - Enabled
# 0 - Disabled
#

VanillaNaxxramas.LoadDatabase = 1

#
# VanillaNaxxramas.ReapplyUpdates
# Description: Always reapply every SQL file on start up. Warning: impacts start up times.
# Default: 0 - Disabled
# 1 - Enabled (Recommended for development)
#

VanillaNaxxramas.ReapplyUpdates = 0

#
# VanillaNaxxramas.X
# Description: Defines if the phase should be loaded being 0 not loaded, 1 loaded.
# Default: 0 - Not loaded.
# VanillaNaxxramas.ScourgeEvent (NOT IMPLEMENTED)
#

VanillaNaxxramas.ScourgeEvent = 0
VanillaNaxxramas.Naxxramas = 1

#
# VanillaNaxxramas.Naxxramas.RequireNaxxStrathEntrance
# Description: Requires Players to first enter through Stratholme entrance
Expand All @@ -66,8 +17,11 @@ VanillaNaxxramas.Naxxramas.RequireNaxxStrathEntrance = 1
#
# VanillaNaxxramas.Naxxramas.RequireAttunement
# Description: Requires Players to complete the attunement quests from Light's Hope Chapel
# Note that disabling this requirement does not remove the quest requirement
# for Echoes Of War (kill quest) which is a requirement for other quests.
# See database query in optional/SkipAttunement
# Default: 1 - Enabled
# 0 - Disabled
# 0 - Disabled (Requires optional/SkipAttunement DB changes to work as expected)
#

VanillaNaxxramas.Naxxramas.RequireAttunement = 1
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
-- Warning: .ReapplyUpdates = 0 must be disabled (=0) in the .conf
-- or this will have no effect
-- Warning: Scaling may have already been applied in the naxx40_creatures.sql
-- Warning: Only run this once after applying naxx40*sql scripts
--
-- Warning: Scaling has already been applied in the naxx40_creatures.sql
-- Warning: Only run this once
SET @DAMAGE_MULTIPLIER:= 0.80;
SET @HEALTH_MULTIPLIER:= 1.00;
SET @ARMOR_MULTIPLIER:= 1.00;
Expand Down
3 changes: 2 additions & 1 deletion optional/PlaguewoodHub/naxx40_plaguewood_hub.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--
-- Add invisible teleport trigger NPC to plaguewood naxx entrance
DELETE FROM `creature` WHERE `guid` = 352043;
DELETE FROM `creature` WHERE `guid` = 352043 and `id`=351097;
INSERT INTO `creature` (`guid`, `id1`, `id2`, `id3`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES
(352043, 351097, 0, 0, 0, 139, 2277, 1, 1, 0, 3132.8572, -3731.2629, 138.622925, 4.71395, 300, 0, 0, 6986, 0, 0, 0, 0, 0, '', 0);

Expand Down
5 changes: 3 additions & 2 deletions optional/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Optional files
* `PlaguewoodHub` contains a map edit to restore the original Plaguewood teleporter hub

* `SkipAttunement` contains DB changes that are needed when disabling attunement requirement `Naxxramas.RequireAttunement=0`
* `DamageHealthArmorModifierScaling` contains a single query to apply additonal scaling to all Naxx40 creatures

## PlaguewoodHub
this folder contains:
Expand Down Expand Up @@ -43,5 +44,5 @@ config option
```
VanillaNaxxramas.Naxxramas.RequireAttunement = 0
```
recommended database changes:
required database changes:
`naxx40_skip_attunement.sql` Removes attunement requirement for Echoes of War (kill quest) which is a requirement for T3 quests and some other quests
2 changes: 0 additions & 2 deletions optional/SkipAttunement/naxx40_skip_attunement.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
--
-- Warning: .ReapplyUpdates = 0 must be disabled (=0) in the .conf
-- or this will have no effect
-- Remove PrevQuestID for Echoes of War (kill quest) which is a requirement for T3 quests
-- Disable attunement quest completion before being able to pickup Echoes of War
UPDATE `quest_template_addon` SET `PrevQuestID` = 0 WHERE (`ID` = 9033);
Expand Down
2 changes: 0 additions & 2 deletions src/Naxxramas/Naxxramas_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ void AddSC_custom_gameobjects_40();

void AddNaxxramas_Scripts()
{
if (!(sConfigMgr->GetOption<bool>("VanillaNaxxramas.Naxxramas", false)))
return;
AddSC_npc_omarion_40();
AddSC_instance_naxxramas_combined();
AddSC_boss_anubrekhan_40();
Expand Down
6 changes: 2 additions & 4 deletions src/ScourgeEvent/ScourgeEvent_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
*/

#include "VanillaNaxxramas.h"
// #include "VanillaNaxxramas.h"

// void AddSC_scourge_event();

void AddScourgeEvent_Scripts()
{
if (!(sConfigMgr->GetOption<bool>("VanillaNaxxramas.ScourgeEvent", false)))
return;
// AddSC_scourge_event_tuning();
// AddSC_scourge_event();
}
88 changes: 2 additions & 86 deletions src/VanillaNaxxramas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,6 @@
*/

#include "VanillaNaxxramas.h"
#include "DBUpdater.h"

inline std::vector<std::string> GetDatabaseDirectories(std::string const& folderName)
{
std::vector<std::string> directories;

std::string const path = "/modules/mod-vanilla-naxxramas/src/";
for (std::string const& bracketName : NaxxramasPhasesNames)
{
if (!(sConfigMgr->GetOption<bool>("VanillaNaxxramas." + bracketName, false)))
{
continue;
}

std::string bracketPath = path + bracketName + "/sql/" + folderName;
directories.push_back(std::move(bracketPath));
}

return directories;
}

class VanillaNaxxramasLoadingDBUpdates : public DatabaseScript
{
public:
VanillaNaxxramasLoadingDBUpdates() : DatabaseScript("VanillaNaxxramasLoadingDBUpdates") {}

void OnAfterDatabasesLoaded(uint32 updateFlags) override
{
LOG_INFO("server.server", "Loading mod-vanilla-naxxramas updates...");

if (DBUpdater<LoginDatabaseConnection>::IsEnabled(updateFlags))
{
if (sConfigMgr->GetOption<bool>("VanillaNaxxramas.ReapplyUpdates", false))
{
LoginDatabase.Query("DELETE FROM updates WHERE name LIKE '%naxx40%'");
}

std::vector<std::string> loginDatabaseDirectories = GetDatabaseDirectories("auth");
if (!loginDatabaseDirectories.empty())
{
DBUpdater<LoginDatabaseConnection>::Update(LoginDatabase, &loginDatabaseDirectories);
}
}

if (DBUpdater<CharacterDatabaseConnection>::IsEnabled(updateFlags))
{
if (sConfigMgr->GetOption<bool>("VanillaNaxxramas.ReapplyUpdates", false))
{
CharacterDatabase.Query("DELETE FROM updates WHERE name LIKE '%naxx40%'");
}

std::vector<std::string> charactersDatabaseDirectories = GetDatabaseDirectories("characters");
if (!charactersDatabaseDirectories.empty())
{
DBUpdater<CharacterDatabaseConnection>::Update(CharacterDatabase, &charactersDatabaseDirectories);
}
}

if (DBUpdater<WorldDatabaseConnection>::IsEnabled(updateFlags))
{
if (sConfigMgr->GetOption<bool>("VanillaNaxxramas.ReapplyUpdates", false))
{
WorldDatabase.Query("DELETE FROM updates WHERE name LIKE '%naxx40%'");
}

std::vector<std::string> worldDatabaseDirectories = GetDatabaseDirectories("world");
if (!worldDatabaseDirectories.empty())
{
DBUpdater<WorldDatabaseConnection>::Update(WorldDatabase, &worldDatabaseDirectories);
}
}
}
};

VanillaNaxxramas* VanillaNaxxramas::instance()
{
Expand All @@ -85,28 +12,17 @@ VanillaNaxxramas* VanillaNaxxramas::instance()

class VanillaNaxxramas_WorldScript : public WorldScript
{
private:
static void LoadConfig()
{
sVanillaNaxxramas->enabled = sConfigMgr->GetOption<bool>("VanillaNaxxramas.Enable", true);
sVanillaNaxxramas->requireAttunement = sConfigMgr->GetOption<bool>("VanillaNaxxramas.Naxxramas.RequireAttunement", true);
sVanillaNaxxramas->requireNaxxStrath = sConfigMgr->GetOption<bool>("VanillaNaxxramas.Naxxramas.RequireNaxxStrathEntrance", true);
}

public:
VanillaNaxxramas_WorldScript() : WorldScript("VanillaNaxxramas_WorldScript") { }

void OnBeforeConfigLoad(bool /*reload*/) override
{
LoadConfig();
sVanillaNaxxramas->requireAttunement = sConfigMgr->GetOption<bool>("VanillaNaxxramas.Naxxramas.RequireAttunement", true);
sVanillaNaxxramas->requireNaxxStrath = sConfigMgr->GetOption<bool>("VanillaNaxxramas.Naxxramas.RequireNaxxStrathEntrance", true);
}
};

void AddVanillaNaxxramasScripts()
{
if (sConfigMgr->GetOption<bool>("VanillaNaxxramas.LoadDatabase", true))
{
new VanillaNaxxramasLoadingDBUpdates();
}
new VanillaNaxxramas_WorldScript();
}
6 changes: 0 additions & 6 deletions src/VanillaNaxxramas_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
*/

#include "Config.h"

void AddVanillaNaxxramasScripts();
void AddNaxxramas_Scripts();
void AddScourgeEvent_Scripts();

void Addmod_vanilla_naxxramasScripts()
{
AddVanillaNaxxramasScripts();

if (!sConfigMgr->GetOption<bool>("VanillaNaxxramas.LoadScripts", true))
return;

AddNaxxramas_Scripts();
AddScourgeEvent_Scripts();
}

0 comments on commit 7685bbc

Please sign in to comment.