mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10508] Arrange case SCRIPT_COMMAND_ in correct order, also in ObjectMgr
Some additional code style corrections. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
29a723e41e
commit
8ccf9c7464
2 changed files with 78 additions and 84 deletions
|
|
@ -4465,7 +4465,6 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
// if(!GetMangosStringLocale(tmp.dataint)) will checked after db_script_string loading
|
||||
break;
|
||||
}
|
||||
|
||||
case SCRIPT_COMMAND_EMOTE:
|
||||
{
|
||||
if (!sEmotesStore.LookupEntry(tmp.emote.emoteId))
|
||||
|
|
@ -4475,7 +4474,6 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCRIPT_COMMAND_TELEPORT_TO:
|
||||
{
|
||||
if (!sMapStore.LookupEntry(tmp.teleportTo.mapId))
|
||||
|
|
@ -4491,95 +4489,16 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
||||
{
|
||||
if (!GetCreatureTemplate(tmp.killCredit.creatureEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tablename, tmp.killCredit.creatureEntry, tmp.id);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
||||
{
|
||||
if (!MaNGOS::IsValidMapCoord(tmp.x, tmp.y, tmp.z, tmp.o))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tablename, tmp.x, tmp.y, tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetCreatureTemplate(tmp.summonCreature.creatureEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tablename, tmp.summonCreature.creatureEntry, tmp.id);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
||||
{
|
||||
GameObjectData const* data = GetGOData(tmp.GetGOGuid());
|
||||
if(!data)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, tmp.GetGOGuid(), tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
||||
if(!info)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, tmp.GetGOGuid(), data->id, tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if( info->type==GAMEOBJECT_TYPE_FISHINGNODE ||
|
||||
info->type==GAMEOBJECT_TYPE_FISHINGHOLE ||
|
||||
info->type==GAMEOBJECT_TYPE_DOOR ||
|
||||
info->type==GAMEOBJECT_TYPE_BUTTON ||
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
||||
{
|
||||
GameObjectData const* data = GetGOData(tmp.GetGOGuid());
|
||||
if(!data)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", tablename, tmp.GetGOGuid(), (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
||||
if(!info)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", tablename, tmp.GetGOGuid(), data->id, (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_QUEST_EXPLORED:
|
||||
{
|
||||
Quest const* quest = GetQuestTemplate(tmp.questExplored.questId);
|
||||
if(!quest)
|
||||
if (!quest)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tablename, tmp.questExplored.questId, tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||
if (!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tablename, tmp.questExplored.questId, tmp.id);
|
||||
|
||||
|
|
@ -4612,7 +4531,82 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_KILL_CREDIT:
|
||||
{
|
||||
if (!GetCreatureTemplate(tmp.killCredit.creatureEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tablename, tmp.killCredit.creatureEntry, tmp.id);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
||||
{
|
||||
GameObjectData const* data = GetGOData(tmp.GetGOGuid());
|
||||
if (!data)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, tmp.GetGOGuid(), tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
||||
if (!info)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, tmp.GetGOGuid(), data->id, tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (info->type==GAMEOBJECT_TYPE_FISHINGNODE ||
|
||||
info->type==GAMEOBJECT_TYPE_FISHINGHOLE ||
|
||||
info->type==GAMEOBJECT_TYPE_DOOR ||
|
||||
info->type==GAMEOBJECT_TYPE_BUTTON ||
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
|
||||
{
|
||||
if (!MaNGOS::IsValidMapCoord(tmp.x, tmp.y, tmp.z, tmp.o))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tablename, tmp.x, tmp.y, tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetCreatureTemplate(tmp.summonCreature.creatureEntry))
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tablename, tmp.summonCreature.creatureEntry, tmp.id);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_OPEN_DOOR:
|
||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
||||
{
|
||||
GameObjectData const* data = GetGOData(tmp.GetGOGuid());
|
||||
if (!data)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", tablename, tmp.GetGOGuid(), (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectInfo const* info = GetGameObjectInfo(data->id);
|
||||
if (!info)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", tablename, tmp.GetGOGuid(), data->id, (tmp.command == SCRIPT_COMMAND_OPEN_DOOR ? "SCRIPT_COMMAND_OPEN_DOOR" : "SCRIPT_COMMAND_CLOSE_DOOR"), tmp.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SCRIPT_COMMAND_REMOVE_AURA:
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(tmp.removeAura.spellId))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue