feat(Core/Instance): Add instance validation for creature scripts (#4596)

This commit is contained in:
Kitzunu
2021-04-05 15:34:26 +02:00
committed by GitHub
parent 60f865fce6
commit f9d708b450
371 changed files with 1315 additions and 767 deletions
+7 -1
View File
@@ -5288,7 +5288,7 @@ void ObjectMgr::ValidateSpellScripts()
bool valid = true;
if (!spellScript && !auraScript)
{
sLog->outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
sLog->outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second).c_str());
valid = false;
}
if (spellScript)
@@ -8849,6 +8849,12 @@ void ObjectMgr::LoadScriptNames()
sLog->outString();
}
std::string const& ObjectMgr::GetScriptName(uint32 id) const
{
static std::string const empty = "";
return (id < _scriptNamesStore.size()) ? _scriptNamesStore[id] : empty;
}
uint32 ObjectMgr::GetScriptId(const char* name)
{
// use binary search to find the script name in the sorted vector
+1 -1
View File
@@ -1299,7 +1299,7 @@ public:
void LoadScriptNames();
ScriptNameContainer& GetScriptNames() { return _scriptNamesStore; }
[[nodiscard]] const char* GetScriptName(uint32 id) const { return id < _scriptNamesStore.size() ? _scriptNamesStore[id].c_str() : ""; }
[[nodiscard]] std::string const& GetScriptName(uint32 id) const;
uint32 GetScriptId(const char* name);
[[nodiscard]] SpellClickInfoMapBounds GetSpellClickInfoMapBounds(uint32 creature_id) const