From efdb8e01dd857df1c3a0d784d60a60d2a1ebb66e Mon Sep 17 00:00:00 2001 From: tomrus88 Date: Sat, 15 Nov 2008 22:04:00 +0300 Subject: [PATCH] Removed direct use of some updatefields --- src/game/MiscHandler.cpp | 2 +- src/game/MovementHandler.cpp | 71 ++++++++++++++++++++++++++++++++---- src/game/Opcodes.cpp | 2 +- src/game/Pet.cpp | 4 +- src/game/Player.cpp | 20 ++++++---- src/game/Player.h | 4 ++ src/game/Spell.cpp | 2 + src/game/SpellAuras.cpp | 18 ++++----- src/game/SpellEffects.cpp | 19 +++++----- src/game/Totem.cpp | 7 ++-- src/game/Unit.cpp | 15 +++++--- src/game/Unit.h | 8 +++- src/game/WorldSession.h | 1 + 13 files changed, 122 insertions(+), 51 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index c27df41d4..7ed3b57cb 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1467,7 +1467,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) sLog.outDebug("Removed FarSight from player %u", _player->GetGUIDLow()); break; case 1: - sLog.outDebug("Added FarSight " I64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); + sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSight(), _player->GetGUIDLow()); break; } } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index cd7e4a81d..13b987610 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -187,9 +187,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) recv_data >> movementInfo.z; recv_data >> movementInfo.o; - //Save movement flags - _player->SetUnitMovementFlags(MovementFlags); - if(MovementFlags & MOVEMENTFLAG_ONTRANSPORT) { // recheck @@ -360,14 +357,34 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) /*----------------------*/ /* process position-change */ + Unit *mover = _player->m_mover; recv_data.put(6, getMSTime()); // offset flags(4) + unk(2) - WorldPacket data(recv_data.GetOpcode(), (GetPlayer()->GetPackGUID().size()+recv_data.size())); - data.append(GetPlayer()->GetPackGUID()); + WorldPacket data(recv_data.GetOpcode(), (mover->GetPackGUID().size()+recv_data.size())); + data.append(_player->m_mover->GetPackGUID()); // use mover guid data.append(recv_data.contents(), recv_data.size()); GetPlayer()->SendMessageToSet(&data, false); - GetPlayer()->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); - GetPlayer()->m_movementInfo = movementInfo; + if(!_player->GetCharmGUID()) + { + _player->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + _player->m_movementInfo = movementInfo; + _player->SetUnitMovementFlags(MovementFlags); + } + else + { + if(mover->GetTypeId() != TYPEID_PLAYER) + { + mover->Relocate(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + mover->SetUnitMovementFlags(MovementFlags); + } + else + { + ((Player*)mover)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + ((Player*)mover)->m_movementInfo = movementInfo; + ((Player*)mover)->SetUnitMovementFlags(MovementFlags); + } + } + if (GetPlayer()->m_fallMovementInfo.fallTime >= movementInfo.fallTime || GetPlayer()->m_fallMovementInfo.z <=movementInfo.z) GetPlayer()->m_fallMovementInfo = movementInfo; @@ -520,17 +537,55 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) { sLog.outDebug("WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); + recv_data.hexlike(); - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; recv_data >> guid; + if(_player->GetGUID() == guid) + { + if(_player->GetCharmGUID() == 0) + _player->m_mover = _player; + } + else + { + if(_player->GetCharmGUID() == guid) + { + if(IS_PLAYER_GUID(guid)) + { + if(Player *plr = objmgr.GetPlayer(guid)) + _player->m_mover = plr; + } + else if(IS_CREATURE_OR_PET_GUID(guid)) + { + if(Creature *creature = ObjectAccessor::GetCreatureOrPet(*_player, guid)) + _player->m_mover = creature; + } + else if(IS_VEHICLE_GUID(guid)) + { + if(Vehicle *vehicle = ObjectAccessor::GetVehicle(guid)) + _player->m_mover = vehicle; + } + else + { + sLog.outError("Unknown guid " I64FMT "in HandleSetActiveMoverOpcode", guid); + } + } + } + WorldPacket data(SMSG_TIME_SYNC_REQ, 4); // new 2.0.x, enable movement data << uint32(0x00000000); // on blizz it increments periodically SendPacket(&data); } +void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data) +{ + sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); + recv_data.hexlike(); // normal movement packet +} + void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/) { //sLog.outDebug("WORLD: Recvd CMSG_MOUNTSPECIAL_ANIM"); diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 644c4ecdc..4e6825606 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -747,7 +747,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x2CE*/ { "CMSG_MOVE_TIME_SKIPPED", STATUS_LOGGEDIN, &WorldSession::HandleMoveTimeSkippedOpcode }, /*0x2CF*/ { "CMSG_MOVE_FEATHER_FALL_ACK", STATUS_LOGGEDIN, &WorldSession::HandleFeatherFallAck }, /*0x2D0*/ { "CMSG_MOVE_WATER_WALK_ACK", STATUS_LOGGEDIN, &WorldSession::HandleMoveWaterWalkAck }, - /*0x2D1*/ { "CMSG_MOVE_NOT_ACTIVE_MOVER", STATUS_NEVER, &WorldSession::Handle_NULL }, + /*0x2D1*/ { "CMSG_MOVE_NOT_ACTIVE_MOVER", STATUS_LOGGEDIN, &WorldSession::HandleMoveNotActiveMoverOpcode }, /*0x2D2*/ { "SMSG_PLAY_SOUND", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2D3*/ { "CMSG_BATTLEFIELD_STATUS", STATUS_LOGGEDIN, &WorldSession::HandleBattlefieldStatusOpcode }, /*0x2D4*/ { "SMSG_BATTLEFIELD_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 466405175..4838ac098 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -189,7 +189,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu else m_charmInfo->SetPetNumber(pet_number, false); - SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID()); + SetOwnerGUID(owner->GetGUID()); SetDisplayId(fields[3].GetUInt32()); SetNativeDisplayId(fields[3].GetUInt32()); uint32 petlevel = fields[4].GetUInt32(); @@ -224,7 +224,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu InitStatsForLevel(petlevel); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32()); - SetUInt64Value(UNIT_FIELD_CREATEDBY, owner->GetGUID()); + SetCreatorGUID(owner->GetGUID()); m_charmInfo->SetReactState(ReactStates(fields[6].GetUInt8())); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index d6a889110..606d1e7bf 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -423,6 +423,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this) //Default movement to run mode m_unit_movement_flags = 0; + m_mover = NULL; + m_miniPet = 0; m_bgAfkReportedTimer = 0; m_contestedPvPTimer = 0; @@ -13902,14 +13904,14 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetUInt32Value(UNIT_CHANNEL_SPELL,0); // clear charm/summon related fields - SetUInt64Value(UNIT_FIELD_CHARM,0); - SetUInt64Value(UNIT_FIELD_SUMMON,0); - SetUInt64Value(UNIT_FIELD_CHARMEDBY,0); - SetUInt64Value(UNIT_FIELD_SUMMONEDBY,0); - SetUInt64Value(UNIT_FIELD_CREATEDBY,0); + SetCharm(NULL); + SetPet(NULL); + SetCharmerGUID(NULL); + SetOwnerGUID(NULL); + SetCreatorGUID(NULL); // reset some aura modifiers before aura apply - SetUInt64Value(PLAYER_FARSIGHT, 0); + SetFarSight(NULL); SetUInt32Value(PLAYER_TRACK_CREATURES, 0 ); SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 ); @@ -17522,6 +17524,8 @@ void Player::SendInitialPacketsBeforeAddToMap() // set fly flag if in fly form or taxi flight to prevent visually drop at ground in showup moment if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight()) AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); + + m_mover = this; } void Player::SendInitialPacketsAfterAddToMap() @@ -18638,7 +18642,7 @@ void Player::EnterVehicle(Vehicle *vehicle) //vehicle->SetUInt32Value(UNIT_FIELD_BYTES_1, 0x02000000); SetCharm(vehicle); - SetUInt64Value(PLAYER_FARSIGHT, vehicle->GetGUID()); + SetFarSight(vehicle->GetGUID()); SetClientControl(vehicle, 1); @@ -18691,7 +18695,7 @@ void Player::ExitVehicle(Vehicle *vehicle) //vehicle->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); SetCharm(NULL); - SetUInt64Value(PLAYER_FARSIGHT, 0); + SetFarSight(NULL); SetClientControl(vehicle, 0); diff --git a/src/game/Player.h b/src/game/Player.h index d38bb079d..38f48c1e9 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1941,6 +1941,7 @@ class MANGOS_DLL_SPEC Player : public Unit /*********************************************************/ MovementInfo m_movementInfo; MovementInfo m_fallMovementInfo; + Unit *m_mover; bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); } bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); } @@ -1954,6 +1955,9 @@ class MANGOS_DLL_SPEC Player : public Unit void EnterVehicle(Vehicle *vehicle); void ExitVehicle(Vehicle *vehicle); + uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); } + void SetFarSight(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); } + // Transports Transport * GetTransport() const { return m_transport; } void SetTransport(Transport * t) { m_transport = t; } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6fb3b292e..0854606bd 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -270,6 +270,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_triggeringContainer = triggeringContainer; m_referencedFromCurrentSpell = false; m_executedCurrently = false; + m_delayStart = 0; m_delayAtDamageCount = 0; m_applyMultiplierMask = 0; @@ -336,6 +337,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi gameObjTarget = NULL; focusObject = NULL; m_cast_count = 0; + m_glyphIndex = 0; m_triggeredByAuraSpell = NULL; //Auto Shot & Shoot diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index e1dd97ac0..e775150e1 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2000,7 +2000,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) ( GetSpellProto()->EffectApplyAuraName[0]==1 || GetSpellProto()->EffectApplyAuraName[0]==128 ) ) ) { // spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425 - m_target->SetUInt64Value(PLAYER_FARSIGHT, 0); + ((Player*)m_target)->SetFarSight(NULL); WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0); ((Player*)m_target)->GetSession()->SendPacket(&data); return; @@ -2858,7 +2858,7 @@ void Aura::HandleBindSight(bool apply, bool Real) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_target->GetGUID() : 0); + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); } void Aura::HandleFarSight(bool apply, bool Real) @@ -2867,7 +2867,7 @@ void Aura::HandleFarSight(bool apply, bool Real) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_modifier.m_miscvalue : 0); + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); } void Aura::HandleAuraTrackCreatures(bool apply, bool Real) @@ -2974,7 +2974,7 @@ void Aura::HandleModPossess(bool apply, bool Real) } } if(caster->GetTypeId() == TYPEID_PLAYER) - caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_target->GetGUID() : 0); + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); } void Aura::HandleModPossessPet(bool apply, bool Real) @@ -2989,15 +2989,13 @@ void Aura::HandleModPossessPet(bool apply, bool Real) return; if(apply) - { - caster->SetUInt64Value(PLAYER_FARSIGHT, m_target->GetGUID()); m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); - } else - { - caster->SetUInt64Value(PLAYER_FARSIGHT, 0); m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); - } + + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); + ((Player*)caster)->SetCharm(apply ? m_target : NULL); + ((Player*)caster)->SetClientControl(m_target, apply ? 1 : 0); } void Aura::HandleModCharm(bool apply, bool Real) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 450e239e1..f1a12dbb2 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -3202,7 +3202,7 @@ void Spell::EffectSummon(uint32 i) if(duration > 0) spawnCreature->SetDuration(duration); - spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); + spawnCreature->SetOwnerGUID(m_caster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); spawnCreature->setPowerType(POWER_MANA); spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction()); @@ -3212,7 +3212,7 @@ void Spell::EffectSummon(uint32 i) spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); - spawnCreature->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); + spawnCreature->SetCreatorGUID(m_caster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); spawnCreature->InitStatsForLevel(level); @@ -3474,7 +3474,8 @@ void Spell::EffectAddFarsight(uint32 i) dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002); m_caster->AddDynObject(dynObj); MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj); - m_caster->SetUInt64Value(PLAYER_FARSIGHT, dynObj->GetGUID()); + if(m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->SetFarSight(dynObj->GetGUID()); } void Spell::EffectSummonWild(uint32 i) @@ -3631,14 +3632,14 @@ void Spell::EffectSummonGuardian(uint32 i) if(duration > 0) spawnCreature->SetDuration(duration); - spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); + spawnCreature->SetOwnerGUID(m_caster->GetGUID()); spawnCreature->setPowerType(POWER_MANA); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); - spawnCreature->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); + spawnCreature->SetCreatorGUID(m_caster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); spawnCreature->InitStatsForLevel(level); @@ -4038,8 +4039,8 @@ void Spell::EffectSummonPet(uint32 i) NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); } - NewSummon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); - NewSummon->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); + NewSummon->SetOwnerGUID(m_caster->GetGUID()); + NewSummon->SetCreatorGUID(m_caster->GetGUID()); NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0); NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); @@ -5659,8 +5660,8 @@ void Spell::EffectSummonCritter(uint32 i) return; } - critter->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); - critter->SetUInt64Value(UNIT_FIELD_CREATEDBY,m_caster->GetGUID()); + critter->SetOwnerGUID(m_caster->GetGUID()); + critter->SetCreatorGUID(m_caster->GetGUID()); critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 5c708bf0c..5f21b7cd9 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -128,10 +128,9 @@ void Totem::UnSummon() void Totem::SetOwner(uint64 guid) { - SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid); - SetUInt64Value(UNIT_FIELD_CREATEDBY, guid); - Unit *owner = GetOwner(); - if (owner) + SetCreatorGUID(guid); + SetOwnerGUID(guid); + if (Unit *owner = GetOwner()) { setFaction(owner->getFaction()); SetLevel(owner->getLevel()); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 0b6da451d..b23ad75c8 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7151,12 +7151,15 @@ void Unit::SetPet(Pet* pet) // FIXME: hack, speed must be set only at follow if(pet) for(int i = 0; i < MAX_MOVE_TYPE; ++i) - pet->SetSpeed(UnitMoveType(i),m_speed_rate[i],true); + pet->SetSpeed(UnitMoveType(i), m_speed_rate[i], true); } -void Unit::SetCharm(Unit* charmed) +void Unit::SetCharm(Unit* pet) { - SetUInt64Value(UNIT_FIELD_CHARM,charmed ? charmed->GetGUID() : 0); + SetUInt64Value(UNIT_FIELD_CHARM, pet ? pet->GetGUID() : 0); + + if(GetTypeId() == TYPEID_PLAYER) + ((Player*)this)->m_mover = pet ? pet : this; } void Unit::UnsummonAllTotems() @@ -10784,9 +10787,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return NULL; } - pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()); - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,getFaction()); + pet->SetOwnerGUID(GetGUID()); + pet->SetCreatorGUID(GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel(); diff --git a/src/game/Unit.h b/src/game/Unit.h index 73580cc77..63f2ffb5b 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -977,11 +977,14 @@ class MANGOS_DLL_SPEC Unit : public WorldObject DeathState getDeathState() { return m_deathState; }; virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet - uint64 const& GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } + uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } + void SetOwnerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); } + uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); } + void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); } uint64 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); } - uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); } + uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); } uint64 GetCharmerOrOwnerOrOwnGUID() const @@ -1010,6 +1013,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SetPet(Pet* pet); void SetCharm(Unit* pet); + bool isCharmed() const { return GetCharmerGUID() != 0; } CharmInfo* GetCharmInfo() { return m_charmInfo; } diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index df306a616..db79803f0 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -331,6 +331,7 @@ class MANGOS_DLL_SPEC WorldSession void HandleMovementOpcodes(WorldPacket& recvPacket); void HandleSetActiveMoverOpcode(WorldPacket &recv_data); + void HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data); void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data); void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );