aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-03-19 20:44:30 +0100
committerShauren <shauren.trinity@gmail.com>2012-03-19 20:44:30 +0100
commit568e524c456098c8adae806a26bdcb6913eccc22 (patch)
treefeb2967357c8d9c2da849b1bd3ff2b60a223d4f5 /src/server/game/Entities
parent4665d5bfc456a49b10b0817db5473c3ee5c86603 (diff)
Core/Spells: Implemented CREATURE_TYPEFLAGS_PARTY_MEMBER, creature with this type_flag set can be targeted by spells that require target to be in caster's party/raid
Diffstat (limited to 'src/server/game/Entities')
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp93
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h6
2 files changed, 16 insertions, 83 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 1246bbc0bcb..638e09a73bc 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -12199,7 +12199,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
}
Creature const* creatureAttacker = ToCreature();
- if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26)
+ if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER)
return false;
Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL;
@@ -12286,7 +12286,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
// can't assist non-friendly targets
if (GetReactionTo(target) <= REP_NEUTRAL
&& target->GetReactionTo(this) <= REP_NEUTRAL
- && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26)))
+ && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER)))
return false;
// PvP case
@@ -12320,7 +12320,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
&& !((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP)))
{
if (Creature const* creatureTarget = target->ToCreature())
- return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS;
+ return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS;
}
return true;
}
@@ -16160,7 +16160,10 @@ bool Unit::IsInPartyWith(Unit const* unit) const
return true;
if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER)
- return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
+ return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
+ else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) ||
+ (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER))
+ return true;
else
return false;
}
@@ -16176,82 +16179,14 @@ bool Unit::IsInRaidWith(Unit const* unit) const
return true;
if (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_PLAYER)
- return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
+ return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
+ else if ((u2->GetTypeId() == TYPEID_PLAYER && u1->GetTypeId() == TYPEID_UNIT && u1->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER) ||
+ (u1->GetTypeId() == TYPEID_PLAYER && u2->GetTypeId() == TYPEID_UNIT && u2->ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PARTY_MEMBER))
+ return true;
else
return false;
}
-void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius)
-{
- Player* owner = GetCharmerOrOwnerPlayerOrPlayerItself();
- if (!owner)
- return;
-
- Group* group = owner->GetGroup();
- if (group)
- {
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* Target = itr->getSource();
-
- if (Target && !IsHostileTo(Target))
- {
- if (Target->isAlive() && IsWithinDistInMap(Target, radius))
- nearMembers.push_back(Target);
-
- if (Guardian* pet = Target->GetGuardianPet())
- if (pet->isAlive() && IsWithinDistInMap(pet, radius))
- nearMembers.push_back(pet);
- }
- }
- }
- else
- {
- if (owner->isAlive() && (owner == this || IsWithinDistInMap(owner, radius)))
- nearMembers.push_back(owner);
- if (Guardian* pet = owner->GetGuardianPet())
- if (pet->isAlive() && (pet == this || IsWithinDistInMap(pet, radius)))
- nearMembers.push_back(pet);
- }
-}
-
-void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius)
-{
- Unit* owner = GetCharmerOrOwnerOrSelf();
- Group* group = NULL;
- if (owner->GetTypeId() == TYPEID_PLAYER)
- group = owner->ToPlayer()->GetGroup();
-
- if (group)
- {
- uint8 subgroup = owner->ToPlayer()->GetSubGroup();
-
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- {
- Player* Target = itr->getSource();
-
- // IsHostileTo check duel and controlled by enemy
- if (Target && Target->GetSubGroup() == subgroup && !IsHostileTo(Target))
- {
- if (Target->isAlive() && IsWithinDistInMap(Target, radius))
- TagUnitMap.push_back(Target);
-
- if (Guardian* pet = Target->GetGuardianPet())
- if (pet->isAlive() && IsWithinDistInMap(pet, radius))
- TagUnitMap.push_back(pet);
- }
- }
- }
- else
- {
- if (owner->isAlive() && (owner == this || IsWithinDistInMap(owner, radius)))
- TagUnitMap.push_back(owner);
- if (Guardian* pet = owner->GetGuardianPet())
- if (pet->isAlive() && (pet == this || IsWithinDistInMap(pet, radius)))
- TagUnitMap.push_back(pet);
- }
-}
-
void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap)
{
Unit* owner = GetCharmerOrOwnerOrSelf();
@@ -17486,7 +17421,7 @@ bool Unit::SetDisableGravity(bool disable)
{
if (disable == IsLevitating())
return false;
-
+
if (disable)
AddUnitMovementFlag(MOVEMENTFLAG_DISABLE_GRAVITY);
else
@@ -17529,7 +17464,7 @@ void Unit::SendMovementHover()
SendMessageToSet(&data, true);
}
-void Unit::SendMovementWaterWalking()
+void Unit::SendMovementWaterWalking()
{
WorldPacket data(MSG_MOVE_WATER_WALK, 64);
data.append(GetPackGUID());
@@ -17544,7 +17479,7 @@ void Unit::SendMovementFeatherFall()
BuildMovementPacket(&data);
SendMessageToSet(&data, true);
}
-
+
void Unit::SendMovementGravityChange()
{
WorldPacket data(MSG_MOVE_GRAVITY_CHNG, 64);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 4919f0e6fe3..e1717dc5858 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -708,7 +708,7 @@ enum MovementFlags
MOVEMENTFLAG_LEFT | MOVEMENTFLAG_RIGHT,
//! TODO if needed: add more flags to this masks that are exclusive to players
- MOVEMENTFLAG_MASK_PLAYER_ONLY =
+ MOVEMENTFLAG_MASK_PLAYER_ONLY =
MOVEMENTFLAG_FLYING,
};
enum MovementFlags2
@@ -1398,9 +1398,7 @@ class Unit : public WorldObject
bool IsNeutralToAll() const;
bool IsInPartyWith(Unit const* unit) const;
bool IsInRaidWith(Unit const* unit) const;
- void GetPartyMemberInDist(std::list<Unit*> &units, float dist);
void GetPartyMembers(std::list<Unit*> &units);
- void GetRaidMember(std::list<Unit*> &units, float dist);
bool IsContestedGuard() const
{
if (FactionTemplateEntry const* entry = getFactionTemplateEntry())
@@ -1635,7 +1633,7 @@ class Unit : public WorldObject
/*! These methods send the same packet to the client in apply and unapply case.
The client-side interpretation of this packet depends on the presence of relevant movementflags
which are sent with movementinfo. Furthermore, these packets are broadcast to nearby players as well
- as the current unit.
+ as the current unit.
*/
void SendMovementHover();
void SendMovementFeatherFall();