feat: add Configuration Option for limitrace (#13)

* Modified to allow for excluding certain spells from the module

* change of plans. let's load the spell ids from the config file instead, makes it a bit more versatile for others as well.

* Update mod_account_mount.cpp

* Update .gitignore

ignore .conf file, only commit .dist

* Update mod_account_mount.cpp

* Handle scenarios where no spell IDs are to be excluded

Modified the AccountMounts script to seamlessly handle scenarios where no spell IDs are to be excluded by interpreting "0" or an empty configuration string as no exclusion criteria. This update leverages the existing uint32 type for spell ID representation and enhances the script's flexibility in configuration management.

The change ensures that the AccountMounts script is more adaptable to server administrators' needs, allowing for a straightforward way to toggle spell ID exclusions.

Also added some code commenting

* fatal error: 'GetStringDefault' is deprecated

* add racial limit to config

* Create world_disable_racial_mounts_in_bg.sql

* include scriptmgr

* remove onlogin override

* OnLogin -> OnPlayerLogin

* delete project specific sql

---------

Co-authored-by: Walter Pagani <paganiwalter@gmail.com>
This commit is contained in:
blkht01
2025-03-18 15:52:26 +02:00
committed by GitHub
parent 5fa57ad590
commit 65ea80fb9e
2 changed files with 10 additions and 2 deletions

View File

@@ -16,3 +16,9 @@ Account.Mounts.Announce = 0
# Account.Mounts.ExcludedSpellIDs = 470,578,6777
Account.Mounts.ExcludedSpellIDs = 0
# Limit race and class specific mounts? (1: true | 0: false)
# 0 = will allow any race/class to own other racial/class-specific mounts.
# 1 = will enforce the limit.
Account.Mounts.LimitRace = 0

View File

@@ -8,7 +8,7 @@
class AccountMounts : public PlayerScript
{
static const bool limitrace = true; // This set to true will only learn mounts from chars on the same team, do what you want.
bool limitrace; // Boolean to hold limit race option
std::set<uint32> excludedSpellIds; // Set to hold the Spell IDs to be excluded
public:
@@ -16,6 +16,8 @@ public:
PLAYERHOOK_ON_LOGIN
})
{
// Retrieve limitrace option from the config file
limitrace = sConfigMgr->GetOption<bool>("Account.Mounts.LimitRace", false);
// Retrieve the string of excluded Spell IDs from the config file
std::string excludedSpellsStr = sConfigMgr->GetOption<std::string>("Account.Mounts.ExcludedSpellIDs", "");
// Proceed only if the configuration is not "0" or empty, indicating exclusions are specified