diff options
| author | Shauren <shauren.trinity@gmail.com> | 2017-06-04 01:00:45 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2017-06-04 01:00:45 +0200 |
| commit | b453e124231a90321fe79fbf3a62acdcfa54a691 (patch) | |
| tree | ca2a815b923080385ed9a3a69aefe20ee54a7969 /src/server/game/Entities | |
| parent | ec72a59b08e71ebc7ba00b32592ec903a7995a84 (diff) | |
Core/Game: Include cleanup part 5
* ObjectMgr.h
* Player.h
* Unit.h
* G3D should no longer propagate everywhere from Spline/MotionMaster
Diffstat (limited to 'src/server/game/Entities')
38 files changed, 2144 insertions, 1990 deletions
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 5106b37cea1..d545cbb003e 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -31,6 +31,7 @@ #include "Player.h" #include "ScriptMgr.h" #include "SpellInfo.h" +#include "Spline.h" #include "Transport.h" #include "Unit.h" #include "UpdateData.h" @@ -409,19 +410,17 @@ void AreaTrigger::UpdatePolygonOrientation() if (G3D::fuzzyEq(_previousCheckOrientation, newOrientation)) return; - _polygonVertices = GetTemplate()->PolygonVertices; + _polygonVertices.assign(GetTemplate()->PolygonVertices.begin(), GetTemplate()->PolygonVertices.end()); float angleSin = std::sin(newOrientation); float angleCos = std::cos(newOrientation); // This is needed to rotate the vertices, following orientation - for (G3D::Vector2& vertice : _polygonVertices) + for (Position& vertice : _polygonVertices) { - float tempX = vertice.x; - float tempY = vertice.y; - - vertice.x = tempX * angleCos - tempY * angleSin; - vertice.y = tempX * angleSin + tempY * angleCos; + float tempX = vertice.GetPositionX(); + float tempY = vertice.GetPositionY(); + vertice.Relocate(tempX * angleCos - tempY * angleSin, tempX * angleSin + tempY * angleCos); } _previousCheckOrientation = newOrientation; @@ -451,10 +450,10 @@ bool AreaTrigger::CheckIsInPolygon2D(Position const* pos) const nextVertex = vertex + 1; } - float vertX_i = GetPositionX() + _polygonVertices[vertex].x; - float vertY_i = GetPositionY() + _polygonVertices[vertex].y; - float vertX_j = GetPositionX() + _polygonVertices[nextVertex].x; - float vertY_j = GetPositionY() + _polygonVertices[nextVertex].y; + float vertX_i = GetPositionX() + _polygonVertices[vertex].GetPositionX(); + float vertY_i = GetPositionY() + _polygonVertices[vertex].GetPositionY(); + float vertX_j = GetPositionX() + _polygonVertices[nextVertex].GetPositionX(); + float vertY_j = GetPositionY() + _polygonVertices[nextVertex].GetPositionY(); // following statement checks if testPoint.Y is below Y-coord of i-th vertex bool belowLowY = vertY_i > testY; @@ -561,42 +560,45 @@ void AreaTrigger::DoActions(Unit* unit) void AreaTrigger::UndoActions(Unit* unit) { for (AreaTriggerAction const& action : GetTemplate()->Actions) - { if (action.ActionType == AREATRIGGER_ACTION_CAST || action.ActionType == AREATRIGGER_ACTION_ADDAURA) unit->RemoveAurasDueToSpell(action.Param, GetCasterGuid()); - } } -void AreaTrigger::InitSplineOffsets(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget) +void AreaTrigger::InitSplineOffsets(std::vector<Position> const& splinePoints, uint32 timeToTarget) { float angleSin = std::sin(GetOrientation()); float angleCos = std::cos(GetOrientation()); // This is needed to rotate the spline, following caster orientation - for (G3D::Vector3& spline : splinePoints) + std::vector<G3D::Vector3> rotatedPoints; + rotatedPoints.reserve(splinePoints.size()); + for (Position const& spline : splinePoints) { - float tempX = spline.x; - float tempY = spline.y; + float tempX = spline.GetPositionX(); + float tempY = spline.GetPositionY(); float tempZ = GetPositionZ(); - spline.x = (tempX * angleCos - tempY * angleSin) + GetPositionX(); - spline.y = (tempX * angleSin + tempY * angleCos) + GetPositionY(); - UpdateAllowedPositionZ(spline.x, spline.y, tempZ); - spline.z += tempZ; + UpdateAllowedPositionZ(spline.GetPositionX(), spline.GetPositionY(), tempZ); + rotatedPoints.emplace_back( + (tempX * angleCos - tempY * angleSin) + GetPositionX(), + (tempX * angleSin + tempY * angleCos) + GetPositionY(), + tempZ + ); } - InitSplines(splinePoints, timeToTarget); + InitSplines(std::move(rotatedPoints), timeToTarget); } -void AreaTrigger::InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget) +void AreaTrigger::InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget) { if (splinePoints.size() < 2) return; _movementTime = 0; - _spline.init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear); - _spline.initLengths(); + _spline = Trinity::make_unique<::Movement::Spline<int32>>(); + _spline->init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear); + _spline->initLengths(); // should be sent in object create packets only m_uint32Values[AREATRIGGER_TIME_TO_TARGET] = timeToTarget; @@ -624,6 +626,11 @@ void AreaTrigger::InitSplines(std::vector<G3D::Vector3> const& splinePoints, uin _reachedDestination = false; } +bool AreaTrigger::HasSplines() const +{ + return !_spline->empty(); +} + void AreaTrigger::UpdateSplinePosition(uint32 diff) { if (_reachedDestination) @@ -637,9 +644,9 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff) if (_movementTime >= GetTimeToTarget()) { _reachedDestination = true; - _lastSplineIndex = int32(_spline.last()); + _lastSplineIndex = int32(_spline->last()); - G3D::Vector3 lastSplinePosition = _spline.getPoint(_lastSplineIndex); + G3D::Vector3 lastSplinePosition = _spline->getPoint(_lastSplineIndex); GetMap()->AreaTriggerRelocation(this, lastSplinePosition.x, lastSplinePosition.y, lastSplinePosition.z, GetOrientation()); #ifdef TRINITY_DEBUG DebugVisualizePosition(); @@ -669,15 +676,15 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff) int lastPositionIndex = 0; float percentFromLastPoint = 0; - _spline.computeIndex(currentTimePercent, lastPositionIndex, percentFromLastPoint); + _spline->computeIndex(currentTimePercent, lastPositionIndex, percentFromLastPoint); G3D::Vector3 currentPosition; - _spline.evaluate_percent(lastPositionIndex, percentFromLastPoint, currentPosition); + _spline->evaluate_percent(lastPositionIndex, percentFromLastPoint, currentPosition); float orientation = GetOrientation(); if (GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_FACE_MOVEMENT_DIR)) { - G3D::Vector3 const& nextPoint = _spline.getPoint(lastPositionIndex + 1); + G3D::Vector3 const& nextPoint = _spline->getPoint(lastPositionIndex + 1); orientation = GetAngle(nextPoint.x, nextPoint.y); } diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h index f1284754600..d3b92cae0ae 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h @@ -19,7 +19,6 @@ #define TRINITYCORE_AREATRIGGER_H #include "Object.h" -#include "Spline.h" #include "MapObject.h" class AreaTriggerTemplate; @@ -31,6 +30,17 @@ class AuraEffect; struct AreaTriggerPolygonVertice; +namespace G3D +{ + class Vector2; + class Vector3; +} +namespace Movement +{ + template<typename length_type> + class Spline; +} + class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigger>, public MapObject { public: @@ -71,10 +81,10 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge Position const& GetRollPitchYaw() const { return _rollPitchYaw; } Position const& GetTargetRollPitchYaw() const { return _targetRollPitchYaw; } - void InitSplineOffsets(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget); - void InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget); - bool HasSplines() const { return !_spline.empty(); } - ::Movement::Spline<int32> const& GetSpline() const { return _spline; } + void InitSplineOffsets(std::vector<Position> const& splinePoints, uint32 timeToTarget); + void InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget); + bool HasSplines() const; + ::Movement::Spline<int32> const& GetSpline() const { return *_spline; } uint32 GetElapsedTimeForMovement() const { return GetTimeSinceCreated(); } /// @todo: research the right value, in sniffs both timers are nearly identical void UpdateShape(); @@ -111,8 +121,8 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge Position _rollPitchYaw; Position _targetRollPitchYaw; - std::vector<G3D::Vector2> _polygonVertices; - ::Movement::Spline<int32> _spline; + std::vector<Position> _polygonVertices; + std::unique_ptr<::Movement::Spline<int32>> _spline; bool _reachedDestination; int32 _lastSplineIndex; diff --git a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp index 5a34fbcb474..2b3c1cfe19f 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp @@ -65,9 +65,10 @@ void AreaTriggerTemplate::InitMaxSearchRadius() if (PolygonDatas.Height <= 0.0f) PolygonDatas.Height = 1.0f; - for (G3D::Vector2 const& vertice : PolygonVertices) + Position center(0.0f, 0.0f); + for (TaggedPosition<Position::XY> const& vertice : PolygonVertices) { - float pointDist = vertice.length(); + float pointDist = center.GetExactDist2d(vertice); if (pointDist > MaxSearchRadius) MaxSearchRadius = pointDist; diff --git a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h index 64db8856666..0fa2ce01c54 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h +++ b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h @@ -19,14 +19,9 @@ #define TRINITYCORE_AREATRIGGER_TEMPLATE_H #include "Define.h" +#include "Position.h" #include <vector> -namespace G3D -{ - class Vector2; - class Vector3; -} - #define MAX_AREATRIGGER_ENTITY_DATA 6 #define MAX_AREATRIGGER_SCALE 7 @@ -117,8 +112,8 @@ public: uint32 Flags; uint32 ScriptId; float MaxSearchRadius; - std::vector<G3D::Vector2> PolygonVertices; - std::vector<G3D::Vector2> PolygonVerticesTarget; + std::vector<TaggedPosition<Position::XY>> PolygonVertices; + std::vector<TaggedPosition<Position::XY>> PolygonVerticesTarget; std::vector<AreaTriggerAction> Actions; union @@ -186,7 +181,7 @@ public: AreaTriggerScaleInfo ScaleInfo; AreaTriggerTemplate const* Template; - std::vector<G3D::Vector3> SplinePoints; + std::vector<Position> SplinePoints; }; #endif diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 91adaa4ca34..b119dc4283a 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -19,7 +19,9 @@ #include "Common.h" #include "Corpse.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "Log.h" +#include "Map.h" #include "ObjectAccessor.h" #include "Player.h" #include "UpdateData.h" diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index f3b40225078..0396786871c 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -19,6 +19,7 @@ #include "Creature.h" #include "BattlegroundMgr.h" #include "CellImpl.h" +#include "CombatPackets.h" #include "Common.h" #include "CreatureAI.h" #include "CreatureAISelector.h" @@ -27,29 +28,29 @@ #include "Formulas.h" #include "GameEventMgr.h" #include "GossipDef.h" -#include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "Group.h" #include "GroupMgr.h" #include "InstanceScript.h" #include "Log.h" #include "LootMgr.h" +#include "MiscPackets.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" #include "PoolMgr.h" #include "QuestDef.h" +#include "ScriptedGossip.h" #include "SpellAuraEffects.h" #include "SpellMgr.h" #include "TemporarySummon.h" +#include "Transport.h" #include "Util.h" #include "Vehicle.h" #include "World.h" #include "WorldPacket.h" -#include "CombatPackets.h" -#include "MiscPackets.h" - -#include "Transport.h" -#include "ScriptedGossip.h" +#include <G3D/g3dmath.h> TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const { @@ -60,27 +61,27 @@ TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const return nullptr; } +bool VendorItem::IsGoldRequired(ItemTemplate const* pProto) const +{ + return pProto->GetFlags2() & ITEM_FLAG2_DONT_IGNORE_BUY_PRICE || !ExtendedCost; +} + bool VendorItemData::RemoveItem(uint32 item_id, uint8 type) { - bool found = false; - for (VendorItemList::iterator i = m_items.begin(); i != m_items.end();) + auto newEnd = std::remove_if(m_items.begin(), m_items.end(), [=](VendorItem const& vendorItem) { - if ((*i)->item == item_id && (*i)->Type == type) - { - i = m_items.erase(i++); - found = true; - } - else - ++i; - } + return vendorItem.item == item_id && vendorItem.Type == type; + }); + bool found = newEnd != m_items.end(); + m_items.erase(newEnd, m_items.end()); return found; } VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const { - for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i) - if ((*i)->item == item_id && (*i)->ExtendedCost == extendedCost && (*i)->Type == type) - return *i; + for (VendorItem const& vendorItem : m_items) + if (vendorItem.item == item_id && vendorItem.ExtendedCost == extendedCost && vendorItem.Type == type) + return &vendorItem; return nullptr; } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 2b6bde797ad..03d69454e2b 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -19,12 +19,12 @@ #ifndef TRINITYCORE_CREATURE_H #define TRINITYCORE_CREATURE_H +#include "Unit.h" #include "Common.h" +#include "CreatureData.h" +#include "DatabaseEnvFwd.h" #include "Duration.h" -#include "Unit.h" -#include "ItemTemplate.h" #include "Loot.h" -#include "DatabaseEnvFwd.h" #include "MapObject.h" #include <list> @@ -36,598 +36,11 @@ class Quest; class Player; class SpellInfo; class WorldSession; - -enum CreatureDifficultyFlags -{ - CREATURE_DIFFICULTYFLAGS_UNK1 = 0x00000001, // Related to mounts - CREATURE_DIFFICULTYFLAGS_NO_EXPERIENCE = 0x00000002, - CREATURE_DIFFICULTYFLAGS_NO_LOOT = 0x00000004, - CREATURE_DIFFICULTYFLAGS_UNKILLABLE = 0x00000008, - CREATURE_DIFFICULTYFLAGS_TAMEABLE = 0x00000010, // CREATURE_TYPEFLAGS_TAMEABLE - CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_PC = 0x00000020, // UNIT_FLAG_IMMUNE_TO_PC - CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_NPC = 0x00000040, // UNIT_FLAG_IMMUNE_TO_NPC - CREATURE_DIFFICULTYFLAGS_UNK2 = 0x00000080, - CREATURE_DIFFICULTYFLAGS_SESSILE = 0x00000100, // Creature is rooted - CREATURE_DIFFICULTYFLAGS_NOT_SELECTABLE = 0x00000200, // UNIT_FLAG_NOT_SELECTABLE - CREATURE_DIFFICULTYFLAGS_UNK3 = 0x00000400, // Related to health - it seems similar to CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET - CREATURE_DIFFICULTYFLAGS_NO_CORPSE_UPON_DEATH = 0x00000800, // Creature instantly disappear when killed - CREATURE_DIFFICULTYFLAGS_UNK5 = 0x00001000, - CREATURE_DIFFICULTYFLAGS_UNK6 = 0x00002000, - CREATURE_DIFFICULTYFLAGS_UNK7 = 0x00004000, - CREATURE_DIFFICULTYFLAGS_UNK8 = 0x00008000, - CREATURE_DIFFICULTYFLAGS_BOSS = 0x00010000, // CREATURE_TYPEFLAGS_BOSS - CREATURE_DIFFICULTYFLAGS_UNK9 = 0x00020000, - CREATURE_DIFFICULTYFLAGS_WATER_BOUND = 0x00040000, - CREATURE_DIFFICULTYFLAGS_CAN_PENETRATE_WATER = 0x00080000, - CREATURE_DIFFICULTYFLAGS_UNK10 = 0x00100000, - CREATURE_DIFFICULTYFLAGS_GHOST = 0x00200000, // CREATURE_TYPEFLAGS_GHOST - CREATURE_DIFFICULTYFLAGS_UNK11 = 0x00400000, - CREATURE_DIFFICULTYFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION = 0x00800000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION - CREATURE_DIFFICULTYFLAGS_HIDE_FACTION_TOOLTIP = 0x01000000, // CREATURE_TYPEFLAGS_HIDE_FACTION_TOOLTIP - CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT = 0x02000000, - CREATURE_DIFFICULTYFLAGS_UNK12 = 0x04000000, - CREATURE_DIFFICULTYFLAGS_SUMMON_GUARD_IF_IN_AGGRO_RANGE = 0x08000000, // Creature will summon a guard if player is within its aggro range (even if creature doesn't attack per se) - CREATURE_DIFFICULTYFLAGS_ONLY_SWIM = 0x10000000, // UNIT_FLAG_UNK_15 - CREATURE_DIFFICULTYFLAGS_UNK13 = 0x20000000, // Related to gravity - CREATURE_DIFFICULTYFLAGS_TFLAG_UNK5 = 0x40000000, // CREATURE_TYPEFLAGS_UNK5 - CREATURE_DIFFICULTYFLAGS_LARGE_AOI = 0x80000000 // UnitFlags2 0x200000 -}; - -enum CreatureDifficultyFlags2 -{ - CREATURE_DIFFICULTYFLAGS_2_UNK1 = 0x00000001, - CREATURE_DIFFICULTYFLAGS_2_FORCE_PARTY_MEMBERS_INTO_COMBAT = 0x00000002, - CREATURE_DIFFICULTYFLAGS_2_UNK2 = 0x00000004, - CREATURE_DIFFICULTYFLAGS_2_SPELL_ATTACKABLE = 0x00000008, // CREATURE_TYPEFLAGS_SPELL_ATTACKABLE - CREATURE_DIFFICULTYFLAGS_2_UNK3 = 0x00000010, - CREATURE_DIFFICULTYFLAGS_2_UNK4 = 0x00000020, - CREATURE_DIFFICULTYFLAGS_2_UNK5 = 0x00000040, - CREATURE_DIFFICULTYFLAGS_2_UNK6 = 0x00000080, - CREATURE_DIFFICULTYFLAGS_2_UNK7 = 0x00000100, - CREATURE_DIFFICULTYFLAGS_2_UNK8 = 0x00000200, - CREATURE_DIFFICULTYFLAGS_2_UNK9 = 0x00000400, - CREATURE_DIFFICULTYFLAGS_2_DEAD_INTERACT = 0x00000800, // CREATURE_TYPEFLAGS_DEAD_INTERACT - CREATURE_DIFFICULTYFLAGS_2_UNK10 = 0x00001000, - CREATURE_DIFFICULTYFLAGS_2_UNK11 = 0x00002000, - CREATURE_DIFFICULTYFLAGS_2_HERBLOOT = 0x00004000, // CREATURE_TYPEFLAGS_HERBLOOT - CREATURE_DIFFICULTYFLAGS_2_MININGLOOT = 0x00008000, // CREATURE_TYPEFLAGS_MININGLOOT - CREATURE_DIFFICULTYFLAGS_2_DONT_LOG_DEATH = 0x00010000, // CREATURE_TYPEFLAGS_DONT_LOG_DEATH - CREATURE_DIFFICULTYFLAGS_2_UNK12 = 0x00020000, - CREATURE_DIFFICULTYFLAGS_2_MOUNTED_COMBAT = 0x00040000, // CREATURE_TYPEFLAGS_MOUNTED_COMBAT - CREATURE_DIFFICULTYFLAGS_2_UNK13 = 0x00080000, - CREATURE_DIFFICULTYFLAGS_2_UNK14 = 0x00100000, // This flag seems similar to CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT - CREATURE_DIFFICULTYFLAGS_2_UNK15 = 0x00200000, - CREATURE_DIFFICULTYFLAGS_2_UNK16 = 0x00400000, - CREATURE_DIFFICULTYFLAGS_2_UNK17 = 0x00800000, - CREATURE_DIFFICULTYFLAGS_2_UNK18 = 0x01000000, - CREATURE_DIFFICULTYFLAGS_2_HIDE_BODY = 0x02000000, // UNIT_FLAG2_UNK1 - CREATURE_DIFFICULTYFLAGS_2_UNK19 = 0x04000000, - CREATURE_DIFFICULTYFLAGS_2_SERVER_ONLY = 0x08000000, - CREATURE_DIFFICULTYFLAGS_2_CAN_SAFE_FALL = 0x10000000, - CREATURE_DIFFICULTYFLAGS_2_CAN_ASSIST = 0x20000000, // CREATURE_TYPEFLAGS_CAN_ASSIST - CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET = 0x40000000, - CREATURE_DIFFICULTYFLAGS_2_IS_PET_BAR_USED = 0x80000000 // CREATURE_TYPEFLAGS_IS_PET_BAR_USED -}; - -enum CreatureDifficultyFlags3 -{ - CREATURE_DIFFICULTYFLAGS_3_UNK1 = 0x00000001, - CREATURE_DIFFICULTYFLAGS_3_UNK2 = 0x00000002, - CREATURE_DIFFICULTYFLAGS_3_INSTANTLY_APPEAR_MODEL = 0x00000004, // UNIT_FLAG2_INSTANTLY_APPEAR_MODEL - CREATURE_DIFFICULTYFLAGS_3_MASK_UID = 0x00000008, // CREATURE_TYPEFLAG_MASK_UID - CREATURE_DIFFICULTYFLAGS_3_ENGINEERLOOT = 0x00000010, // CREATURE_TYPEFLAGS_ENGINEERLOOT - CREATURE_DIFFICULTYFLAGS_3_UNK3 = 0x00000020, - CREATURE_DIFFICULTYFLAGS_3_UNK4 = 0x00000040, - CREATURE_DIFFICULTYFLAGS_3_UNK5 = 0x00000080, - CREATURE_DIFFICULTYFLAGS_3_CANNOT_SWIM = 0x00000100, // UNIT_FLAG_UNK_14 - CREATURE_DIFFICULTYFLAGS_3_EXOTIC = 0x00000200, // CREATURE_TYPEFLAGS_EXOTIC - CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI = 0x00000400, // Since MoP, creatures with that flag have UnitFlags2 0x400000 - CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI = 0x00000800, // Since MoP, creatures with that flag have UnitFlags2 0x40000000 - CREATURE_DIFFICULTYFLAGS_3_WATERWALKING = 0x00001000, - CREATURE_DIFFICULTYFLAGS_3_HIDE_NAMEPLATE = 0x00002000, // CREATURE_TYPEFLAGS_HIDE_NAMEPLATE - CREATURE_DIFFICULTYFLAGS_3_UNK6 = 0x00004000, - CREATURE_DIFFICULTYFLAGS_3_UNK7 = 0x00008000, - CREATURE_DIFFICULTYFLAGS_3_USE_DEFAULT_COLLISION_BOX = 0x00010000, // CREATURE_TYPEFLAGS_USE_DEFAULT_COLLISION_BOX - CREATURE_DIFFICULTYFLAGS_3_UNK8 = 0x00020000, - CREATURE_DIFFICULTYFLAGS_3_IS_SIEGE_WEAPON = 0x00040000, // CREATURE_TYPEFLAGS_IS_SIEGE_WEAPON - CREATURE_DIFFICULTYFLAGS_3_UNK9 = 0x00080000, - CREATURE_DIFFICULTYFLAGS_3_UNK10 = 0x00100000, - CREATURE_DIFFICULTYFLAGS_3_UNK11 = 0x00200000, - CREATURE_DIFFICULTYFLAGS_3_PROJECTILE_COLLISION = 0x00400000, // CREATURE_TYPEFLAGS_PROJECTILE_COLLISION - CREATURE_DIFFICULTYFLAGS_3_CAN_BE_MULTITAPPED = 0x00800000, - CREATURE_DIFFICULTYFLAGS_3_DO_NOT_PLAY_MOUNTED_ANIMATIONS = 0x01000000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_MOUNTED_ANIMATIONS - CREATURE_DIFFICULTYFLAGS_3_DISABLE_TURN = 0x02000000, // UNIT_FLAG2_DISABLE_TURN - CREATURE_DIFFICULTYFLAGS_3_UNK12 = 0x04000000, - CREATURE_DIFFICULTYFLAGS_3_UNK13 = 0x08000000, - CREATURE_DIFFICULTYFLAGS_3_UNK14 = 0x10000000, - CREATURE_DIFFICULTYFLAGS_3_IS_LINK_ALL = 0x20000000, // CREATURE_TYPEFLAGS_IS_LINK_ALL - CREATURE_DIFFICULTYFLAGS_3_UNK15 = 0x40000000, - CREATURE_DIFFICULTYFLAGS_3_UNK16 = 0x80000000 -}; - -enum CreatureDifficultyFlags4 -{ - CREATURE_DIFFICULTYFLAGS_4_HAS_NO_BIRTH_ANIMATION = 0x00000001, // SMSG_UPDATE_OBJECT's "NoBirthAnim" - CREATURE_DIFFICULTYFLAGS_4_UNK1 = 0x00000002, - CREATURE_DIFFICULTYFLAGS_4_UNK2 = 0x00000004, - CREATURE_DIFFICULTYFLAGS_4_INTERACT_ONLY_WITH_CREATOR = 0x00000008, // CREATURE_TYPEFLAGS_INTERACT_ONLY_WITH_CREATOR - CREATURE_DIFFICULTYFLAGS_4_DO_NOT_PLAY_UNIT_EVENT_SOUNDS = 0x00000010, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_UNIT_EVENT_SOUNDS - CREATURE_DIFFICULTYFLAGS_4_HAS_NO_SHADOW_BLOB = 0x00000020, // CREATURE_TYPEFLAGS_HAS_NO_SHADOW_BLOB - CREATURE_DIFFICULTYFLAGS_4_UNK3 = 0x00000040, - CREATURE_DIFFICULTYFLAGS_4_UNK4 = 0x00000080, - CREATURE_DIFFICULTYFLAGS_4_UNK5 = 0x00000100, - CREATURE_DIFFICULTYFLAGS_4_UNK6 = 0x00000200, - CREATURE_DIFFICULTYFLAGS_4_UNK7 = 0x00000400, - CREATURE_DIFFICULTYFLAGS_4_UNK8 = 0x00000800, - CREATURE_DIFFICULTYFLAGS_4_UNK9 = 0x00001000, - CREATURE_DIFFICULTYFLAGS_4_UNK10 = 0x00002000, - CREATURE_DIFFICULTYFLAGS_4_UNK11 = 0x00004000, - CREATURE_DIFFICULTYFLAGS_4_UFLAG2_UNK20 = 0x00008000, // UnitFlags2 0x100000 - CREATURE_DIFFICULTYFLAGS_4_UNK12 = 0x00010000, - CREATURE_DIFFICULTYFLAGS_4_UNK13 = 0x00020000, - CREATURE_DIFFICULTYFLAGS_4_UNK14 = 0x00040000, - CREATURE_DIFFICULTYFLAGS_4_FORCE_GOSSIP = 0x00080000, // CREATURE_TYPEFLAGS_FORCE_GOSSIP - CREATURE_DIFFICULTYFLAGS_4_UNK15 = 0x00100000, - CREATURE_DIFFICULTYFLAGS_4_DO_NOT_SHEATHE = 0x00200000, // CREATURE_TYPEFLAGS_DO_NOT_SHEATHE - CREATURE_DIFFICULTYFLAGS_4_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS = 0x00400000, // UnitFlags2 0x8000000 - CREATURE_DIFFICULTYFLAGS_4_UNK16 = 0x00800000, - CREATURE_DIFFICULTYFLAGS_4_PREVENT_SWIM = 0x01000000, // UnitFlags2 0x1000000 - CREATURE_DIFFICULTYFLAGS_4_HIDE_IN_COMBAT_LOG = 0x02000000, // UnitFlags2 0x2000000 - CREATURE_DIFFICULTYFLAGS_4_UNK17 = 0x04000000, - CREATURE_DIFFICULTYFLAGS_4_UNK18 = 0x08000000, - CREATURE_DIFFICULTYFLAGS_4_UNK19 = 0x10000000, - CREATURE_DIFFICULTYFLAGS_4_DO_NOT_TARGET_ON_INTERACTION = 0x20000000, // CREATURE_TYPEFLAGS_DO_NOT_TARGET_ON_INTERACTION - CREATURE_DIFFICULTYFLAGS_4_DO_NOT_RENDER_OBJECT_NAME = 0x40000000, // CREATURE_TYPEFLAGS_DO_NOT_RENDER_OBJECT_NAME - CREATURE_DIFFICULTYFLAGS_4_UNIT_IS_QUEST_BOSS = 0x80000000 // CREATURE_TYPEFLAGS_UNIT_IS_QUEST_BOSS -}; - -enum CreatureDifficultyFlags5 -{ - CREATURE_DIFFICULTYFLAGS_5_CANNOT_SWITCH_TARGETS = 0x00000001, // UnitFlags2 0x4000000 - CREATURE_DIFFICULTYFLAGS_5_UNK1 = 0x00000002, - CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK30 = 0x00000004, // UnitFlags2 0x10000000 - CREATURE_DIFFICULTYFLAGS_5_UNK2 = 0x00000008, - CREATURE_DIFFICULTYFLAGS_5_UNK3 = 0x00000010, - CREATURE_DIFFICULTYFLAGS_5_UNK4 = 0x00000020, - CREATURE_DIFFICULTYFLAGS_5_UNK5 = 0x00000040, - CREATURE_DIFFICULTYFLAGS_5_UNK6 = 0x00000080, - CREATURE_DIFFICULTYFLAGS_5_CAN_INTERACT_EVEN_IF_HOSTILE = 0x00000100, // UNIT_FLAG2_ALLOW_ENEMY_INTERACT - CREATURE_DIFFICULTYFLAGS_5_UNK7 = 0x00000200, - CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK1 = 0x00000400, // CREATURE_TYPEFLAGS_2_UNK1 - CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK2 = 0x00000800, // CREATURE_TYPEFLAGS_2_UNK2 - CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK3 = 0x00001000, // CREATURE_TYPEFLAGS_2_UNK3 - CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK19 = 0x00002000, // UnitFlags2 0x80000 - CREATURE_DIFFICULTYFLAGS_5_UNK8 = 0x00004000, - CREATURE_DIFFICULTYFLAGS_5_UNK9 = 0x00008000, - CREATURE_DIFFICULTYFLAGS_5_UNK10 = 0x00010000, - CREATURE_DIFFICULTYFLAGS_5_UNK11 = 0x00020000, - CREATURE_DIFFICULTYFLAGS_5_UNK12 = 0x00040000, - CREATURE_DIFFICULTYFLAGS_5_UNK13 = 0x00080000, - CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK4 = 0x00100000, // CREATURE_TYPEFLAGS_2_UNK4 - CREATURE_DIFFICULTYFLAGS_5_UNK14 = 0x00200000, - CREATURE_DIFFICULTYFLAGS_5_UNK15 = 0x00400000, - CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK5 = 0x00800000, // CREATURE_TYPEFLAGS_2_UNK5 - CREATURE_DIFFICULTYFLAGS_5_UNK16 = 0x01000000, - CREATURE_DIFFICULTYFLAGS_5_UNK17 = 0x02000000, - CREATURE_DIFFICULTYFLAGS_5_UNK18 = 0x04000000, - CREATURE_DIFFICULTYFLAGS_5_UNK19 = 0x08000000, - CREATURE_DIFFICULTYFLAGS_5_UNK20 = 0x10000000, - CREATURE_DIFFICULTYFLAGS_5_UNK21 = 0x20000000, - CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK6 = 0x40000000, // CREATURE_TYPEFLAGS_2_UNK6 - CREATURE_DIFFICULTYFLAGS_5_UNK22 = 0x80000000 -}; - -enum CreatureDifficultyFlags6 -{ - CREATURE_DIFFICULTYFLAGS_6_UNK1 = 0x00000001, - CREATURE_DIFFICULTYFLAGS_6_UNK2 = 0x00000002, - CREATURE_DIFFICULTYFLAGS_6_UNK3 = 0x00000004, - CREATURE_DIFFICULTYFLAGS_6_UNK4 = 0x00000008, - CREATURE_DIFFICULTYFLAGS_6_UNK5 = 0x00000010, - CREATURE_DIFFICULTYFLAGS_6_UNK6 = 0x00000020, - CREATURE_DIFFICULTYFLAGS_6_UNK7 = 0x00000040, - CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK7 = 0x00000080, - CREATURE_DIFFICULTYFLAGS_6_UNK8 = 0x00000100, - CREATURE_DIFFICULTYFLAGS_6_UNK9 = 0x00000200, - CREATURE_DIFFICULTYFLAGS_6_UNK10 = 0x00000400, - CREATURE_DIFFICULTYFLAGS_6_UNK11 = 0x00000800, - CREATURE_DIFFICULTYFLAGS_6_UNK12 = 0x00001000, - CREATURE_DIFFICULTYFLAGS_6_UNK13 = 0x00002000, - CREATURE_DIFFICULTYFLAGS_6_UNK14 = 0x00004000, - CREATURE_DIFFICULTYFLAGS_6_UNK15 = 0x00008000, - CREATURE_DIFFICULTYFLAGS_6_UNK16 = 0x00010000, - CREATURE_DIFFICULTYFLAGS_6_UNK17 = 0x00020000, - CREATURE_DIFFICULTYFLAGS_6_UNK18 = 0x00040000, - CREATURE_DIFFICULTYFLAGS_6_UNK19 = 0x00080000, - CREATURE_DIFFICULTYFLAGS_6_UNK20 = 0x00100000, - CREATURE_DIFFICULTYFLAGS_6_UNK21 = 0x00200000, - CREATURE_DIFFICULTYFLAGS_6_UNK22 = 0x00400000, - CREATURE_DIFFICULTYFLAGS_6_UNK23 = 0x00800000, - CREATURE_DIFFICULTYFLAGS_6_UNK24 = 0x01000000, - CREATURE_DIFFICULTYFLAGS_6_UNK25 = 0x02000000, - CREATURE_DIFFICULTYFLAGS_6_UNK26 = 0x04000000, - CREATURE_DIFFICULTYFLAGS_6_UNK27 = 0x08000000, - CREATURE_DIFFICULTYFLAGS_6_UNK28 = 0x10000000, - CREATURE_DIFFICULTYFLAGS_6_UNK29 = 0x20000000, - CREATURE_DIFFICULTYFLAGS_6_UNK30 = 0x40000000, - CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK14 = 0x80000000 -}; - -enum CreatureDifficultyFlags7 -{ - CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK15 = 0x00000001, - CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK16 = 0x00000002, - CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK17 = 0x00000004, - CREATURE_DIFFICULTYFLAGS_7_UNK1 = 0x00000008 -}; - -enum CreatureFlagsExtra -{ - CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group - CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility) - CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry - CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry - CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block - CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks - CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP - CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature - CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and effect attack me - CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging) - CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard - CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes - CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills - CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre - CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // creature is subject to all diminishing returns as player are - CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ = 0x00200000, // creature does not need to take player damage for kill credit - CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB) - CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding - CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000 // creature is immune to knockback effects -}; - -#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \ - CREATURE_FLAG_EXTRA_NO_PARRY | CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN | CREATURE_FLAG_EXTRA_NO_BLOCK | \ - CREATURE_FLAG_EXTRA_NO_CRUSH | CREATURE_FLAG_EXTRA_NO_XP_AT_KILL | CREATURE_FLAG_EXTRA_TRIGGER | \ - CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \ - CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \ - CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING | CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ | CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK) - -const uint32 CREATURE_REGEN_INTERVAL = 2 * IN_MILLISECONDS; -const uint32 CREATURE_NOPATH_EVADE_TIME = 5 * IN_MILLISECONDS; - -const uint8 MAX_KILL_CREDIT = 2; -const uint32 MAX_CREATURE_MODELS = 4; -const uint32 MAX_CREATURE_NAMES = 4; -const uint32 MAX_CREATURE_SPELLS = 8; -const uint32 MAX_CREATURE_DIFFICULTIES = 3; - -// from `creature_template` table -struct TC_GAME_API CreatureTemplate -{ - uint32 Entry; - uint32 DifficultyEntry[MAX_CREATURE_DIFFICULTIES]; - uint32 KillCredit[MAX_KILL_CREDIT]; - uint32 Modelid1; - uint32 Modelid2; - uint32 Modelid3; - uint32 Modelid4; - std::string Name; - std::string FemaleName; - std::string SubName; - std::string IconName; - uint32 GossipMenuId; - int16 minlevel; - int16 maxlevel; - int32 HealthScalingExpansion; - uint32 RequiredExpansion; - uint32 VignetteID; /// @todo Read Vignette.db2 - uint32 faction; - uint64 npcflag; - float speed_walk; - float speed_run; - float scale; - uint32 rank; - uint32 dmgschool; - uint32 BaseAttackTime; - uint32 RangeAttackTime; - float BaseVariance; - float RangeVariance; - uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures. - uint32 unit_flags; // enum UnitFlags mask values - uint32 unit_flags2; // enum UnitFlags2 mask values - uint32 unit_flags3; // enum UnitFlags3 mask values - uint32 dynamicflags; - CreatureFamily family; // enum CreatureFamily values (optional) - uint32 trainer_type; - uint32 trainer_class; - uint32 trainer_race; - uint32 type; // enum CreatureType values - uint32 type_flags; // enum CreatureTypeFlags mask values - uint32 type_flags2; // unknown enum, only set for 4 creatures (with value 1) - uint32 lootid; - uint32 pickpocketLootId; - uint32 SkinLootId; - int32 resistance[MAX_SPELL_SCHOOL]; - uint32 spells[MAX_CREATURE_SPELLS]; - uint32 VehicleId; - uint32 mingold; - uint32 maxgold; - std::string AIName; - uint32 MovementType; - uint32 InhabitType; - float HoverHeight; - float ModHealth; - float ModHealthExtra; - float ModMana; - float ModManaExtra; // Added in 4.x, this value is usually 2 for a small group of creatures with double mana - float ModArmor; - float ModDamage; - float ModExperience; - bool RacialLeader; - uint32 movementId; - bool RegenHealth; - uint32 MechanicImmuneMask; - uint32 flags_extra; - uint32 ScriptID; - uint32 GetRandomValidModelId() const; - uint32 GetFirstValidModelId() const; - uint32 GetFirstInvisibleModel() const; - uint32 GetFirstVisibleModel() const; - - // helpers - SkillType GetRequiredLootSkill() const - { - if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL) - return SKILL_HERBALISM; - else if (type_flags & CREATURE_TYPE_FLAG_MINING_SKINNING_SKILL) - return SKILL_MINING; - else if (type_flags & CREATURE_TYPE_FLAG_ENGINEERING_SKINNING_SKILL) - return SKILL_ENGINEERING; - else - return SKILL_SKINNING; // normal case - } - - bool IsExotic() const - { - return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0; - } - - bool IsTameable(bool canTameExotic) const - { - if (type != CREATURE_TYPE_BEAST || family == CREATURE_FAMILY_NONE || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0) - return false; - - // if can tame exotic then can tame any tameable - return canTameExotic || !IsExotic(); - } - - static int32 DifficultyIDToDifficultyEntryIndex(uint32 difficulty) - { - switch (difficulty) - { - case DIFFICULTY_NONE: - case DIFFICULTY_NORMAL: - case DIFFICULTY_10_N: - case DIFFICULTY_40: - case DIFFICULTY_3_MAN_SCENARIO_N: - case DIFFICULTY_NORMAL_RAID: - return -1; - case DIFFICULTY_HEROIC: - case DIFFICULTY_25_N: - case DIFFICULTY_3_MAN_SCENARIO_HC: - case DIFFICULTY_HEROIC_RAID: - return 0; - case DIFFICULTY_10_HC: - case DIFFICULTY_MYTHIC_KEYSTONE: - case DIFFICULTY_MYTHIC_RAID: - return 1; - case DIFFICULTY_25_HC: - return 2; - case DIFFICULTY_LFR: - case DIFFICULTY_LFR_NEW: - case DIFFICULTY_EVENT_RAID: - case DIFFICULTY_EVENT_DUNGEON: - case DIFFICULTY_EVENT_SCENARIO: - default: - return -1; - } - } -}; - -typedef std::vector<uint32> CreatureQuestItemList; -typedef std::unordered_map<uint32, CreatureQuestItemList> CreatureQuestItemMap; - -// Benchmarked: Faster than std::map (insert/find) -typedef std::unordered_map<uint32, CreatureTemplate> CreatureTemplateContainer; - -#pragma pack(push, 1) - -// Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage). -struct TC_GAME_API CreatureBaseStats -{ - uint32 BaseHealth[MAX_EXPANSIONS]; - uint32 BaseMana; - uint32 BaseArmor; - uint32 AttackPower; - uint32 RangedAttackPower; - float BaseDamage[MAX_EXPANSIONS]; - - // Helpers - - uint32 GenerateHealth(CreatureTemplate const* info) const - { - return uint32(ceil(BaseHealth[info->HealthScalingExpansion] * info->ModHealth * info->ModHealthExtra)); - } - - uint32 GenerateMana(CreatureTemplate const* info) const - { - // Mana can be 0. - if (!BaseMana) - return 0; - - return uint32(ceil(BaseMana * info->ModMana * info->ModManaExtra)); - } - - uint32 GenerateArmor(CreatureTemplate const* info) const - { - return uint32(ceil(BaseArmor * info->ModArmor)); - } - - float GenerateBaseDamage(CreatureTemplate const* info) const - { - return BaseDamage[info->HealthScalingExpansion]; - } - - static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass); -}; - -typedef std::unordered_map<uint16, CreatureBaseStats> CreatureBaseStatsContainer; - -struct CreatureLocale -{ - std::vector<std::string> Name; - std::vector<std::string> NameAlt; - std::vector<std::string> Title; - std::vector<std::string> TitleAlt; -}; - -struct EquipmentItem -{ - uint32 ItemId = 0; - uint16 AppearanceModId = 0; - uint16 ItemVisual = 0; -}; - -struct EquipmentInfo -{ - EquipmentItem Items[MAX_EQUIPMENT_ITEMS]; -}; - -// Benchmarked: Faster than std::map (insert/find) -typedef std::unordered_map<uint8, EquipmentInfo> EquipmentInfoContainerInternal; -typedef std::unordered_map<uint32, EquipmentInfoContainerInternal> EquipmentInfoContainer; - -// from `creature` table -struct CreatureData -{ - CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0), - posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), - spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0), - spawnMask(0), npcflag(0), unit_flags(0), unit_flags2(0), unit_flags3(0), dynamicflags(0), - phaseid(0), phaseGroup(0), dbData(true) { } - uint32 id; // entry in creature_template - uint16 mapid; - uint32 phaseMask; - uint32 displayid; - int8 equipmentId; - float posX; - float posY; - float posZ; - float orientation; - uint32 spawntimesecs; - float spawndist; - uint32 currentwaypoint; - uint32 curhealth; - uint32 curmana; - uint8 movementType; - uint32 spawnMask; - uint64 npcflag; - uint32 unit_flags; // enum UnitFlags mask values - uint32 unit_flags2; // enum UnitFlags2 mask values - uint32 unit_flags3; // enum UnitFlags3 mask values - uint32 dynamicflags; - uint32 phaseid; - uint32 phaseGroup; - uint32 ScriptId; - bool dbData; -}; - -struct CreatureModelInfo -{ - float bounding_radius; - float combat_reach; - int8 gender; - uint32 displayId_other_gender; - bool is_trigger; -}; - -// Benchmarked: Faster than std::map (insert/find) -typedef std::unordered_map<uint32, CreatureModelInfo> CreatureModelContainer; - -enum InhabitTypeValues -{ - INHABIT_GROUND = 1, - INHABIT_WATER = 2, - INHABIT_AIR = 4, - INHABIT_ROOT = 8, - INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR | INHABIT_ROOT -}; - -#pragma pack(pop) - -// `creature_addon` table -struct CreatureAddon -{ - uint32 path_id; - uint32 mount; - uint32 bytes1; - uint32 bytes2; - uint32 emote; - uint16 aiAnimKit; - uint16 movementAnimKit; - uint16 meleeAnimKit; - std::vector<uint32> auras; -}; - -typedef std::unordered_map<ObjectGuid::LowType, CreatureAddon> CreatureAddonContainer; -typedef std::unordered_map<uint32, CreatureAddon> CreatureTemplateAddonContainer; - -// Vendors -struct VendorItem -{ - VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost, uint8 _Type) - : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost), Type(_Type) { } - - uint32 item; - uint32 maxcount; // 0 for infinity item amount - uint32 incrtime; // time for restore items amount if maxcount != 0 - uint32 ExtendedCost; - uint8 Type; - - //helpers - bool IsGoldRequired(ItemTemplate const* pProto) const { return pProto->GetFlags2() & ITEM_FLAG2_DONT_IGNORE_BUY_PRICE || !ExtendedCost; } -}; -typedef std::vector<VendorItem*> VendorItemList; - -struct VendorItemData -{ - VendorItemList m_items; - - VendorItem* GetItem(uint32 slot) const - { - if (slot >= m_items.size()) - return NULL; - - return m_items[slot]; - } - bool Empty() const { return m_items.empty(); } - uint32 GetItemCount() const { return uint32(m_items.size()); } - void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type) - { - m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost, type)); - } - bool RemoveItem(uint32 item_id, uint8 type); - VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const; - void Clear() - { - for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr) - delete (*itr); - m_items.clear(); - } -}; +enum MovementGeneratorType : uint8; struct VendorItemCount { - explicit VendorItemCount(uint32 _item, uint32 _count) + VendorItemCount(uint32 _item, uint32 _count) : itemId(_item), count(_count), lastIncrementTime(time(NULL)) { } uint32 itemId; @@ -637,43 +50,6 @@ struct VendorItemCount typedef std::list<VendorItemCount> VendorItemCounts; -#define MAX_TRAINERSPELL_ABILITY_REQS 3 - -struct TrainerSpell -{ - TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0), Index(0) - { - for (uint8 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i) - ReqAbility[i] = 0; - } - - uint32 SpellID; - uint32 MoneyCost; - uint32 ReqSkillLine; - uint32 ReqSkillRank; - uint32 ReqLevel; - uint32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS]; - uint32 Index; - - // helpers - bool IsCastable() const { return ReqAbility[0] != SpellID; } -}; - -typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap; - -struct TC_GAME_API TrainerSpellData -{ - TrainerSpellData() : trainerType(0) { } - ~TrainerSpellData() { spellList.clear(); } - - TrainerSpellMap spellList; - uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value. - // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2. - TrainerSpell const* Find(uint32 spell_id) const; -}; - -typedef std::map<uint32, time_t> CreatureSpellCooldowns; - // max different by z coordinate for creature aggro reaction #define CREATURE_Z_ATTACK_RANGE 3 diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h new file mode 100644 index 00000000000..9fa90399bde --- /dev/null +++ b/src/server/game/Entities/Creature/CreatureData.h @@ -0,0 +1,633 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef CreatureData_h__ +#define CreatureData_h__ + +#include "DBCEnums.h" +#include "SharedDefines.h" +#include "UnitDefines.h" +#include <string> +#include <unordered_map> +#include <vector> +#include <cmath> + +struct ItemTemplate; + +enum CreatureDifficultyFlags +{ + CREATURE_DIFFICULTYFLAGS_UNK1 = 0x00000001, // Related to mounts + CREATURE_DIFFICULTYFLAGS_NO_EXPERIENCE = 0x00000002, + CREATURE_DIFFICULTYFLAGS_NO_LOOT = 0x00000004, + CREATURE_DIFFICULTYFLAGS_UNKILLABLE = 0x00000008, + CREATURE_DIFFICULTYFLAGS_TAMEABLE = 0x00000010, // CREATURE_TYPEFLAGS_TAMEABLE + CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_PC = 0x00000020, // UNIT_FLAG_IMMUNE_TO_PC + CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_NPC = 0x00000040, // UNIT_FLAG_IMMUNE_TO_NPC + CREATURE_DIFFICULTYFLAGS_UNK2 = 0x00000080, + CREATURE_DIFFICULTYFLAGS_SESSILE = 0x00000100, // Creature is rooted + CREATURE_DIFFICULTYFLAGS_NOT_SELECTABLE = 0x00000200, // UNIT_FLAG_NOT_SELECTABLE + CREATURE_DIFFICULTYFLAGS_UNK3 = 0x00000400, // Related to health - it seems similar to CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET + CREATURE_DIFFICULTYFLAGS_NO_CORPSE_UPON_DEATH = 0x00000800, // Creature instantly disappear when killed + CREATURE_DIFFICULTYFLAGS_UNK5 = 0x00001000, + CREATURE_DIFFICULTYFLAGS_UNK6 = 0x00002000, + CREATURE_DIFFICULTYFLAGS_UNK7 = 0x00004000, + CREATURE_DIFFICULTYFLAGS_UNK8 = 0x00008000, + CREATURE_DIFFICULTYFLAGS_BOSS = 0x00010000, // CREATURE_TYPEFLAGS_BOSS + CREATURE_DIFFICULTYFLAGS_UNK9 = 0x00020000, + CREATURE_DIFFICULTYFLAGS_WATER_BOUND = 0x00040000, + CREATURE_DIFFICULTYFLAGS_CAN_PENETRATE_WATER = 0x00080000, + CREATURE_DIFFICULTYFLAGS_UNK10 = 0x00100000, + CREATURE_DIFFICULTYFLAGS_GHOST = 0x00200000, // CREATURE_TYPEFLAGS_GHOST + CREATURE_DIFFICULTYFLAGS_UNK11 = 0x00400000, + CREATURE_DIFFICULTYFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION = 0x00800000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION + CREATURE_DIFFICULTYFLAGS_HIDE_FACTION_TOOLTIP = 0x01000000, // CREATURE_TYPEFLAGS_HIDE_FACTION_TOOLTIP + CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT = 0x02000000, + CREATURE_DIFFICULTYFLAGS_UNK12 = 0x04000000, + CREATURE_DIFFICULTYFLAGS_SUMMON_GUARD_IF_IN_AGGRO_RANGE = 0x08000000, // Creature will summon a guard if player is within its aggro range (even if creature doesn't attack per se) + CREATURE_DIFFICULTYFLAGS_ONLY_SWIM = 0x10000000, // UNIT_FLAG_UNK_15 + CREATURE_DIFFICULTYFLAGS_UNK13 = 0x20000000, // Related to gravity + CREATURE_DIFFICULTYFLAGS_TFLAG_UNK5 = 0x40000000, // CREATURE_TYPEFLAGS_UNK5 + CREATURE_DIFFICULTYFLAGS_LARGE_AOI = 0x80000000 // UnitFlags2 0x200000 +}; + +enum CreatureDifficultyFlags2 +{ + CREATURE_DIFFICULTYFLAGS_2_UNK1 = 0x00000001, + CREATURE_DIFFICULTYFLAGS_2_FORCE_PARTY_MEMBERS_INTO_COMBAT = 0x00000002, + CREATURE_DIFFICULTYFLAGS_2_UNK2 = 0x00000004, + CREATURE_DIFFICULTYFLAGS_2_SPELL_ATTACKABLE = 0x00000008, // CREATURE_TYPEFLAGS_SPELL_ATTACKABLE + CREATURE_DIFFICULTYFLAGS_2_UNK3 = 0x00000010, + CREATURE_DIFFICULTYFLAGS_2_UNK4 = 0x00000020, + CREATURE_DIFFICULTYFLAGS_2_UNK5 = 0x00000040, + CREATURE_DIFFICULTYFLAGS_2_UNK6 = 0x00000080, + CREATURE_DIFFICULTYFLAGS_2_UNK7 = 0x00000100, + CREATURE_DIFFICULTYFLAGS_2_UNK8 = 0x00000200, + CREATURE_DIFFICULTYFLAGS_2_UNK9 = 0x00000400, + CREATURE_DIFFICULTYFLAGS_2_DEAD_INTERACT = 0x00000800, // CREATURE_TYPEFLAGS_DEAD_INTERACT + CREATURE_DIFFICULTYFLAGS_2_UNK10 = 0x00001000, + CREATURE_DIFFICULTYFLAGS_2_UNK11 = 0x00002000, + CREATURE_DIFFICULTYFLAGS_2_HERBLOOT = 0x00004000, // CREATURE_TYPEFLAGS_HERBLOOT + CREATURE_DIFFICULTYFLAGS_2_MININGLOOT = 0x00008000, // CREATURE_TYPEFLAGS_MININGLOOT + CREATURE_DIFFICULTYFLAGS_2_DONT_LOG_DEATH = 0x00010000, // CREATURE_TYPEFLAGS_DONT_LOG_DEATH + CREATURE_DIFFICULTYFLAGS_2_UNK12 = 0x00020000, + CREATURE_DIFFICULTYFLAGS_2_MOUNTED_COMBAT = 0x00040000, // CREATURE_TYPEFLAGS_MOUNTED_COMBAT + CREATURE_DIFFICULTYFLAGS_2_UNK13 = 0x00080000, + CREATURE_DIFFICULTYFLAGS_2_UNK14 = 0x00100000, // This flag seems similar to CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT + CREATURE_DIFFICULTYFLAGS_2_UNK15 = 0x00200000, + CREATURE_DIFFICULTYFLAGS_2_UNK16 = 0x00400000, + CREATURE_DIFFICULTYFLAGS_2_UNK17 = 0x00800000, + CREATURE_DIFFICULTYFLAGS_2_UNK18 = 0x01000000, + CREATURE_DIFFICULTYFLAGS_2_HIDE_BODY = 0x02000000, // UNIT_FLAG2_UNK1 + CREATURE_DIFFICULTYFLAGS_2_UNK19 = 0x04000000, + CREATURE_DIFFICULTYFLAGS_2_SERVER_ONLY = 0x08000000, + CREATURE_DIFFICULTYFLAGS_2_CAN_SAFE_FALL = 0x10000000, + CREATURE_DIFFICULTYFLAGS_2_CAN_ASSIST = 0x20000000, // CREATURE_TYPEFLAGS_CAN_ASSIST + CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET = 0x40000000, + CREATURE_DIFFICULTYFLAGS_2_IS_PET_BAR_USED = 0x80000000 // CREATURE_TYPEFLAGS_IS_PET_BAR_USED +}; + +enum CreatureDifficultyFlags3 +{ + CREATURE_DIFFICULTYFLAGS_3_UNK1 = 0x00000001, + CREATURE_DIFFICULTYFLAGS_3_UNK2 = 0x00000002, + CREATURE_DIFFICULTYFLAGS_3_INSTANTLY_APPEAR_MODEL = 0x00000004, // UNIT_FLAG2_INSTANTLY_APPEAR_MODEL + CREATURE_DIFFICULTYFLAGS_3_MASK_UID = 0x00000008, // CREATURE_TYPEFLAG_MASK_UID + CREATURE_DIFFICULTYFLAGS_3_ENGINEERLOOT = 0x00000010, // CREATURE_TYPEFLAGS_ENGINEERLOOT + CREATURE_DIFFICULTYFLAGS_3_UNK3 = 0x00000020, + CREATURE_DIFFICULTYFLAGS_3_UNK4 = 0x00000040, + CREATURE_DIFFICULTYFLAGS_3_UNK5 = 0x00000080, + CREATURE_DIFFICULTYFLAGS_3_CANNOT_SWIM = 0x00000100, // UNIT_FLAG_UNK_14 + CREATURE_DIFFICULTYFLAGS_3_EXOTIC = 0x00000200, // CREATURE_TYPEFLAGS_EXOTIC + CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI = 0x00000400, // Since MoP, creatures with that flag have UnitFlags2 0x400000 + CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI = 0x00000800, // Since MoP, creatures with that flag have UnitFlags2 0x40000000 + CREATURE_DIFFICULTYFLAGS_3_WATERWALKING = 0x00001000, + CREATURE_DIFFICULTYFLAGS_3_HIDE_NAMEPLATE = 0x00002000, // CREATURE_TYPEFLAGS_HIDE_NAMEPLATE + CREATURE_DIFFICULTYFLAGS_3_UNK6 = 0x00004000, + CREATURE_DIFFICULTYFLAGS_3_UNK7 = 0x00008000, + CREATURE_DIFFICULTYFLAGS_3_USE_DEFAULT_COLLISION_BOX = 0x00010000, // CREATURE_TYPEFLAGS_USE_DEFAULT_COLLISION_BOX + CREATURE_DIFFICULTYFLAGS_3_UNK8 = 0x00020000, + CREATURE_DIFFICULTYFLAGS_3_IS_SIEGE_WEAPON = 0x00040000, // CREATURE_TYPEFLAGS_IS_SIEGE_WEAPON + CREATURE_DIFFICULTYFLAGS_3_UNK9 = 0x00080000, + CREATURE_DIFFICULTYFLAGS_3_UNK10 = 0x00100000, + CREATURE_DIFFICULTYFLAGS_3_UNK11 = 0x00200000, + CREATURE_DIFFICULTYFLAGS_3_PROJECTILE_COLLISION = 0x00400000, // CREATURE_TYPEFLAGS_PROJECTILE_COLLISION + CREATURE_DIFFICULTYFLAGS_3_CAN_BE_MULTITAPPED = 0x00800000, + CREATURE_DIFFICULTYFLAGS_3_DO_NOT_PLAY_MOUNTED_ANIMATIONS = 0x01000000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_MOUNTED_ANIMATIONS + CREATURE_DIFFICULTYFLAGS_3_DISABLE_TURN = 0x02000000, // UNIT_FLAG2_DISABLE_TURN + CREATURE_DIFFICULTYFLAGS_3_UNK12 = 0x04000000, + CREATURE_DIFFICULTYFLAGS_3_UNK13 = 0x08000000, + CREATURE_DIFFICULTYFLAGS_3_UNK14 = 0x10000000, + CREATURE_DIFFICULTYFLAGS_3_IS_LINK_ALL = 0x20000000, // CREATURE_TYPEFLAGS_IS_LINK_ALL + CREATURE_DIFFICULTYFLAGS_3_UNK15 = 0x40000000, + CREATURE_DIFFICULTYFLAGS_3_UNK16 = 0x80000000 +}; + +enum CreatureDifficultyFlags4 +{ + CREATURE_DIFFICULTYFLAGS_4_HAS_NO_BIRTH_ANIMATION = 0x00000001, // SMSG_UPDATE_OBJECT's "NoBirthAnim" + CREATURE_DIFFICULTYFLAGS_4_UNK1 = 0x00000002, + CREATURE_DIFFICULTYFLAGS_4_UNK2 = 0x00000004, + CREATURE_DIFFICULTYFLAGS_4_INTERACT_ONLY_WITH_CREATOR = 0x00000008, // CREATURE_TYPEFLAGS_INTERACT_ONLY_WITH_CREATOR + CREATURE_DIFFICULTYFLAGS_4_DO_NOT_PLAY_UNIT_EVENT_SOUNDS = 0x00000010, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_UNIT_EVENT_SOUNDS + CREATURE_DIFFICULTYFLAGS_4_HAS_NO_SHADOW_BLOB = 0x00000020, // CREATURE_TYPEFLAGS_HAS_NO_SHADOW_BLOB + CREATURE_DIFFICULTYFLAGS_4_UNK3 = 0x00000040, + CREATURE_DIFFICULTYFLAGS_4_UNK4 = 0x00000080, + CREATURE_DIFFICULTYFLAGS_4_UNK5 = 0x00000100, + CREATURE_DIFFICULTYFLAGS_4_UNK6 = 0x00000200, + CREATURE_DIFFICULTYFLAGS_4_UNK7 = 0x00000400, + CREATURE_DIFFICULTYFLAGS_4_UNK8 = 0x00000800, + CREATURE_DIFFICULTYFLAGS_4_UNK9 = 0x00001000, + CREATURE_DIFFICULTYFLAGS_4_UNK10 = 0x00002000, + CREATURE_DIFFICULTYFLAGS_4_UNK11 = 0x00004000, + CREATURE_DIFFICULTYFLAGS_4_UFLAG2_UNK20 = 0x00008000, // UnitFlags2 0x100000 + CREATURE_DIFFICULTYFLAGS_4_UNK12 = 0x00010000, + CREATURE_DIFFICULTYFLAGS_4_UNK13 = 0x00020000, + CREATURE_DIFFICULTYFLAGS_4_UNK14 = 0x00040000, + CREATURE_DIFFICULTYFLAGS_4_FORCE_GOSSIP = 0x00080000, // CREATURE_TYPEFLAGS_FORCE_GOSSIP + CREATURE_DIFFICULTYFLAGS_4_UNK15 = 0x00100000, + CREATURE_DIFFICULTYFLAGS_4_DO_NOT_SHEATHE = 0x00200000, // CREATURE_TYPEFLAGS_DO_NOT_SHEATHE + CREATURE_DIFFICULTYFLAGS_4_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS = 0x00400000, // UnitFlags2 0x8000000 + CREATURE_DIFFICULTYFLAGS_4_UNK16 = 0x00800000, + CREATURE_DIFFICULTYFLAGS_4_PREVENT_SWIM = 0x01000000, // UnitFlags2 0x1000000 + CREATURE_DIFFICULTYFLAGS_4_HIDE_IN_COMBAT_LOG = 0x02000000, // UnitFlags2 0x2000000 + CREATURE_DIFFICULTYFLAGS_4_UNK17 = 0x04000000, + CREATURE_DIFFICULTYFLAGS_4_UNK18 = 0x08000000, + CREATURE_DIFFICULTYFLAGS_4_UNK19 = 0x10000000, + CREATURE_DIFFICULTYFLAGS_4_DO_NOT_TARGET_ON_INTERACTION = 0x20000000, // CREATURE_TYPEFLAGS_DO_NOT_TARGET_ON_INTERACTION + CREATURE_DIFFICULTYFLAGS_4_DO_NOT_RENDER_OBJECT_NAME = 0x40000000, // CREATURE_TYPEFLAGS_DO_NOT_RENDER_OBJECT_NAME + CREATURE_DIFFICULTYFLAGS_4_UNIT_IS_QUEST_BOSS = 0x80000000 // CREATURE_TYPEFLAGS_UNIT_IS_QUEST_BOSS +}; + +enum CreatureDifficultyFlags5 +{ + CREATURE_DIFFICULTYFLAGS_5_CANNOT_SWITCH_TARGETS = 0x00000001, // UnitFlags2 0x4000000 + CREATURE_DIFFICULTYFLAGS_5_UNK1 = 0x00000002, + CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK30 = 0x00000004, // UnitFlags2 0x10000000 + CREATURE_DIFFICULTYFLAGS_5_UNK2 = 0x00000008, + CREATURE_DIFFICULTYFLAGS_5_UNK3 = 0x00000010, + CREATURE_DIFFICULTYFLAGS_5_UNK4 = 0x00000020, + CREATURE_DIFFICULTYFLAGS_5_UNK5 = 0x00000040, + CREATURE_DIFFICULTYFLAGS_5_UNK6 = 0x00000080, + CREATURE_DIFFICULTYFLAGS_5_CAN_INTERACT_EVEN_IF_HOSTILE = 0x00000100, // UNIT_FLAG2_ALLOW_ENEMY_INTERACT + CREATURE_DIFFICULTYFLAGS_5_UNK7 = 0x00000200, + CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK1 = 0x00000400, // CREATURE_TYPEFLAGS_2_UNK1 + CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK2 = 0x00000800, // CREATURE_TYPEFLAGS_2_UNK2 + CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK3 = 0x00001000, // CREATURE_TYPEFLAGS_2_UNK3 + CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK19 = 0x00002000, // UnitFlags2 0x80000 + CREATURE_DIFFICULTYFLAGS_5_UNK8 = 0x00004000, + CREATURE_DIFFICULTYFLAGS_5_UNK9 = 0x00008000, + CREATURE_DIFFICULTYFLAGS_5_UNK10 = 0x00010000, + CREATURE_DIFFICULTYFLAGS_5_UNK11 = 0x00020000, + CREATURE_DIFFICULTYFLAGS_5_UNK12 = 0x00040000, + CREATURE_DIFFICULTYFLAGS_5_UNK13 = 0x00080000, + CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK4 = 0x00100000, // CREATURE_TYPEFLAGS_2_UNK4 + CREATURE_DIFFICULTYFLAGS_5_UNK14 = 0x00200000, + CREATURE_DIFFICULTYFLAGS_5_UNK15 = 0x00400000, + CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK5 = 0x00800000, // CREATURE_TYPEFLAGS_2_UNK5 + CREATURE_DIFFICULTYFLAGS_5_UNK16 = 0x01000000, + CREATURE_DIFFICULTYFLAGS_5_UNK17 = 0x02000000, + CREATURE_DIFFICULTYFLAGS_5_UNK18 = 0x04000000, + CREATURE_DIFFICULTYFLAGS_5_UNK19 = 0x08000000, + CREATURE_DIFFICULTYFLAGS_5_UNK20 = 0x10000000, + CREATURE_DIFFICULTYFLAGS_5_UNK21 = 0x20000000, + CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK6 = 0x40000000, // CREATURE_TYPEFLAGS_2_UNK6 + CREATURE_DIFFICULTYFLAGS_5_UNK22 = 0x80000000 +}; + +enum CreatureDifficultyFlags6 +{ + CREATURE_DIFFICULTYFLAGS_6_UNK1 = 0x00000001, + CREATURE_DIFFICULTYFLAGS_6_UNK2 = 0x00000002, + CREATURE_DIFFICULTYFLAGS_6_UNK3 = 0x00000004, + CREATURE_DIFFICULTYFLAGS_6_UNK4 = 0x00000008, + CREATURE_DIFFICULTYFLAGS_6_UNK5 = 0x00000010, + CREATURE_DIFFICULTYFLAGS_6_UNK6 = 0x00000020, + CREATURE_DIFFICULTYFLAGS_6_UNK7 = 0x00000040, + CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK7 = 0x00000080, + CREATURE_DIFFICULTYFLAGS_6_UNK8 = 0x00000100, + CREATURE_DIFFICULTYFLAGS_6_UNK9 = 0x00000200, + CREATURE_DIFFICULTYFLAGS_6_UNK10 = 0x00000400, + CREATURE_DIFFICULTYFLAGS_6_UNK11 = 0x00000800, + CREATURE_DIFFICULTYFLAGS_6_UNK12 = 0x00001000, + CREATURE_DIFFICULTYFLAGS_6_UNK13 = 0x00002000, + CREATURE_DIFFICULTYFLAGS_6_UNK14 = 0x00004000, + CREATURE_DIFFICULTYFLAGS_6_UNK15 = 0x00008000, + CREATURE_DIFFICULTYFLAGS_6_UNK16 = 0x00010000, + CREATURE_DIFFICULTYFLAGS_6_UNK17 = 0x00020000, + CREATURE_DIFFICULTYFLAGS_6_UNK18 = 0x00040000, + CREATURE_DIFFICULTYFLAGS_6_UNK19 = 0x00080000, + CREATURE_DIFFICULTYFLAGS_6_UNK20 = 0x00100000, + CREATURE_DIFFICULTYFLAGS_6_UNK21 = 0x00200000, + CREATURE_DIFFICULTYFLAGS_6_UNK22 = 0x00400000, + CREATURE_DIFFICULTYFLAGS_6_UNK23 = 0x00800000, + CREATURE_DIFFICULTYFLAGS_6_UNK24 = 0x01000000, + CREATURE_DIFFICULTYFLAGS_6_UNK25 = 0x02000000, + CREATURE_DIFFICULTYFLAGS_6_UNK26 = 0x04000000, + CREATURE_DIFFICULTYFLAGS_6_UNK27 = 0x08000000, + CREATURE_DIFFICULTYFLAGS_6_UNK28 = 0x10000000, + CREATURE_DIFFICULTYFLAGS_6_UNK29 = 0x20000000, + CREATURE_DIFFICULTYFLAGS_6_UNK30 = 0x40000000, + CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK14 = 0x80000000 +}; + +enum CreatureDifficultyFlags7 +{ + CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK15 = 0x00000001, + CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK16 = 0x00000002, + CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK17 = 0x00000004, + CREATURE_DIFFICULTYFLAGS_7_UNK1 = 0x00000008 +}; + +enum CreatureFlagsExtra +{ + CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group + CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility) + CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry + CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry + CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block + CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks + CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP + CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature + CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and effect attack me + CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging) + CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard + CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes + CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills + CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre + CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // creature is subject to all diminishing returns as player are + CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ = 0x00200000, // creature does not need to take player damage for kill credit + CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB) + CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding + CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000 // creature is immune to knockback effects +}; + +#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \ + CREATURE_FLAG_EXTRA_NO_PARRY | CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN | CREATURE_FLAG_EXTRA_NO_BLOCK | \ + CREATURE_FLAG_EXTRA_NO_CRUSH | CREATURE_FLAG_EXTRA_NO_XP_AT_KILL | CREATURE_FLAG_EXTRA_TRIGGER | \ + CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \ + CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \ + CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING | CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ | CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK) + +const uint32 CREATURE_REGEN_INTERVAL = 2 * IN_MILLISECONDS; +const uint32 CREATURE_NOPATH_EVADE_TIME = 5 * IN_MILLISECONDS; + +const uint8 MAX_KILL_CREDIT = 2; +const uint32 MAX_CREATURE_MODELS = 4; +const uint32 MAX_CREATURE_NAMES = 4; +const uint32 MAX_CREATURE_SPELLS = 8; +const uint32 MAX_CREATURE_DIFFICULTIES = 3; + +// from `creature_template` table +struct TC_GAME_API CreatureTemplate +{ + uint32 Entry; + uint32 DifficultyEntry[MAX_CREATURE_DIFFICULTIES]; + uint32 KillCredit[MAX_KILL_CREDIT]; + uint32 Modelid1; + uint32 Modelid2; + uint32 Modelid3; + uint32 Modelid4; + std::string Name; + std::string FemaleName; + std::string SubName; + std::string IconName; + uint32 GossipMenuId; + int16 minlevel; + int16 maxlevel; + int32 HealthScalingExpansion; + uint32 RequiredExpansion; + uint32 VignetteID; /// @todo Read Vignette.db2 + uint32 faction; + uint64 npcflag; + float speed_walk; + float speed_run; + float scale; + uint32 rank; + uint32 dmgschool; + uint32 BaseAttackTime; + uint32 RangeAttackTime; + float BaseVariance; + float RangeVariance; + uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures. + uint32 unit_flags; // enum UnitFlags mask values + uint32 unit_flags2; // enum UnitFlags2 mask values + uint32 unit_flags3; // enum UnitFlags3 mask values + uint32 dynamicflags; + CreatureFamily family; // enum CreatureFamily values (optional) + uint32 trainer_type; + uint32 trainer_class; + uint32 trainer_race; + uint32 type; // enum CreatureType values + uint32 type_flags; // enum CreatureTypeFlags mask values + uint32 type_flags2; // unknown enum, only set for 4 creatures (with value 1) + uint32 lootid; + uint32 pickpocketLootId; + uint32 SkinLootId; + int32 resistance[MAX_SPELL_SCHOOL]; + uint32 spells[MAX_CREATURE_SPELLS]; + uint32 VehicleId; + uint32 mingold; + uint32 maxgold; + std::string AIName; + uint32 MovementType; + uint32 InhabitType; + float HoverHeight; + float ModHealth; + float ModHealthExtra; + float ModMana; + float ModManaExtra; // Added in 4.x, this value is usually 2 for a small group of creatures with double mana + float ModArmor; + float ModDamage; + float ModExperience; + bool RacialLeader; + uint32 movementId; + bool RegenHealth; + uint32 MechanicImmuneMask; + uint32 flags_extra; + uint32 ScriptID; + uint32 GetRandomValidModelId() const; + uint32 GetFirstValidModelId() const; + uint32 GetFirstInvisibleModel() const; + uint32 GetFirstVisibleModel() const; + + // helpers + SkillType GetRequiredLootSkill() const + { + if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL) + return SKILL_HERBALISM; + else if (type_flags & CREATURE_TYPE_FLAG_MINING_SKINNING_SKILL) + return SKILL_MINING; + else if (type_flags & CREATURE_TYPE_FLAG_ENGINEERING_SKINNING_SKILL) + return SKILL_ENGINEERING; + else + return SKILL_SKINNING; // normal case + } + + bool IsExotic() const + { + return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0; + } + + bool IsTameable(bool canTameExotic) const + { + if (type != CREATURE_TYPE_BEAST || family == CREATURE_FAMILY_NONE || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0) + return false; + + // if can tame exotic then can tame any tameable + return canTameExotic || !IsExotic(); + } + + static int32 DifficultyIDToDifficultyEntryIndex(uint32 difficulty) + { + switch (difficulty) + { + case DIFFICULTY_NONE: + case DIFFICULTY_NORMAL: + case DIFFICULTY_10_N: + case DIFFICULTY_40: + case DIFFICULTY_3_MAN_SCENARIO_N: + case DIFFICULTY_NORMAL_RAID: + return -1; + case DIFFICULTY_HEROIC: + case DIFFICULTY_25_N: + case DIFFICULTY_3_MAN_SCENARIO_HC: + case DIFFICULTY_HEROIC_RAID: + return 0; + case DIFFICULTY_10_HC: + case DIFFICULTY_MYTHIC_KEYSTONE: + case DIFFICULTY_MYTHIC_RAID: + return 1; + case DIFFICULTY_25_HC: + return 2; + case DIFFICULTY_LFR: + case DIFFICULTY_LFR_NEW: + case DIFFICULTY_EVENT_RAID: + case DIFFICULTY_EVENT_DUNGEON: + case DIFFICULTY_EVENT_SCENARIO: + default: + return -1; + } + } +}; + +#pragma pack(push, 1) + +// Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage). +struct TC_GAME_API CreatureBaseStats +{ + uint32 BaseHealth[MAX_EXPANSIONS]; + uint32 BaseMana; + uint32 BaseArmor; + uint32 AttackPower; + uint32 RangedAttackPower; + float BaseDamage[MAX_EXPANSIONS]; + + // Helpers + + uint32 GenerateHealth(CreatureTemplate const* info) const + { + return uint32(ceil(BaseHealth[info->HealthScalingExpansion] * info->ModHealth * info->ModHealthExtra)); + } + + uint32 GenerateMana(CreatureTemplate const* info) const + { + // Mana can be 0. + if (!BaseMana) + return 0; + + return uint32(ceil(BaseMana * info->ModMana * info->ModManaExtra)); + } + + uint32 GenerateArmor(CreatureTemplate const* info) const + { + return uint32(ceil(BaseArmor * info->ModArmor)); + } + + float GenerateBaseDamage(CreatureTemplate const* info) const + { + return BaseDamage[info->HealthScalingExpansion]; + } + + static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass); +}; + +struct CreatureLocale +{ + std::vector<std::string> Name; + std::vector<std::string> NameAlt; + std::vector<std::string> Title; + std::vector<std::string> TitleAlt; +}; + +struct EquipmentItem +{ + uint32 ItemId = 0; + uint16 AppearanceModId = 0; + uint16 ItemVisual = 0; +}; + +struct EquipmentInfo +{ + EquipmentItem Items[MAX_EQUIPMENT_ITEMS]; +}; + +// from `creature` table +struct CreatureData +{ + CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0), + posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), + spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0), + spawnMask(0), npcflag(0), unit_flags(0), unit_flags2(0), unit_flags3(0), dynamicflags(0), + phaseid(0), phaseGroup(0), dbData(true) { } + uint32 id; // entry in creature_template + uint16 mapid; + uint32 phaseMask; + uint32 displayid; + int8 equipmentId; + float posX; + float posY; + float posZ; + float orientation; + uint32 spawntimesecs; + float spawndist; + uint32 currentwaypoint; + uint32 curhealth; + uint32 curmana; + uint8 movementType; + uint32 spawnMask; + uint64 npcflag; + uint32 unit_flags; // enum UnitFlags mask values + uint32 unit_flags2; // enum UnitFlags2 mask values + uint32 unit_flags3; // enum UnitFlags3 mask values + uint32 dynamicflags; + uint32 phaseid; + uint32 phaseGroup; + uint32 ScriptId; + bool dbData; +}; + +struct CreatureModelInfo +{ + float bounding_radius; + float combat_reach; + int8 gender; + uint32 displayId_other_gender; + bool is_trigger; +}; + +enum InhabitTypeValues +{ + INHABIT_GROUND = 1, + INHABIT_WATER = 2, + INHABIT_AIR = 4, + INHABIT_ROOT = 8, + INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR | INHABIT_ROOT +}; + +#pragma pack(pop) + +// `creature_addon` table +struct CreatureAddon +{ + uint32 path_id; + uint32 mount; + uint32 bytes1; + uint32 bytes2; + uint32 emote; + uint16 aiAnimKit; + uint16 movementAnimKit; + uint16 meleeAnimKit; + std::vector<uint32> auras; +}; + +// Vendors +struct VendorItem +{ + VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost, uint8 _Type) + : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost), Type(_Type) { } + + uint32 item; + uint32 maxcount; // 0 for infinity item amount + uint32 incrtime; // time for restore items amount if maxcount != 0 + uint32 ExtendedCost; + uint8 Type; + + //helpers + bool IsGoldRequired(ItemTemplate const* pProto) const; +}; + +struct VendorItemData +{ + std::vector<VendorItem> m_items; + + VendorItem const* GetItem(uint32 slot) const + { + if (slot >= m_items.size()) + return nullptr; + + return &m_items[slot]; + } + bool Empty() const { return m_items.empty(); } + uint32 GetItemCount() const { return uint32(m_items.size()); } + void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type) + { + m_items.emplace_back(item, maxcount, ptime, ExtendedCost, type); + } + bool RemoveItem(uint32 item_id, uint8 type); + VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const; + void Clear() + { + m_items.clear(); + } +}; + +#define MAX_TRAINERSPELL_ABILITY_REQS 3 + +struct TrainerSpell +{ + TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0), Index(0) + { + for (uint8 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i) + ReqAbility[i] = 0; + } + + uint32 SpellID; + uint32 MoneyCost; + uint32 ReqSkillLine; + uint32 ReqSkillRank; + uint32 ReqLevel; + uint32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS]; + uint32 Index; + + // helpers + bool IsCastable() const { return ReqAbility[0] != SpellID; } +}; + +typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap; + +struct TC_GAME_API TrainerSpellData +{ + TrainerSpellData() : trainerType(0) { } + ~TrainerSpellData() { spellList.clear(); } + + TrainerSpellMap spellList; + uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value. + // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2. + TrainerSpell const* Find(uint32 spell_id) const; +}; + +#endif // CreatureData_h__ diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index e92506f3a9a..de677d44329 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -21,6 +21,8 @@ #include "CreatureAI.h" #include "DatabaseEnv.h" #include "Log.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectMgr.h" #define MAX_DESYNC 5.0f diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 26b0509f13f..8a3b83f2aa1 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -17,12 +17,16 @@ */ #include "GossipDef.h" -#include "Formulas.h" +#include "Creature.h" +#include "DB2Stores.h" #include "Log.h" #include "NPCPackets.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" +#include "Player.h" #include "QuestDef.h" #include "QuestPackets.h" +#include "World.h" #include "WorldSession.h" GossipMenu::GossipMenu() diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index c31cec6dee3..5d2d56c9d09 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -16,11 +16,12 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "TemporarySummon.h" +#include "CreatureAI.h" +#include "DB2Structure.h" #include "Log.h" +#include "Map.h" #include "ObjectAccessor.h" -#include "CreatureAI.h" -#include "ObjectMgr.h" -#include "TemporarySummon.h" #include "Pet.h" #include "Player.h" @@ -252,7 +253,7 @@ void TempSummon::UnSummon(uint32 msTime) //ASSERT(!IsPet()); if (IsPet()) { - ((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT); + ToPet()->Remove(PET_SAVE_NOT_IN_SLOT); ASSERT(!IsInWorld()); return; } diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index 20050617c03..e919f6647bb 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -21,21 +21,7 @@ #include "Creature.h" -enum SummonerType -{ - SUMMONER_TYPE_CREATURE = 0, - SUMMONER_TYPE_GAMEOBJECT = 1, - SUMMONER_TYPE_MAP = 2 -}; - -/// Stores data for temp summons -struct TempSummonData -{ - uint32 entry; ///< Entry of summoned creature - Position pos; ///< Position, where should be creature spawned - TempSummonType type; ///< Summon type, see TempSummonType for available types - uint32 time; ///< Despawn time, usable only with certain temp summon types -}; +struct SummonPropertiesEntry; class TC_GAME_API TempSummon : public Creature { diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 3a2708e80fe..1e3a6b85343 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -16,13 +16,19 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "DynamicObject.h" #include "Common.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" #include "Log.h" +#include "Map.h" #include "ObjectAccessor.h" +#include "Player.h" #include "ScriptMgr.h" +#include "SpellAuras.h" +#include "SpellInfo.h" +#include "SpellMgr.h" #include "Transport.h" +#include "Unit.h" +#include "UpdateData.h" #include "World.h" DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject), @@ -236,3 +242,8 @@ void DynamicObject::UnbindFromCaster() _caster->_UnregisterDynObject(this); _caster = NULL; } + +SpellInfo const* DynamicObject::GetSpellInfo() const +{ + return sSpellMgr->GetSpellInfo(GetSpellId()); +} diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h index aa3af92ed31..ee2ad1022e2 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.h +++ b/src/server/game/Entities/DynamicObject/DynamicObject.h @@ -56,6 +56,7 @@ class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicO void BindToCaster(); void UnbindFromCaster(); uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); } + SpellInfo const* GetSpellInfo() const; ObjectGuid GetCasterGUID() const { return GetGuidValue(DYNAMICOBJECT_CASTER); } float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 4bb4901823a..42eb2cbe3f7 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -28,9 +28,11 @@ #include "GridNotifiersImpl.h" #include "Group.h" #include "GroupMgr.h" +#include "Item.h" #include "Log.h" #include "LootMgr.h" #include "MiscPackets.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" #include "PoolMgr.h" @@ -41,6 +43,17 @@ #include "World.h" #include <G3D/Quat.h> +bool QuaternionData::isUnit() const +{ + return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5; +} + +QuaternionData QuaternionData::fromEulerAnglesZYX(float Z, float Y, float X) +{ + G3D::Quat quat(G3D::Matrix3::fromEulerAnglesZYX(Z, Y, X)); + return QuaternionData(quat.x, quat.y, quat.z, quat.w); +} + GameObject::GameObject() : WorldObject(false), MapObject(), m_model(nullptr), m_goValue(), m_AI(nullptr), _animKitId(0) { diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 0e225bf5faa..e55f74c4b2b 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -19,820 +19,21 @@ #ifndef TRINITYCORE_GAMEOBJECT_H #define TRINITYCORE_GAMEOBJECT_H -#include "Common.h" -#include "SharedDefines.h" #include "Object.h" -#include "Loot.h" #include "DatabaseEnvFwd.h" +#include "GameObjectData.h" +#include "Loot.h" #include "MapObject.h" +#include "SharedDefines.h" class GameObjectAI; +class GameObjectModel; class Group; -class Transport; -enum TriggerCastFlags : uint32; - -// from `gameobject_template` -struct GameObjectTemplate -{ - uint32 entry; - uint32 type; - uint32 displayId; - std::string name; - std::string IconName; - std::string castBarCaption; - std::string unk1; - float size; - int32 RequiredLevel; - union - { - // 0 GAMEOBJECT_TYPE_DOOR - struct - { - uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false - uint32 open; // 1 open, References: Lock_, NoValue = 0 - uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000 - uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false - uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0 - uint32 closeTextID; // 5 closeTextID, References: BroadcastText, NoValue = 0 - uint32 IgnoredByPathing; // 6 Ignored By Pathing, enum { false, true, }; Default: false - uint32 conditionID1; // 7 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 DoorisOpaque; // 8 Door is Opaque (Disable portal on close), enum { false, true, }; Default: true - uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false - uint32 InfiniteAOI; // 10 Infinite AOI, enum { false, true, }; Default: false - } door; - // 1 GAMEOBJECT_TYPE_BUTTON - struct - { - uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false - uint32 open; // 1 open, References: Lock_, NoValue = 0 - uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000 - uint32 linkedTrap; // 3 linkedTrap, References: GameObjects, NoValue = 0 - uint32 noDamageImmune; // 4 noDamageImmune, enum { false, true, }; Default: false - uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false - uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 - uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0 - uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false - uint32 conditionID1; // 9 conditionID1, References: PlayerCondition, NoValue = 0 - } button; - // 2 GAMEOBJECT_TYPE_QUESTGIVER - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 questGiver; // 1 questGiver, References: QuestGiver, NoValue = 0 - uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0 - uint32 gossipID; // 3 gossipID, References: Gossip, NoValue = 0 - uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0 - uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false - uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 - uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: false - uint32 allowMounted; // 8 allowMounted, enum { false, true, }; Default: false - uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false - uint32 conditionID1; // 10 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 NeverUsableWhileMounted; // 11 Never Usable While Mounted, enum { false, true, }; Default: false - } questgiver; - // 3 GAMEOBJECT_TYPE_CHEST - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0 - uint32 chestRestockTime; // 2 chestRestockTime, int, Min value: 0, Max value: 1800000, Default value: 0 - uint32 consumable; // 3 consumable, enum { false, true, }; Default: false - uint32 minRestock; // 4 minRestock, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 maxRestock; // 5 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 triggeredEvent; // 6 triggeredEvent, References: GameEvents, NoValue = 0 - uint32 linkedTrap; // 7 linkedTrap, References: GameObjects, NoValue = 0 - uint32 questID; // 8 questID, References: QuestV2, NoValue = 0 - uint32 level; // 9 level, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 requireLOS; // 10 require LOS, enum { false, true, }; Default: false - uint32 leaveLoot; // 11 leaveLoot, enum { false, true, }; Default: false - uint32 notInCombat; // 12 notInCombat, enum { false, true, }; Default: false - uint32 logloot; // 13 log loot, enum { false, true, }; Default: false - uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0 - uint32 usegrouplootrules; // 15 use group loot rules, enum { false, true, }; Default: false - uint32 floatingTooltip; // 16 floatingTooltip, enum { false, true, }; Default: false - uint32 conditionID1; // 17 conditionID1, References: PlayerCondition, NoValue = 0 - int32 xpLevel; // 18 xpLevel, int, Min value: -1, Max value: 123, Default value: 0 - uint32 xpDifficulty; // 19 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp - uint32 lootLevel; // 20 lootLevel, int, Min value: 0, Max value: 123, Default value: 0 - uint32 GroupXP; // 21 Group XP, enum { false, true, }; Default: false - uint32 DamageImmuneOK; // 22 Damage Immune OK, enum { false, true, }; Default: false - uint32 trivialSkillLow; // 23 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 trivialSkillHigh; // 24 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 DungeonEncounter; // 25 Dungeon Encounter, References: DungeonEncounter, NoValue = 0 - uint32 spell; // 26 spell, References: Spell, NoValue = 0 - uint32 GiganticAOI; // 27 Gigantic AOI, enum { false, true, }; Default: false - uint32 LargeAOI; // 28 Large AOI, enum { false, true, }; Default: false - uint32 SpawnVignette; // 29 Spawn Vignette, References: vignette, NoValue = 0 - uint32 chestPersonalLoot; // 30 chest Personal Loot, References: Treasure, NoValue = 0 - uint32 turnpersonallootsecurityoff; // 31 turn personal loot security off, enum { false, true, }; Default: false - uint32 ChestProperties; // 32 Chest Properties, References: ChestProperties, NoValue = 0 - } chest; - // 4 GAMEOBJECT_TYPE_BINDER - struct - { - } binder; - // 5 GAMEOBJECT_TYPE_GENERIC - struct - { - uint32 floatingTooltip; // 0 floatingTooltip, enum { false, true, }; Default: false - uint32 highlight; // 1 highlight, enum { false, true, }; Default: true - uint32 serverOnly; // 2 serverOnly, enum { false, true, }; Default: false - uint32 GiganticAOI; // 3 Gigantic AOI, enum { false, true, }; Default: false - uint32 floatOnWater; // 4 floatOnWater, enum { false, true, }; Default: false - uint32 questID; // 5 questID, References: QuestV2, NoValue = 0 - uint32 conditionID1; // 6 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 LargeAOI; // 7 Large AOI, enum { false, true, }; Default: false - uint32 UseGarrisonOwnerGuildColors; // 8 Use Garrison Owner Guild Colors, enum { false, true, }; Default: false - } generic; - // 6 GAMEOBJECT_TYPE_TRAP - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 level; // 1 level, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 radius; // 2 radius, int, Min value: 0, Max value: 100, Default value: 0 - uint32 spell; // 3 spell, References: Spell, NoValue = 0 - uint32 charges; // 4 charges, int, Min value: 0, Max value: 65535, Default value: 1 - uint32 cooldown; // 5 cooldown, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 autoClose; // 6 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 startDelay; // 7 startDelay, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 serverOnly; // 8 serverOnly, enum { false, true, }; Default: false - uint32 stealthed; // 9 stealthed, enum { false, true, }; Default: false - uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false - uint32 stealthAffected; // 11 stealthAffected, enum { false, true, }; Default: false - uint32 openTextID; // 12 openTextID, References: BroadcastText, NoValue = 0 - uint32 closeTextID; // 13 closeTextID, References: BroadcastText, NoValue = 0 - uint32 IgnoreTotems; // 14 Ignore Totems, enum { false, true, }; Default: false - uint32 conditionID1; // 15 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 playerCast; // 16 playerCast, enum { false, true, }; Default: false - uint32 SummonerTriggered; // 17 Summoner Triggered, enum { false, true, }; Default: false - uint32 requireLOS; // 18 require LOS, enum { false, true, }; Default: false - } trap; - // 7 GAMEOBJECT_TYPE_CHAIR - struct - { - uint32 chairslots; // 0 chairslots, int, Min value: 1, Max value: 5, Default value: 1 - uint32 chairheight; // 1 chairheight, int, Min value: 0, Max value: 2, Default value: 1 - uint32 onlyCreatorUse; // 2 onlyCreatorUse, enum { false, true, }; Default: false - uint32 triggeredEvent; // 3 triggeredEvent, References: GameEvents, NoValue = 0 - uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 - } chair; - // 8 GAMEOBJECT_TYPE_SPELL_FOCUS - struct - { - uint32 spellFocusType; // 0 spellFocusType, References: SpellFocusObject, NoValue = 0 - uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 10 - uint32 linkedTrap; // 2 linkedTrap, References: GameObjects, NoValue = 0 - uint32 serverOnly; // 3 serverOnly, enum { false, true, }; Default: false - uint32 questID; // 4 questID, References: QuestV2, NoValue = 0 - uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false - uint32 floatingTooltip; // 6 floatingTooltip, enum { false, true, }; Default: false - uint32 floatOnWater; // 7 floatOnWater, enum { false, true, }; Default: false - uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0 - } spellFocus; - // 9 GAMEOBJECT_TYPE_TEXT - struct - { - uint32 pageID; // 0 pageID, References: PageText, NoValue = 0 - uint32 language; // 1 language, References: Languages, NoValue = 0 - uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0 - uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false - uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 NeverUsableWhileMounted; // 5 Never Usable While Mounted, enum { false, true, }; Default: false - } text; - // 10 GAMEOBJECT_TYPE_GOOBER - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 questID; // 1 questID, References: QuestV2, NoValue = 0 - uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0 - uint32 autoClose; // 3 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000 - uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0 - uint32 consumable; // 5 consumable, enum { false, true, }; Default: false - uint32 cooldown; // 6 cooldown, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 pageID; // 7 pageID, References: PageText, NoValue = 0 - uint32 language; // 8 language, References: Languages, NoValue = 0 - uint32 pageMaterial; // 9 pageMaterial, References: PageTextMaterial, NoValue = 0 - uint32 spell; // 10 spell, References: Spell, NoValue = 0 - uint32 noDamageImmune; // 11 noDamageImmune, enum { false, true, }; Default: false - uint32 linkedTrap; // 12 linkedTrap, References: GameObjects, NoValue = 0 - uint32 GiganticAOI; // 13 Gigantic AOI, enum { false, true, }; Default: false - uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0 - uint32 closeTextID; // 15 closeTextID, References: BroadcastText, NoValue = 0 - uint32 requireLOS; // 16 require LOS, enum { false, true, }; Default: false - uint32 allowMounted; // 17 allowMounted, enum { false, true, }; Default: false - uint32 floatingTooltip; // 18 floatingTooltip, enum { false, true, }; Default: false - uint32 gossipID; // 19 gossipID, References: Gossip, NoValue = 0 - uint32 AllowMultiInteract; // 20 Allow Multi-Interact, enum { false, true, }; Default: false - uint32 floatOnWater; // 21 floatOnWater, enum { false, true, }; Default: false - uint32 conditionID1; // 22 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 playerCast; // 23 playerCast, enum { false, true, }; Default: false - uint32 SpawnVignette; // 24 Spawn Vignette, References: vignette, NoValue = 0 - uint32 startOpen; // 25 startOpen, enum { false, true, }; Default: false - uint32 DontPlayOpenAnim; // 26 Dont Play Open Anim, enum { false, true, }; Default: false - uint32 IgnoreBoundingBox; // 27 Ignore Bounding Box, enum { false, true, }; Default: false - uint32 NeverUsableWhileMounted; // 28 Never Usable While Mounted, enum { false, true, }; Default: false - uint32 SortFarZ; // 29 Sort Far Z, enum { false, true, }; Default: false - uint32 SyncAnimationtoObjectLifetime; // 30 Sync Animation to Object Lifetime (global track only), enum { false, true, }; Default: false - uint32 NoFuzzyHit; // 31 No Fuzzy Hit, enum { false, true, }; Default: false - } goober; - // 11 GAMEOBJECT_TYPE_TRANSPORT - struct - { - uint32 Timeto2ndfloor; // 0 Time to 2nd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false - uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached1stfloor; // 3 Reached 1st floor, References: GameEvents, NoValue = 0 - uint32 Reached2ndfloor; // 4 Reached 2nd floor, References: GameEvents, NoValue = 0 - int32 SpawnMap; // 5 Spawn Map, References: Map, NoValue = -1 - uint32 Timeto3rdfloor; // 6 Time to 3rd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached3rdfloor; // 7 Reached 3rd floor, References: GameEvents, NoValue = 0 - uint32 Timeto4thfloor; // 8 Time to 4th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached4thfloor; // 9 Reached 4th floor, References: GameEvents, NoValue = 0 - uint32 Timeto5thfloor; // 10 Time to 5th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached5thfloor; // 11 Reached 5th floor, References: GameEvents, NoValue = 0 - uint32 Timeto6thfloor; // 12 Time to 6th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached6thfloor; // 13 Reached 6th floor, References: GameEvents, NoValue = 0 - uint32 Timeto7thfloor; // 14 Time to 7th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached7thfloor; // 15 Reached 7th floor, References: GameEvents, NoValue = 0 - uint32 Timeto8thfloor; // 16 Time to 8th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached8thfloor; // 17 Reached 8th floor, References: GameEvents, NoValue = 0 - uint32 Timeto9thfloor; // 18 Time to 9th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached9thfloor; // 19 Reached 9th floor, References: GameEvents, NoValue = 0 - uint32 Timeto10thfloor; // 20 Time to 10th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 Reached10thfloor; // 21 Reached 10th floor, References: GameEvents, NoValue = 0 - uint32 onlychargeheightcheck; // 22 only charge height check. (yards), int, Min value: 0, Max value: 65535, Default value: 0 - uint32 onlychargetimecheck; // 23 only charge time check, int, Min value: 0, Max value: 65535, Default value: 0 - } transport; - // 12 GAMEOBJECT_TYPE_AREADAMAGE - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 3 - uint32 damageMin; // 2 damageMin, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 damageMax; // 3 damageMax, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 damageSchool; // 4 damageSchool, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 autoClose; // 5 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 - uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0 - } areaDamage; - // 13 GAMEOBJECT_TYPE_CAMERA - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 camera; // 1 camera, References: CinematicSequences, NoValue = 0 - uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0 - uint32 openTextID; // 3 openTextID, References: BroadcastText, NoValue = 0 - uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 - } camera; - // 14 GAMEOBJECT_TYPE_MAP_OBJECT - struct - { - } mapobject; - // 15 GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT - struct - { - uint32 taxiPathID; // 0 taxiPathID, References: TaxiPath, NoValue = 0 - uint32 moveSpeed; // 1 moveSpeed, int, Min value: 1, Max value: 60, Default value: 1 - uint32 accelRate; // 2 accelRate, int, Min value: 1, Max value: 20, Default value: 1 - uint32 startEventID; // 3 startEventID, References: GameEvents, NoValue = 0 - uint32 stopEventID; // 4 stopEventID, References: GameEvents, NoValue = 0 - uint32 transportPhysics; // 5 transportPhysics, References: TransportPhysics, NoValue = 0 - int32 SpawnMap; // 6 Spawn Map, References: Map, NoValue = -1 - uint32 worldState1; // 7 worldState1, References: WorldState, NoValue = 0 - uint32 allowstopping; // 8 allow stopping, enum { false, true, }; Default: false - uint32 InitStopped; // 9 Init Stopped, enum { false, true, }; Default: false - uint32 TrueInfiniteAOI; // 10 True Infinite AOI (programmer only!), enum { false, true, }; Default: false - } moTransport; - // 16 GAMEOBJECT_TYPE_DUEL_ARBITER - struct - { - } duelFlag; - // 17 GAMEOBJECT_TYPE_FISHINGNODE - struct - { - } fishingNode; - // 18 GAMEOBJECT_TYPE_RITUAL - struct - { - uint32 casters; // 0 casters, int, Min value: 1, Max value: 10, Default value: 1 - uint32 spell; // 1 spell, References: Spell, NoValue = 0 - uint32 animSpell; // 2 animSpell, References: Spell, NoValue = 0 - uint32 ritualPersistent; // 3 ritualPersistent, enum { false, true, }; Default: false - uint32 casterTargetSpell; // 4 casterTargetSpell, References: Spell, NoValue = 0 - uint32 casterTargetSpellTargets; // 5 casterTargetSpellTargets, int, Min value: 1, Max value: 10, Default value: 1 - uint32 castersGrouped; // 6 castersGrouped, enum { false, true, }; Default: true - uint32 ritualNoTargetCheck; // 7 ritualNoTargetCheck, enum { false, true, }; Default: true - uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0 - } ritual; - // 19 GAMEOBJECT_TYPE_MAILBOX - struct - { - uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0 - } mailbox; - // 20 GAMEOBJECT_TYPE_DO_NOT_USE - struct - { - } DONOTUSE; - // 21 GAMEOBJECT_TYPE_GUARDPOST - struct - { - uint32 creatureID; // 0 creatureID, References: Creature, NoValue = 0 - uint32 charges; // 1 charges, int, Min value: 0, Max value: 65535, Default value: 1 - } guardPost; - // 22 GAMEOBJECT_TYPE_SPELLCASTER - struct - { - uint32 spell; // 0 spell, References: Spell, NoValue = 0 - int32 charges; // 1 charges, int, Min value: -1, Max value: 65535, Default value: 1 - uint32 partyOnly; // 2 partyOnly, enum { false, true, }; Default: false - uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false - uint32 GiganticAOI; // 4 Gigantic AOI, enum { false, true, }; Default: false - uint32 conditionID1; // 5 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 playerCast; // 6 playerCast, enum { false, true, }; Default: false - uint32 NeverUsableWhileMounted; // 7 Never Usable While Mounted, enum { false, true, }; Default: false - } spellCaster; - // 23 GAMEOBJECT_TYPE_MEETINGSTONE - struct - { - uint32 minLevel; // 0 minLevel, int, Min value: 0, Max value: 65535, Default value: 1 - uint32 maxLevel; // 1 maxLevel, int, Min value: 1, Max value: 65535, Default value: 60 - uint32 areaID; // 2 areaID, References: AreaTable, NoValue = 0 - } meetingStone; - // 24 GAMEOBJECT_TYPE_FLAGSTAND - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0 - uint32 radius; // 2 radius, int, Min value: 0, Max value: 50, Default value: 0 - uint32 returnAura; // 3 returnAura, References: Spell, NoValue = 0 - uint32 returnSpell; // 4 returnSpell, References: Spell, NoValue = 0 - uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false - uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 - uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: true - uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 playerCast; // 9 playerCast, enum { false, true, }; Default: false - uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false - uint32 InfiniteAOI; // 11 Infinite AOI, enum { false, true, }; Default: false - uint32 cooldown; // 12 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000 - } flagStand; - // 25 GAMEOBJECT_TYPE_FISHINGHOLE - struct - { - uint32 radius; // 0 radius, int, Min value: 0, Max value: 50, Default value: 0 - uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0 - uint32 minRestock; // 2 minRestock, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 maxRestock; // 3 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 open; // 4 open, References: Lock_, NoValue = 0 - } fishingHole; - // 26 GAMEOBJECT_TYPE_FLAGDROP - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 eventID; // 1 eventID, References: GameEvents, NoValue = 0 - uint32 pickupSpell; // 2 pickupSpell, References: Spell, NoValue = 0 - uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false - uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0 - uint32 playerCast; // 5 playerCast, enum { false, true, }; Default: false - uint32 ExpireDuration; // 6 Expire Duration, int, Min value: 0, Max value: 60000, Default value: 10000 - uint32 GiganticAOI; // 7 Gigantic AOI, enum { false, true, }; Default: false - uint32 InfiniteAOI; // 8 Infinite AOI, enum { false, true, }; Default: false - uint32 cooldown; // 9 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000 - } flagDrop; - // 27 GAMEOBJECT_TYPE_MINI_GAME - struct - { - } miniGame; - // 28 GAMEOBJECT_TYPE_DO_NOT_USE_2 - struct - { - } DONOTUSE2; - // 29 GAMEOBJECT_TYPE_CONTROL_ZONE - struct - { - uint32 radius; // 0 radius, int, Min value: 0, Max value: 100, Default value: 10 - uint32 spell; // 1 spell, References: Spell, NoValue = 0 - uint32 worldState1; // 2 worldState1, References: WorldState, NoValue = 0 - uint32 worldstate2; // 3 worldstate2, References: WorldState, NoValue = 0 - uint32 CaptureEventHorde; // 4 Capture Event (Horde), References: GameEvents, NoValue = 0 - uint32 CaptureEventAlliance; // 5 Capture Event (Alliance), References: GameEvents, NoValue = 0 - uint32 ContestedEventHorde; // 6 Contested Event (Horde), References: GameEvents, NoValue = 0 - uint32 ContestedEventAlliance; // 7 Contested Event (Alliance), References: GameEvents, NoValue = 0 - uint32 ProgressEventHorde; // 8 Progress Event (Horde), References: GameEvents, NoValue = 0 - uint32 ProgressEventAlliance; // 9 Progress Event (Alliance), References: GameEvents, NoValue = 0 - uint32 NeutralEventHorde; // 10 Neutral Event (Horde), References: GameEvents, NoValue = 0 - uint32 NeutralEventAlliance; // 11 Neutral Event (Alliance), References: GameEvents, NoValue = 0 - uint32 neutralPercent; // 12 neutralPercent, int, Min value: 0, Max value: 100, Default value: 0 - uint32 worldstate3; // 13 worldstate3, References: WorldState, NoValue = 0 - uint32 minSuperiority; // 14 minSuperiority, int, Min value: 1, Max value: 65535, Default value: 1 - uint32 maxSuperiority; // 15 maxSuperiority, int, Min value: 1, Max value: 65535, Default value: 1 - uint32 minTime; // 16 minTime, int, Min value: 1, Max value: 65535, Default value: 1 - uint32 maxTime; // 17 maxTime, int, Min value: 1, Max value: 65535, Default value: 1 - uint32 GiganticAOI; // 18 Gigantic AOI, enum { false, true, }; Default: false - uint32 highlight; // 19 highlight, enum { false, true, }; Default: true - uint32 startingValue; // 20 startingValue, int, Min value: 0, Max value: 100, Default value: 50 - uint32 unidirectional; // 21 unidirectional, enum { false, true, }; Default: false - uint32 killbonustime; // 22 kill bonus time %, int, Min value: 0, Max value: 100, Default value: 0 - uint32 speedWorldState1; // 23 speedWorldState1, References: WorldState, NoValue = 0 - uint32 speedWorldState2; // 24 speedWorldState2, References: WorldState, NoValue = 0 - uint32 UncontestedTime; // 25 Uncontested Time, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 FrequentHeartbeat; // 26 Frequent Heartbeat, enum { false, true, }; Default: false - } controlZone; - // 30 GAMEOBJECT_TYPE_AURA_GENERATOR - struct - { - uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: true - uint32 radius; // 1 radius, int, Min value: 0, Max value: 100, Default value: 10 - uint32 auraID1; // 2 auraID1, References: Spell, NoValue = 0 - uint32 conditionID1; // 3 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 auraID2; // 4 auraID2, References: Spell, NoValue = 0 - uint32 conditionID2; // 5 conditionID2, References: PlayerCondition, NoValue = 0 - uint32 serverOnly; // 6 serverOnly, enum { false, true, }; Default: false - } auraGenerator; - // 31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY - struct - { - uint32 InstanceType; // 0 Instance Type, enum { Not Instanced, Party Dungeon, Raid Dungeon, PVP Battlefield, Arena Battlefield, Scenario, }; Default: Party Dungeon - uint32 DifficultyNormal; // 1 Difficulty Normal, References: animationdata, NoValue = 0 - uint32 DifficultyHeroic; // 2 Difficulty Heroic, References: animationdata, NoValue = 0 - uint32 DifficultyEpic; // 3 Difficulty Epic, References: animationdata, NoValue = 0 - uint32 DifficultyLegendary; // 4 Difficulty Legendary, References: animationdata, NoValue = 0 - uint32 HeroicAttachment; // 5 Heroic Attachment, References: gameobjectdisplayinfo, NoValue = 0 - uint32 ChallengeAttachment; // 6 Challenge Attachment, References: gameobjectdisplayinfo, NoValue = 0 - uint32 DifficultyAnimations; // 7 Difficulty Animations, References: GameObjectDiffAnim, NoValue = 0 - uint32 LargeAOI; // 8 Large AOI, enum { false, true, }; Default: false - uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false - uint32 Legacy; // 10 Legacy, enum { false, true, }; Default: false - } dungeonDifficulty; - // 32 GAMEOBJECT_TYPE_BARBER_CHAIR - struct - { - uint32 chairheight; // 0 chairheight, int, Min value: 0, Max value: 2, Default value: 1 - int32 HeightOffset; // 1 Height Offset (inches), int, Min value: -100, Max value: 100, Default value: 0 - uint32 SitAnimKit; // 2 Sit Anim Kit, References: AnimKit, NoValue = 0 - } barberChair; - // 33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING - struct - { - int32 Unused; // 0 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 CreditProxyCreature; // 1 Credit Proxy Creature, References: Creature, NoValue = 0 - uint32 HealthRec; // 2 Health Rec, References: DestructibleHitpoint, NoValue = 0 - uint32 IntactEvent; // 3 Intact Event, References: GameEvents, NoValue = 0 - uint32 PVPEnabling; // 4 PVP Enabling, enum { false, true, }; Default: false - uint32 InteriorVisible; // 5 Interior Visible, enum { false, true, }; Default: false - uint32 InteriorLight; // 6 Interior Light, enum { false, true, }; Default: false - int32 Unused1; // 7 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - int32 Unused2; // 8 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 DamagedEvent; // 9 Damaged Event, References: GameEvents, NoValue = 0 - int32 Unused3; // 10 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - int32 Unused4; // 11 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - int32 Unused5; // 12 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - int32 Unused6; // 13 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 DestroyedEvent; // 14 Destroyed Event, References: GameEvents, NoValue = 0 - int32 Unused7; // 15 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 RebuildingTime; // 16 Rebuilding: Time (secs), int, Min value: 0, Max value: 65535, Default value: 0 - int32 Unused8; // 17 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 DestructibleModelRec; // 18 Destructible Model Rec, References: DestructibleModelData, NoValue = 0 - uint32 RebuildingEvent; // 19 Rebuilding: Event, References: GameEvents, NoValue = 0 - int32 Unused9; // 20 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - int32 Unused10; // 21 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 DamageEvent; // 22 Damage Event, References: GameEvents, NoValue = 0 - } destructibleBuilding; - // 34 GAMEOBJECT_TYPE_GUILD_BANK - struct - { - uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0 - } guildbank; - // 35 GAMEOBJECT_TYPE_TRAPDOOR - struct - { - uint32 AutoLink; // 0 Auto Link, enum { false, true, }; Default: false - uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false - uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 BlocksPathsDown; // 3 Blocks Paths Down, enum { false, true, }; Default: false - uint32 PathBlockerBump; // 4 Path Blocker Bump (ft), int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - } trapdoor; - // 36 GAMEOBJECT_TYPE_NEW_FLAG - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0 - uint32 openTextID; // 2 openTextID, References: BroadcastText, NoValue = 0 - uint32 requireLOS; // 3 require LOS, enum { false, true, }; Default: true - uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false - uint32 InfiniteAOI; // 6 Infinite AOI, enum { false, true, }; Default: false - uint32 ExpireDuration; // 7 Expire Duration, int, Min value: 0, Max value: 3600000, Default value: 10000 - uint32 RespawnTime; // 8 Respawn Time, int, Min value: 0, Max value: 3600000, Default value: 20000 - uint32 FlagDrop; // 9 Flag Drop, References: GameObjects, NoValue = 0 - int32 ExclusiveCategory; // 10 Exclusive Category (BGs Only), int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 worldState1; // 11 worldState1, References: WorldState, NoValue = 0 - uint32 ReturnonDefenderInteract; // 12 Return on Defender Interact, enum { false, true, }; Default: false - } newflag; - // 37 GAMEOBJECT_TYPE_NEW_FLAG_DROP - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - } newflagdrop; - // 38 GAMEOBJECT_TYPE_GARRISON_BUILDING - struct - { - int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1 - } garrisonBuilding; - // 39 GAMEOBJECT_TYPE_GARRISON_PLOT - struct - { - uint32 PlotInstance; // 0 Plot Instance, References: GarrPlotInstance, NoValue = 0 - int32 SpawnMap; // 1 Spawn Map, References: Map, NoValue = -1 - } garrisonPlot; - // 40 GAMEOBJECT_TYPE_CLIENT_CREATURE - struct - { - uint32 CreatureDisplayInfo; // 0 Creature Display Info, References: CreatureDisplayInfo, NoValue = 0 - uint32 AnimKit; // 1 Anim Kit, References: AnimKit, NoValue = 0 - uint32 creatureID; // 2 creatureID, References: Creature, NoValue = 0 - } clientCreature; - // 41 GAMEOBJECT_TYPE_CLIENT_ITEM - struct - { - uint32 Item; // 0 Item, References: Item, NoValue = 0 - } clientItem; - // 42 GAMEOBJECT_TYPE_CAPTURE_POINT - struct - { - uint32 CaptureTime; // 0 Capture Time (ms), int, Min value: 0, Max value: 2147483647, Default value: 60000 - uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false - uint32 highlight; // 2 highlight, enum { false, true, }; Default: true - uint32 open; // 3 open, References: Lock_, NoValue = 0 - uint32 AssaultBroadcastHorde; // 4 Assault Broadcast (Horde), References: BroadcastText, NoValue = 0 - uint32 CaptureBroadcastHorde; // 5 Capture Broadcast (Horde), References: BroadcastText, NoValue = 0 - uint32 DefendedBroadcastHorde; // 6 Defended Broadcast (Horde), References: BroadcastText, NoValue = 0 - uint32 AssaultBroadcastAlliance; // 7 Assault Broadcast (Alliance), References: BroadcastText, NoValue = 0 - uint32 CaptureBroadcastAlliance; // 8 Capture Broadcast (Alliance), References: BroadcastText, NoValue = 0 - uint32 DefendedBroadcastAlliance; // 9 Defended Broadcast (Alliance), References: BroadcastText, NoValue = 0 - uint32 worldState1; // 10 worldState1, References: WorldState, NoValue = 0 - uint32 ContestedEventHorde; // 11 Contested Event (Horde), References: GameEvents, NoValue = 0 - uint32 CaptureEventHorde; // 12 Capture Event (Horde), References: GameEvents, NoValue = 0 - uint32 DefendedEventHorde; // 13 Defended Event (Horde), References: GameEvents, NoValue = 0 - uint32 ContestedEventAlliance; // 14 Contested Event (Alliance), References: GameEvents, NoValue = 0 - uint32 CaptureEventAlliance; // 15 Capture Event (Alliance), References: GameEvents, NoValue = 0 - uint32 DefendedEventAlliance; // 16 Defended Event (Alliance), References: GameEvents, NoValue = 0 - uint32 SpellVisual1; // 17 Spell Visual 1, References: SpellVisual, NoValue = 0 - uint32 SpellVisual2; // 18 Spell Visual 2, References: SpellVisual, NoValue = 0 - uint32 SpellVisual3; // 19 Spell Visual 3, References: SpellVisual, NoValue = 0 - uint32 SpellVisual4; // 20 Spell Visual 4, References: SpellVisual, NoValue = 0 - uint32 SpellVisual5; // 21 Spell Visual 5, References: SpellVisual, NoValue = 0 - } capturePoint; - // 43 GAMEOBJECT_TYPE_PHASEABLE_MO - struct - { - int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1 - uint32 AreaNameSet; // 1 Area Name Set (Index), int, Min value: -2147483648, Max value: 2147483647, Default value: 0 - uint32 DoodadSetA; // 2 Doodad Set A, int, Min value: 0, Max value: 2147483647, Default value: 0 - uint32 DoodadSetB; // 3 Doodad Set B, int, Min value: 0, Max value: 2147483647, Default value: 0 - } phaseableMO; - // 44 GAMEOBJECT_TYPE_GARRISON_MONUMENT - struct - { - uint32 TrophyTypeID; // 0 Trophy Type ID, References: TrophyType, NoValue = 0 - uint32 TrophyInstanceID; // 1 Trophy Instance ID, References: TrophyInstance, NoValue = 0 - } garrisonMonument; - // 45 GAMEOBJECT_TYPE_GARRISON_SHIPMENT - struct - { - uint32 ShipmentContainer; // 0 Shipment Container, References: CharShipmentContainer, NoValue = 0 - uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false - uint32 LargeAOI; // 2 Large AOI, enum { false, true, }; Default: false - } garrisonShipment; - // 46 GAMEOBJECT_TYPE_GARRISON_MONUMENT_PLAQUE - struct - { - uint32 TrophyInstanceID; // 0 Trophy Instance ID, References: TrophyInstance, NoValue = 0 - } garrisonMonumentPlaque; - // 47 GAMEOBJECT_TYPE_ARTIFACT_FORGE - struct - { - uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 LargeAOI; // 1 Large AOI, enum { false, true, }; Default: false - uint32 IgnoreBoundingBox; // 2 Ignore Bounding Box, enum { false, true, }; Default: false - uint32 CameraMode; // 3 Camera Mode, References: CameraMode, NoValue = 0 - uint32 FadeRegionRadius; // 4 Fade Region Radius, int, Min value: 0, Max value: 2147483647, Default value: 0 - } artifactForge; - // 48 GAMEOBJECT_TYPE_UI_LINK - struct - { - uint32 UILinkType; // 0 UI Link Type, enum { Adventure Journal, Obliterum Forge, }; Default: Adventure Journal - uint32 allowMounted; // 1 allowMounted, enum { false, true, }; Default: false - uint32 GiganticAOI; // 2 Gigantic AOI, enum { false, true, }; Default: false - uint32 spellFocusType; // 3 spellFocusType, References: SpellFocusObject, NoValue = 0 - uint32 radius; // 4 radius, int, Min value: 0, Max value: 50, Default value: 10 - } UILink; - // 49 GAMEOBJECT_TYPE_KEYSTONE_RECEPTACLE - struct - { - } KeystoneReceptacle; - // 50 GAMEOBJECT_TYPE_GATHERING_NODE - struct - { - uint32 open; // 0 open, References: Lock_, NoValue = 0 - uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0 - uint32 level; // 2 level, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 notInCombat; // 3 notInCombat, enum { false, true, }; Default: false - uint32 trivialSkillLow; // 4 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 trivialSkillHigh; // 5 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0 - uint32 ObjectDespawnDelay; // 6 Object Despawn Delay, int, Min value: 0, Max value: 600, Default value: 15 - uint32 triggeredEvent; // 7 triggeredEvent, References: GameEvents, NoValue = 0 - uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false - uint32 openTextID; // 9 openTextID, References: BroadcastText, NoValue = 0 - uint32 floatingTooltip; // 10 floatingTooltip, enum { false, true, }; Default: false - uint32 conditionID1; // 11 conditionID1, References: PlayerCondition, NoValue = 0 - uint32 xpLevel; // 12 xpLevel, int, Min value: -1, Max value: 123, Default value: 0 - uint32 xpDifficulty; // 13 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp - uint32 spell; // 14 spell, References: Spell, NoValue = 0 - uint32 GiganticAOI; // 15 Gigantic AOI, enum { false, true, }; Default: false - uint32 LargeAOI; // 16 Large AOI, enum { false, true, }; Default: false - uint32 SpawnVignette; // 17 Spawn Vignette, References: vignette, NoValue = 0 - uint32 MaxNumberofLoots; // 18 Max Number of Loots, int, Min value: 1, Max value: 40, Default value: 10 - uint32 logloot; // 19 log loot, enum { false, true, }; Default: false - uint32 linkedTrap; // 20 linkedTrap, References: GameObjects, NoValue = 0 - } gatheringNode; - // 51 GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD - struct - { - uint32 chestLoot; // 0 chestLoot, References: Treasure, NoValue = 0 - uint32 WhenAvailable; // 1 When Available, References: GameObjectDisplayInfo, NoValue = 0 - } challengeModeReward; - struct - { - uint32 data[MAX_GAMEOBJECT_DATA]; - } raw; - }; - - std::string AIName; - uint32 ScriptId; - - // helpers - bool IsDespawnAtAction() const - { - switch (type) - { - case GAMEOBJECT_TYPE_CHEST: return chest.consumable != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.consumable != 0; - default: return false; - } - } - - bool IsUsableMounted() const - { - switch (type) - { - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted != 0; - case GAMEOBJECT_TYPE_TEXT: return text.allowMounted != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted != 0; - case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.allowMounted != 0; - case GAMEOBJECT_TYPE_UI_LINK: return UILink.allowMounted != 0; - default: return false; - } - } - - uint32 GetLockId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: return door.open; - case GAMEOBJECT_TYPE_BUTTON: return button.open; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.open; - case GAMEOBJECT_TYPE_CHEST: return chest.open; - case GAMEOBJECT_TYPE_TRAP: return trap.open; - case GAMEOBJECT_TYPE_GOOBER: return goober.open; - case GAMEOBJECT_TYPE_AREADAMAGE: return areaDamage.open; - case GAMEOBJECT_TYPE_CAMERA: return camera.open; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.open; - case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.open; - case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.open; - case GAMEOBJECT_TYPE_NEW_FLAG: return newflag.open; - case GAMEOBJECT_TYPE_NEW_FLAG_DROP: return newflagdrop.open; - case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.open; - case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.open; - default: return 0; - } - } - - bool GetDespawnPossibility() const // despawn at targeting of cast? - { - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0; - case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.noDamageImmune != 0; - default: return true; - } - } - - uint32 GetCharges() const // despawn at uses amount - { - switch (type) - { - //case GAMEOBJECT_TYPE_TRAP: return trap.charges; - case GAMEOBJECT_TYPE_GUARDPOST: return guardPost.charges; - case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.charges; - default: return 0; - } - } - - uint32 GetLinkedGameObjectEntry() const - { - switch (type) - { - case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrap; - case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrap; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrap; - case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrap; - case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.linkedTrap; - default: return 0; - } - } - - uint32 GetAutoCloseTime() const - { - uint32 autoCloseTime = 0; - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoClose; break; - case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoClose; break; - case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoClose; break; - case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoClose; break; - case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoClose; break; - case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areaDamage.autoClose; break; - case GAMEOBJECT_TYPE_TRAPDOOR: autoCloseTime = trapdoor.autoClose; break; - default: break; - } - return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000; - } - - uint32 GetLootId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_CHEST: return chest.chestLoot; - case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.chestLoot; - case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.chestLoot; - case GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD: return challengeModeReward.chestLoot; - default: return 0; - } - } - - uint32 GetGossipMenuId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID; - case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID; - default: return 0; - } - } - - uint32 GetEventScriptId() const - { - switch (type) - { - case GAMEOBJECT_TYPE_GOOBER: return goober.eventID; - case GAMEOBJECT_TYPE_CHEST: return chest.triggeredEvent; - case GAMEOBJECT_TYPE_CAMERA: return camera.eventID; - case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.triggeredEvent; - default: return 0; - } - } - - uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell - { - switch (type) - { - case GAMEOBJECT_TYPE_TRAP: return trap.cooldown; - case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown; - default: return 0; - } - } -}; - -// From `gameobject_template_addon` -struct GameObjectTemplateAddon -{ - uint32 entry; - uint32 faction; - uint32 flags; - uint32 mingold; - uint32 maxgold; -}; - -// Benchmarked: Faster than std::map (insert/find) -typedef std::unordered_map<uint32, GameObjectTemplate> GameObjectTemplateContainer; -typedef std::unordered_map<uint32, GameObjectTemplateAddon> GameObjectTemplateAddonContainer; - class OPvPCapturePoint; +class Transport; +class Unit; struct TransportAnimation; +enum TriggerCastFlags : uint32; union GameObjectValue { @@ -863,60 +64,6 @@ union GameObjectValue } Building; }; -struct GameObjectLocale -{ - std::vector<std::string> Name; - std::vector<std::string> CastBarCaption; - std::vector<std::string> Unk1; -}; - -struct QuaternionData -{ - float x, y, z, w; - - QuaternionData() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {} - QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {} - - bool isUnit() const { return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5; } -}; - -// `gameobject_addon` table -struct GameObjectAddon -{ - QuaternionData ParentRotation; - InvisibilityType invisibilityType; - uint32 InvisibilityValue; -}; - -typedef std::unordered_map<ObjectGuid::LowType, GameObjectAddon> GameObjectAddonContainer; - -// from `gameobject` -struct GameObjectData -{ - explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), - animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), phaseid(0), phaseGroup(0), dbData(true) { } - uint32 id; // entry in gamobject_template - uint16 mapid; - uint32 phaseMask; - float posX; - float posY; - float posZ; - float orientation; - QuaternionData rotation; - int32 spawntimesecs; - uint32 animprogress; - GOState go_state; - uint32 spawnMask; - uint8 artKit; - uint32 phaseid; - uint32 phaseGroup; - uint32 ScriptId; - bool dbData; -}; - -typedef std::vector<uint32> GameObjectQuestItemList; -typedef std::unordered_map<uint32, GameObjectQuestItemList> GameObjectQuestItemMap; - // For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ... // For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted> // For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ... @@ -929,9 +76,6 @@ enum LootState GO_JUST_DEACTIVATED }; -class Unit; -class GameObjectModel; - // 5 sec for bobber catch #define FISHING_BOBBER_READY_TIME 5 diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h new file mode 100644 index 00000000000..c0a91a3d166 --- /dev/null +++ b/src/server/game/Entities/GameObject/GameObjectData.h @@ -0,0 +1,873 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef GameObjectData_h__ +#define GameObjectData_h__ + +#include "Common.h" +#include "SharedDefines.h" +#include <string> +#include <vector> + +// from `gameobject_template` +struct GameObjectTemplate +{ + uint32 entry; + uint32 type; + uint32 displayId; + std::string name; + std::string IconName; + std::string castBarCaption; + std::string unk1; + float size; + int32 RequiredLevel; + union + { + // 0 GAMEOBJECT_TYPE_DOOR + struct + { + uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false + uint32 open; // 1 open, References: Lock_, NoValue = 0 + uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000 + uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false + uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0 + uint32 closeTextID; // 5 closeTextID, References: BroadcastText, NoValue = 0 + uint32 IgnoredByPathing; // 6 Ignored By Pathing, enum { false, true, }; Default: false + uint32 conditionID1; // 7 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 DoorisOpaque; // 8 Door is Opaque (Disable portal on close), enum { false, true, }; Default: true + uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false + uint32 InfiniteAOI; // 10 Infinite AOI, enum { false, true, }; Default: false + } door; + // 1 GAMEOBJECT_TYPE_BUTTON + struct + { + uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false + uint32 open; // 1 open, References: Lock_, NoValue = 0 + uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000 + uint32 linkedTrap; // 3 linkedTrap, References: GameObjects, NoValue = 0 + uint32 noDamageImmune; // 4 noDamageImmune, enum { false, true, }; Default: false + uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false + uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 + uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0 + uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false + uint32 conditionID1; // 9 conditionID1, References: PlayerCondition, NoValue = 0 + } button; + // 2 GAMEOBJECT_TYPE_QUESTGIVER + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 questGiver; // 1 questGiver, References: QuestGiver, NoValue = 0 + uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0 + uint32 gossipID; // 3 gossipID, References: Gossip, NoValue = 0 + uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0 + uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false + uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 + uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: false + uint32 allowMounted; // 8 allowMounted, enum { false, true, }; Default: false + uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false + uint32 conditionID1; // 10 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 NeverUsableWhileMounted; // 11 Never Usable While Mounted, enum { false, true, }; Default: false + } questgiver; + // 3 GAMEOBJECT_TYPE_CHEST + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0 + uint32 chestRestockTime; // 2 chestRestockTime, int, Min value: 0, Max value: 1800000, Default value: 0 + uint32 consumable; // 3 consumable, enum { false, true, }; Default: false + uint32 minRestock; // 4 minRestock, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 maxRestock; // 5 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 triggeredEvent; // 6 triggeredEvent, References: GameEvents, NoValue = 0 + uint32 linkedTrap; // 7 linkedTrap, References: GameObjects, NoValue = 0 + uint32 questID; // 8 questID, References: QuestV2, NoValue = 0 + uint32 level; // 9 level, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 requireLOS; // 10 require LOS, enum { false, true, }; Default: false + uint32 leaveLoot; // 11 leaveLoot, enum { false, true, }; Default: false + uint32 notInCombat; // 12 notInCombat, enum { false, true, }; Default: false + uint32 logloot; // 13 log loot, enum { false, true, }; Default: false + uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0 + uint32 usegrouplootrules; // 15 use group loot rules, enum { false, true, }; Default: false + uint32 floatingTooltip; // 16 floatingTooltip, enum { false, true, }; Default: false + uint32 conditionID1; // 17 conditionID1, References: PlayerCondition, NoValue = 0 + int32 xpLevel; // 18 xpLevel, int, Min value: -1, Max value: 123, Default value: 0 + uint32 xpDifficulty; // 19 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp + uint32 lootLevel; // 20 lootLevel, int, Min value: 0, Max value: 123, Default value: 0 + uint32 GroupXP; // 21 Group XP, enum { false, true, }; Default: false + uint32 DamageImmuneOK; // 22 Damage Immune OK, enum { false, true, }; Default: false + uint32 trivialSkillLow; // 23 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 trivialSkillHigh; // 24 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 DungeonEncounter; // 25 Dungeon Encounter, References: DungeonEncounter, NoValue = 0 + uint32 spell; // 26 spell, References: Spell, NoValue = 0 + uint32 GiganticAOI; // 27 Gigantic AOI, enum { false, true, }; Default: false + uint32 LargeAOI; // 28 Large AOI, enum { false, true, }; Default: false + uint32 SpawnVignette; // 29 Spawn Vignette, References: vignette, NoValue = 0 + uint32 chestPersonalLoot; // 30 chest Personal Loot, References: Treasure, NoValue = 0 + uint32 turnpersonallootsecurityoff; // 31 turn personal loot security off, enum { false, true, }; Default: false + uint32 ChestProperties; // 32 Chest Properties, References: ChestProperties, NoValue = 0 + } chest; + // 4 GAMEOBJECT_TYPE_BINDER + struct + { + } binder; + // 5 GAMEOBJECT_TYPE_GENERIC + struct + { + uint32 floatingTooltip; // 0 floatingTooltip, enum { false, true, }; Default: false + uint32 highlight; // 1 highlight, enum { false, true, }; Default: true + uint32 serverOnly; // 2 serverOnly, enum { false, true, }; Default: false + uint32 GiganticAOI; // 3 Gigantic AOI, enum { false, true, }; Default: false + uint32 floatOnWater; // 4 floatOnWater, enum { false, true, }; Default: false + uint32 questID; // 5 questID, References: QuestV2, NoValue = 0 + uint32 conditionID1; // 6 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 LargeAOI; // 7 Large AOI, enum { false, true, }; Default: false + uint32 UseGarrisonOwnerGuildColors; // 8 Use Garrison Owner Guild Colors, enum { false, true, }; Default: false + } generic; + // 6 GAMEOBJECT_TYPE_TRAP + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 level; // 1 level, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 radius; // 2 radius, int, Min value: 0, Max value: 100, Default value: 0 + uint32 spell; // 3 spell, References: Spell, NoValue = 0 + uint32 charges; // 4 charges, int, Min value: 0, Max value: 65535, Default value: 1 + uint32 cooldown; // 5 cooldown, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 autoClose; // 6 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 startDelay; // 7 startDelay, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 serverOnly; // 8 serverOnly, enum { false, true, }; Default: false + uint32 stealthed; // 9 stealthed, enum { false, true, }; Default: false + uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false + uint32 stealthAffected; // 11 stealthAffected, enum { false, true, }; Default: false + uint32 openTextID; // 12 openTextID, References: BroadcastText, NoValue = 0 + uint32 closeTextID; // 13 closeTextID, References: BroadcastText, NoValue = 0 + uint32 IgnoreTotems; // 14 Ignore Totems, enum { false, true, }; Default: false + uint32 conditionID1; // 15 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 playerCast; // 16 playerCast, enum { false, true, }; Default: false + uint32 SummonerTriggered; // 17 Summoner Triggered, enum { false, true, }; Default: false + uint32 requireLOS; // 18 require LOS, enum { false, true, }; Default: false + } trap; + // 7 GAMEOBJECT_TYPE_CHAIR + struct + { + uint32 chairslots; // 0 chairslots, int, Min value: 1, Max value: 5, Default value: 1 + uint32 chairheight; // 1 chairheight, int, Min value: 0, Max value: 2, Default value: 1 + uint32 onlyCreatorUse; // 2 onlyCreatorUse, enum { false, true, }; Default: false + uint32 triggeredEvent; // 3 triggeredEvent, References: GameEvents, NoValue = 0 + uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 + } chair; + // 8 GAMEOBJECT_TYPE_SPELL_FOCUS + struct + { + uint32 spellFocusType; // 0 spellFocusType, References: SpellFocusObject, NoValue = 0 + uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 10 + uint32 linkedTrap; // 2 linkedTrap, References: GameObjects, NoValue = 0 + uint32 serverOnly; // 3 serverOnly, enum { false, true, }; Default: false + uint32 questID; // 4 questID, References: QuestV2, NoValue = 0 + uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false + uint32 floatingTooltip; // 6 floatingTooltip, enum { false, true, }; Default: false + uint32 floatOnWater; // 7 floatOnWater, enum { false, true, }; Default: false + uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0 + } spellFocus; + // 9 GAMEOBJECT_TYPE_TEXT + struct + { + uint32 pageID; // 0 pageID, References: PageText, NoValue = 0 + uint32 language; // 1 language, References: Languages, NoValue = 0 + uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0 + uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false + uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 NeverUsableWhileMounted; // 5 Never Usable While Mounted, enum { false, true, }; Default: false + } text; + // 10 GAMEOBJECT_TYPE_GOOBER + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 questID; // 1 questID, References: QuestV2, NoValue = 0 + uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0 + uint32 autoClose; // 3 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000 + uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0 + uint32 consumable; // 5 consumable, enum { false, true, }; Default: false + uint32 cooldown; // 6 cooldown, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 pageID; // 7 pageID, References: PageText, NoValue = 0 + uint32 language; // 8 language, References: Languages, NoValue = 0 + uint32 pageMaterial; // 9 pageMaterial, References: PageTextMaterial, NoValue = 0 + uint32 spell; // 10 spell, References: Spell, NoValue = 0 + uint32 noDamageImmune; // 11 noDamageImmune, enum { false, true, }; Default: false + uint32 linkedTrap; // 12 linkedTrap, References: GameObjects, NoValue = 0 + uint32 GiganticAOI; // 13 Gigantic AOI, enum { false, true, }; Default: false + uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0 + uint32 closeTextID; // 15 closeTextID, References: BroadcastText, NoValue = 0 + uint32 requireLOS; // 16 require LOS, enum { false, true, }; Default: false + uint32 allowMounted; // 17 allowMounted, enum { false, true, }; Default: false + uint32 floatingTooltip; // 18 floatingTooltip, enum { false, true, }; Default: false + uint32 gossipID; // 19 gossipID, References: Gossip, NoValue = 0 + uint32 AllowMultiInteract; // 20 Allow Multi-Interact, enum { false, true, }; Default: false + uint32 floatOnWater; // 21 floatOnWater, enum { false, true, }; Default: false + uint32 conditionID1; // 22 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 playerCast; // 23 playerCast, enum { false, true, }; Default: false + uint32 SpawnVignette; // 24 Spawn Vignette, References: vignette, NoValue = 0 + uint32 startOpen; // 25 startOpen, enum { false, true, }; Default: false + uint32 DontPlayOpenAnim; // 26 Dont Play Open Anim, enum { false, true, }; Default: false + uint32 IgnoreBoundingBox; // 27 Ignore Bounding Box, enum { false, true, }; Default: false + uint32 NeverUsableWhileMounted; // 28 Never Usable While Mounted, enum { false, true, }; Default: false + uint32 SortFarZ; // 29 Sort Far Z, enum { false, true, }; Default: false + uint32 SyncAnimationtoObjectLifetime; // 30 Sync Animation to Object Lifetime (global track only), enum { false, true, }; Default: false + uint32 NoFuzzyHit; // 31 No Fuzzy Hit, enum { false, true, }; Default: false + } goober; + // 11 GAMEOBJECT_TYPE_TRANSPORT + struct + { + uint32 Timeto2ndfloor; // 0 Time to 2nd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false + uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached1stfloor; // 3 Reached 1st floor, References: GameEvents, NoValue = 0 + uint32 Reached2ndfloor; // 4 Reached 2nd floor, References: GameEvents, NoValue = 0 + int32 SpawnMap; // 5 Spawn Map, References: Map, NoValue = -1 + uint32 Timeto3rdfloor; // 6 Time to 3rd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached3rdfloor; // 7 Reached 3rd floor, References: GameEvents, NoValue = 0 + uint32 Timeto4thfloor; // 8 Time to 4th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached4thfloor; // 9 Reached 4th floor, References: GameEvents, NoValue = 0 + uint32 Timeto5thfloor; // 10 Time to 5th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached5thfloor; // 11 Reached 5th floor, References: GameEvents, NoValue = 0 + uint32 Timeto6thfloor; // 12 Time to 6th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached6thfloor; // 13 Reached 6th floor, References: GameEvents, NoValue = 0 + uint32 Timeto7thfloor; // 14 Time to 7th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached7thfloor; // 15 Reached 7th floor, References: GameEvents, NoValue = 0 + uint32 Timeto8thfloor; // 16 Time to 8th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached8thfloor; // 17 Reached 8th floor, References: GameEvents, NoValue = 0 + uint32 Timeto9thfloor; // 18 Time to 9th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached9thfloor; // 19 Reached 9th floor, References: GameEvents, NoValue = 0 + uint32 Timeto10thfloor; // 20 Time to 10th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 Reached10thfloor; // 21 Reached 10th floor, References: GameEvents, NoValue = 0 + uint32 onlychargeheightcheck; // 22 only charge height check. (yards), int, Min value: 0, Max value: 65535, Default value: 0 + uint32 onlychargetimecheck; // 23 only charge time check, int, Min value: 0, Max value: 65535, Default value: 0 + } transport; + // 12 GAMEOBJECT_TYPE_AREADAMAGE + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 3 + uint32 damageMin; // 2 damageMin, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 damageMax; // 3 damageMax, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 damageSchool; // 4 damageSchool, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 autoClose; // 5 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 + uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0 + } areaDamage; + // 13 GAMEOBJECT_TYPE_CAMERA + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 camera; // 1 camera, References: CinematicSequences, NoValue = 0 + uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0 + uint32 openTextID; // 3 openTextID, References: BroadcastText, NoValue = 0 + uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 + } camera; + // 14 GAMEOBJECT_TYPE_MAP_OBJECT + struct + { + } mapobject; + // 15 GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT + struct + { + uint32 taxiPathID; // 0 taxiPathID, References: TaxiPath, NoValue = 0 + uint32 moveSpeed; // 1 moveSpeed, int, Min value: 1, Max value: 60, Default value: 1 + uint32 accelRate; // 2 accelRate, int, Min value: 1, Max value: 20, Default value: 1 + uint32 startEventID; // 3 startEventID, References: GameEvents, NoValue = 0 + uint32 stopEventID; // 4 stopEventID, References: GameEvents, NoValue = 0 + uint32 transportPhysics; // 5 transportPhysics, References: TransportPhysics, NoValue = 0 + int32 SpawnMap; // 6 Spawn Map, References: Map, NoValue = -1 + uint32 worldState1; // 7 worldState1, References: WorldState, NoValue = 0 + uint32 allowstopping; // 8 allow stopping, enum { false, true, }; Default: false + uint32 InitStopped; // 9 Init Stopped, enum { false, true, }; Default: false + uint32 TrueInfiniteAOI; // 10 True Infinite AOI (programmer only!), enum { false, true, }; Default: false + } moTransport; + // 16 GAMEOBJECT_TYPE_DUEL_ARBITER + struct + { + } duelFlag; + // 17 GAMEOBJECT_TYPE_FISHINGNODE + struct + { + } fishingNode; + // 18 GAMEOBJECT_TYPE_RITUAL + struct + { + uint32 casters; // 0 casters, int, Min value: 1, Max value: 10, Default value: 1 + uint32 spell; // 1 spell, References: Spell, NoValue = 0 + uint32 animSpell; // 2 animSpell, References: Spell, NoValue = 0 + uint32 ritualPersistent; // 3 ritualPersistent, enum { false, true, }; Default: false + uint32 casterTargetSpell; // 4 casterTargetSpell, References: Spell, NoValue = 0 + uint32 casterTargetSpellTargets; // 5 casterTargetSpellTargets, int, Min value: 1, Max value: 10, Default value: 1 + uint32 castersGrouped; // 6 castersGrouped, enum { false, true, }; Default: true + uint32 ritualNoTargetCheck; // 7 ritualNoTargetCheck, enum { false, true, }; Default: true + uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0 + } ritual; + // 19 GAMEOBJECT_TYPE_MAILBOX + struct + { + uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0 + } mailbox; + // 20 GAMEOBJECT_TYPE_DO_NOT_USE + struct + { + } DONOTUSE; + // 21 GAMEOBJECT_TYPE_GUARDPOST + struct + { + uint32 creatureID; // 0 creatureID, References: Creature, NoValue = 0 + uint32 charges; // 1 charges, int, Min value: 0, Max value: 65535, Default value: 1 + } guardPost; + // 22 GAMEOBJECT_TYPE_SPELLCASTER + struct + { + uint32 spell; // 0 spell, References: Spell, NoValue = 0 + int32 charges; // 1 charges, int, Min value: -1, Max value: 65535, Default value: 1 + uint32 partyOnly; // 2 partyOnly, enum { false, true, }; Default: false + uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false + uint32 GiganticAOI; // 4 Gigantic AOI, enum { false, true, }; Default: false + uint32 conditionID1; // 5 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 playerCast; // 6 playerCast, enum { false, true, }; Default: false + uint32 NeverUsableWhileMounted; // 7 Never Usable While Mounted, enum { false, true, }; Default: false + } spellCaster; + // 23 GAMEOBJECT_TYPE_MEETINGSTONE + struct + { + uint32 minLevel; // 0 minLevel, int, Min value: 0, Max value: 65535, Default value: 1 + uint32 maxLevel; // 1 maxLevel, int, Min value: 1, Max value: 65535, Default value: 60 + uint32 areaID; // 2 areaID, References: AreaTable, NoValue = 0 + } meetingStone; + // 24 GAMEOBJECT_TYPE_FLAGSTAND + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0 + uint32 radius; // 2 radius, int, Min value: 0, Max value: 50, Default value: 0 + uint32 returnAura; // 3 returnAura, References: Spell, NoValue = 0 + uint32 returnSpell; // 4 returnSpell, References: Spell, NoValue = 0 + uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false + uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0 + uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: true + uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 playerCast; // 9 playerCast, enum { false, true, }; Default: false + uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false + uint32 InfiniteAOI; // 11 Infinite AOI, enum { false, true, }; Default: false + uint32 cooldown; // 12 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000 + } flagStand; + // 25 GAMEOBJECT_TYPE_FISHINGHOLE + struct + { + uint32 radius; // 0 radius, int, Min value: 0, Max value: 50, Default value: 0 + uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0 + uint32 minRestock; // 2 minRestock, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 maxRestock; // 3 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 open; // 4 open, References: Lock_, NoValue = 0 + } fishingHole; + // 26 GAMEOBJECT_TYPE_FLAGDROP + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 eventID; // 1 eventID, References: GameEvents, NoValue = 0 + uint32 pickupSpell; // 2 pickupSpell, References: Spell, NoValue = 0 + uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false + uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0 + uint32 playerCast; // 5 playerCast, enum { false, true, }; Default: false + uint32 ExpireDuration; // 6 Expire Duration, int, Min value: 0, Max value: 60000, Default value: 10000 + uint32 GiganticAOI; // 7 Gigantic AOI, enum { false, true, }; Default: false + uint32 InfiniteAOI; // 8 Infinite AOI, enum { false, true, }; Default: false + uint32 cooldown; // 9 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000 + } flagDrop; + // 27 GAMEOBJECT_TYPE_MINI_GAME + struct + { + } miniGame; + // 28 GAMEOBJECT_TYPE_DO_NOT_USE_2 + struct + { + } DONOTUSE2; + // 29 GAMEOBJECT_TYPE_CONTROL_ZONE + struct + { + uint32 radius; // 0 radius, int, Min value: 0, Max value: 100, Default value: 10 + uint32 spell; // 1 spell, References: Spell, NoValue = 0 + uint32 worldState1; // 2 worldState1, References: WorldState, NoValue = 0 + uint32 worldstate2; // 3 worldstate2, References: WorldState, NoValue = 0 + uint32 CaptureEventHorde; // 4 Capture Event (Horde), References: GameEvents, NoValue = 0 + uint32 CaptureEventAlliance; // 5 Capture Event (Alliance), References: GameEvents, NoValue = 0 + uint32 ContestedEventHorde; // 6 Contested Event (Horde), References: GameEvents, NoValue = 0 + uint32 ContestedEventAlliance; // 7 Contested Event (Alliance), References: GameEvents, NoValue = 0 + uint32 ProgressEventHorde; // 8 Progress Event (Horde), References: GameEvents, NoValue = 0 + uint32 ProgressEventAlliance; // 9 Progress Event (Alliance), References: GameEvents, NoValue = 0 + uint32 NeutralEventHorde; // 10 Neutral Event (Horde), References: GameEvents, NoValue = 0 + uint32 NeutralEventAlliance; // 11 Neutral Event (Alliance), References: GameEvents, NoValue = 0 + uint32 neutralPercent; // 12 neutralPercent, int, Min value: 0, Max value: 100, Default value: 0 + uint32 worldstate3; // 13 worldstate3, References: WorldState, NoValue = 0 + uint32 minSuperiority; // 14 minSuperiority, int, Min value: 1, Max value: 65535, Default value: 1 + uint32 maxSuperiority; // 15 maxSuperiority, int, Min value: 1, Max value: 65535, Default value: 1 + uint32 minTime; // 16 minTime, int, Min value: 1, Max value: 65535, Default value: 1 + uint32 maxTime; // 17 maxTime, int, Min value: 1, Max value: 65535, Default value: 1 + uint32 GiganticAOI; // 18 Gigantic AOI, enum { false, true, }; Default: false + uint32 highlight; // 19 highlight, enum { false, true, }; Default: true + uint32 startingValue; // 20 startingValue, int, Min value: 0, Max value: 100, Default value: 50 + uint32 unidirectional; // 21 unidirectional, enum { false, true, }; Default: false + uint32 killbonustime; // 22 kill bonus time %, int, Min value: 0, Max value: 100, Default value: 0 + uint32 speedWorldState1; // 23 speedWorldState1, References: WorldState, NoValue = 0 + uint32 speedWorldState2; // 24 speedWorldState2, References: WorldState, NoValue = 0 + uint32 UncontestedTime; // 25 Uncontested Time, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 FrequentHeartbeat; // 26 Frequent Heartbeat, enum { false, true, }; Default: false + } controlZone; + // 30 GAMEOBJECT_TYPE_AURA_GENERATOR + struct + { + uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: true + uint32 radius; // 1 radius, int, Min value: 0, Max value: 100, Default value: 10 + uint32 auraID1; // 2 auraID1, References: Spell, NoValue = 0 + uint32 conditionID1; // 3 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 auraID2; // 4 auraID2, References: Spell, NoValue = 0 + uint32 conditionID2; // 5 conditionID2, References: PlayerCondition, NoValue = 0 + uint32 serverOnly; // 6 serverOnly, enum { false, true, }; Default: false + } auraGenerator; + // 31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY + struct + { + uint32 InstanceType; // 0 Instance Type, enum { Not Instanced, Party Dungeon, Raid Dungeon, PVP Battlefield, Arena Battlefield, Scenario, }; Default: Party Dungeon + uint32 DifficultyNormal; // 1 Difficulty Normal, References: animationdata, NoValue = 0 + uint32 DifficultyHeroic; // 2 Difficulty Heroic, References: animationdata, NoValue = 0 + uint32 DifficultyEpic; // 3 Difficulty Epic, References: animationdata, NoValue = 0 + uint32 DifficultyLegendary; // 4 Difficulty Legendary, References: animationdata, NoValue = 0 + uint32 HeroicAttachment; // 5 Heroic Attachment, References: gameobjectdisplayinfo, NoValue = 0 + uint32 ChallengeAttachment; // 6 Challenge Attachment, References: gameobjectdisplayinfo, NoValue = 0 + uint32 DifficultyAnimations; // 7 Difficulty Animations, References: GameObjectDiffAnim, NoValue = 0 + uint32 LargeAOI; // 8 Large AOI, enum { false, true, }; Default: false + uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false + uint32 Legacy; // 10 Legacy, enum { false, true, }; Default: false + } dungeonDifficulty; + // 32 GAMEOBJECT_TYPE_BARBER_CHAIR + struct + { + uint32 chairheight; // 0 chairheight, int, Min value: 0, Max value: 2, Default value: 1 + int32 HeightOffset; // 1 Height Offset (inches), int, Min value: -100, Max value: 100, Default value: 0 + uint32 SitAnimKit; // 2 Sit Anim Kit, References: AnimKit, NoValue = 0 + } barberChair; + // 33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING + struct + { + int32 Unused; // 0 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 CreditProxyCreature; // 1 Credit Proxy Creature, References: Creature, NoValue = 0 + uint32 HealthRec; // 2 Health Rec, References: DestructibleHitpoint, NoValue = 0 + uint32 IntactEvent; // 3 Intact Event, References: GameEvents, NoValue = 0 + uint32 PVPEnabling; // 4 PVP Enabling, enum { false, true, }; Default: false + uint32 InteriorVisible; // 5 Interior Visible, enum { false, true, }; Default: false + uint32 InteriorLight; // 6 Interior Light, enum { false, true, }; Default: false + int32 Unused1; // 7 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + int32 Unused2; // 8 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 DamagedEvent; // 9 Damaged Event, References: GameEvents, NoValue = 0 + int32 Unused3; // 10 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + int32 Unused4; // 11 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + int32 Unused5; // 12 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + int32 Unused6; // 13 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 DestroyedEvent; // 14 Destroyed Event, References: GameEvents, NoValue = 0 + int32 Unused7; // 15 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 RebuildingTime; // 16 Rebuilding: Time (secs), int, Min value: 0, Max value: 65535, Default value: 0 + int32 Unused8; // 17 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 DestructibleModelRec; // 18 Destructible Model Rec, References: DestructibleModelData, NoValue = 0 + uint32 RebuildingEvent; // 19 Rebuilding: Event, References: GameEvents, NoValue = 0 + int32 Unused9; // 20 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + int32 Unused10; // 21 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 DamageEvent; // 22 Damage Event, References: GameEvents, NoValue = 0 + } destructibleBuilding; + // 34 GAMEOBJECT_TYPE_GUILD_BANK + struct + { + uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0 + } guildbank; + // 35 GAMEOBJECT_TYPE_TRAPDOOR + struct + { + uint32 AutoLink; // 0 Auto Link, enum { false, true, }; Default: false + uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false + uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 BlocksPathsDown; // 3 Blocks Paths Down, enum { false, true, }; Default: false + uint32 PathBlockerBump; // 4 Path Blocker Bump (ft), int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + } trapdoor; + // 36 GAMEOBJECT_TYPE_NEW_FLAG + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0 + uint32 openTextID; // 2 openTextID, References: BroadcastText, NoValue = 0 + uint32 requireLOS; // 3 require LOS, enum { false, true, }; Default: true + uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false + uint32 InfiniteAOI; // 6 Infinite AOI, enum { false, true, }; Default: false + uint32 ExpireDuration; // 7 Expire Duration, int, Min value: 0, Max value: 3600000, Default value: 10000 + uint32 RespawnTime; // 8 Respawn Time, int, Min value: 0, Max value: 3600000, Default value: 20000 + uint32 FlagDrop; // 9 Flag Drop, References: GameObjects, NoValue = 0 + int32 ExclusiveCategory; // 10 Exclusive Category (BGs Only), int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 worldState1; // 11 worldState1, References: WorldState, NoValue = 0 + uint32 ReturnonDefenderInteract; // 12 Return on Defender Interact, enum { false, true, }; Default: false + } newflag; + // 37 GAMEOBJECT_TYPE_NEW_FLAG_DROP + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + } newflagdrop; + // 38 GAMEOBJECT_TYPE_GARRISON_BUILDING + struct + { + int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1 + } garrisonBuilding; + // 39 GAMEOBJECT_TYPE_GARRISON_PLOT + struct + { + uint32 PlotInstance; // 0 Plot Instance, References: GarrPlotInstance, NoValue = 0 + int32 SpawnMap; // 1 Spawn Map, References: Map, NoValue = -1 + } garrisonPlot; + // 40 GAMEOBJECT_TYPE_CLIENT_CREATURE + struct + { + uint32 CreatureDisplayInfo; // 0 Creature Display Info, References: CreatureDisplayInfo, NoValue = 0 + uint32 AnimKit; // 1 Anim Kit, References: AnimKit, NoValue = 0 + uint32 creatureID; // 2 creatureID, References: Creature, NoValue = 0 + } clientCreature; + // 41 GAMEOBJECT_TYPE_CLIENT_ITEM + struct + { + uint32 Item; // 0 Item, References: Item, NoValue = 0 + } clientItem; + // 42 GAMEOBJECT_TYPE_CAPTURE_POINT + struct + { + uint32 CaptureTime; // 0 Capture Time (ms), int, Min value: 0, Max value: 2147483647, Default value: 60000 + uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false + uint32 highlight; // 2 highlight, enum { false, true, }; Default: true + uint32 open; // 3 open, References: Lock_, NoValue = 0 + uint32 AssaultBroadcastHorde; // 4 Assault Broadcast (Horde), References: BroadcastText, NoValue = 0 + uint32 CaptureBroadcastHorde; // 5 Capture Broadcast (Horde), References: BroadcastText, NoValue = 0 + uint32 DefendedBroadcastHorde; // 6 Defended Broadcast (Horde), References: BroadcastText, NoValue = 0 + uint32 AssaultBroadcastAlliance; // 7 Assault Broadcast (Alliance), References: BroadcastText, NoValue = 0 + uint32 CaptureBroadcastAlliance; // 8 Capture Broadcast (Alliance), References: BroadcastText, NoValue = 0 + uint32 DefendedBroadcastAlliance; // 9 Defended Broadcast (Alliance), References: BroadcastText, NoValue = 0 + uint32 worldState1; // 10 worldState1, References: WorldState, NoValue = 0 + uint32 ContestedEventHorde; // 11 Contested Event (Horde), References: GameEvents, NoValue = 0 + uint32 CaptureEventHorde; // 12 Capture Event (Horde), References: GameEvents, NoValue = 0 + uint32 DefendedEventHorde; // 13 Defended Event (Horde), References: GameEvents, NoValue = 0 + uint32 ContestedEventAlliance; // 14 Contested Event (Alliance), References: GameEvents, NoValue = 0 + uint32 CaptureEventAlliance; // 15 Capture Event (Alliance), References: GameEvents, NoValue = 0 + uint32 DefendedEventAlliance; // 16 Defended Event (Alliance), References: GameEvents, NoValue = 0 + uint32 SpellVisual1; // 17 Spell Visual 1, References: SpellVisual, NoValue = 0 + uint32 SpellVisual2; // 18 Spell Visual 2, References: SpellVisual, NoValue = 0 + uint32 SpellVisual3; // 19 Spell Visual 3, References: SpellVisual, NoValue = 0 + uint32 SpellVisual4; // 20 Spell Visual 4, References: SpellVisual, NoValue = 0 + uint32 SpellVisual5; // 21 Spell Visual 5, References: SpellVisual, NoValue = 0 + } capturePoint; + // 43 GAMEOBJECT_TYPE_PHASEABLE_MO + struct + { + int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1 + uint32 AreaNameSet; // 1 Area Name Set (Index), int, Min value: -2147483648, Max value: 2147483647, Default value: 0 + uint32 DoodadSetA; // 2 Doodad Set A, int, Min value: 0, Max value: 2147483647, Default value: 0 + uint32 DoodadSetB; // 3 Doodad Set B, int, Min value: 0, Max value: 2147483647, Default value: 0 + } phaseableMO; + // 44 GAMEOBJECT_TYPE_GARRISON_MONUMENT + struct + { + uint32 TrophyTypeID; // 0 Trophy Type ID, References: TrophyType, NoValue = 0 + uint32 TrophyInstanceID; // 1 Trophy Instance ID, References: TrophyInstance, NoValue = 0 + } garrisonMonument; + // 45 GAMEOBJECT_TYPE_GARRISON_SHIPMENT + struct + { + uint32 ShipmentContainer; // 0 Shipment Container, References: CharShipmentContainer, NoValue = 0 + uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false + uint32 LargeAOI; // 2 Large AOI, enum { false, true, }; Default: false + } garrisonShipment; + // 46 GAMEOBJECT_TYPE_GARRISON_MONUMENT_PLAQUE + struct + { + uint32 TrophyInstanceID; // 0 Trophy Instance ID, References: TrophyInstance, NoValue = 0 + } garrisonMonumentPlaque; + // 47 GAMEOBJECT_TYPE_ARTIFACT_FORGE + struct + { + uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 LargeAOI; // 1 Large AOI, enum { false, true, }; Default: false + uint32 IgnoreBoundingBox; // 2 Ignore Bounding Box, enum { false, true, }; Default: false + uint32 CameraMode; // 3 Camera Mode, References: CameraMode, NoValue = 0 + uint32 FadeRegionRadius; // 4 Fade Region Radius, int, Min value: 0, Max value: 2147483647, Default value: 0 + } artifactForge; + // 48 GAMEOBJECT_TYPE_UI_LINK + struct + { + uint32 UILinkType; // 0 UI Link Type, enum { Adventure Journal, Obliterum Forge, }; Default: Adventure Journal + uint32 allowMounted; // 1 allowMounted, enum { false, true, }; Default: false + uint32 GiganticAOI; // 2 Gigantic AOI, enum { false, true, }; Default: false + uint32 spellFocusType; // 3 spellFocusType, References: SpellFocusObject, NoValue = 0 + uint32 radius; // 4 radius, int, Min value: 0, Max value: 50, Default value: 10 + } UILink; + // 49 GAMEOBJECT_TYPE_KEYSTONE_RECEPTACLE + struct + { + } KeystoneReceptacle; + // 50 GAMEOBJECT_TYPE_GATHERING_NODE + struct + { + uint32 open; // 0 open, References: Lock_, NoValue = 0 + uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0 + uint32 level; // 2 level, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 notInCombat; // 3 notInCombat, enum { false, true, }; Default: false + uint32 trivialSkillLow; // 4 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 trivialSkillHigh; // 5 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0 + uint32 ObjectDespawnDelay; // 6 Object Despawn Delay, int, Min value: 0, Max value: 600, Default value: 15 + uint32 triggeredEvent; // 7 triggeredEvent, References: GameEvents, NoValue = 0 + uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false + uint32 openTextID; // 9 openTextID, References: BroadcastText, NoValue = 0 + uint32 floatingTooltip; // 10 floatingTooltip, enum { false, true, }; Default: false + uint32 conditionID1; // 11 conditionID1, References: PlayerCondition, NoValue = 0 + uint32 xpLevel; // 12 xpLevel, int, Min value: -1, Max value: 123, Default value: 0 + uint32 xpDifficulty; // 13 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp + uint32 spell; // 14 spell, References: Spell, NoValue = 0 + uint32 GiganticAOI; // 15 Gigantic AOI, enum { false, true, }; Default: false + uint32 LargeAOI; // 16 Large AOI, enum { false, true, }; Default: false + uint32 SpawnVignette; // 17 Spawn Vignette, References: vignette, NoValue = 0 + uint32 MaxNumberofLoots; // 18 Max Number of Loots, int, Min value: 1, Max value: 40, Default value: 10 + uint32 logloot; // 19 log loot, enum { false, true, }; Default: false + uint32 linkedTrap; // 20 linkedTrap, References: GameObjects, NoValue = 0 + } gatheringNode; + // 51 GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD + struct + { + uint32 chestLoot; // 0 chestLoot, References: Treasure, NoValue = 0 + uint32 WhenAvailable; // 1 When Available, References: GameObjectDisplayInfo, NoValue = 0 + } challengeModeReward; + struct + { + uint32 data[MAX_GAMEOBJECT_DATA]; + } raw; + }; + + std::string AIName; + uint32 ScriptId; + + // helpers + bool IsDespawnAtAction() const + { + switch (type) + { + case GAMEOBJECT_TYPE_CHEST: return chest.consumable != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.consumable != 0; + default: return false; + } + } + + bool IsUsableMounted() const + { + switch (type) + { + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted != 0; + case GAMEOBJECT_TYPE_TEXT: return text.allowMounted != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted != 0; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.allowMounted != 0; + case GAMEOBJECT_TYPE_UI_LINK: return UILink.allowMounted != 0; + default: return false; + } + } + + uint32 GetLockId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: return door.open; + case GAMEOBJECT_TYPE_BUTTON: return button.open; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.open; + case GAMEOBJECT_TYPE_CHEST: return chest.open; + case GAMEOBJECT_TYPE_TRAP: return trap.open; + case GAMEOBJECT_TYPE_GOOBER: return goober.open; + case GAMEOBJECT_TYPE_AREADAMAGE: return areaDamage.open; + case GAMEOBJECT_TYPE_CAMERA: return camera.open; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.open; + case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.open; + case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.open; + case GAMEOBJECT_TYPE_NEW_FLAG: return newflag.open; + case GAMEOBJECT_TYPE_NEW_FLAG_DROP: return newflagdrop.open; + case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.open; + case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.open; + default: return 0; + } + } + + bool GetDespawnPossibility() const // despawn at targeting of cast? + { + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0; + case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.noDamageImmune != 0; + default: return true; + } + } + + uint32 GetCharges() const // despawn at uses amount + { + switch (type) + { + //case GAMEOBJECT_TYPE_TRAP: return trap.charges; + case GAMEOBJECT_TYPE_GUARDPOST: return guardPost.charges; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.charges; + default: return 0; + } + } + + uint32 GetLinkedGameObjectEntry() const + { + switch (type) + { + case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrap; + case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrap; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrap; + case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrap; + case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.linkedTrap; + default: return 0; + } + } + + uint32 GetAutoCloseTime() const + { + uint32 autoCloseTime = 0; + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoClose; break; + case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoClose; break; + case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoClose; break; + case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoClose; break; + case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoClose; break; + case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areaDamage.autoClose; break; + case GAMEOBJECT_TYPE_TRAPDOOR: autoCloseTime = trapdoor.autoClose; break; + default: break; + } + return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000; + } + + uint32 GetLootId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_CHEST: return chest.chestLoot; + case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.chestLoot; + case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.chestLoot; + case GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD: return challengeModeReward.chestLoot; + default: return 0; + } + } + + uint32 GetGossipMenuId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID; + case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID; + default: return 0; + } + } + + uint32 GetEventScriptId() const + { + switch (type) + { + case GAMEOBJECT_TYPE_GOOBER: return goober.eventID; + case GAMEOBJECT_TYPE_CHEST: return chest.triggeredEvent; + case GAMEOBJECT_TYPE_CAMERA: return camera.eventID; + case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.triggeredEvent; + default: return 0; + } + } + + uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell + { + switch (type) + { + case GAMEOBJECT_TYPE_TRAP: return trap.cooldown; + case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown; + default: return 0; + } + } +}; + +// From `gameobject_template_addon` +struct GameObjectTemplateAddon +{ + uint32 entry; + uint32 faction; + uint32 flags; + uint32 mingold; + uint32 maxgold; +}; + + +struct GameObjectLocale +{ + std::vector<std::string> Name; + std::vector<std::string> CastBarCaption; + std::vector<std::string> Unk1; +}; + +struct TC_GAME_API QuaternionData +{ + float x, y, z, w; + + QuaternionData() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {} + QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {} + + bool isUnit() const; + static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X); +}; + +// `gameobject_addon` table +struct GameObjectAddon +{ + QuaternionData ParentRotation; + InvisibilityType invisibilityType; + uint32 InvisibilityValue; +}; + +// from `gameobject` +struct GameObjectData +{ + explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0), + animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), phaseid(0), phaseGroup(0), dbData(true) { } + uint32 id; // entry in gamobject_template + uint16 mapid; + uint32 phaseMask; + float posX; + float posY; + float posZ; + float orientation; + QuaternionData rotation; + int32 spawntimesecs; + uint32 animprogress; + GOState go_state; + uint32 spawnMask; + uint8 artKit; + uint32 phaseid; + uint32 phaseGroup; + uint32 ScriptId; + bool dbData; +}; + +#endif // GameObjectData_h__ diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h index c9276f2a855..eaa7507de75 100644 --- a/src/server/game/Entities/Item/Container/Bag.h +++ b/src/server/game/Entities/Item/Container/Bag.h @@ -23,7 +23,6 @@ #define MAX_BAG_SIZE 36 // 2.0.12 #include "Item.h" -#include "ItemTemplate.h" class TC_GAME_API Bag : public Item { diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index cf0679a0395..d81c4e8e59d 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -18,24 +18,26 @@ #include "Item.h" #include "ArtifactPackets.h" +#include "Bag.h" #include "CollectionMgr.h" #include "Common.h" #include "ConditionMgr.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "GameTables.h" #include "ItemEnchantmentMgr.h" #include "ItemPackets.h" #include "Log.h" #include "LootMgr.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" -#include "Opcodes.h" #include "Player.h" #include "ScriptMgr.h" #include "SpellInfo.h" #include "SpellMgr.h" #include "TradeData.h" #include "UpdateData.h" -#include "WorldPacket.h" #include "WorldSession.h" void AddItemsSetItem(Player* player, Item* item) @@ -958,7 +960,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) // pretend the item never existed if (forplayer) { - RemoveFromUpdateQueueOf(forplayer); + RemoveItemFromUpdateQueueOf(this, forplayer); forplayer->DeleteRefundReference(GetGUID()); } delete this; @@ -971,7 +973,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) uState = state; if (forplayer) - AddToUpdateQueueOf(forplayer); + AddItemToUpdateQueueOf(this, forplayer); } else { @@ -982,46 +984,46 @@ void Item::SetState(ItemUpdateState state, Player* forplayer) } } -void Item::AddToUpdateQueueOf(Player* player) +void AddItemToUpdateQueueOf(Item* item, Player* player) { - if (IsInUpdateQueue()) + if (item->IsInUpdateQueue()) return; ASSERT(player != NULL); - if (player->GetGUID() != GetOwnerGUID()) + if (player->GetGUID() != item->GetOwnerGUID()) { TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", - GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str()); + item->GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str()); return; } if (player->m_itemUpdateQueueBlocked) return; - player->m_itemUpdateQueue.push_back(this); - uQueuePos = player->m_itemUpdateQueue.size()-1; + player->m_itemUpdateQueue.push_back(item); + item->uQueuePos = player->m_itemUpdateQueue.size() - 1; } -void Item::RemoveFromUpdateQueueOf(Player* player) +void RemoveItemFromUpdateQueueOf(Item* item, Player* player) { - if (!IsInUpdateQueue()) + if (!item->IsInUpdateQueue()) return; ASSERT(player != NULL); - if (player->GetGUID() != GetOwnerGUID()) + if (player->GetGUID() != item->GetOwnerGUID()) { TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!", - GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str()); + item->GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str()); return; } if (player->m_itemUpdateQueueBlocked) return; - player->m_itemUpdateQueue[uQueuePos] = NULL; - uQueuePos = -1; + player->m_itemUpdateQueue[item->uQueuePos] = nullptr; + item->uQueuePos = -1; } uint8 Item::GetBagSlot() const @@ -1042,7 +1044,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE) || !trade))) return false; - if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty())) + if (IsBag() && (Player::IsBagPos(GetPos()) || !ToBag()->IsEmpty())) return false; if (Player* owner = GetOwner()) diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 76e1ef5258b..31dbb82c098 100644 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -19,13 +19,13 @@ #ifndef TRINITYCORE_ITEM_H #define TRINITYCORE_ITEM_H -#include "Common.h" #include "Object.h" -#include "Loot.h" +#include "Common.h" +#include "DatabaseEnvFwd.h" +#include "ItemDefines.h" #include "ItemEnchantmentMgr.h" #include "ItemTemplate.h" -#include "DatabaseEnvFwd.h" -#include <unordered_set> +#include "Loot.h" class SpellInfo; class Bag; @@ -45,158 +45,6 @@ struct ItemSetEffect std::unordered_set<ItemSetSpellEntry const*> SetBonuses; }; -enum InventoryResult : uint8 -{ - EQUIP_ERR_OK = 0, - EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, // You must reach level %d to use that item. - EQUIP_ERR_CANT_EQUIP_SKILL = 2, // You aren't skilled enough to use that item. - EQUIP_ERR_WRONG_SLOT = 3, // That item does not go in that slot. - EQUIP_ERR_BAG_FULL = 4, // That bag is full. - EQUIP_ERR_BAG_IN_BAG = 5, // Can't put non-empty bags in other bags. - EQUIP_ERR_TRADE_EQUIPPED_BAG = 6, // You can't trade equipped bags. - EQUIP_ERR_AMMO_ONLY = 7, // Only ammo can go there. - EQUIP_ERR_PROFICIENCY_NEEDED = 8, // You do not have the required proficiency for that item. - EQUIP_ERR_NO_SLOT_AVAILABLE = 9, // No equipment slot is available for that item. - EQUIP_ERR_CANT_EQUIP_EVER = 10, // You can never use that item. - EQUIP_ERR_CANT_EQUIP_EVER_2 = 11, // You can never use that item. - EQUIP_ERR_NO_SLOT_AVAILABLE_2 = 12, // No equipment slot is available for that item. - EQUIP_ERR_2HANDED_EQUIPPED = 13, // Cannot equip that with a two-handed weapon. - EQUIP_ERR_2HSKILLNOTFOUND = 14, // You cannot dual-wield - EQUIP_ERR_WRONG_BAG_TYPE = 15, // That item doesn't go in that container. - EQUIP_ERR_WRONG_BAG_TYPE_2 = 16, // That item doesn't go in that container. - EQUIP_ERR_ITEM_MAX_COUNT = 17, // You can't carry any more of those items. - EQUIP_ERR_NO_SLOT_AVAILABLE_3 = 18, // No equipment slot is available for that item. - EQUIP_ERR_CANT_STACK = 19, // This item cannot stack. - EQUIP_ERR_NOT_EQUIPPABLE = 20, // This item cannot be equipped. - EQUIP_ERR_CANT_SWAP = 21, // These items can't be swapped. - EQUIP_ERR_SLOT_EMPTY = 22, // That slot is empty. - EQUIP_ERR_ITEM_NOT_FOUND = 23, // The item was not found. - EQUIP_ERR_DROP_BOUND_ITEM = 24, // You can't drop a soulbound item. - EQUIP_ERR_OUT_OF_RANGE = 25, // Out of range. - EQUIP_ERR_TOO_FEW_TO_SPLIT = 26, // Tried to split more than number in stack. - EQUIP_ERR_SPLIT_FAILED = 27, // Couldn't split those items. - EQUIP_ERR_SPELL_FAILED_REAGENTS_GENERIC = 28, // Missing reagent - EQUIP_ERR_NOT_ENOUGH_MONEY = 29, // You don't have enough money. - EQUIP_ERR_NOT_A_BAG = 30, // Not a bag. - EQUIP_ERR_DESTROY_NONEMPTY_BAG = 31, // You can only do that with empty bags. - EQUIP_ERR_NOT_OWNER = 32, // You don't own that item. - EQUIP_ERR_ONLY_ONE_QUIVER = 33, // You can only equip one quiver. - EQUIP_ERR_NO_BANK_SLOT = 34, // You must purchase that bag slot first - EQUIP_ERR_NO_BANK_HERE = 35, // You are too far away from a bank. - EQUIP_ERR_ITEM_LOCKED = 36, // Item is locked. - EQUIP_ERR_GENERIC_STUNNED = 37, // You are stunned - EQUIP_ERR_PLAYER_DEAD = 38, // You can't do that when you're dead. - EQUIP_ERR_CLIENT_LOCKED_OUT = 39, // You can't do that right now. - EQUIP_ERR_INTERNAL_BAG_ERROR = 40, // Internal Bag Error - EQUIP_ERR_ONLY_ONE_BOLT = 41, // You can only equip one quiver. - EQUIP_ERR_ONLY_ONE_AMMO = 42, // You can only equip one ammo pouch. - EQUIP_ERR_CANT_WRAP_STACKABLE = 43, // Stackable items can't be wrapped. - EQUIP_ERR_CANT_WRAP_EQUIPPED = 44, // Equipped items can't be wrapped. - EQUIP_ERR_CANT_WRAP_WRAPPED = 45, // Wrapped items can't be wrapped. - EQUIP_ERR_CANT_WRAP_BOUND = 46, // Bound items can't be wrapped. - EQUIP_ERR_CANT_WRAP_UNIQUE = 47, // Unique items can't be wrapped. - EQUIP_ERR_CANT_WRAP_BAGS = 48, // Bags can't be wrapped. - EQUIP_ERR_LOOT_GONE = 49, // Already looted - EQUIP_ERR_INV_FULL = 50, // Inventory is full. - EQUIP_ERR_BANK_FULL = 51, // Your bank is full - EQUIP_ERR_VENDOR_SOLD_OUT = 52, // That item is currently sold out. - EQUIP_ERR_BAG_FULL_2 = 53, // That bag is full. - EQUIP_ERR_ITEM_NOT_FOUND_2 = 54, // The item was not found. - EQUIP_ERR_CANT_STACK_2 = 55, // This item cannot stack. - EQUIP_ERR_BAG_FULL_3 = 56, // That bag is full. - EQUIP_ERR_VENDOR_SOLD_OUT_2 = 57, // That item is currently sold out. - EQUIP_ERR_OBJECT_IS_BUSY = 58, // That object is busy. - EQUIP_ERR_CANT_BE_DISENCHANTED = 59, - EQUIP_ERR_NOT_IN_COMBAT = 60, // You can't do that while in combat - EQUIP_ERR_NOT_WHILE_DISARMED = 61, // You can't do that while disarmed - EQUIP_ERR_BAG_FULL_4 = 62, // That bag is full. - EQUIP_ERR_CANT_EQUIP_RANK = 63, // You don't have the required rank for that item - EQUIP_ERR_CANT_EQUIP_REPUTATION = 64, // You don't have the required reputation for that item - EQUIP_ERR_TOO_MANY_SPECIAL_BAGS = 65, // You cannot equip another bag of that type - EQUIP_ERR_LOOT_CANT_LOOT_THAT_NOW = 66, // You can't loot that item now. - EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE = 67, // You cannot equip more than one of those. - EQUIP_ERR_VENDOR_MISSING_TURNINS = 68, // You do not have the required items for that purchase - EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS = 69, // You don't have enough honor points - EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS = 70, // You don't have enough arena points - EQUIP_ERR_ITEM_MAX_COUNT_SOCKETED = 71, // You have the maximum number of those gems in your inventory or socketed into items. - EQUIP_ERR_MAIL_BOUND_ITEM = 72, // You can't mail soulbound items. - EQUIP_ERR_INTERNAL_BAG_ERROR_2 = 73, // Internal Bag Error - EQUIP_ERR_BAG_FULL_5 = 74, // That bag is full. - EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED = 75, // You have the maximum number of those gems socketed into equipped items. - EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED = 76, // You cannot socket more than one of those gems into a single item. - EQUIP_ERR_TOO_MUCH_GOLD = 77, // At gold limit - EQUIP_ERR_NOT_DURING_ARENA_MATCH = 78, // You can't do that while in an arena match - EQUIP_ERR_TRADE_BOUND_ITEM = 79, // You can't trade a soulbound item. - EQUIP_ERR_CANT_EQUIP_RATING = 80, // You don't have the personal, team, or battleground rating required to buy that item - EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM = 81, - EQUIP_ERR_NOT_SAME_ACCOUNT = 82, // Account-bound items can only be given to your own characters. - EQUIP_ERR_NO_OUTPUT = 83, - EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS = 84, // You can only carry %d %s - EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED_IS = 85, // You can only equip %d |4item:items in the %s category - EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_EXCEEDED = 86, // Your level is too high to use that item - EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW = 87, // You must reach level %d to purchase that item. - EQUIP_ERR_CANT_EQUIP_NEED_TALENT = 88, // You do not have the required talent to equip that. - EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS = 89, // You can only equip %d |4item:items in the %s category - EQUIP_ERR_SHAPESHIFT_FORM_CANNOT_EQUIP = 90, // Cannot equip item in this form - EQUIP_ERR_ITEM_INVENTORY_FULL_SATCHEL = 91, // Your inventory is full. Your satchel has been delivered to your mailbox. - EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_TOO_LOW = 92, // Your level is too low to use that item - EQUIP_ERR_CANT_BUY_QUANTITY = 93, // You can't buy the specified quantity of that item. - EQUIP_ERR_ITEM_IS_BATTLE_PAY_LOCKED = 94, // Your purchased item is still waiting to be unlocked - EQUIP_ERR_REAGENT_BANK_FULL = 95, // Your reagent bank is full - EQUIP_ERR_REAGENT_BANK_LOCKED = 96, - EQUIP_ERR_WRONG_BAG_TYPE_3 = 97, - EQUIP_ERR_CANT_USE_ITEM = 98, // You can't use that item. - EQUIP_ERR_CANT_BE_OBLITERATED = 99, // You can't obliterate that item - EQUIP_ERR_GUILD_BANK_CONJURED_ITEM = 100,// You cannot store conjured items in the guild bank -}; - -enum BuyResult -{ - BUY_ERR_CANT_FIND_ITEM = 0, - BUY_ERR_ITEM_ALREADY_SOLD = 1, - BUY_ERR_NOT_ENOUGHT_MONEY = 2, - BUY_ERR_SELLER_DONT_LIKE_YOU = 4, - BUY_ERR_DISTANCE_TOO_FAR = 5, - BUY_ERR_ITEM_SOLD_OUT = 7, - BUY_ERR_CANT_CARRY_MORE = 8, - BUY_ERR_RANK_REQUIRE = 11, - BUY_ERR_REPUTATION_REQUIRE = 12 -}; - -enum SellResult -{ - SELL_ERR_CANT_FIND_ITEM = 1, - SELL_ERR_CANT_SELL_ITEM = 2, // merchant doesn't like that item - SELL_ERR_CANT_FIND_VENDOR = 3, // merchant doesn't like you - SELL_ERR_YOU_DONT_OWN_THAT_ITEM = 4, // you don't own that item - SELL_ERR_UNK = 5, // nothing appears... - SELL_ERR_ONLY_EMPTY_BAG = 6 // can only do with empty bags -}; - -// -1 from client enchantment slot number -enum EnchantmentSlot : uint16 -{ - PERM_ENCHANTMENT_SLOT = 0, - TEMP_ENCHANTMENT_SLOT = 1, - SOCK_ENCHANTMENT_SLOT = 2, - SOCK_ENCHANTMENT_SLOT_2 = 3, - SOCK_ENCHANTMENT_SLOT_3 = 4, - BONUS_ENCHANTMENT_SLOT = 5, - PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment - USE_ENCHANTMENT_SLOT = 7, - - MAX_INSPECTED_ENCHANTMENT_SLOT = 8, - - PROP_ENCHANTMENT_SLOT_0 = 8, // used with RandomSuffix - PROP_ENCHANTMENT_SLOT_1 = 9, // used with RandomSuffix - PROP_ENCHANTMENT_SLOT_2 = 10, // used with RandomSuffix and RandomProperty - PROP_ENCHANTMENT_SLOT_3 = 11, // used with RandomProperty - PROP_ENCHANTMENT_SLOT_4 = 12, // used with RandomProperty - MAX_ENCHANTMENT_SLOT = 13 -}; - -#define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment) - #define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected enum EnchantmentOffset @@ -208,16 +56,6 @@ enum EnchantmentOffset #define MAX_ENCHANTMENT_OFFSET 3 -enum EnchantmentSlotMask -{ - ENCHANTMENT_CAN_SOULBOUND = 0x01, - ENCHANTMENT_UNK1 = 0x02, - ENCHANTMENT_UNK2 = 0x04, - ENCHANTMENT_UNK3 = 0x08, - ENCHANTMENT_COLLECTABLE = 0x100, - ENCHANTMENT_HIDE_IF_NOT_COLLECTED = 0x200, -}; - enum ItemUpdateState { ITEM_UNCHANGED = 0, @@ -226,36 +64,6 @@ enum ItemUpdateState ITEM_REMOVED = 3 }; -enum ItemModifier : uint16 -{ - ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS = 0, - ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1 = 1, - ITEM_MODIFIER_UPGRADE_ID = 2, - ITEM_MODIFIER_BATTLE_PET_SPECIES_ID = 3, - ITEM_MODIFIER_BATTLE_PET_BREED_DATA = 4, // (breedId) | (breedQuality << 24) - ITEM_MODIFIER_BATTLE_PET_LEVEL = 5, - ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID = 6, - ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS = 7, - ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID = 8, - ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL = 9, - ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1 = 10, - ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2 = 11, - ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2 = 12, - ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3 = 13, - ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3 = 14, - ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4 = 15, - ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4 = 16, - ITEM_MODIFIER_CHALLENGE_MAP_CHALLENGE_MODE_ID = 17, - ITEM_MODIFIER_CHALLENGE_KEYSTONE_LEVEL = 18, - ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_1 = 19, - ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_2 = 20, - ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_3 = 21, - ITEM_MODIFIER_CHALLENGE_KEYSTONE_IS_CHARGED = 22, - ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL = 23, - ITEM_MODIFIER_ARTIFACT_TIER = 24, - - MAX_ITEM_MODIFIERS -}; #define MAX_ITEM_SPELLS 5 @@ -318,6 +126,8 @@ struct ItemDynamicFieldGems class TC_GAME_API Item : public Object { + friend void AddItemToUpdateQueueOf(Item* item, Player* player); + friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player); public: static Item* CreateItem(uint32 itemEntry, uint32 count, Player const* player = NULL); Item* CloneItem(uint32 count, Player const* player = NULL) const; @@ -435,7 +245,6 @@ class TC_GAME_API Item : public Object // Update States ItemUpdateState GetState() const { return uState; } void SetState(ItemUpdateState state, Player* forplayer = NULL); - void AddToUpdateQueueOf(Player* player); void RemoveFromUpdateQueueOf(Player* player); bool IsInUpdateQueue() const { return uQueuePos != -1; } uint16 GetQueuePos() const { return uQueuePos; } diff --git a/src/server/game/Entities/Item/ItemDefines.h b/src/server/game/Entities/Item/ItemDefines.h new file mode 100644 index 00000000000..012b16e7509 --- /dev/null +++ b/src/server/game/Entities/Item/ItemDefines.h @@ -0,0 +1,213 @@ +/* + * Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/> + * + * 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, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ItemDefines_h__ +#define ItemDefines_h__ + +#include "Define.h" + +enum InventoryResult : uint8 +{ + EQUIP_ERR_OK = 0, + EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, // You must reach level %d to use that item. + EQUIP_ERR_CANT_EQUIP_SKILL = 2, // You aren't skilled enough to use that item. + EQUIP_ERR_WRONG_SLOT = 3, // That item does not go in that slot. + EQUIP_ERR_BAG_FULL = 4, // That bag is full. + EQUIP_ERR_BAG_IN_BAG = 5, // Can't put non-empty bags in other bags. + EQUIP_ERR_TRADE_EQUIPPED_BAG = 6, // You can't trade equipped bags. + EQUIP_ERR_AMMO_ONLY = 7, // Only ammo can go there. + EQUIP_ERR_PROFICIENCY_NEEDED = 8, // You do not have the required proficiency for that item. + EQUIP_ERR_NO_SLOT_AVAILABLE = 9, // No equipment slot is available for that item. + EQUIP_ERR_CANT_EQUIP_EVER = 10, // You can never use that item. + EQUIP_ERR_CANT_EQUIP_EVER_2 = 11, // You can never use that item. + EQUIP_ERR_NO_SLOT_AVAILABLE_2 = 12, // No equipment slot is available for that item. + EQUIP_ERR_2HANDED_EQUIPPED = 13, // Cannot equip that with a two-handed weapon. + EQUIP_ERR_2HSKILLNOTFOUND = 14, // You cannot dual-wield + EQUIP_ERR_WRONG_BAG_TYPE = 15, // That item doesn't go in that container. + EQUIP_ERR_WRONG_BAG_TYPE_2 = 16, // That item doesn't go in that container. + EQUIP_ERR_ITEM_MAX_COUNT = 17, // You can't carry any more of those items. + EQUIP_ERR_NO_SLOT_AVAILABLE_3 = 18, // No equipment slot is available for that item. + EQUIP_ERR_CANT_STACK = 19, // This item cannot stack. + EQUIP_ERR_NOT_EQUIPPABLE = 20, // This item cannot be equipped. + EQUIP_ERR_CANT_SWAP = 21, // These items can't be swapped. + EQUIP_ERR_SLOT_EMPTY = 22, // That slot is empty. + EQUIP_ERR_ITEM_NOT_FOUND = 23, // The item was not found. + EQUIP_ERR_DROP_BOUND_ITEM = 24, // You can't drop a soulbound item. + EQUIP_ERR_OUT_OF_RANGE = 25, // Out of range. + EQUIP_ERR_TOO_FEW_TO_SPLIT = 26, // Tried to split more than number in stack. + EQUIP_ERR_SPLIT_FAILED = 27, // Couldn't split those items. + EQUIP_ERR_SPELL_FAILED_REAGENTS_GENERIC = 28, // Missing reagent + EQUIP_ERR_NOT_ENOUGH_MONEY = 29, // You don't have enough money. + EQUIP_ERR_NOT_A_BAG = 30, // Not a bag. + EQUIP_ERR_DESTROY_NONEMPTY_BAG = 31, // You can only do that with empty bags. + EQUIP_ERR_NOT_OWNER = 32, // You don't own that item. + EQUIP_ERR_ONLY_ONE_QUIVER = 33, // You can only equip one quiver. + EQUIP_ERR_NO_BANK_SLOT = 34, // You must purchase that bag slot first + EQUIP_ERR_NO_BANK_HERE = 35, // You are too far away from a bank. + EQUIP_ERR_ITEM_LOCKED = 36, // Item is locked. + EQUIP_ERR_GENERIC_STUNNED = 37, // You are stunned + EQUIP_ERR_PLAYER_DEAD = 38, // You can't do that when you're dead. + EQUIP_ERR_CLIENT_LOCKED_OUT = 39, // You can't do that right now. + EQUIP_ERR_INTERNAL_BAG_ERROR = 40, // Internal Bag Error + EQUIP_ERR_ONLY_ONE_BOLT = 41, // You can only equip one quiver. + EQUIP_ERR_ONLY_ONE_AMMO = 42, // You can only equip one ammo pouch. + EQUIP_ERR_CANT_WRAP_STACKABLE = 43, // Stackable items can't be wrapped. + EQUIP_ERR_CANT_WRAP_EQUIPPED = 44, // Equipped items can't be wrapped. + EQUIP_ERR_CANT_WRAP_WRAPPED = 45, // Wrapped items can't be wrapped. + EQUIP_ERR_CANT_WRAP_BOUND = 46, // Bound items can't be wrapped. + EQUIP_ERR_CANT_WRAP_UNIQUE = 47, // Unique items can't be wrapped. + EQUIP_ERR_CANT_WRAP_BAGS = 48, // Bags can't be wrapped. + EQUIP_ERR_LOOT_GONE = 49, // Already looted + EQUIP_ERR_INV_FULL = 50, // Inventory is full. + EQUIP_ERR_BANK_FULL = 51, // Your bank is full + EQUIP_ERR_VENDOR_SOLD_OUT = 52, // That item is currently sold out. + EQUIP_ERR_BAG_FULL_2 = 53, // That bag is full. + EQUIP_ERR_ITEM_NOT_FOUND_2 = 54, // The item was not found. + EQUIP_ERR_CANT_STACK_2 = 55, // This item cannot stack. + EQUIP_ERR_BAG_FULL_3 = 56, // That bag is full. + EQUIP_ERR_VENDOR_SOLD_OUT_2 = 57, // That item is currently sold out. + EQUIP_ERR_OBJECT_IS_BUSY = 58, // That object is busy. + EQUIP_ERR_CANT_BE_DISENCHANTED = 59, + EQUIP_ERR_NOT_IN_COMBAT = 60, // You can't do that while in combat + EQUIP_ERR_NOT_WHILE_DISARMED = 61, // You can't do that while disarmed + EQUIP_ERR_BAG_FULL_4 = 62, // That bag is full. + EQUIP_ERR_CANT_EQUIP_RANK = 63, // You don't have the required rank for that item + EQUIP_ERR_CANT_EQUIP_REPUTATION = 64, // You don't have the required reputation for that item + EQUIP_ERR_TOO_MANY_SPECIAL_BAGS = 65, // You cannot equip another bag of that type + EQUIP_ERR_LOOT_CANT_LOOT_THAT_NOW = 66, // You can't loot that item now. + EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE = 67, // You cannot equip more than one of those. + EQUIP_ERR_VENDOR_MISSING_TURNINS = 68, // You do not have the required items for that purchase + EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS = 69, // You don't have enough honor points + EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS = 70, // You don't have enough arena points + EQUIP_ERR_ITEM_MAX_COUNT_SOCKETED = 71, // You have the maximum number of those gems in your inventory or socketed into items. + EQUIP_ERR_MAIL_BOUND_ITEM = 72, // You can't mail soulbound items. + EQUIP_ERR_INTERNAL_BAG_ERROR_2 = 73, // Internal Bag Error + EQUIP_ERR_BAG_FULL_5 = 74, // That bag is full. + EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED = 75, // You have the maximum number of those gems socketed into equipped items. + EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED = 76, // You cannot socket more than one of those gems into a single item. + EQUIP_ERR_TOO_MUCH_GOLD = 77, // At gold limit + EQUIP_ERR_NOT_DURING_ARENA_MATCH = 78, // You can't do that while in an arena match + EQUIP_ERR_TRADE_BOUND_ITEM = 79, // You can't trade a soulbound item. + EQUIP_ERR_CANT_EQUIP_RATING = 80, // You don't have the personal, team, or battleground rating required to buy that item + EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM = 81, + EQUIP_ERR_NOT_SAME_ACCOUNT = 82, // Account-bound items can only be given to your own characters. + EQUIP_ERR_NO_OUTPUT = 83, + EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS = 84, // You can only carry %d %s + EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED_IS = 85, // You can only equip %d |4item:items in the %s category + EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_EXCEEDED = 86, // Your level is too high to use that item + EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW = 87, // You must reach level %d to purchase that item. + EQUIP_ERR_CANT_EQUIP_NEED_TALENT = 88, // You do not have the required talent to equip that. + EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS = 89, // You can only equip %d |4item:items in the %s category + EQUIP_ERR_SHAPESHIFT_FORM_CANNOT_EQUIP = 90, // Cannot equip item in this form + EQUIP_ERR_ITEM_INVENTORY_FULL_SATCHEL = 91, // Your inventory is full. Your satchel has been delivered to your mailbox. + EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_TOO_LOW = 92, // Your level is too low to use that item + EQUIP_ERR_CANT_BUY_QUANTITY = 93, // You can't buy the specified quantity of that item. + EQUIP_ERR_ITEM_IS_BATTLE_PAY_LOCKED = 94, // Your purchased item is still waiting to be unlocked + EQUIP_ERR_REAGENT_BANK_FULL = 95, // Your reagent bank is full + EQUIP_ERR_REAGENT_BANK_LOCKED = 96, + EQUIP_ERR_WRONG_BAG_TYPE_3 = 97, + EQUIP_ERR_CANT_USE_ITEM = 98, // You can't use that item. + EQUIP_ERR_CANT_BE_OBLITERATED = 99, // You can't obliterate that item + EQUIP_ERR_GUILD_BANK_CONJURED_ITEM = 100,// You cannot store conjured items in the guild bank +}; + +enum BuyResult +{ + BUY_ERR_CANT_FIND_ITEM = 0, + BUY_ERR_ITEM_ALREADY_SOLD = 1, + BUY_ERR_NOT_ENOUGHT_MONEY = 2, + BUY_ERR_SELLER_DONT_LIKE_YOU = 4, + BUY_ERR_DISTANCE_TOO_FAR = 5, + BUY_ERR_ITEM_SOLD_OUT = 7, + BUY_ERR_CANT_CARRY_MORE = 8, + BUY_ERR_RANK_REQUIRE = 11, + BUY_ERR_REPUTATION_REQUIRE = 12 +}; + +enum SellResult +{ + SELL_ERR_CANT_FIND_ITEM = 1, + SELL_ERR_CANT_SELL_ITEM = 2, // merchant doesn't like that item + SELL_ERR_CANT_FIND_VENDOR = 3, // merchant doesn't like you + SELL_ERR_YOU_DONT_OWN_THAT_ITEM = 4, // you don't own that item + SELL_ERR_UNK = 5, // nothing appears... + SELL_ERR_ONLY_EMPTY_BAG = 6 // can only do with empty bags +}; + +// -1 from client enchantment slot number +enum EnchantmentSlot : uint16 +{ + PERM_ENCHANTMENT_SLOT = 0, + TEMP_ENCHANTMENT_SLOT = 1, + SOCK_ENCHANTMENT_SLOT = 2, + SOCK_ENCHANTMENT_SLOT_2 = 3, + SOCK_ENCHANTMENT_SLOT_3 = 4, + BONUS_ENCHANTMENT_SLOT = 5, + PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment + USE_ENCHANTMENT_SLOT = 7, + + MAX_INSPECTED_ENCHANTMENT_SLOT = 8, + + PROP_ENCHANTMENT_SLOT_0 = 8, // used with RandomSuffix + PROP_ENCHANTMENT_SLOT_1 = 9, // used with RandomSuffix + PROP_ENCHANTMENT_SLOT_2 = 10, // used with RandomSuffix and RandomProperty + PROP_ENCHANTMENT_SLOT_3 = 11, // used with RandomProperty + PROP_ENCHANTMENT_SLOT_4 = 12, // used with RandomProperty + MAX_ENCHANTMENT_SLOT = 13 +}; + +#define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment) + +enum ItemVendorType +{ + ITEM_VENDOR_TYPE_NONE = 0, + ITEM_VENDOR_TYPE_ITEM = 1, + ITEM_VENDOR_TYPE_CURRENCY = 2, +}; + +enum ItemModifier : uint16 +{ + ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS = 0, + ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1 = 1, + ITEM_MODIFIER_UPGRADE_ID = 2, + ITEM_MODIFIER_BATTLE_PET_SPECIES_ID = 3, + ITEM_MODIFIER_BATTLE_PET_BREED_DATA = 4, // (breedId) | (breedQuality << 24) + ITEM_MODIFIER_BATTLE_PET_LEVEL = 5, + ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID = 6, + ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS = 7, + ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID = 8, + ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL = 9, + ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1 = 10, + ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2 = 11, + ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2 = 12, + ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3 = 13, + ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3 = 14, + ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4 = 15, + ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4 = 16, + ITEM_MODIFIER_CHALLENGE_MAP_CHALLENGE_MODE_ID = 17, + ITEM_MODIFIER_CHALLENGE_KEYSTONE_LEVEL = 18, + ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_1 = 19, + ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_2 = 20, + ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_3 = 21, + ITEM_MODIFIER_CHALLENGE_KEYSTONE_IS_CHARGED = 22, + ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL = 23, + ITEM_MODIFIER_ARTIFACT_TIER = 24, + + MAX_ITEM_MODIFIERS +}; + +#endif // ItemDefines_h__ diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h index c40cb3791db..3babccc4163 100644 --- a/src/server/game/Entities/Item/ItemTemplate.h +++ b/src/server/game/Entities/Item/ItemTemplate.h @@ -293,13 +293,6 @@ enum CurrencyCategory // ... }; -enum ItemVendorType -{ - ITEM_VENDOR_TYPE_NONE = 0, - ITEM_VENDOR_TYPE_ITEM = 1, - ITEM_VENDOR_TYPE_CURRENCY = 2, -}; - enum BAG_FAMILY_MASK { BAG_FAMILY_MASK_NONE = 0x00000000, @@ -348,7 +341,7 @@ extern uint32 const SocketColorToGemTypeMask[19]; #define SOCKET_COLOR_STANDARD (SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE) -enum InventoryType +enum InventoryType : uint8 { INVTYPE_NON_EQUIP = 0, INVTYPE_HEAD = 1, @@ -814,7 +807,4 @@ struct TC_GAME_API ItemTemplate static std::size_t CalculateItemSpecBit(ChrSpecializationEntry const* spec); }; -// Benchmarked: Faster than std::map (insert/find) -typedef std::unordered_map<uint32, ItemTemplate> ItemTemplateContainer; - #endif diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 61baafd3c97..a96015a848a 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -17,35 +17,37 @@ */ #include "Object.h" +#include "AreaTriggerTemplate.h" +#include "BattlefieldMgr.h" +#include "CellImpl.h" +#include "CinematicMgr.h" #include "Common.h" -#include "SharedDefines.h" -#include "WorldPacket.h" -#include "Opcodes.h" -#include "Log.h" -#include "World.h" #include "Creature.h" -#include "Player.h" -#include "Vehicle.h" -#include "ObjectMgr.h" -#include "UpdateData.h" -#include "Util.h" -#include "ObjectAccessor.h" -#include "Transport.h" -#include "VMapFactory.h" -#include "CellImpl.h" -#include "GridNotifiers.h" #include "GridNotifiersImpl.h" +#include "InstanceScenario.h" +#include "Item.h" +#include "Log.h" +#include "MiscPackets.h" +#include "MovementPackets.h" +#include "MovementTypedefs.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "OutdoorPvPMgr.h" +#include "Player.h" +#include "SharedDefines.h" #include "SpellAuraEffects.h" -#include "UpdateFieldFlags.h" #include "TemporarySummon.h" #include "Totem.h" -#include "MovementPackets.h" -#include "OutdoorPvPMgr.h" +#include "Transport.h" #include "Unit.h" -#include "BattlefieldMgr.h" -#include "MiscPackets.h" -#include "InstanceScenario.h" -#include "AreaTriggerTemplate.h" +#include "UpdateData.h" +#include "UpdateFieldFlags.h" +#include "Util.h" +#include "VMapFactory.h" +#include "Vehicle.h" +#include "World.h" +#include "WorldSession.h" +#include <G3D/Vector3.h> Object::Object() { @@ -258,7 +260,7 @@ void Object::SendUpdateToPlayer(Player* player) else BuildCreateUpdateBlockForPlayer(&upd, player); upd.BuildPacket(&packet); - player->GetSession()->SendPacket(&packet); + player->SendDirectMessage(&packet); } void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const @@ -569,15 +571,10 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const if (hasAreaTriggerSpline) { - std::vector<G3D::Vector3> const& splinePoints = areaTrigger->GetSpline().getPoints(); - *data << uint32(areaTrigger->GetTimeToTarget()); *data << uint32(areaTrigger->GetElapsedTimeForMovement()); - data->WriteBits(splinePoints.size(), 16); - - for (G3D::Vector3 const& spline : splinePoints) - *data << spline.x << spline.y << spline.z; + WorldPackets::Movement::CommonMovement::WriteCreateObjectAreaTriggerSpline(areaTrigger->GetSpline(), *data); } if (hasTargetRollPitchYaw) @@ -624,11 +621,11 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const *data << float(areaTriggerTemplate->PolygonDatas.Height); *data << float(areaTriggerTemplate->PolygonDatas.HeightTarget); - for (G3D::Vector2 const& vertice : areaTriggerTemplate->PolygonVertices) - *data << vertice.x << vertice.y; + for (TaggedPosition<Position::XY> const& vertice : areaTriggerTemplate->PolygonVertices) + *data << vertice; - for (G3D::Vector2 const& vertice : areaTriggerTemplate->PolygonVerticesTarget) - *data << vertice.x << vertice.y; + for (TaggedPosition<Position::XY> const& vertice : areaTriggerTemplate->PolygonVerticesTarget) + *data << vertice; } if (hasAreaTriggerCylinder) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 2209282223a..e1de1dd37ca 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -19,10 +19,11 @@ #include "Pet.h" #include "Common.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "Group.h" #include "Log.h" +#include "Map.h" #include "ObjectMgr.h" -#include "Opcodes.h" #include "PetPackets.h" #include "Player.h" #include "Spell.h" @@ -34,7 +35,6 @@ #include "Unit.h" #include "Util.h" #include "World.h" -#include "WorldPacket.h" #include "WorldSession.h" #define PET_XP_FACTOR 0.05f diff --git a/src/server/game/Entities/Player/CinematicMgr.cpp b/src/server/game/Entities/Player/CinematicMgr.cpp index e3f0db3af8f..8e426d74982 100644 --- a/src/server/game/Entities/Player/CinematicMgr.cpp +++ b/src/server/game/Entities/Player/CinematicMgr.cpp @@ -16,8 +16,9 @@ */ #include "CinematicMgr.h" -#include "Creature.h" #include "M2Stores.h" +#include "Map.h" +#include "MotionMaster.h" #include "Player.h" #include "TemporarySummon.h" diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp index f7a62a2ae5d..1e89d90cec6 100644 --- a/src/server/game/Entities/Player/KillRewarder.cpp +++ b/src/server/game/Entities/Player/KillRewarder.cpp @@ -16,8 +16,8 @@ */ #include "KillRewarder.h" -#include "SpellAuraEffects.h" #include "Creature.h" +#include "DB2Stores.h" #include "Formulas.h" #include "Group.h" #include "Guild.h" @@ -26,6 +26,7 @@ #include "Pet.h" #include "Player.h" #include "Scenario.h" +#include "SpellAuraEffects.h" // == KillRewarder ==================================================== // KillRewarder encapsulates logic of rewarding player upon kill with: diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 90b615a9477..85a2153f546 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -22,6 +22,7 @@ #include "AchievementMgr.h" #include "ArenaTeam.h" #include "ArenaTeamMgr.h" +#include "Bag.h" #include "Battlefield.h" #include "BattlefieldMgr.h" #include "BattlefieldTB.h" @@ -39,6 +40,7 @@ #include "CharacterPackets.h" #include "Chat.h" #include "ChatPackets.h" +#include "CinematicMgr.h" #include "CombatLogPackets.h" #include "CombatPackets.h" #include "Common.h" @@ -71,9 +73,11 @@ #include "Log.h" #include "LootMgr.h" #include "LootPackets.h" +#include "Mail.h" #include "MailPackets.h" #include "MapManager.h" #include "MiscPackets.h" +#include "MotionMaster.h" #include "MovementPackets.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" @@ -98,6 +102,7 @@ #include "SpellPackets.h" #include "TalentPackets.h" #include "ToyPackets.h" +#include "TradeData.h" #include "TransmogrificationPackets.h" #include "Transport.h" #include "UpdateData.h" @@ -111,6 +116,7 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "WorldStatePackets.h" +#include <G3D/g3dmath.h> #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -10038,6 +10044,11 @@ InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item return EQUIP_ERR_OK; } +InventoryResult Player::CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId /*= nullptr*/) const +{ + return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem, nullptr, offendingItemId); +} + InventoryResult Player::CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count /*= NULL*/) const { return CanStoreItem(bag, slot, dest, item, count, nullptr, false, no_space_count); @@ -12138,7 +12149,7 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update) ItemRemovedQuestCheck(it->GetEntry(), it->GetCount()); RemoveItem(bag, slot, update); it->SetNotRefundable(this, false, nullptr, false); - it->RemoveFromUpdateQueueOf(this); + RemoveItemFromUpdateQueueOf(it, this); GetSession()->GetCollectionMgr()->RemoveTemporaryAppearance(it); if (it->IsInWorld()) { @@ -19085,13 +19096,10 @@ void Player::_LoadGroup(PreparedQueryResult result) SetGroup(group, subgroup); SetPartyType(group->GetGroupCategory(), GROUP_TYPE_NORMAL); ResetGroupUpdateSequenceIfNeeded(group); - if (getLevel() >= LEVELREQUIREMENT_HEROIC) - { - // the group leader may change the instance difficulty while the player is offline - SetDungeonDifficultyID(group->GetDungeonDifficultyID()); - SetRaidDifficultyID(group->GetRaidDifficultyID()); - SetLegacyRaidDifficultyID(group->GetLegacyRaidDifficultyID()); - } + // the group leader may change the instance difficulty while the player is offline + SetDungeonDifficultyID(group->GetDungeonDifficultyID()); + SetRaidDifficultyID(group->GetRaidDifficultyID()); + SetLegacyRaidDifficultyID(group->GetLegacyRaidDifficultyID()); } } @@ -21413,6 +21421,65 @@ bool Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod return spellInfo->IsAffectedBySpellMod(mod); } +template <class T> +void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/) +{ + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); + if (!spellInfo) + return; + + float totalmul = 1.0f; + int32 totalflat = 0; + + // Drop charges for triggering spells instead of triggered ones + if (m_spellModTakingSpell) + spell = m_spellModTakingSpell; + + for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_FLAT].begin(); itr != m_spellMods[op][SPELLMOD_FLAT].end(); ++itr) + { + SpellModifier* mod = *itr; + + // Charges can be set only for mods with auras + if (!mod->ownerAura) + ASSERT(mod->charges == 0); + + if (!IsAffectedBySpellmod(spellInfo, mod, spell)) + continue; + + totalflat += mod->value; + DropModCharge(mod, spell); + } + + for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_PCT].begin(); itr != m_spellMods[op][SPELLMOD_PCT].end(); ++itr) + { + SpellModifier* mod = *itr; + + // Charges can be set only for mods with auras + if (!mod->ownerAura) + ASSERT(mod->charges == 0); + + if (!IsAffectedBySpellmod(spellInfo, mod, spell)) + continue; + + // skip percent mods for null basevalue (most important for spell mods with charges) + if (basevalue + totalflat == T(0)) + continue; + + // special case (skip > 10sec spell casts for instant cast setting) + if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) + continue; + + totalmul *= 1.0f + CalculatePct(1.0f, mod->value); + DropModCharge(mod, spell); + } + + basevalue = T(float(basevalue + totalflat) * totalmul); +} + +template TC_GAME_API void Player::ApplySpellMod(uint32 spellId, SpellModOp op, int32& basevalue, Spell* spell); +template TC_GAME_API void Player::ApplySpellMod(uint32 spellId, SpellModOp op, uint32& basevalue, Spell* spell); +template TC_GAME_API void Player::ApplySpellMod(uint32 spellId, SpellModOp op, float& basevalue, Spell* spell); + void Player::AddSpellMod(SpellModifier* mod, bool apply) { TC_LOG_DEBUG("spells", "Player::AddSpellMod: Player '%s' (%s), SpellID: %d", GetName().c_str(), GetGUID().ToString().c_str(), mod->spellId); @@ -24158,6 +24225,11 @@ float Player::GetReputationPriceDiscount(Creature const* creature) const return 1.0f - 0.05f* (rank - REP_NEUTRAL); } +Player* Player::GetTrader() const +{ + return m_trade ? m_trade->GetTrader() : nullptr; +} + bool Player::IsSpellFitByClassAndRace(uint32 spell_id) const { uint32 racemask = getRaceMask(); @@ -25241,6 +25313,11 @@ bool Player::HasTitle(uint32 bitIndex) const return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag); } +bool Player::HasTitle(CharTitlesEntry const* title) const +{ + return HasTitle(title->MaskID); +} + void Player::SetTitle(CharTitlesEntry const* title, bool lost) { uint32 fieldIndexOffset = title->MaskID / 32; diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 7d9a8d915f5..3aafac29b28 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -19,47 +19,80 @@ #ifndef _PLAYER_H #define _PLAYER_H -#include "DB2Stores.h" -#include "GroupReference.h" -#include "MapReference.h" +#include "Unit.h" #include "CUFProfile.h" +#include "DatabaseEnvFwd.h" +#include "DBCEnums.h" #include "EquipementSet.h" -#include "Item.h" +#include "GroupReference.h" +#include "ItemDefines.h" +#include "ItemEnchantmentMgr.h" +#include "MapReference.h" #include "PetDefines.h" -#include "QuestDef.h" -#include "SpellMgr.h" -#include "SpellHistory.h" -#include "Unit.h" -#include "WorldSession.h" #include "PlayerTaxi.h" -#include "TradeData.h" -#include "CinematicMgr.h" +#include "QuestDef.h" #include "SceneMgr.h" #include <queue> struct AccessRequirement; +struct AchievementEntry; +struct AreaTableEntry; +struct AreaTriggerEntry; +struct ArtifactPowerRankEntry; +struct BarberShopStyleEntry; +struct CharTitlesEntry; +struct ChatChannelsEntry; +struct ChrSpecializationEntry; struct CreatureTemplate; -struct Mail; +struct CurrencyTypesEntry; +struct FactionEntry; struct ItemExtendedCostEntry; +struct ItemSetEffect; +struct ItemTemplate; +struct Loot; +struct Mail; +struct MapEntry; +struct QuestPackageItemEntry; +struct SkillRaceClassInfoEntry; +struct TalentEntry; struct TrainerSpell; struct VendorItem; -class PlayerAchievementMgr; -class ReputationMgr; +class AELootResult; +class Bag; +class Battleground; class Channel; +class CinematicMgr; class Creature; class DynamicObject; class Garrison; class Group; class Guild; +class Item; +class LootStore; class OutdoorPvP; class Pet; +class PlayerAI; +class PlayerAchievementMgr; class PlayerMenu; class PlayerSocial; +class ReputationMgr; class SpellCastTargets; -class PlayerAI; +class TradeData; enum GroupCategory : uint8; +enum InventoryType : uint8; +enum ItemClass : uint8; +enum LootError : uint8; +enum LootType : uint8; + +namespace WorldPackets +{ + namespace Character + { + struct CharacterCreateInfo; + } +} typedef std::deque<Mail*> PlayerMails; @@ -1021,8 +1054,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> { friend class WorldSession; friend class CinematicMgr; - friend void Item::AddToUpdateQueueOf(Player* player); - friend void Item::RemoveFromUpdateQueueOf(Player* player); + friend void AddItemToUpdateQueueOf(Item* item, Player* player); + friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player); public: explicit Player(WorldSession* session); ~Player(); @@ -1183,7 +1216,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> bool CanNoReagentCast(SpellInfo const* spellInfo) const; bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; - InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem, nullptr, offendingItemId); } + InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const; InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(entry, count, nullptr, nullptr, offendingItemId); } InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const; InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const; @@ -1288,7 +1321,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> float GetReputationPriceDiscount(Creature const* creature) const; - Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; } + Player* GetTrader() const; TradeData* GetTradeData() const { return m_trade; } void TradeCancel(bool sendback); @@ -2274,7 +2307,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> bool ModifierTreeSatisfied(uint32 modifierTreeId) const; bool HasTitle(uint32 bitIndex) const; - bool HasTitle(CharTitlesEntry const* title) const { return HasTitle(title->MaskID); } + bool HasTitle(CharTitlesEntry const* title) const; void SetTitle(CharTitlesEntry const* title, bool lost = false); //bool isActiveObject() const { return true; } @@ -2687,60 +2720,4 @@ class TC_GAME_API Player : public Unit, public GridObject<Player> TC_GAME_API void AddItemsSetItem(Player* player, Item* item); TC_GAME_API void RemoveItemsSetItem(Player* player, ItemTemplate const* proto); -// "the bodies of template functions must be made available in a header file" -template <class T> -void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/) -{ - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (!spellInfo) - return; - - float totalmul = 1.0f; - int32 totalflat = 0; - - // Drop charges for triggering spells instead of triggered ones - if (m_spellModTakingSpell) - spell = m_spellModTakingSpell; - - for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_FLAT].begin(); itr != m_spellMods[op][SPELLMOD_FLAT].end(); ++itr) - { - SpellModifier* mod = *itr; - - // Charges can be set only for mods with auras - if (!mod->ownerAura) - ASSERT(mod->charges == 0); - - if (!IsAffectedBySpellmod(spellInfo, mod, spell)) - continue; - - totalflat += mod->value; - DropModCharge(mod, spell); - } - - for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_PCT].begin(); itr != m_spellMods[op][SPELLMOD_PCT].end(); ++itr) - { - SpellModifier* mod = *itr; - - // Charges can be set only for mods with auras - if (!mod->ownerAura) - ASSERT(mod->charges == 0); - - if (!IsAffectedBySpellmod(spellInfo, mod, spell)) - continue; - - // skip percent mods for null basevalue (most important for spell mods with charges) - if (basevalue + totalflat == T(0)) - continue; - - // special case (skip > 10sec spell casts for instant cast setting) - if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100) - continue; - - totalmul *= 1.0f + CalculatePct(1.0f, mod->value); - DropModCharge(mod, spell); - } - - basevalue = T(float(basevalue + totalflat) * totalmul); -} - #endif diff --git a/src/server/game/Entities/Player/PlayerTaxi.cpp b/src/server/game/Entities/Player/PlayerTaxi.cpp index f3ebb891062..816920049e3 100644 --- a/src/server/game/Entities/Player/PlayerTaxi.cpp +++ b/src/server/game/Entities/Player/PlayerTaxi.cpp @@ -15,11 +15,12 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "PlayerTaxi.h" +#include "DB2Stores.h" +#include "ObjectMgr.h" #include "Player.h" #include "TaxiPackets.h" -#include "ObjectMgr.h" #include <limits> -#include <math.h> #include <sstream> void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level) diff --git a/src/server/game/Entities/Player/PlayerTaxi.h b/src/server/game/Entities/Player/PlayerTaxi.h index 13aeed19ef8..82abf771bf8 100644 --- a/src/server/game/Entities/Player/PlayerTaxi.h +++ b/src/server/game/Entities/Player/PlayerTaxi.h @@ -1,10 +1,19 @@ #ifndef __PLAYERTAXI_H__ #define __PLAYERTAXI_H__ -#include "DB2Stores.h" +#include "DBCEnums.h" #include "Define.h" -#include "WorldSession.h" -#include <map> +#include <deque> +#include <iosfwd> +#include <vector> + +namespace WorldPackets +{ + namespace Taxi + { + class ShowTaxiNodes; + } +} class TC_GAME_API PlayerTaxi { diff --git a/src/server/game/Entities/Player/SceneMgr.cpp b/src/server/game/Entities/Player/SceneMgr.cpp index 8ecdcf0348e..130261a2aea 100644 --- a/src/server/game/Entities/Player/SceneMgr.cpp +++ b/src/server/game/Entities/Player/SceneMgr.cpp @@ -17,6 +17,7 @@ #include "SceneMgr.h" #include "Chat.h" +#include "DB2Stores.h" #include "Language.h" #include "ObjectMgr.h" #include "Player.h" @@ -62,7 +63,7 @@ uint32 SceneMgr::PlaySceneByTemplate(SceneTemplate const* sceneTemplate, Positio playScene.Location = *position; playScene.TransportGUID = GetPlayer()->GetTransGUID(); - GetPlayer()->GetSession()->SendPacket(playScene.Write(), true); + GetPlayer()->SendDirectMessage(playScene.Write()); AddInstanceIdToSceneMap(sceneInstanceID, sceneTemplate); @@ -89,7 +90,7 @@ void SceneMgr::CancelScene(uint32 sceneInstanceID, bool removeFromMap /*= true*/ WorldPackets::Scenes::CancelScene cancelScene; cancelScene.SceneInstanceID = sceneInstanceID; - GetPlayer()->GetSession()->SendPacket(cancelScene.Write(), true); + GetPlayer()->SendDirectMessage(cancelScene.Write()); } void SceneMgr::OnSceneTrigger(uint32 sceneInstanceID, std::string const& triggerName) diff --git a/src/server/game/Entities/Player/TradeData.cpp b/src/server/game/Entities/Player/TradeData.cpp index fe5b8231109..8c478ad3837 100644 --- a/src/server/game/Entities/Player/TradeData.cpp +++ b/src/server/game/Entities/Player/TradeData.cpp @@ -16,9 +16,11 @@ */ #include "TradeData.h" +#include "Item.h" #include "Player.h" #include "Random.h" #include "TradePackets.h" +#include "WorldSession.h" TradeData* TradeData::GetTraderData() const { diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index 4ebb6ce30bc..5e89828ac74 100644 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -18,7 +18,7 @@ #include "Totem.h" #include "Group.h" -#include "ObjectMgr.h" +#include "Map.h" #include "Player.h" #include "SpellHistory.h" #include "SpellMgr.h" diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 72f58e0f17a..88160cf4f62 100644 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -17,6 +17,8 @@ */ #include "Unit.h" +#include "DB2Stores.h" +#include "Item.h" #include "Player.h" #include "Pet.h" #include "Creature.h" @@ -25,6 +27,7 @@ #include "SpellAuras.h" #include "SpellAuraEffects.h" #include "World.h" +#include <G3D/g3dmath.h> #include <numeric> inline bool _ModifyUInt32(bool apply, uint32& baseValue, int32& amount) @@ -553,7 +556,7 @@ void Player::UpdateMastery() if (G3D::fuzzyEq(mult, 0.0f)) continue; - aura->GetEffect(effect->EffectIndex)->ChangeAmount(int32(value * effect->BonusCoefficient)); + aura->GetEffect(effect->EffectIndex)->ChangeAmount(int32(value * mult)); } } } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1bf845f750d..a78644eb8fb 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -38,12 +38,15 @@ #include "Group.h" #include "InstanceSaveMgr.h" #include "InstanceScript.h" +#include "Item.h" #include "Log.h" #include "LootMgr.h" #include "LootPackets.h" #include "MiscPackets.h" +#include "MotionMaster.h" #include "MovementPackets.h" #include "MoveSpline.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" @@ -10845,6 +10848,11 @@ void Unit::SendPetAIReaction(ObjectGuid guid) owner->ToPlayer()->SendDirectMessage(packet.Write()); } +void Unit::propagateSpeedChange() +{ + GetMotionMaster()->propagateSpeedChange(); +} + ///----------End of Pet responses methods---------- void Unit::StopMoving() diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 177defa83e0..b782ccfd288 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -19,19 +19,19 @@ #ifndef __UNIT_H #define __UNIT_H -#include "UnitDefines.h" +#include "Object.h" #include "EventProcessor.h" #include "FollowerReference.h" #include "FollowerRefManager.h" #include "HostileRefManager.h" -#include "MotionMaster.h" -#include "Object.h" #include "SpellAuraDefines.h" #include "ThreatManager.h" -#include "MoveSplineInit.h" #include "Timer.h" +#include "UnitDefines.h" #include "Util.h" #include <boost/container/flat_set.hpp> +#include <algorithm> +#include <map> #define WORLD_TRIGGER 12999 #define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE 197886 @@ -275,32 +275,34 @@ struct LiquidTypeEntry; struct MountCapabilityEntry; struct SpellValue; -class AuraApplication; class Aura; -class UnitAura; +class AuraApplication; class AuraEffect; class Creature; -class Spell; -class SpellInfo; -class SpellEffectInfo; -class SpellHistory; class DynamicObject; class GameObject; +class Guardian; class Item; +class Minion; +class MotionMaster; class Pet; class PetAura; -class Minion; -class Guardian; -class UnitAI; +class Spell; +class SpellCastTargets; +class SpellEffectInfo; +class SpellHistory; +class SpellInfo; class Totem; class Transport; +class TransportBase; +class UnitAI; +class UnitAura; class Vehicle; class VehicleJoinEvent; -class TransportBase; -class SpellCastTargets; namespace Movement { class MoveSpline; + struct SpellEffectExtraData; } namespace WorldPackets { @@ -819,33 +821,6 @@ enum CurrentSpellTypes : uint8 #define CURRENT_FIRST_NON_MELEE_SPELL 1 #define CURRENT_MAX_SPELL 4 -enum ActiveStates -{ - ACT_PASSIVE = 0x01, // 0x01 - passive - ACT_DISABLED = 0x81, // 0x80 - castable - ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable - ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04 - ACT_REACTION = 0x06, // 0x02 | 0x04 - ACT_DECIDE = 0x00 // custom -}; - -enum ReactStates -{ - REACT_PASSIVE = 0, - REACT_DEFENSIVE = 1, - REACT_AGGRESSIVE = 2, - REACT_ASSIST = 3 -}; - -enum CommandStates : uint8 -{ - COMMAND_STAY = 0, - COMMAND_FOLLOW = 1, - COMMAND_ATTACK = 2, - COMMAND_ABANDON = 3, - COMMAND_MOVE_TO = 4 -}; - #define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF) #define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24) #define MAKE_UNIT_ACTION_BUTTON(A, T) (uint32(A) | (uint32(T) << 24)) @@ -999,8 +974,6 @@ enum PlayerTotemType SUMMON_TYPE_TOTEM_AIR = 83 }; -#define MAX_EQUIPMENT_ITEMS 3 - // delay time next attack to prevent client attack animation problems #define ATTACK_DISPLAY_DELAY 200 #define MAX_PLAYER_STEALTH_DETECT_RANGE 30.0f // max distance for detection targets by player @@ -1874,7 +1847,7 @@ class TC_GAME_API Unit : public WorldObject void SendPetAIReaction(ObjectGuid guid); ///----------End of Pet responses methods---------- - void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); } + void propagateSpeedChange(); // reactive attacks void ClearAllReactives(); diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h index 35490f33bb0..3552ca4dea4 100644 --- a/src/server/game/Entities/Unit/UnitDefines.h +++ b/src/server/game/Entities/Unit/UnitDefines.h @@ -29,6 +29,8 @@ #define BASE_MAXDAMAGE 2.0f #define BASE_ATTACK_TIME 2000 +#define MAX_EQUIPMENT_ITEMS 3 + // byte value (UNIT_FIELD_BYTES_1, 0) enum UnitStandStateType : uint8 { @@ -357,4 +359,31 @@ struct DeclinedName std::string name[MAX_DECLINED_NAME_CASES]; }; +enum ActiveStates +{ + ACT_PASSIVE = 0x01, // 0x01 - passive + ACT_DISABLED = 0x81, // 0x80 - castable + ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable + ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04 + ACT_REACTION = 0x06, // 0x02 | 0x04 + ACT_DECIDE = 0x00 // custom +}; + +enum ReactStates +{ + REACT_PASSIVE = 0, + REACT_DEFENSIVE = 1, + REACT_AGGRESSIVE = 2, + REACT_ASSIST = 3 +}; + +enum CommandStates : uint8 +{ + COMMAND_STAY = 0, + COMMAND_FOLLOW = 1, + COMMAND_ATTACK = 2, + COMMAND_ABANDON = 3, + COMMAND_MOVE_TO = 4 +}; + #endif // UnitDefines_h__ diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index db46a0dce2d..6ae0bc5caf2 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -16,19 +16,21 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "Vehicle.h" +#include "Battleground.h" #include "Common.h" +#include "CreatureAI.h" +#include "DB2Stores.h" +#include "EventProcessor.h" #include "Log.h" +#include "MoveSplineInit.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" -#include "Vehicle.h" -#include "Unit.h" -#include "Util.h" +#include "Player.h" #include "ScriptMgr.h" -#include "CreatureAI.h" -#include "MoveSplineInit.h" #include "TemporarySummon.h" -#include "EventProcessor.h" -#include "Player.h" -#include "Battleground.h" +#include "Unit.h" +#include "Util.h" Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE), _lastShootPos() |
