mirror of
https://github.com/mangosfour/server.git
synced 2025-12-20 16:37:04 +00:00
[8444] Prevent spawn gameobjects with invalid displayid by command.
Also fix mangos string for not existed gameobejct entry.
This commit is contained in:
parent
a9dea03e09
commit
4d0088e7a9
8 changed files with 35 additions and 16 deletions
|
|
@ -331,7 +331,8 @@ enum MangosStrings
|
|||
LANG_CUSTOMIZE_PLAYER = 345,
|
||||
LANG_CUSTOMIZE_PLAYER_GUID = 346,
|
||||
LANG_COMMAND_GOTAXINODENOTFOUND = 347,
|
||||
// Room for more level 2 348-399 not used
|
||||
LANG_GAMEOBJECT_HAVE_INVALID_DATA = 348,
|
||||
// Room for more level 2 349-399 not used
|
||||
|
||||
// level 3 chat
|
||||
LANG_SCRIPTS_RELOADED = 400,
|
||||
|
|
|
|||
|
|
@ -700,15 +700,24 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
|
|||
|
||||
char* spawntimeSecs = strtok(NULL, " ");
|
||||
|
||||
const GameObjectInfo *goI = objmgr.GetGameObjectInfo(id);
|
||||
const GameObjectInfo *gInfo = objmgr.GetGameObjectInfo(id);
|
||||
|
||||
if (!goI)
|
||||
if (!gInfo)
|
||||
{
|
||||
PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST,id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
|
||||
{
|
||||
// report to DB errors log as in loading case
|
||||
sLog.outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.",id, gInfo->type, gInfo->displayId);
|
||||
PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA,id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player *chr = m_session->GetPlayer();
|
||||
float x = float(chr->GetPositionX());
|
||||
float y = float(chr->GetPositionY());
|
||||
|
|
@ -719,7 +728,7 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
|
|||
GameObject* pGameObj = new GameObject;
|
||||
uint32 db_lowGUID = objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
|
||||
|
||||
if(!pGameObj->Create(db_lowGUID, goI->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
if(!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
|
||||
{
|
||||
delete pGameObj;
|
||||
return false;
|
||||
|
|
@ -742,14 +751,14 @@ bool ChatHandler::HandleGameObjectAddCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
sLog.outDebug(GetMangosString(LANG_GAMEOBJECT_CURRENT), goI->name, db_lowGUID, x, y, z, o);
|
||||
sLog.outDebug(GetMangosString(LANG_GAMEOBJECT_CURRENT), gInfo->name, db_lowGUID, x, y, z, o);
|
||||
|
||||
map->Add(pGameObj);
|
||||
|
||||
// TODO: is it really necessary to add both the real and DB table guid here ?
|
||||
objmgr.AddGameobjectToGrid(db_lowGUID, objmgr.GetGOData(db_lowGUID));
|
||||
|
||||
PSendSysMessage(LANG_GAMEOBJECT_ADD,id,goI->name,db_lowGUID,x,y,z);
|
||||
PSendSysMessage(LANG_GAMEOBJECT_ADD,id,gInfo->name,db_lowGUID,x,y,z);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1220,13 +1220,13 @@ void ObjectMgr::LoadGameobjects()
|
|||
uint32 entry = fields[ 1].GetUInt32();
|
||||
|
||||
GameObjectInfo const* gInfo = GetGameObjectInfo(entry);
|
||||
if(!gInfo)
|
||||
if (!gInfo)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
|
||||
if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.",guid, entry, gInfo->type, gInfo->displayId);
|
||||
continue;
|
||||
|
|
@ -1266,25 +1266,25 @@ void ObjectMgr::LoadGameobjects()
|
|||
int16 gameEvent = fields[16].GetInt16();
|
||||
int16 PoolId = fields[17].GetInt16();
|
||||
|
||||
if(data.rotation2 < -1.0f || data.rotation2 > 1.0f)
|
||||
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation2 (%f) value, skip",guid,data.id,data.rotation2 );
|
||||
continue;
|
||||
}
|
||||
|
||||
if(data.rotation3 < -1.0f || data.rotation3 > 1.0f)
|
||||
if (data.rotation3 < -1.0f || data.rotation3 > 1.0f)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid rotation3 (%f) value, skip",guid,data.id,data.rotation3 );
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!MapManager::IsValidMapCoord(data.mapid,data.posX,data.posY,data.posZ,data.orientation))
|
||||
if (!MapManager::IsValidMapCoord(data.mapid,data.posX,data.posY,data.posZ,data.orientation))
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with invalid coordinates, skip",guid,data.id );
|
||||
continue;
|
||||
}
|
||||
|
||||
if(data.phaseMask==0)
|
||||
if (data.phaseMask==0)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id );
|
||||
data.phaseMask = 1;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8443"
|
||||
#define REVISION_NR "8444"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_8433_01_characters_character_account_data"
|
||||
#define REVISION_DB_MANGOS "required_8416_01_mangos_spell_learn_spell"
|
||||
#define REVISION_DB_MANGOS "required_8444_01_mangos_mangos_string"
|
||||
#define REVISION_DB_REALMD "required_8332_01_realmd_realmcharacters"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue