[c12628] Use TransportAnimation.dbc to check transport validity

This commit is contained in:
Dramacydal 2013-05-31 12:44:28 +01:00 committed by Antz
parent 988bad89e8
commit c47a6fa6ab
5 changed files with 96 additions and 6 deletions

View file

@ -141,7 +141,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
return false; return false;
} }
Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT); if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
Object::_Create(guidlow, 0, HIGHGUID_MO_TRANSPORT);
else
Object::_Create(guidlow, goinfo->id, HIGHGUID_GAMEOBJECT);
m_goInfo = goinfo; m_goInfo = goinfo;
@ -151,6 +154,15 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
return false; return false;
} }
// transport gameobject must have entry in TransportAnimation.dbc or client will crash
if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
if (sTransportAnimationsByEntry.find(goinfo->id) == sTransportAnimationsByEntry.end())
{
sLog.outError("GameObject::Create: gameobject entry %u guid %u is transport, but does not have entry in TransportAnimation.dbc. Can't spawn.",
goinfo->id, guidlow);
return false;
}
SetObjectScale(goinfo->size); SetObjectScale(goinfo->size);
SetWorldRotation(rotation.x, rotation.y, rotation.z, rotation.w); SetWorldRotation(rotation.x, rotation.y, rotation.z, rotation.w);
@ -184,6 +196,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING: case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
ForceGameObjectHealth(GetMaxHealth(), NULL); ForceGameObjectHealth(GetMaxHealth(), NULL);
SetUInt32Value(GAMEOBJECT_PARENTROTATION, m_goInfo->destructibleBuilding.destructibleData); SetUInt32Value(GAMEOBJECT_PARENTROTATION, m_goInfo->destructibleBuilding.destructibleData);
case GAMEOBJECT_TYPE_TRANSPORT:
SetUInt32Value(GAMEOBJECT_LEVEL, WorldTimer::getMSTime());
if (goinfo->transport.startOpen)
SetGoState(GO_STATE_ACTIVE);
break; break;
} }

View file

@ -192,11 +192,30 @@ struct GameObjectInfo
//11 GAMEOBJECT_TYPE_TRANSPORT //11 GAMEOBJECT_TYPE_TRANSPORT
struct struct
{ {
uint32 pause; //0 uint32 startFrame; //0
uint32 startOpen; //1 uint32 startOpen; //1
uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
uint32 pause1EventID; //3 uint32 pause1EventID; //3
uint32 pause2EventID; //4 uint32 pause2EventID; //4
uint32 baseMap; //5
uint32 nextFrame1; //6
uint32 unk7; //7
uint32 nextFrame2; //8
uint32 unk9; //9
uint32 nextFrame3; //10
uint32 unk11; //11
uint32 unk12; //12
uint32 unk13; //13
uint32 unk14; //14
uint32 unk15; //15
uint32 unk16; //16
uint32 unk17; //17
uint32 unk18; //18
uint32 unk19; //19
uint32 unk20; //20
uint32 unk21; //21
uint32 unk22; //22 ring of valor elevators
uint32 unk23; //23 ring of valor elevators
} transport; } transport;
//12 GAMEOBJECT_TYPE_AREADAMAGE //12 GAMEOBJECT_TYPE_AREADAMAGE
struct struct
@ -543,9 +562,10 @@ struct GameObjectLocale
// client side GO show states // client side GO show states
enum GOState enum GOState
{ {
GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open) GO_STATE_ACTIVE = 0x00, // show in world as used and not reset (closed door open)
GO_STATE_READY = 1, // show in world as ready (closed door close) GO_STATE_READY = 0x01, // show in world as ready (closed door close)
GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire) GO_STATE_ACTIVE_ALTERNATIVE = 0x02, // show in world as used in alt way and not reset (closed door open by cannon fire)
GO_STATE_TRANSPORT_SPEC = 0x18, // additional mask that have all transport gameobjects
}; };
#define MAX_GO_STATE 3 #define MAX_GO_STATE 3

View file

@ -720,6 +720,13 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u
*data << uint16(-1); *data << uint16(-1);
} }
} }
else if (index == GAMEOBJECT_BYTES_1)
{
if (((GameObject*)this)->GetGOInfo()->type == GAMEOBJECT_TYPE_TRANSPORT)
*data << uint32(m_uint32Values[index] | GO_STATE_TRANSPORT_SPEC);
else
*data << uint32(m_uint32Values[index]);
}
else else
*data << m_uint32Values[index]; // other cases *data << m_uint32Values[index]; // other cases
} }

View file

@ -6272,6 +6272,53 @@ void ObjectMgr::LoadGameobjectInfo()
CheckGOLinkedTrapId(goInfo, goInfo->goober.linkedTrapId, 12); CheckGOLinkedTrapId(goInfo, goInfo->goober.linkedTrapId, 12);
break; break;
} }
case GAMEOBJECT_TYPE_TRANSPORT: // 11
{
TransportAnimationsByEntry::const_iterator itr = sTransportAnimationsByEntry.find(goInfo->id);
if (itr == sTransportAnimationsByEntry.end())
{
sLog.outError("Gameobject (Entry: %u GoType: %u) is transport but does not have entries in TransportAnimation.dbc! Gameobject is obsolete.",
goInfo->id, goInfo->type);
break;
}
if (uint32 frame = goInfo->transport.startFrame)
{
if (itr->second.find(frame) == itr->second.end())
{
sLog.outError("Gameobject (Entry: %u GoType: %u) has data0=%u but this frame is not in TransportAnimation.dbc! May cause client crashes.",
goInfo->id, goInfo->type, frame);
}
}
if (uint32 frame = goInfo->transport.nextFrame1)
{
if (itr->second.find(frame) == itr->second.end())
{
sLog.outError("Gameobject (Entry: %u GoType: %u) has data6=%u but this frame is not in TransportAnimation.dbc! May cause client crashes.",
goInfo->id, goInfo->type, frame);
}
}
if (uint32 frame = goInfo->transport.nextFrame2)
{
if (itr->second.find(frame) == itr->second.end())
{
sLog.outError("Gameobject (Entry: %u GoType: %u) has data8=%u but this frame is not in TransportAnimation.dbc! May cause client crashes.",
goInfo->id, goInfo->type, frame);
}
}
if (uint32 frame = goInfo->transport.nextFrame3)
{
if (itr->second.find(frame) == itr->second.end())
{
sLog.outError("Gameobject (Entry: %u GoType: %u) has data10=%u but this frame is not in TransportAnimation.dbc! May cause client crashes.",
goInfo->id, goInfo->type, frame);
}
}
break;
}
case GAMEOBJECT_TYPE_AREADAMAGE: // 12 case GAMEOBJECT_TYPE_AREADAMAGE: // 12
{ {
if (goInfo->areadamage.lockId) if (goInfo->areadamage.lockId)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12627" #define REVISION_NR "12628"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__