Added empty vehicle class, vehicle*.dbc struct's

This commit is contained in:
tomrus88 2008-11-11 00:05:00 +03:00
parent 6fae544fbe
commit 204b61c220
19 changed files with 323 additions and 34 deletions

View file

@ -249,6 +249,8 @@ libmangosgame_a_SOURCES = \
UpdateData.h \
UpdateFields.h \
UpdateMask.h \
Vehicle.cpp \
Vehicle.h \
VoiceChatHandler.cpp \
WaypointManager.cpp \
WaypointManager.h \

View file

@ -45,7 +45,6 @@ INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ZThread::FastMutex);
namespace MaNGOS
{
struct MANGOS_DLL_DECL BuildUpdateForPlayer
{
Player &i_player;
@ -631,10 +630,11 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player )
template <class T> UNORDERED_MAP< uint64, T* > HashMapHolder<T>::m_objectMap;
template <class T> ZThread::FastMutex HashMapHolder<T>::i_lock;
/// Global defintions for the hashmap storage
/// Global definitions for the hashmap storage
template class HashMapHolder<Player>;
template class HashMapHolder<Pet>;
template class HashMapHolder<Vehicle>;
template class HashMapHolder<GameObject>;
template class HashMapHolder<DynamicObject>;
template class HashMapHolder<Creature>;
@ -642,6 +642,7 @@ template class HashMapHolder<Corpse>;
template Player* ObjectAccessor::GetObjectInWorld<Player>(uint32 mapid, float x, float y, uint64 guid, Player* /*fake*/);
template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float y, uint64 guid, Pet* /*fake*/);
template Vehicle* ObjectAccessor::GetObjectInWorld<Vehicle>(uint32 mapid, float x, float y, uint64 guid, Vehicle* /*fake*/);
template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, uint64 guid, Creature* /*fake*/);
template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/);
template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/);

View file

@ -31,6 +31,7 @@
#include "GridDefines.h"
#include "Object.h"
#include "Player.h"
#include "Vehicle.h"
#include <set>
@ -72,7 +73,7 @@ class HashMapHolder
static LockType* GetLock() { return &i_lock; }
private:
//Non instanciable only static
//Non instanceable only static
HashMapHolder() {}
static LockType i_lock;

View file

@ -39,7 +39,7 @@ enum HighGuid
HIGHGUID_TRANSPORT = 0xF120, // blizz F120 (for GAMEOBJECT_TYPE_TRANSPORT)
HIGHGUID_UNIT = 0xF130, // blizz F130
HIGHGUID_PET = 0xF140, // blizz F140
HIGHGUID_VEHICLE = 0xF150, // blizz F540
HIGHGUID_VEHICLE = 0xF150, // blizz F550
HIGHGUID_DYNAMICOBJECT = 0xF100, // blizz F100
HIGHGUID_CORPSE = 0xF101, // blizz F100
HIGHGUID_MO_TRANSPORT = 0x1FC0, // blizz 1FC0 (for GAMEOBJECT_TYPE_MO_TRANSPORT)

View file

@ -110,6 +110,7 @@ ObjectMgr::ObjectMgr()
m_hiCharGuid = 1;
m_hiCreatureGuid = 1;
m_hiPetGuid = 1;
m_hiVehicleGuid = 1;
m_hiItemGuid = 1;
m_hiGoGuid = 1;
m_hiDoGuid = 1;
@ -5102,6 +5103,8 @@ void ObjectMgr::SetHighestGuids()
// pet guids are not saved to DB, set to 0 (pet guid != pet id)
m_hiPetGuid = 0;
// same for vehicles
m_hiVehicleGuid = 0;
result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" );
if( result )
@ -5279,6 +5282,14 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh)
sWorld.m_stopEvent = true;
}
return m_hiPetGuid;
case HIGHGUID_VEHICLE:
++m_hiVehicleGuid;
if(m_hiVehicleGuid>=0x00FFFFFF)
{
sLog.outError("Vehicle guid overflow!! Can't continue, shutting down server. ");
sWorld.m_stopEvent = true;
}
return m_hiVehicleGuid;
case HIGHGUID_PLAYER:
++m_hiCharGuid;
if(m_hiCharGuid>=0xFFFFFFFF)

View file

@ -772,6 +772,7 @@ class ObjectMgr
uint32 m_hiCharGuid;
uint32 m_hiCreatureGuid;
uint32 m_hiPetGuid;
uint32 m_hiVehicleGuid;
uint32 m_hiItemGuid;
uint32 m_hiGoGuid;
uint32 m_hiDoGuid;

View file

@ -2063,22 +2063,6 @@ enum SummonType
SUMMON_TYPE_POSESSED2 = 428
};
enum SummonType2
{
SUMMON_TYPE2_UNKNOWN = 0,
SUMMON_TYPE2_SUMMON = 1,
SUMMON_TYPE2_GUARDIAN = 2,
SUMMON_TYPE2_DEMON = 3,
SUMMON_TYPE2_TOTEM = 4,
SUMMON_TYPE2_CRITTER = 5,
SUMMON_TYPE2_GHOUL = 6,
SUMMON_TYPE2_BOMB = 7,
SUMMON_TYPE2_PHASING = 8,
SUMMON_TYPE2_SIEGE_VEH = 9,
SUMMON_TYPE2_DRAKE_VEH = 10,
SUMMON_TYPE2_LIGHTWELL = 11
};
enum ResponseCodes
{
RESPONSE_SUCCESS = 0x00,

View file

@ -146,7 +146,7 @@ Unit::Unit()
m_objectType |= TYPEMASK_UNIT;
m_objectTypeId = TYPEID_UNIT;
// 2.3.2 - 0x70
m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION);
m_updateFlag = (UPDATEFLAG_LOWGUID | UPDATEFLAG_HIGHGUID | UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION);
m_attackTimer[BASE_ATTACK] = 0;
m_attackTimer[OFF_ATTACK] = 0;

78
src/game/Vehicle.cpp Normal file
View file

@ -0,0 +1,78 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
#include "Log.h"
#include "WorldSession.h"
#include "WorldPacket.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Vehicle.h"
#include "MapManager.h"
#include "SpellAuras.h"
#include "Unit.h"
#include "Util.h"
Vehicle::Vehicle() : Creature()
{
m_updateFlag = (UPDATEFLAG_LOWGUID | UPDATEFLAG_HIGHGUID | UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_VEHICLE);
}
Vehicle::~Vehicle()
{
if(m_uint32Values) // only for fully created Object
ObjectAccessor::Instance().RemoveObject(this);
}
void Vehicle::AddToWorld()
{
///- Register the vehicle for guid lookup
if(!IsInWorld()) ObjectAccessor::Instance().AddObject(this);
Unit::AddToWorld();
}
void Vehicle::RemoveFromWorld()
{
///- Remove the vehicle from the accessor
if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
///- Don't call the function for Creature, normal mobs + totems go in a different storage
Unit::RemoveFromWorld();
}
void Vehicle::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState
{
Creature::setDeathState(s);
}
void Vehicle::Update(uint32 diff)
{
Creature::Update(diff);
}
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 Entry)
{
SetMapId(map->GetId());
SetInstanceId(map->GetInstanceId());
Object::_Create(guidlow, Entry, HIGHGUID_VEHICLE);
if(!InitEntry(Entry))
return false;
return true;
}

52
src/game/Vehicle.h Normal file
View file

@ -0,0 +1,52 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOSSERVER_VEHICLE_H
#define MANGOSSERVER_VEHICLE_H
#include "ObjectDefines.h"
#include "Creature.h"
#include "Unit.h"
class Vehicle : public Creature
{
public:
explicit Vehicle();
virtual ~Vehicle();
void AddToWorld();
void RemoveFromWorld();
bool Create (uint32 guidlow, Map *map, uint32 Entry);
void setDeathState(DeathState s); // overwrite virtual Creature::setDeathState and Unit::setDeathState
void Update(uint32 diff); // overwrite virtual Creature::Update and Unit::Update
protected:
private:
void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called
{
assert(false);
}
void DeleteFromDB() // overwrited of Creature::DeleteFromDB - don't must be called
{
assert(false);
}
};
#endif

View file

@ -1513,6 +1513,9 @@ void World::ScriptsProcess()
case HIGHGUID_PET:
source = HashMapHolder<Pet>::Find(step.sourceGUID);
break;
case HIGHGUID_VEHICLE:
source = HashMapHolder<Vehicle>::Find(step.sourceGUID);
break;
case HIGHGUID_PLAYER:
source = HashMapHolder<Player>::Find(step.sourceGUID);
break;
@ -1540,6 +1543,9 @@ void World::ScriptsProcess()
case HIGHGUID_PET:
target = HashMapHolder<Pet>::Find(step.targetGUID);
break;
case HIGHGUID_VEHICLE:
target = HashMapHolder<Vehicle>::Find(step.targetGUID);
break;
case HIGHGUID_PLAYER: // empty GUID case also
target = HashMapHolder<Player>::Find(step.targetGUID);
break;

View file

@ -248,4 +248,51 @@ enum TotemCategoryType
TOTEM_CATEGORY_TYPE_SPANNER = 24
};
// SummonProperties.dbc, col 1
/*enum SummonGroup
{
SUMMON_GROUP_UNKNOWN1 = 0, // 1160 spells in 3.0.3
SUMMON_GROUP_UNKNOWN2 = 1, // 861 spells in 3.0.3
SUMMON_GROUP_PETS = 2, // 52 spells in 3.0.3, pets mostly
SUMMON_GROUP_CONTROLLABLE = 3, // 13 spells in 3.0.3, mostly controllable
SUMMON_GROUP_UNKNOWN3 = 4 // 86 spells in 3.0.3, taxi/mounts
};
// SummonProperties.dbc, col 3
enum SummonType
{
SUMMON_TYPE_UNKNOWN = 0, // different summons, 1330 spells in 3.0.3
SUMMON_TYPE_SUMMON = 1, // generic summons, 49 spells in 3.0.3
SUMMON_TYPE_GUARDIAN = 2, // summon guardian, 393 spells in 3.0.3
SUMMON_TYPE_ARMY = 3, // summon army, 5 spells in 3.0.3
SUMMON_TYPE_TOTEM = 4, // summon totem, 169 spells in 3.0.3
SUMMON_TYPE_CRITTER = 5, // critter/minipet, 195 spells in 3.0.3
SUMMON_TYPE_DK = 6, // summon DRW/Ghoul, 2 spells in 3.0.3
SUMMON_TYPE_BOMB = 7, // summon bot/bomb, 4 spells in 3.0.3
SUMMON_TYPE_PHASING = 8, // something todo with DK prequest line, 2 spells in 3.0.3
SUMMON_TYPE_SIEGE_VEH = 9, // summon different vehicles, 14 spells in 3.0.3
SUMMON_TYPE_DRAKE_VEH = 10, // summon drake (vehicle), 3 spells
SUMMON_TYPE_LIGHTWELL = 11 // summon lightwell, 6 spells in 3.0.3
};
// SummonProperties.dbc, col 5
enum SummonFlags
{
SUMMON_FLAG_NONE = 0x0000, // 1342 spells in 3.0.3
SUMMON_FLAG_UNK1 = 0x0001, // 75 spells in 3.0.3, something unfriendly
SUMMON_FLAG_UNK2 = 0x0002, // 616 spells in 3.0.3, something friendly
SUMMON_FLAG_UNK3 = 0x0004, // 22 spells in 3.0.3, no idea...
SUMMON_FLAG_UNK4 = 0x0008, // 49 spells in 3.0.3, some mounts
SUMMON_FLAG_UNK5 = 0x0010, // 25 spells in 3.0.3, quest related?
SUMMON_FLAG_UNK6 = 0x0020, // 0 spells in 3.0.3, unused
SUMMON_FLAG_UNK7 = 0x0040, // 12 spells in 3.0.3, no idea
SUMMON_FLAG_UNK8 = 0x0080, // 4 spells in 3.0.3, no idea
SUMMON_FLAG_UNK9 = 0x0100, // 51 spells in 3.0.3, no idea, many quest related
SUMMON_FLAG_UNK10 = 0x0200, // 51 spells in 3.0.3, something defensive
SUMMON_FLAG_UNK11 = 0x0400, // 3 spells, requires something near?
SUMMON_FLAG_UNK12 = 0x0800, // 30 spells in 3.0.3, no idea
SUMMON_FLAG_UNK13 = 0x1000, // 8 spells in 3.0.3, siege vehicle
SUMMON_FLAG_UNK14 = 0x2000, // 2 spells in 3.0.3, escort?
};
*/
#endif

View file

@ -109,7 +109,7 @@ DBCStorage <SpellRangeEntry> sSpellRangeStore(SpellRangefmt);
DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostfmt);
DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore(SpellShapeshiftfmt);
DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore(StableSlotPricesfmt);
DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore(SummonPropertiesfmt);
//DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore(SummonPropertiesfmt);
DBCStorage <TalentEntry> sTalentStore(TalentEntryfmt);
TalentSpellPosMap sTalentSpellPosMap;
DBCStorage <TalentTabEntry> sTalentTabStore(TalentTabEntryfmt);
@ -319,7 +319,7 @@ void LoadDBCStores(std::string dataPath)
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellRuneCostStore, dbcPath,"SpellRuneCost.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSpellShapeshiftStore, dbcPath,"SpellShapeshiftForm.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sStableSlotPricesStore, dbcPath,"StableSlotPrices.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc");
//LoadDBC(availableDbcLocales,bar,bad_dbc_files,sSummonPropertiesStore, dbcPath,"SummonProperties.dbc");
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sTalentStore, dbcPath,"Talent.dbc");
// create talent spells set

View file

@ -191,7 +191,7 @@ extern DBCStorage <SpellRuneCostEntry> sSpellRuneCostStore;
extern DBCStorage <SpellShapeshiftEntry> sSpellShapeshiftStore;
extern DBCStorage <SpellEntry> sSpellStore;
extern DBCStorage <StableSlotPricesEntry> sStableSlotPricesStore;
extern DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore;
//extern DBCStorage <SummonPropertiesEntry> sSummonPropertiesStore;
extern DBCStorage <TalentEntry> sTalentStore;
extern DBCStorage <TalentTabEntry> sTalentTabStore;
extern DBCStorage <TaxiNodesEntry> sTaxiNodesStore;

View file

@ -1100,7 +1100,7 @@ struct SpellEntry
uint32 StartRecoveryTime; // 209 m_startRecoveryTime
uint32 MaxTargetLevel; // 210 m_maxTargetLevel
uint32 SpellFamilyName; // 211 m_spellClassSet
uint64 SpellFamilyFlags; // 212-213 m_spellClassMask
uint64 SpellFamilyFlags; // 212-213 m_spellClassMask NOTE: size is 12 bytes!!!
uint32 SpellFamilyFlags2; // 214 addition to m_spellClassMask
uint32 MaxAffectedTargets; // 215 m_maxTargets
uint32 DmgClass; // 216 m_defenseType
@ -1234,15 +1234,15 @@ struct StableSlotPricesEntry
uint32 Price;
};
struct SummonPropertiesEntry
/*struct SummonPropertiesEntry
{
uint32 Id;
uint32 Unk1;
uint32 Unk2;
uint32 Type;
uint32 Slot;
uint32 Flags;
};
uint32 Id; // 0
uint32 Group; // 1, 0 - can't be controlled?, 1 - something guardian?, 2 - pet?, 3 - something controllable?, 4 - taxi/mount?
uint32 Unk2; // 2, 14 rows > 0
uint32 Type; // 3, see enum
uint32 Slot; // 4, 0-6
uint32 Flags; // 5
};*/
struct TalentEntry
{
@ -1320,6 +1320,90 @@ struct TotemCategoryEntry
uint32 categoryMask; // 19 (compatibility mask for same type: different for totems, compatible from high to low for rods)
};
struct VehicleEntry
{
uint32 m_ID; // 0
uint32 m_flags; // 1
float m_turnSpeed; // 2
float m_pitchSpeed; // 3
float m_pitchMin; // 4
float m_pitchMax; // 5
uint32 m_seatID[8]; // 6-13
float m_mouseLookOffsetPitch; // 14
float m_cameraFadeDistScalarMin; // 15
float m_cameraFadeDistScalarMax; // 16
float m_cameraPitchOffset; // 17
int m_powerType[3]; // 18-20
int m_powerToken[3]; // 21-23
float m_facingLimitRight; // 24
float m_facingLimitLeft; // 25
float m_msslTrgtTurnLingering; // 26
float m_msslTrgtPitchLingering; // 27
float m_msslTrgtMouseLingering; // 28
float m_msslTrgtEndOpacity; // 29
float m_msslTrgtArcSpeed; // 30
float m_msslTrgtArcRepeat; // 31
float m_msslTrgtArcWidth; // 32
float m_msslTrgtImpactRadius[2]; // 33-34
char* m_msslTrgtArcTexture; // 35
char* m_msslTrgtImpactTexture; // 36
char* m_msslTrgtImpactModel[2]; // 37-38
float m_cameraYawOffset; // 39
uint32 m_uiLocomotionType; // 40
float m_msslTrgtImpactTexRadius; // 41
uint32 m_uiSeatIndicatorType; // 42
};
struct VehicleSeatEntry
{
uint32 m_ID; // 0
uint32 m_flags; // 1
int32 m_attachmentID; // 2
float m_attachmentOffsetX; // 3
float m_attachmentOffsetY; // 4
float m_attachmentOffsetZ; // 5
float m_enterPreDelay; // 6
float m_enterSpeed; // 7
float m_enterGravity; // 8
float m_enterMinDuration; // 9
float m_enterMaxDuration; // 10
float m_enterMinArcHeight; // 11
float m_enterMaxArcHeight; // 12
int32 m_enterAnimStart; // 13
int32 m_enterAnimLoop; // 14
int32 m_rideAnimStart; // 15
int32 m_rideAnimLoop; // 16
int32 m_rideUpperAnimStart; // 17
int32 m_rideUpperAnimLoop; // 18
float m_exitPreDelay; // 19
float m_exitSpeed; // 20
float m_exitGravity; // 21
float m_exitMinDuration; // 22
float m_exitMaxDuration; // 23
float m_exitMinArcHeight; // 24
float m_exitMaxArcHeight; // 25
int32 m_exitAnimStart; // 26
int32 m_exitAnimLoop; // 27
int32 m_exitAnimEnd; // 28
float m_passengerYaw; // 29
float m_passengerPitch; // 30
float m_passengerRoll; // 31
int32 m_passengerAttachmentID; // 32
int32 m_vehicleEnterAnim; // 33
int32 m_vehicleExitAnim; // 34
int32 m_vehicleRideAnimLoop; // 35
int32 m_vehicleEnterAnimBone; // 36
int32 m_vehicleExitAnimBone; // 37
int32 m_vehicleRideAnimLoopBone; // 38
float m_vehicleEnterAnimDelay; // 39
float m_vehicleExitAnimDelay; // 40
uint32 m_vehicleAbilityDisplay; // 41
uint32 m_enterUISoundID; // 42
uint32 m_exitUISoundID; // 43
int32 m_uiSkin; // 44
uint32 m_flagsB; // 45
};
struct WorldMapAreaEntry
{
//uint32 ID; // 0

View file

@ -77,7 +77,7 @@ const char SpellRangefmt[]="nfxfxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellRuneCostfmt[]="niiii";
const char SpellShapeshiftfmt[]="nxxxxxxxxxxxxxxxxxxiixixxxxxxxxxxxx";
const char StableSlotPricesfmt[] = "ni";
const char SummonPropertiesfmt[] = "niiiii";
//const char SummonPropertiesfmt[] = "niiiii";
const char TalentEntryfmt[]="niiiiiiiixxxxixxixxxxxx";
const char TalentTabEntryfmt[]="nxxxxxxxxxxxxxxxxxxxiiix";
const char TaxiNodesEntryfmt[]="nifffxxxxxxxxxxxxxxxxxii";

View file

@ -758,6 +758,12 @@
<File
RelativePath="..\..\src\game\UpdateMask.h">
</File>
<File
RelativePath="..\..\src\game\Vehicle.cpp">
</File>
<File
RelativePath="..\..\src\game\Vehicle.h">
</File>
<File
RelativePath="..\..\src\game\WaypointMovementGenerator.cpp">
</File>

View file

@ -1182,6 +1182,14 @@
RelativePath="..\..\src\game\UpdateMask.h"
>
</File>
<File
RelativePath="..\..\src\game\Vehicle.cpp"
>
</File>
<File
RelativePath="..\..\src\game\Vehicle.h"
>
</File>
<File
RelativePath="..\..\src\game\WaypointMovementGenerator.cpp"
>

View file

@ -1184,6 +1184,14 @@
RelativePath="..\..\src\game\UpdateMask.h"
>
</File>
<File
RelativePath="..\..\src\game\Vehicle.cpp"
>
</File>
<File
RelativePath="..\..\src\game\Vehicle.h"
>
</File>
<File
RelativePath="..\..\src\game\WaypointMovementGenerator.cpp"
>