aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp2
-rwxr-xr-xsrc/server/game/Entities/Object/Object.h4
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp39
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h3
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h2
6 files changed, 49 insertions, 3 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 22748095d7a..cb5d455dacc 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -56,7 +56,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* pWho)
return false;
//experimental (unknown) flag not present
- if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13))
+ if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
return false;
//not a player
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index c75aea7316d..c64af4b3619 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -54,7 +54,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* pWho)
return false;
//experimental (unknown) flag not present
- if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK13))
+ if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
return false;
//not a player
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 8dd065d0dfa..b05b98f67b7 100755
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -323,6 +323,10 @@ class Object
Creature* ToCreature(){ if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
const Creature* ToCreature() const {if (GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
+ Unit* ToUnit(){ if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return NULL; }
+ const Unit* ToUnit() const {if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return NULL; }
+ GameObject* ToGameObject(){ if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return NULL; }
+ const GameObject* ToGameObject() const {if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return NULL; }
protected:
Object ();
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 6c1ca283e3a..1179c0e474e 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -315,6 +315,32 @@ void Unit::SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTim
SendMonsterMove(x, y, z, transitTime, player);
}
+void Unit::SetFacing(float ori, WorldObject* obj)
+{
+ SetOrientation(obj ? GetAngle(obj) : ori);
+
+ WorldPacket data(SMSG_MONSTER_MOVE, (1+12+4+1+(obj ? 8 : 4)+4+4+4+12+GetPackGUID().size()));
+ data.append(GetPackGUID());
+ data << uint8(0);//unk
+ data << GetPositionX() << GetPositionY() << GetPositionZ();
+ data << getMSTime();
+ if (obj)
+ {
+ data << uint8(SPLINETYPE_FACING_TARGET);
+ data << uint64(obj->GetGUID());
+ }
+ else
+ {
+ data << uint8(SPLINETYPE_FACING_ANGLE);
+ data << ori;
+ }
+ data << uint32(SPLINEFLAG_NONE);
+ data << uint32(0);//move time 0
+ data << uint32(1);//one point
+ data << GetPositionX() << GetPositionY() << GetPositionZ();
+ SendMessageToSet(&data, true);
+}
+
void Unit::SendMonsterStop(bool on_death)
{
WorldPacket data(SMSG_MONSTER_MOVE, (17 + GetPackGUID().size()));
@@ -4377,6 +4403,19 @@ bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
return false;
}
+uint32 Unit::GetAuraCount(uint32 spellId) const
+{
+ uint32 count = 0;
+ for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr)
+ {
+ if (itr->second->GetBase()->GetStackAmount())
+ count++;
+ else
+ count += (uint32)itr->second->GetBase()->GetStackAmount();
+ }
+ return count;
+}
+
bool Unit::HasAura(uint32 spellId, uint64 caster, uint8 reqEffMask) const
{
if (GetAuraApplication(spellId, caster, reqEffMask))
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index f355bec161c..4784c591694 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1454,6 +1454,8 @@ class Unit : public WorldObject
void JumpTo(float speedXY, float speedZ, bool forward = true);
void JumpTo(WorldObject *obj, float speedZ);
+ void SetFacing(WorldObject* obj) { SetFacing(0, obj); }
+ void SetFacing(float ori, WorldObject* obj);
void SendMonsterStop(bool on_death = false);
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 Time, Player* player = NULL);
void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 MoveFlags, uint32 time, float speedZ, Player *player = NULL);
@@ -1632,6 +1634,7 @@ class Unit : public WorldObject
Aura * GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0) const;
bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const;
+ uint32 GetAuraCount(uint32 spellId) const;
bool HasAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0) const;
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 2f4601c493d..7cff02cafb5 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -2018,7 +2018,7 @@ enum CreatureTypeFlags
CREATURE_TYPEFLAGS_MININGLOOT = 0x000200, // Can be looted by miner
CREATURE_TYPEFLAGS_UNK11 = 0x000400,
CREATURE_TYPEFLAGS_UNK12 = 0x000800, // ? Related to mounts in some way. If mounted, fight mounted, mount appear as independant when rider dies?
- CREATURE_TYPEFLAGS_UNK13 = 0x001000, // ? Can aid any player in combat if in range?
+ CREATURE_TYPEFLAGS_AID_PLAYERS = 0x001000, // ? Can aid any player in combat if in range?
CREATURE_TYPEFLAGS_UNK14 = 0x002000,
CREATURE_TYPEFLAGS_UNK15 = 0x004000, // ? Possibly not in use
CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x008000, // Can be looted by engineer