Files
azerothcore-wotlk/data/sql
Kitzunu 231096132c 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
2025-03-09 09:18:01 +01:00
..