mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7640] Move spell and chair height checks to functions for gameobject loading code. Fixed some field ids.
This commit is contained in:
parent
4ec75c7c9e
commit
f87684bab6
2 changed files with 59 additions and 68 deletions
|
|
@ -5397,6 +5397,27 @@ inline void CheckGOLinkedTrapId(GameObjectInfo const* goInfo,uint32 dataN,uint32
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadGameobjectInfo()
|
void ObjectMgr::LoadGameobjectInfo()
|
||||||
{
|
{
|
||||||
SQLGameObjectLoader loader;
|
SQLGameObjectLoader loader;
|
||||||
|
|
@ -5442,25 +5463,14 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
{
|
{
|
||||||
if (goInfo->trap.lockId)
|
if (goInfo->trap.lockId)
|
||||||
CheckGOLockId(goInfo,goInfo->trap.lockId,0);
|
CheckGOLockId(goInfo,goInfo->trap.lockId,0);
|
||||||
/* disable check for while
|
/* disable check for while, too many not existed spells
|
||||||
if (goInfo->trap.spellId) // spell
|
if (goInfo->trap.spellId) // spell
|
||||||
{
|
CheckGOSpellId(goInfo,goInfo->trap.spellId,3);
|
||||||
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);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GAMEOBJECT_TYPE_CHAIR: //7
|
case GAMEOBJECT_TYPE_CHAIR: //7
|
||||||
if(goInfo->chair.height > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
|
CheckAndFixGOChairHeightId(goInfo,goInfo->chair.height,1);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
|
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
|
||||||
{
|
{
|
||||||
|
|
@ -5486,13 +5496,9 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
sLog.outErrorDb("Gameobject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.",
|
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);
|
id,goInfo->type,goInfo->goober.pageId,goInfo->goober.pageId);
|
||||||
}
|
}
|
||||||
/* disable check for while
|
/* disable check for while, too many not existed spells
|
||||||
if (goInfo->goober.spellId) // spell
|
if (goInfo->goober.spellId) // spell
|
||||||
{
|
CheckGOSpellId(goInfo,goInfo->goober.spellId,10);
|
||||||
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);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
if (goInfo->goober.linkedTrapId) // linked trap
|
if (goInfo->goober.linkedTrapId) // linked trap
|
||||||
CheckGOLinkedTrapId(goInfo,goInfo->goober.linkedTrapId,12);
|
CheckGOLinkedTrapId(goInfo,goInfo->goober.linkedTrapId,12);
|
||||||
|
|
@ -5522,24 +5528,16 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
}
|
}
|
||||||
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
|
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
|
||||||
{
|
{
|
||||||
/* disabled
|
/* disable check for while, too many not existed spells
|
||||||
if(goInfo->summoningRitual.spellId)
|
// always must have spell
|
||||||
{
|
CheckGOSpellId(goInfo,goInfo->summoningRitual.spellId,1);
|
||||||
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);
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GAMEOBJECT_TYPE_SPELLCASTER: //22
|
case GAMEOBJECT_TYPE_SPELLCASTER: //22
|
||||||
{
|
{
|
||||||
if(goInfo->spellcaster.spellId) // spell
|
// always must have spell
|
||||||
{
|
CheckGOSpellId(goInfo,goInfo->spellcaster.spellId,0);
|
||||||
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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GAMEOBJECT_TYPE_FLAGSTAND: //24
|
case GAMEOBJECT_TYPE_FLAGSTAND: //24
|
||||||
|
|
@ -5561,14 +5559,7 @@ void ObjectMgr::LoadGameobjectInfo()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
|
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
|
||||||
if(goInfo->barberChair.chairheight > (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR) )
|
CheckAndFixGOChairHeightId(goInfo,goInfo->barberChair.chairheight,0);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7639"
|
#define REVISION_NR "7640"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue