mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[12017] Add support for getRace() of creatures. Thanks to vladimir for input
This commit is contained in:
parent
dfa35dafab
commit
fb3a990b13
6 changed files with 16 additions and 9 deletions
|
|
@ -2168,6 +2168,11 @@ bool Creature::HasSpellCooldown(uint32 spell_id) const
|
|||
return (itr != m_CreatureSpellCooldowns.end() && itr->second > time(NULL)) || HasCategoryCooldown(spell_id);
|
||||
}
|
||||
|
||||
uint8 Creature::getRace() const
|
||||
{
|
||||
return Unit::getRace() ? Unit::getRace() : GetCreatureModelRace(GetNativeDisplayId());
|
||||
}
|
||||
|
||||
bool Creature::IsInEvadeMode() const
|
||||
{
|
||||
return !i_motionMaster.empty() && i_motionMaster.GetCurrentMovementGeneratorType() == HOME_MOTION_TYPE;
|
||||
|
|
|
|||
|
|
@ -525,6 +525,8 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
|||
|
||||
uint32 GetLevelForTarget(Unit const* target) const; // overwrite Unit::GetLevelForTarget for boss level support
|
||||
|
||||
uint8 getRace() const override;
|
||||
|
||||
bool IsInEvadeMode() const;
|
||||
|
||||
bool AIM_Initialize();
|
||||
|
|
|
|||
|
|
@ -3681,10 +3681,8 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
|
|||
case 65528: // Gossip NPC Appearance - Pirates' Day
|
||||
{
|
||||
// expecting npc's using this spell to have models with race info.
|
||||
uint32 race = GetCreatureModelRace(target->GetNativeDisplayId());
|
||||
|
||||
// random gender, regardless of current gender
|
||||
switch(race)
|
||||
switch (target->getRace())
|
||||
{
|
||||
case RACE_HUMAN:
|
||||
target->SetDisplayId(roll_chance_i(50) ? 25037 : 25048);
|
||||
|
|
@ -8426,7 +8424,9 @@ void Aura::HandleAuraMirrorImage(bool apply, bool Real)
|
|||
// Caster can be player or creature, the unit who pCreature will become an clone of.
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER) // TODO - Verify! Does it take a 'pseudo-race' (from display-id) for creature-mirroring, and what is sent in SMSG_MIRRORIMAGE_DATA
|
||||
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 0, caster->getRace());
|
||||
|
||||
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 1, caster->getClass());
|
||||
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 2, caster->getGender());
|
||||
pCreature->SetByteValue(UNIT_FIELD_BYTES_0, 3, caster->getPowerType());
|
||||
|
|
|
|||
|
|
@ -4522,10 +4522,10 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
|
|||
return false;
|
||||
}
|
||||
|
||||
if(raceMask)
|
||||
if (raceMask)
|
||||
{
|
||||
// not in expected race
|
||||
if(!player || !(raceMask & player->getRaceMask()))
|
||||
if (!(raceMask & player->getRaceMask()))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1182,8 +1182,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
|
|||
uint32 getLevel() const { return GetUInt32Value(UNIT_FIELD_LEVEL); }
|
||||
virtual uint32 GetLevelForTarget(Unit const* /*target*/) const { return getLevel(); }
|
||||
void SetLevel(uint32 lvl);
|
||||
uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); }
|
||||
uint32 getRaceMask() const { return 1 << (getRace()-1); }
|
||||
virtual uint8 getRace() const { return GetByteValue(UNIT_FIELD_BYTES_0, 0); }
|
||||
uint32 getRaceMask() const { return getRace() ? 1 << (getRace()-1) : 0; }
|
||||
uint8 getClass() const { return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
|
||||
uint32 getClassMask() const { return 1 << (getClass()-1); }
|
||||
uint8 getGender() const { return GetByteValue(UNIT_FIELD_BYTES_0, 2); }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12016"
|
||||
#define REVISION_NR "12017"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue