[11380] Research dynamicobject types, added DynamicObjectType enum

This commit is contained in:
SilverIce 2011-04-19 11:22:35 +03:00
parent 3bf9a5c35b
commit 820a3c0eff
4 changed files with 16 additions and 9 deletions

View file

@ -58,7 +58,7 @@ void DynamicObject::RemoveFromWorld()
Object::RemoveFromWorld(); Object::RemoveFromWorld();
} }
bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius ) bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type)
{ {
WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask()); WorldObject::_Create(guidlow, HIGHGUID_DYNAMICOBJECT, caster->GetPhaseMask());
SetMap(caster->GetMap()); SetMap(caster->GetMap());
@ -86,7 +86,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
bytes |= 0x00 << 16; bytes |= 0x00 << 16;
bytes |= 0x00 << 24; bytes |= 0x00 << 24;
*/ */
SetUInt32Value(DYNAMICOBJECT_BYTES, 0x00000001); SetByteValue(DYNAMICOBJECT_BYTES, 0, type);
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId); SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
SetFloatValue(DYNAMICOBJECT_RADIUS, radius); SetFloatValue(DYNAMICOBJECT_RADIUS, radius);

View file

@ -23,6 +23,13 @@
#include "DBCEnums.h" #include "DBCEnums.h"
#include "Unit.h" #include "Unit.h"
enum DynamicObjectType
{
DYNAMIC_OBJECT_PORTAL = 0x0, // unused
DYNAMIC_OBJECT_AREA_SPELL = 0x1,
DYNAMIC_OBJECT_FARSIGHT_FOCUS = 0x2,
};
struct SpellEntry; struct SpellEntry;
class DynamicObject : public WorldObject class DynamicObject : public WorldObject
@ -34,7 +41,7 @@ class DynamicObject : public WorldObject
void AddToWorld(); void AddToWorld();
void RemoveFromWorld(); void RemoveFromWorld();
bool Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius); bool Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius, DynamicObjectType type);
void Update(uint32 update_diff, uint32 p_time); void Update(uint32 update_diff, uint32 p_time);
void Delete(); void Delete();
uint32 GetSpellId() const { return m_spellId; } uint32 GetSpellId() const { return m_spellId; }
@ -43,6 +50,7 @@ class DynamicObject : public WorldObject
ObjectGuid const& GetCasterGuid() const { return GetGuidValue(DYNAMICOBJECT_CASTER); } ObjectGuid const& GetCasterGuid() const { return GetGuidValue(DYNAMICOBJECT_CASTER); }
Unit* GetCaster() const; Unit* GetCaster() const;
float GetRadius() const { return m_radius; } float GetRadius() const { return m_radius; }
DynamicObjectType GetType() const { return (DynamicObjectType)GetByteValue(DYNAMICOBJECT_BYTES,0); }
bool IsAffecting(Unit *unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); } bool IsAffecting(Unit *unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); }
void AddAffected(Unit *unit) { m_affected.insert(unit->GetObjectGuid()); } void AddAffected(Unit *unit) { m_affected.insert(unit->GetObjectGuid()); }
void RemoveAffected(Unit *unit) { m_affected.erase(unit->GetObjectGuid()); } void RemoveAffected(Unit *unit) { m_affected.erase(unit->GetObjectGuid()); }

View file

@ -4010,7 +4010,8 @@ void Spell::EffectPersistentAA(SpellEffectIndex eff_idx)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
DynamicObject* dynObj = new DynamicObject; DynamicObject* dynObj = new DynamicObject;
if (!dynObj->Create(pCaster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), pCaster, m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, radius)) if (!dynObj->Create(pCaster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), pCaster, m_spellInfo->Id,
eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, radius, DYNAMIC_OBJECT_AREA_SPELL))
{ {
delete dynObj; delete dynObj;
return; return;
@ -4834,15 +4835,13 @@ void Spell::EffectAddFarsight(SpellEffectIndex eff_idx)
DynamicObject* dynObj = new DynamicObject; DynamicObject* dynObj = new DynamicObject;
// set radius to 0: spell not expected to work as persistent aura // set radius to 0: spell not expected to work as persistent aura
if(!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, 0)) if(!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster,
m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, 0, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{ {
delete dynObj; delete dynObj;
return; return;
} }
// DYNAMICOBJECT_BYTES is apparently different from the default bytes set in ::Create
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002);
m_caster->AddDynObject(dynObj); m_caster->AddDynObject(dynObj);
m_caster->GetMap()->Add(dynObj); m_caster->GetMap()->Add(dynObj);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11379" #define REVISION_NR "11380"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__