mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Merge branch 'master' into 310
Conflicts: src/game/Player.cpp
This commit is contained in:
commit
9b20869a32
83 changed files with 623 additions and 581 deletions
|
|
@ -5391,6 +5391,61 @@ struct SQLGameObjectLoader : public SQLStorageLoaderBase<SQLGameObjectLoader>
|
|||
}
|
||||
};
|
||||
|
||||
inline void CheckGOLockId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
|
||||
{
|
||||
if (sLockStore.LookupEntry(dataN))
|
||||
return;
|
||||
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.",
|
||||
goInfo->id,goInfo->type,N,goInfo->door.lockId,goInfo->door.lockId);
|
||||
}
|
||||
|
||||
inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
|
||||
{
|
||||
if (GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(dataN))
|
||||
{
|
||||
if (trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
|
||||
goInfo->id,goInfo->type,N,dataN,dataN,GAMEOBJECT_TYPE_TRAP);
|
||||
}
|
||||
/* disable check for while (too many error reports baout not existed in trap templates
|
||||
else
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
|
||||
goInfo->id,goInfo->type,N,dataN,dataN);
|
||||
*/
|
||||
}
|
||||
|
||||
inline void CheckGOSpellId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
|
||||
{
|
||||
if (sSpellStore.LookupEntry(dataN))
|
||||
return;
|
||||
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
|
||||
goInfo->id,goInfo->type,N,dataN,dataN);
|
||||
}
|
||||
|
||||
inline void CheckAndFixGOChairHeightId(GameObjectInfo const* goInfo,uint32 const& dataN,uint32 N)
|
||||
{
|
||||
if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
|
||||
return;
|
||||
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.",
|
||||
goInfo->id,goInfo->type,N,dataN,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
|
||||
|
||||
// prevent client and server unexpected work
|
||||
const_cast<uint32&>(dataN) = 0;
|
||||
}
|
||||
|
||||
inline void CheckGONoDamageImmuneId(GameObjectInfo const* goInfo,uint32 dataN,uint32 N)
|
||||
{
|
||||
// 0/1 correct values
|
||||
if (dataN <= 1)
|
||||
return;
|
||||
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.",
|
||||
goInfo->id,goInfo->type,N,dataN);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadGameobjectInfo()
|
||||
{
|
||||
SQLGameObjectLoader loader;
|
||||
|
|
@ -5400,139 +5455,104 @@ void ObjectMgr::LoadGameobjectInfo()
|
|||
for(uint32 id = 1; id < sGOStorage.MaxEntry; id++)
|
||||
{
|
||||
GameObjectInfo const* goInfo = sGOStorage.LookupEntry<GameObjectInfo>(id);
|
||||
if(!goInfo)
|
||||
if (!goInfo)
|
||||
continue;
|
||||
|
||||
switch(goInfo->type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: //0
|
||||
{
|
||||
if(goInfo->door.lockId)
|
||||
{
|
||||
if(!sLockStore.LookupEntry(goInfo->door.lockId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but lock (Id: %u) not found.",
|
||||
id,goInfo->type,goInfo->door.lockId,goInfo->door.lockId);
|
||||
}
|
||||
if (goInfo->door.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->door.lockId,1);
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->door.noDamageImmune,3);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_BUTTON: //1
|
||||
{
|
||||
if(goInfo->button.lockId)
|
||||
{
|
||||
if(!sLockStore.LookupEntry(goInfo->button.lockId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but lock (Id: %u) not found.",
|
||||
id,goInfo->type,goInfo->button.lockId,goInfo->button.lockId);
|
||||
}
|
||||
if (goInfo->button.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->button.lockId,1);
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->button.noDamageImmune,4);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: //2
|
||||
{
|
||||
if (goInfo->questgiver.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->questgiver.lockId,0);
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->questgiver.noDamageImmune,5);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_CHEST: //3
|
||||
{
|
||||
if(goInfo->chest.lockId)
|
||||
{
|
||||
if(!sLockStore.LookupEntry(goInfo->chest.lockId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but lock (Id: %u) not found.",
|
||||
id,goInfo->type,goInfo->chest.lockId,goInfo->chest.lockId);
|
||||
}
|
||||
if(goInfo->chest.linkedTrapId) // linked trap
|
||||
{
|
||||
if(GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(goInfo->chest.linkedTrapId))
|
||||
{
|
||||
if(trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
|
||||
id,goInfo->type,goInfo->chest.linkedTrapId,goInfo->chest.linkedTrapId,GAMEOBJECT_TYPE_TRAP);
|
||||
}
|
||||
/* disable check for while
|
||||
else
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
|
||||
id,goInfo->type,goInfo->chest.linkedTrapId,goInfo->chest.linkedTrapId);
|
||||
*/
|
||||
}
|
||||
if (goInfo->chest.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->chest.lockId,0);
|
||||
|
||||
if (goInfo->chest.linkedTrapId) // linked trap
|
||||
CheckGOLinkedTrapId(goInfo,goInfo->chest.linkedTrapId,7);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_TRAP: //6
|
||||
{
|
||||
/* disable check for while
|
||||
if(goInfo->trap.spellId) // spell
|
||||
{
|
||||
if(!sSpellStore.LookupEntry(goInfo->trap.spellId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data3=%u but Spell (Entry %u) not exist.",
|
||||
id,goInfo->type,goInfo->trap.spellId,goInfo->trap.spellId);
|
||||
}
|
||||
if (goInfo->trap.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->trap.lockId,0);
|
||||
/* disable check for while, too many not existed spells
|
||||
if (goInfo->trap.spellId) // spell
|
||||
CheckGOSpellId(goInfo,goInfo->trap.spellId,3);
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_CHAIR: //7
|
||||
if(goInfo->chair.height > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..%i.",
|
||||
id,goInfo->type,goInfo->chair.height,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
|
||||
|
||||
// prevent client and server unexpected work
|
||||
const_cast<GameObjectInfo*>(goInfo)->chair.height = 0;
|
||||
}
|
||||
CheckAndFixGOChairHeightId(goInfo,goInfo->chair.height,1);
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
|
||||
{
|
||||
if(goInfo->spellFocus.focusId)
|
||||
if (goInfo->spellFocus.focusId)
|
||||
{
|
||||
if(!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId))
|
||||
if (!sSpellFocusObjectStore.LookupEntry(goInfo->spellFocus.focusId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.",
|
||||
id,goInfo->type,goInfo->spellFocus.focusId,goInfo->spellFocus.focusId);
|
||||
}
|
||||
|
||||
if(goInfo->spellFocus.linkedTrapId) // linked trap
|
||||
{
|
||||
if(GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(goInfo->spellFocus.linkedTrapId))
|
||||
{
|
||||
if(trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
|
||||
id,goInfo->type,goInfo->spellFocus.linkedTrapId,goInfo->spellFocus.linkedTrapId,GAMEOBJECT_TYPE_TRAP);
|
||||
}
|
||||
/* disable check for while
|
||||
else
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
|
||||
id,goInfo->type,goInfo->spellFocus.linkedTrapId,goInfo->spellFocus.linkedTrapId);
|
||||
*/
|
||||
}
|
||||
if (goInfo->spellFocus.linkedTrapId) // linked trap
|
||||
CheckGOLinkedTrapId(goInfo,goInfo->spellFocus.linkedTrapId,2);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_GOOBER: //10
|
||||
{
|
||||
if(goInfo->goober.pageId) // pageId
|
||||
if (goInfo->goober.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->goober.lockId,0);
|
||||
|
||||
if (goInfo->goober.pageId) // pageId
|
||||
{
|
||||
if(!sPageTextStore.LookupEntry<PageText>(goInfo->goober.pageId))
|
||||
if (!sPageTextStore.LookupEntry<PageText>(goInfo->goober.pageId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
|
||||
id,goInfo->type,goInfo->goober.pageId,goInfo->goober.pageId);
|
||||
}
|
||||
/* disable check for while
|
||||
if(goInfo->goober.spellId) // spell
|
||||
{
|
||||
if(!sSpellStore.LookupEntry(goInfo->goober.spellId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data2=%u but Spell (Entry %u) not exist.",
|
||||
id,goInfo->type,goInfo->goober.spellId,goInfo->goober.spellId);
|
||||
}
|
||||
/* disable check for while, too many not existed spells
|
||||
if (goInfo->goober.spellId) // spell
|
||||
CheckGOSpellId(goInfo,goInfo->goober.spellId,10);
|
||||
*/
|
||||
if(goInfo->goober.linkedTrapId) // linked trap
|
||||
{
|
||||
if(GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(goInfo->goober.linkedTrapId))
|
||||
{
|
||||
if(trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data12=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.",
|
||||
id,goInfo->type,goInfo->goober.linkedTrapId,goInfo->goober.linkedTrapId,GAMEOBJECT_TYPE_TRAP);
|
||||
}
|
||||
/* disable check for while
|
||||
else
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data12=%u but trap GO (Entry %u) not exist in `gameobject_template`.",
|
||||
id,goInfo->type,goInfo->goober.linkedTrapId,goInfo->goober.linkedTrapId);
|
||||
*/
|
||||
}
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->goober.noDamageImmune,11);
|
||||
if (goInfo->goober.linkedTrapId) // linked trap
|
||||
CheckGOLinkedTrapId(goInfo,goInfo->goober.linkedTrapId,12);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_AREADAMAGE: //12
|
||||
{
|
||||
if (goInfo->areadamage.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->areadamage.lockId,0);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_CAMERA: //13
|
||||
{
|
||||
if (goInfo->camera.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->camera.lockId,0);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_MO_TRANSPORT: //15
|
||||
{
|
||||
if(goInfo->moTransport.taxiPathId)
|
||||
if (goInfo->moTransport.taxiPathId)
|
||||
{
|
||||
if(goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[goInfo->moTransport.taxiPathId].empty())
|
||||
if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[goInfo->moTransport.taxiPathId].empty())
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.",
|
||||
id,goInfo->type,goInfo->moTransport.taxiPathId,goInfo->moTransport.taxiPathId);
|
||||
}
|
||||
|
|
@ -5540,35 +5560,40 @@ void ObjectMgr::LoadGameobjectInfo()
|
|||
}
|
||||
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
|
||||
{
|
||||
/* disabled
|
||||
if(goInfo->summoningRitual.spellId)
|
||||
{
|
||||
if(!sSpellStore.LookupEntry(goInfo->summoningRitual.spellId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but Spell (Entry %u) not exist.",
|
||||
id,goInfo->type,goInfo->summoningRitual.spellId,goInfo->summoningRitual.spellId);
|
||||
}
|
||||
/* disable check for while, too many not existed spells
|
||||
// always must have spell
|
||||
CheckGOSpellId(goInfo,goInfo->summoningRitual.spellId,1);
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_SPELLCASTER: //22
|
||||
{
|
||||
if(goInfo->spellcaster.spellId) // spell
|
||||
{
|
||||
if(!sSpellStore.LookupEntry(goInfo->spellcaster.spellId))
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data3=%u but Spell (Entry %u) not exist.",
|
||||
id,goInfo->type,goInfo->spellcaster.spellId,goInfo->spellcaster.spellId);
|
||||
}
|
||||
// always must have spell
|
||||
CheckGOSpellId(goInfo,goInfo->spellcaster.spellId,0);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_FLAGSTAND: //24
|
||||
{
|
||||
if (goInfo->flagstand.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->flagstand.lockId,0);
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->flagstand.noDamageImmune,5);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_FISHINGHOLE: //25
|
||||
{
|
||||
if (goInfo->fishinghole.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->fishinghole.lockId,4);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_FLAGDROP: //26
|
||||
{
|
||||
if (goInfo->flagdrop.lockId)
|
||||
CheckGOLockId(goInfo,goInfo->flagdrop.lockId,0);
|
||||
CheckGONoDamageImmuneId(goInfo,goInfo->flagdrop.noDamageImmune,3);
|
||||
break;
|
||||
}
|
||||
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
|
||||
if(goInfo->barberChair.chairheight > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data1=%u but correct chair height in range 0..%i.",
|
||||
id,goInfo->type,goInfo->barberChair.chairheight,UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR);
|
||||
|
||||
// prevent client and server unexpected work
|
||||
const_cast<GameObjectInfo*>(goInfo)->barberChair.chairheight = 0;
|
||||
}
|
||||
CheckAndFixGOChairHeightId(goInfo,goInfo->barberChair.chairheight,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue