refactor(Core/ServerMail): Refactor to Dedicated Manager Class with Multi-Item & Condition Support (#21590)
1. Core Cleanup
- Move all ServerMail logic from `ObjectMgr` into a new dedicated `ServerMailMgr` class
- Move faction logic for money from SendServerMail into the script
2. Separation of items into a new table
- Create a new `mail_server_template_items` table
- Allows to send multiple items in one mail
- Separate items per faction Alliance/Horde
3. Separation of conditions into a new table
- Create a new `mail_server_template_conditions` table
- Allows to use multiple conditions for one mail
- Available condition types
- Minimum playtime (playerLevel >= condition)
- Minimum playtime (playerPlayTime >= condition)
- Rewarded quest
- Earned achievement
- Earned reputation (playerReputation >= conditionState)
- Faction
- Race
- Class
4. Updated ServerMail loading
- Move item and condition loading to their own functions
- LoadMailServerTemplateItems()
- LoadMailServerTemplateConditions()
5. Reworked eligibility check
- Player needs to pass all conditions to be eligible for the mail
- All players are automatically eligible if no conditions exist for a server mail template.
6. Updated foreign keys
- For table `mail_server_character`, `mail_server_template_conditions`, `mail_server_template_items` foreign key with on delete cascade is added for automatic removal of entries if mail_server_template.id is deleted.
7. Database changes
- See the PR
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
#include "PoolMgr.h"
|
||||
#include "Realm.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ServerMailMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SkillExtraItems.h"
|
||||
#include "SmartAI.h"
|
||||
@@ -1667,8 +1668,8 @@ void World::SetInitialWorldSettings()
|
||||
LOG_INFO("server.loading", "Loading Player Level Dependent Mail Rewards...");
|
||||
sObjectMgr->LoadMailLevelRewards();
|
||||
|
||||
LOG_INFO("server.loading", "Load Mail Server Template...");
|
||||
sObjectMgr->LoadMailServerTemplates();
|
||||
LOG_INFO("server.loading", "Load Mail Server definitions...");
|
||||
sServerMailMgr->LoadMailServerTemplates();
|
||||
|
||||
// Loot tables
|
||||
LoadLootTables();
|
||||
|
||||
Reference in New Issue
Block a user