mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 09:39:11 +00:00
feat(Core/Modules): Preparation to implement progression-system module. (#8837)
This commit is contained in:
@@ -1453,7 +1453,20 @@ public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
|
||||
virtual void OnHandleDevCommand(Player* /*player*/, std::string& /*argstr*/) { }
|
||||
virtual void OnHandleDevCommand(Player* /*player*/, std::string& /*argstr*/) { }
|
||||
};
|
||||
|
||||
class DatabaseScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
DatabaseScript(const char* name);
|
||||
|
||||
public:
|
||||
|
||||
bool IsDatabaseBound() const { return false; }
|
||||
|
||||
virtual void OnAfterDatabasesLoaded(uint32 /*updateFlags*/) {}
|
||||
};
|
||||
|
||||
// Manages registration, loading, and execution of scripts.
|
||||
@@ -1938,6 +1951,10 @@ public: /* AchievementScript */
|
||||
|
||||
void OnHandleDevCommand(Player* player, std::string& argstr);
|
||||
|
||||
public: /* DatabaseScript */
|
||||
|
||||
void OnAfterDatabasesLoaded(uint32 updateFlags);
|
||||
|
||||
private:
|
||||
uint32 _scriptCount;
|
||||
|
||||
@@ -2007,31 +2024,31 @@ public:
|
||||
if (id)
|
||||
{
|
||||
// Try to find an existing script.
|
||||
bool existing = false;
|
||||
TScript const* oldScript = nullptr;
|
||||
for (auto iterator = ScriptPointerList.begin(); iterator != ScriptPointerList.end(); ++iterator)
|
||||
{
|
||||
// If the script names match...
|
||||
if (iterator->second->GetName() == script->GetName())
|
||||
{
|
||||
// ... It exists.
|
||||
existing = true;
|
||||
oldScript = iterator->second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the script isn't assigned -> assign it!
|
||||
if (!existing)
|
||||
// If the script is already assigned -> delete it!
|
||||
if (oldScript)
|
||||
{
|
||||
ScriptPointerList[id] = script;
|
||||
sScriptMgr->IncrementScriptCount();
|
||||
delete oldScript;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the script is already assigned -> delete it!
|
||||
LOG_ERROR("scripts", "Script named '%s' is already assigned (two or more scripts have the same name), so the script can't work, aborting...",
|
||||
script->GetName().c_str());
|
||||
|
||||
ABORT(); // Error that should be fixed ASAP.
|
||||
// Assign new script!
|
||||
ScriptPointerList[id] = script;
|
||||
|
||||
// Increment script count only with new scripts
|
||||
if (!oldScript)
|
||||
{
|
||||
sScriptMgr->IncrementScriptCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user