mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10909] Code style cleanups in scripting related functions
This commit is contained in:
parent
a84d67a389
commit
a1e0111638
5 changed files with 89 additions and 82 deletions
|
|
@ -336,7 +336,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
|
||||||
void Update(const uint32&);
|
void Update(const uint32&);
|
||||||
void CreateInstanceData(bool load);
|
void CreateInstanceData(bool load);
|
||||||
bool Reset(InstanceResetMethod method);
|
bool Reset(InstanceResetMethod method);
|
||||||
uint32 GetScriptId() { return i_script_id; }
|
uint32 GetScriptId() const { return i_script_id; }
|
||||||
InstanceData* GetInstanceData() { return i_data; }
|
InstanceData* GetInstanceData() { return i_data; }
|
||||||
void PermBindAllPlayers(Player *player);
|
void PermBindAllPlayers(Player *player);
|
||||||
void UnloadAll(bool pForce);
|
void UnloadAll(bool pForce);
|
||||||
|
|
|
||||||
|
|
@ -4555,28 +4555,28 @@ void ObjectMgr::LoadQuestLocales()
|
||||||
|
|
||||||
void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
{
|
{
|
||||||
if(sWorld.IsScriptScheduled()) // function don't must be called in time scripts use.
|
if (sWorld.IsScriptScheduled()) // function don't must be called in time scripts use.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sLog.outString( "%s :", tablename);
|
sLog.outString("%s :", tablename);
|
||||||
|
|
||||||
scripts.clear(); // need for reload support
|
scripts.clear(); // need for reload support
|
||||||
|
|
||||||
QueryResult *result = WorldDatabase.PQuery( "SELECT id, delay, command, datalong, datalong2, datalong3, datalong4, data_flags, dataint, dataint2, dataint3, dataint4, x, y, z, o FROM %s", tablename );
|
QueryResult *result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, datalong3, datalong4, data_flags, dataint, dataint2, dataint3, dataint4, x, y, z, o FROM %s", tablename);
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
if( !result )
|
if (!result)
|
||||||
{
|
{
|
||||||
barGoLink bar( 1 );
|
barGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u script definitions", count );
|
sLog.outString(">> Loaded %u script definitions", count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
barGoLink bar( (int)result->GetRowCount() );
|
barGoLink bar((int)result->GetRowCount());
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -4641,7 +4641,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading
|
// if (!GetMangosStringLocale(tmp.dataint)) will be checked after db_script_string loading
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SCRIPT_COMMAND_EMOTE:
|
case SCRIPT_COMMAND_EMOTE:
|
||||||
|
|
@ -4735,11 +4735,11 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->type==GAMEOBJECT_TYPE_FISHINGNODE ||
|
if (info->type == GAMEOBJECT_TYPE_FISHINGNODE ||
|
||||||
info->type==GAMEOBJECT_TYPE_FISHINGHOLE ||
|
info->type == GAMEOBJECT_TYPE_FISHINGHOLE ||
|
||||||
info->type==GAMEOBJECT_TYPE_DOOR ||
|
info->type == GAMEOBJECT_TYPE_DOOR ||
|
||||||
info->type==GAMEOBJECT_TYPE_BUTTON ||
|
info->type == GAMEOBJECT_TYPE_BUTTON ||
|
||||||
info->type==GAMEOBJECT_TYPE_TRAP)
|
info->type == GAMEOBJECT_TYPE_TRAP)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, info->id, tmp.id);
|
sLog.outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, info->id, tmp.id);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -4778,7 +4778,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->type!=GAMEOBJECT_TYPE_DOOR)
|
if (info->type != GAMEOBJECT_TYPE_DOOR)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", tablename, info->id, (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
sLog.outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", tablename, info->id, (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -4992,50 +4992,50 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
||||||
ScriptMap emptyMap;
|
ScriptMap emptyMap;
|
||||||
scripts[tmp.id] = emptyMap;
|
scripts[tmp.id] = emptyMap;
|
||||||
}
|
}
|
||||||
scripts[tmp.id].insert(std::pair<uint32, ScriptInfo>(tmp.delay, tmp));
|
scripts[tmp.id].insert(ScriptMap::value_type(tmp.delay, tmp));
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while( result->NextRow() );
|
} while(result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u script definitions", count );
|
sLog.outString(">> Loaded %u script definitions", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadGameObjectScripts()
|
void ObjectMgr::LoadGameObjectScripts()
|
||||||
{
|
{
|
||||||
LoadScripts(sGameObjectScripts, "gameobject_scripts");
|
LoadScripts(sGameObjectScripts, "gameobject_scripts");
|
||||||
|
|
||||||
// check ids
|
// check ids
|
||||||
for(ScriptMapMap::const_iterator itr = sGameObjectScripts.begin(); itr != sGameObjectScripts.end(); ++itr)
|
for(ScriptMapMap::const_iterator itr = sGameObjectScripts.begin(); itr != sGameObjectScripts.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(!GetGOData(itr->first))
|
if (!GetGOData(itr->first))
|
||||||
sLog.outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id",itr->first);
|
sLog.outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadQuestEndScripts()
|
void ObjectMgr::LoadQuestEndScripts()
|
||||||
{
|
{
|
||||||
LoadScripts(sQuestEndScripts, "quest_end_scripts");
|
LoadScripts(sQuestEndScripts, "quest_end_scripts");
|
||||||
|
|
||||||
// check ids
|
// check ids
|
||||||
for(ScriptMapMap::const_iterator itr = sQuestEndScripts.begin(); itr != sQuestEndScripts.end(); ++itr)
|
for(ScriptMapMap::const_iterator itr = sQuestEndScripts.begin(); itr != sQuestEndScripts.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(!GetQuestTemplate(itr->first))
|
if (!GetQuestTemplate(itr->first))
|
||||||
sLog.outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id",itr->first);
|
sLog.outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadQuestStartScripts()
|
void ObjectMgr::LoadQuestStartScripts()
|
||||||
{
|
{
|
||||||
LoadScripts(sQuestStartScripts,"quest_start_scripts");
|
LoadScripts(sQuestStartScripts, "quest_start_scripts");
|
||||||
|
|
||||||
// check ids
|
// check ids
|
||||||
for(ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr)
|
for(ScriptMapMap::const_iterator itr = sQuestStartScripts.begin(); itr != sQuestStartScripts.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(!GetQuestTemplate(itr->first))
|
if (!GetQuestTemplate(itr->first))
|
||||||
sLog.outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id",itr->first);
|
sLog.outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5048,9 +5048,9 @@ void ObjectMgr::LoadSpellScripts()
|
||||||
{
|
{
|
||||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first);
|
||||||
|
|
||||||
if(!spellInfo)
|
if (!spellInfo)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id",itr->first);
|
sLog.outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id", itr->first);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5070,7 +5070,7 @@ void ObjectMgr::LoadSpellScripts()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
sLog.outErrorDb("Table `spell_scripts` has unsupported spell (Id: %u) without SPELL_EFFECT_SCRIPT_EFFECT (%u) spell effect",itr->first,SPELL_EFFECT_SCRIPT_EFFECT);
|
sLog.outErrorDb("Table `spell_scripts` has unsupported spell (Id: %u) without SPELL_EFFECT_SCRIPT_EFFECT (%u) spell effect", itr->first, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5082,19 +5082,19 @@ void ObjectMgr::LoadEventScripts()
|
||||||
|
|
||||||
// Load all possible script entries from gameobjects
|
// Load all possible script entries from gameobjects
|
||||||
for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
|
for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
|
||||||
if (GameObjectInfo const * goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
if (GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
||||||
if (uint32 eventId = goInfo->GetEventScriptId())
|
if (uint32 eventId = goInfo->GetEventScriptId())
|
||||||
evt_scripts.insert(eventId);
|
evt_scripts.insert(eventId);
|
||||||
|
|
||||||
// Load all possible script entries from spells
|
// Load all possible script entries from spells
|
||||||
for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
|
for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
|
||||||
{
|
{
|
||||||
SpellEntry const * spell = sSpellStore.LookupEntry(i);
|
SpellEntry const* spell = sSpellStore.LookupEntry(i);
|
||||||
if (spell)
|
if (spell)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
{
|
{
|
||||||
if( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT )
|
if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT)
|
||||||
{
|
{
|
||||||
if (spell->EffectMiscValue[j])
|
if (spell->EffectMiscValue[j])
|
||||||
evt_scripts.insert(spell->EffectMiscValue[j]);
|
evt_scripts.insert(spell->EffectMiscValue[j]);
|
||||||
|
|
@ -5670,22 +5670,22 @@ void ObjectMgr::LoadTavernAreaTriggers()
|
||||||
|
|
||||||
void ObjectMgr::LoadAreaTriggerScripts()
|
void ObjectMgr::LoadAreaTriggerScripts()
|
||||||
{
|
{
|
||||||
mAreaTriggerScripts.clear(); // need for reload case
|
m_AreaTriggerScripts.clear(); // need for reload case
|
||||||
QueryResult *result = WorldDatabase.Query("SELECT entry, ScriptName FROM scripted_areatrigger");
|
QueryResult *result = WorldDatabase.Query("SELECT entry, ScriptName FROM scripted_areatrigger");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
barGoLink bar( 1 );
|
barGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u scripted areatrigger", count );
|
sLog.outString(">> Loaded %u scripted areatrigger", count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
barGoLink bar( (int)result->GetRowCount() );
|
barGoLink bar((int)result->GetRowCount());
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
@ -5694,62 +5694,61 @@ void ObjectMgr::LoadAreaTriggerScripts()
|
||||||
|
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
|
|
||||||
uint32 Trigger_ID = fields[0].GetUInt32();
|
uint32 triggerId = fields[0].GetUInt32();
|
||||||
const char *scriptName = fields[1].GetString();
|
const char *scriptName = fields[1].GetString();
|
||||||
|
|
||||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID);
|
if (!sAreaTriggerStore.LookupEntry(triggerId))
|
||||||
if (!atEntry)
|
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `scripted_areatrigger` has area trigger (ID:%u) not listed in `AreaTrigger.dbc`.", Trigger_ID);
|
sLog.outErrorDb("Table `scripted_areatrigger` has area trigger (ID: %u) not listed in `AreaTrigger.dbc`.", triggerId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mAreaTriggerScripts[Trigger_ID] = GetScriptId(scriptName);
|
m_AreaTriggerScripts[triggerId] = GetScriptId(scriptName);
|
||||||
} while( result->NextRow() );
|
} while(result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u areatrigger scripts", count );
|
sLog.outString(">> Loaded %u areatrigger scripts", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadEventIdScripts()
|
void ObjectMgr::LoadEventIdScripts()
|
||||||
{
|
{
|
||||||
mEventIdScripts.clear(); // need for reload case
|
m_EventIdScripts.clear(); // need for reload case
|
||||||
QueryResult *result = WorldDatabase.Query("SELECT id, ScriptName FROM scripted_event_id");
|
QueryResult *result = WorldDatabase.Query("SELECT id, ScriptName FROM scripted_event_id");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
barGoLink bar( 1 );
|
barGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u scripted event id", count );
|
sLog.outString(">> Loaded %u scripted event id", count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
barGoLink bar( (int)result->GetRowCount() );
|
barGoLink bar((int)result->GetRowCount());
|
||||||
|
|
||||||
// TODO: remove duplicate code below, same way to collect event id's used in LoadEventScripts()
|
// TODO: remove duplicate code below, same way to collect event id's used in LoadEventScripts()
|
||||||
std::set<uint32> evt_scripts;
|
std::set<uint32> evt_scripts;
|
||||||
|
|
||||||
// Load all possible event entries from gameobjects
|
// Load all possible event entries from gameobjects
|
||||||
for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
|
for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
|
||||||
if (GameObjectInfo const * goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
if (GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
||||||
if (uint32 eventId = goInfo->GetEventScriptId())
|
if (uint32 eventId = goInfo->GetEventScriptId())
|
||||||
evt_scripts.insert(eventId);
|
evt_scripts.insert(eventId);
|
||||||
|
|
||||||
// Load all possible event entries from spells
|
// Load all possible event entries from spells
|
||||||
for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
|
for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
|
||||||
{
|
{
|
||||||
SpellEntry const * spell = sSpellStore.LookupEntry(i);
|
SpellEntry const* spell = sSpellStore.LookupEntry(i);
|
||||||
if (spell)
|
if (spell)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
for(int j = 0; j < MAX_EFFECT_INDEX; ++j)
|
||||||
{
|
{
|
||||||
if( spell->Effect[j] == SPELL_EFFECT_SEND_EVENT )
|
if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT)
|
||||||
{
|
{
|
||||||
if (spell->EffectMiscValue[j])
|
if (spell->EffectMiscValue[j])
|
||||||
evt_scripts.insert(spell->EffectMiscValue[j]);
|
evt_scripts.insert(spell->EffectMiscValue[j]);
|
||||||
|
|
@ -5788,13 +5787,13 @@ void ObjectMgr::LoadEventIdScripts()
|
||||||
sLog.outErrorDb("Table `scripted_event_id` has id %u not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u or path taxi node data",
|
sLog.outErrorDb("Table `scripted_event_id` has id %u not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u or path taxi node data",
|
||||||
eventId, SPELL_EFFECT_SEND_EVENT);
|
eventId, SPELL_EFFECT_SEND_EVENT);
|
||||||
|
|
||||||
mEventIdScripts[eventId] = GetScriptId(scriptName);
|
m_EventIdScripts[eventId] = GetScriptId(scriptName);
|
||||||
} while( result->NextRow() );
|
} while(result->NextRow());
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString( ">> Loaded %u scripted event id", count );
|
sLog.outString(">> Loaded %u scripted event id", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, Team team )
|
uint32 ObjectMgr::GetNearestTaxiNode( float x, float y, float z, uint32 mapid, Team team )
|
||||||
|
|
@ -8216,19 +8215,20 @@ bool ObjectMgr::CheckDeclinedNames( std::wstring mainpart, DeclinedName const& n
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id)
|
uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 triggerId) const
|
||||||
{
|
{
|
||||||
AreaTriggerScriptMap::const_iterator i = mAreaTriggerScripts.find(trigger_id);
|
AreaTriggerScriptMap::const_iterator itr = m_AreaTriggerScripts.find(triggerId);
|
||||||
if(i!= mAreaTriggerScripts.end())
|
if (itr != m_AreaTriggerScripts.end())
|
||||||
return i->second;
|
return itr->second;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetEventIdScriptId(uint32 eventId)
|
uint32 ObjectMgr::GetEventIdScriptId(uint32 eventId) const
|
||||||
{
|
{
|
||||||
EventIdScriptMap::const_iterator i = mEventIdScripts.find(eventId);
|
EventIdScriptMap::const_iterator itr = m_EventIdScripts.find(eventId);
|
||||||
if (i!= mEventIdScripts.end())
|
if (itr != m_EventIdScripts.end())
|
||||||
return i->second;
|
return itr->second;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -9580,16 +9580,16 @@ void ObjectMgr::LoadScriptNames()
|
||||||
"UNION "
|
"UNION "
|
||||||
"SELECT DISTINCT(ScriptName) FROM instance_template WHERE ScriptName <> ''");
|
"SELECT DISTINCT(ScriptName) FROM instance_template WHERE ScriptName <> ''");
|
||||||
|
|
||||||
if( !result )
|
if (!result)
|
||||||
{
|
{
|
||||||
barGoLink bar( 1 );
|
barGoLink bar(1);
|
||||||
bar.step();
|
bar.step();
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outErrorDb(">> Loaded empty set of Script Names!");
|
sLog.outErrorDb(">> Loaded empty set of Script Names!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
barGoLink bar( (int)result->GetRowCount() );
|
barGoLink bar((int)result->GetRowCount());
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
@ -9605,14 +9605,19 @@ void ObjectMgr::LoadScriptNames()
|
||||||
sLog.outString( ">> Loaded %d Script Names", count );
|
sLog.outString( ">> Loaded %d Script Names", count );
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetScriptId(const char *name)
|
uint32 ObjectMgr::GetScriptId(const char *name) const
|
||||||
{
|
{
|
||||||
// use binary search to find the script name in the sorted vector
|
// use binary search to find the script name in the sorted vector
|
||||||
// assume "" is the first element
|
// assume "" is the first element
|
||||||
if(!name) return 0;
|
if (!name)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ScriptNameMap::const_iterator itr =
|
ScriptNameMap::const_iterator itr =
|
||||||
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
|
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
|
||||||
if(itr == m_scriptNames.end() || *itr != name) return 0;
|
|
||||||
|
if (itr == m_scriptNames.end() || *itr != name)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return uint32(itr - m_scriptNames.begin());
|
return uint32(itr - m_scriptNames.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9692,9 +9697,9 @@ void ObjectMgr::RemoveArenaTeam( uint32 Id )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions for scripting access
|
// Functions for scripting access
|
||||||
uint32 GetAreaTriggerScriptId(uint32 trigger_id)
|
uint32 GetAreaTriggerScriptId(uint32 triggerId)
|
||||||
{
|
{
|
||||||
return sObjectMgr.GetAreaTriggerScriptId(trigger_id);
|
return sObjectMgr.GetAreaTriggerScriptId(triggerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetEventIdScriptId(uint32 eventId)
|
uint32 GetEventIdScriptId(uint32 eventId)
|
||||||
|
|
@ -9720,7 +9725,7 @@ uint32 MANGOS_DLL_SPEC GetScriptId(const char *name)
|
||||||
return sObjectMgr.GetScriptId(name);
|
return sObjectMgr.GetScriptId(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjectMgr::ScriptNameMap & GetScriptNames()
|
ObjectMgr::ScriptNameMap const& GetScriptNames()
|
||||||
{
|
{
|
||||||
return sObjectMgr.GetScriptNames();
|
return sObjectMgr.GetScriptNames();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -839,8 +839,8 @@ class ObjectMgr
|
||||||
AreaTrigger const* GetGoBackTrigger(uint32 Map) const;
|
AreaTrigger const* GetGoBackTrigger(uint32 Map) const;
|
||||||
AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const;
|
AreaTrigger const* GetMapEntranceTrigger(uint32 Map) const;
|
||||||
|
|
||||||
uint32 GetAreaTriggerScriptId(uint32 trigger_id);
|
uint32 GetAreaTriggerScriptId(uint32 triggerId) const;
|
||||||
uint32 GetEventIdScriptId(uint32 eventId);
|
uint32 GetEventIdScriptId(uint32 eventId) const;
|
||||||
|
|
||||||
RepRewardRate const* GetRepRewardRate(uint32 factionId) const
|
RepRewardRate const* GetRepRewardRate(uint32 factionId) const
|
||||||
{
|
{
|
||||||
|
|
@ -1242,9 +1242,9 @@ class ObjectMgr
|
||||||
bool IsVendorItemValid(bool isTemplate, char const* tableName, uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL) const;
|
bool IsVendorItemValid(bool isTemplate, char const* tableName, uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL) const;
|
||||||
|
|
||||||
void LoadScriptNames();
|
void LoadScriptNames();
|
||||||
ScriptNameMap &GetScriptNames() { return m_scriptNames; }
|
ScriptNameMap const& GetScriptNames() const { return m_scriptNames; }
|
||||||
const char * GetScriptName(uint32 id) { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; }
|
const char* GetScriptName(uint32 id) const { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; }
|
||||||
uint32 GetScriptId(const char *name);
|
uint32 GetScriptId(const char *name) const;
|
||||||
|
|
||||||
int GetOrNewIndexForLocale(LocaleConstant loc);
|
int GetOrNewIndexForLocale(LocaleConstant loc);
|
||||||
|
|
||||||
|
|
@ -1345,8 +1345,8 @@ class ObjectMgr
|
||||||
GossipTextMap mGossipText;
|
GossipTextMap mGossipText;
|
||||||
AreaTriggerMap mAreaTriggers;
|
AreaTriggerMap mAreaTriggers;
|
||||||
|
|
||||||
AreaTriggerScriptMap mAreaTriggerScripts;
|
AreaTriggerScriptMap m_AreaTriggerScripts;
|
||||||
EventIdScriptMap mEventIdScripts;
|
EventIdScriptMap m_EventIdScripts;
|
||||||
|
|
||||||
RepRewardRateMap m_RepRewardRateMap;
|
RepRewardRateMap m_RepRewardRateMap;
|
||||||
RepOnKillMap mRepOnKill;
|
RepOnKillMap mRepOnKill;
|
||||||
|
|
@ -1452,10 +1452,10 @@ class ObjectMgr
|
||||||
|
|
||||||
// scripting access functions
|
// scripting access functions
|
||||||
MANGOS_DLL_SPEC bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value = MAX_CREATURE_AI_TEXT_STRING_ID, int32 end_value = std::numeric_limits<int32>::min());
|
MANGOS_DLL_SPEC bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value = MAX_CREATURE_AI_TEXT_STRING_ID, int32 end_value = std::numeric_limits<int32>::min());
|
||||||
MANGOS_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 trigger_id);
|
MANGOS_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 triggerId);
|
||||||
MANGOS_DLL_SPEC uint32 GetEventIdScriptId(uint32 event_id);
|
MANGOS_DLL_SPEC uint32 GetEventIdScriptId(uint32 eventId);
|
||||||
MANGOS_DLL_SPEC uint32 GetScriptId(const char *name);
|
MANGOS_DLL_SPEC uint32 GetScriptId(const char *name);
|
||||||
MANGOS_DLL_SPEC ObjectMgr::ScriptNameMap& GetScriptNames();
|
MANGOS_DLL_SPEC ObjectMgr::ScriptNameMap const& GetScriptNames();
|
||||||
MANGOS_DLL_SPEC CreatureInfo const* GetCreatureTemplateStore(uint32 entry);
|
MANGOS_DLL_SPEC CreatureInfo const* GetCreatureTemplateStore(uint32 entry);
|
||||||
MANGOS_DLL_SPEC Quest const* GetQuestTemplateStore(uint32 entry);
|
MANGOS_DLL_SPEC Quest const* GetQuestTemplateStore(uint32 entry);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,14 @@
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "DBCEnums.h"
|
#include "DBCEnums.h"
|
||||||
|
|
||||||
|
class Aura;
|
||||||
class Creature;
|
class Creature;
|
||||||
class CreatureAI;
|
class CreatureAI;
|
||||||
class GameObject;
|
class GameObject;
|
||||||
class Item;
|
class Item;
|
||||||
class Player;
|
class Player;
|
||||||
class Quest;
|
class Quest;
|
||||||
|
class Unit;
|
||||||
class SpellCastTargets;
|
class SpellCastTargets;
|
||||||
class Map;
|
class Map;
|
||||||
class InstanceData;
|
class InstanceData;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10908"
|
#define REVISION_NR "10909"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue