diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 82af51ec9..c73b3746b 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -141,7 +141,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa 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; @@ -151,6 +154,15 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa 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); 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: ForceGameObjectHealth(GetMaxHealth(), NULL); 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; } diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 3851eb8b9..f1c7dc836 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -192,11 +192,30 @@ struct GameObjectInfo //11 GAMEOBJECT_TYPE_TRANSPORT struct { - uint32 pause; //0 + uint32 startFrame; //0 uint32 startOpen; //1 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000) uint32 pause1EventID; //3 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; //12 GAMEOBJECT_TYPE_AREADAMAGE struct @@ -543,9 +562,10 @@ struct GameObjectLocale // client side GO show states enum GOState { - GO_STATE_ACTIVE = 0, // 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_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire) + GO_STATE_ACTIVE = 0x00, // show in world as used and not reset (closed door open) + GO_STATE_READY = 0x01, // show in world as ready (closed door close) + 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 diff --git a/src/game/Object.cpp b/src/game/Object.cpp index fc2ffea62..84c693dec 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -720,6 +720,13 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* u *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 *data << m_uint32Values[index]; // other cases } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index c320441e6..0a2246d58 100755 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6272,6 +6272,53 @@ void ObjectMgr::LoadGameobjectInfo() CheckGOLinkedTrapId(goInfo, goInfo->goober.linkedTrapId, 12); 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 { if (goInfo->areadamage.lockId) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 809cdf2d7..82bdfafe0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12627" + #define REVISION_NR "12628" #endif // __REVISION_NR_H__