[8444] Prevent spawn gameobjects with invalid displayid by command. Author: VladimirMangos
Also fix mangos string for not existed gameobejct entry. --HG-- branch : trunk
This commit is contained in:
1 parent
f49754447b
commit
0c0a7b6b0e
5 files changed
+30
-13
No files matched your search
+14
-5
@@ -733,15 +733,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());
|
||||
@@ -752,7 +761,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;
|
||||
@@ -775,14 +784,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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user