Removed direct use of some updatefields

This commit is contained in:
tomrus88 2008-11-15 22:04:00 +03:00
parent 768fa2d2de
commit efdb8e01dd
13 changed files with 122 additions and 51 deletions

View file

@ -1467,7 +1467,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data )
sLog.outDebug("Removed FarSight from player %u", _player->GetGUIDLow()); sLog.outDebug("Removed FarSight from player %u", _player->GetGUIDLow());
break; break;
case 1: 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; break;
} }
} }

View file

@ -187,9 +187,6 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
recv_data >> movementInfo.z; recv_data >> movementInfo.z;
recv_data >> movementInfo.o; recv_data >> movementInfo.o;
//Save movement flags
_player->SetUnitMovementFlags(MovementFlags);
if(MovementFlags & MOVEMENTFLAG_ONTRANSPORT) if(MovementFlags & MOVEMENTFLAG_ONTRANSPORT)
{ {
// recheck // recheck
@ -360,14 +357,34 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
/*----------------------*/ /*----------------------*/
/* process position-change */ /* process position-change */
Unit *mover = _player->m_mover;
recv_data.put<uint32>(6, getMSTime()); // offset flags(4) + unk(2) recv_data.put<uint32>(6, getMSTime()); // offset flags(4) + unk(2)
WorldPacket data(recv_data.GetOpcode(), (GetPlayer()->GetPackGUID().size()+recv_data.size())); WorldPacket data(recv_data.GetOpcode(), (mover->GetPackGUID().size()+recv_data.size()));
data.append(GetPlayer()->GetPackGUID()); data.append(_player->m_mover->GetPackGUID()); // use mover guid
data.append(recv_data.contents(), recv_data.size()); data.append(recv_data.contents(), recv_data.size());
GetPlayer()->SendMessageToSet(&data, false); GetPlayer()->SendMessageToSet(&data, false);
GetPlayer()->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); if(!_player->GetCharmGUID())
GetPlayer()->m_movementInfo = movementInfo; {
_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) if (GetPlayer()->m_fallMovementInfo.fallTime >= movementInfo.fallTime || GetPlayer()->m_fallMovementInfo.z <=movementInfo.z)
GetPlayer()->m_fallMovementInfo = movementInfo; GetPlayer()->m_fallMovementInfo = movementInfo;
@ -520,17 +537,55 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
{ {
sLog.outDebug("WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); 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; uint64 guid;
recv_data >> 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 WorldPacket data(SMSG_TIME_SYNC_REQ, 4); // new 2.0.x, enable movement
data << uint32(0x00000000); // on blizz it increments periodically data << uint32(0x00000000); // on blizz it increments periodically
SendPacket(&data); 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*/) void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/)
{ {
//sLog.outDebug("WORLD: Recvd CMSG_MOUNTSPECIAL_ANIM"); //sLog.outDebug("WORLD: Recvd CMSG_MOUNTSPECIAL_ANIM");

View file

@ -747,7 +747,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x2CE*/ { "CMSG_MOVE_TIME_SKIPPED", STATUS_LOGGEDIN, &WorldSession::HandleMoveTimeSkippedOpcode }, /*0x2CE*/ { "CMSG_MOVE_TIME_SKIPPED", STATUS_LOGGEDIN, &WorldSession::HandleMoveTimeSkippedOpcode },
/*0x2CF*/ { "CMSG_MOVE_FEATHER_FALL_ACK", STATUS_LOGGEDIN, &WorldSession::HandleFeatherFallAck }, /*0x2CF*/ { "CMSG_MOVE_FEATHER_FALL_ACK", STATUS_LOGGEDIN, &WorldSession::HandleFeatherFallAck },
/*0x2D0*/ { "CMSG_MOVE_WATER_WALK_ACK", STATUS_LOGGEDIN, &WorldSession::HandleMoveWaterWalkAck }, /*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 }, /*0x2D2*/ { "SMSG_PLAY_SOUND", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2D3*/ { "CMSG_BATTLEFIELD_STATUS", STATUS_LOGGEDIN, &WorldSession::HandleBattlefieldStatusOpcode }, /*0x2D3*/ { "CMSG_BATTLEFIELD_STATUS", STATUS_LOGGEDIN, &WorldSession::HandleBattlefieldStatusOpcode },
/*0x2D4*/ { "SMSG_BATTLEFIELD_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x2D4*/ { "SMSG_BATTLEFIELD_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide },

View file

@ -189,7 +189,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu
else else
m_charmInfo->SetPetNumber(pet_number, false); m_charmInfo->SetPetNumber(pet_number, false);
SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner->GetGUID()); SetOwnerGUID(owner->GetGUID());
SetDisplayId(fields[3].GetUInt32()); SetDisplayId(fields[3].GetUInt32());
SetNativeDisplayId(fields[3].GetUInt32()); SetNativeDisplayId(fields[3].GetUInt32());
uint32 petlevel = fields[4].GetUInt32(); uint32 petlevel = fields[4].GetUInt32();
@ -224,7 +224,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu
InitStatsForLevel(petlevel); InitStatsForLevel(petlevel);
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL));
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32()); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
SetUInt64Value(UNIT_FIELD_CREATEDBY, owner->GetGUID()); SetCreatorGUID(owner->GetGUID());
m_charmInfo->SetReactState(ReactStates(fields[6].GetUInt8())); m_charmInfo->SetReactState(ReactStates(fields[6].GetUInt8()));

View file

@ -423,6 +423,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
//Default movement to run mode //Default movement to run mode
m_unit_movement_flags = 0; m_unit_movement_flags = 0;
m_mover = NULL;
m_miniPet = 0; m_miniPet = 0;
m_bgAfkReportedTimer = 0; m_bgAfkReportedTimer = 0;
m_contestedPvPTimer = 0; m_contestedPvPTimer = 0;
@ -13902,14 +13904,14 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetUInt32Value(UNIT_CHANNEL_SPELL,0); SetUInt32Value(UNIT_CHANNEL_SPELL,0);
// clear charm/summon related fields // clear charm/summon related fields
SetUInt64Value(UNIT_FIELD_CHARM,0); SetCharm(NULL);
SetUInt64Value(UNIT_FIELD_SUMMON,0); SetPet(NULL);
SetUInt64Value(UNIT_FIELD_CHARMEDBY,0); SetCharmerGUID(NULL);
SetUInt64Value(UNIT_FIELD_SUMMONEDBY,0); SetOwnerGUID(NULL);
SetUInt64Value(UNIT_FIELD_CREATEDBY,0); SetCreatorGUID(NULL);
// reset some aura modifiers before aura apply // reset some aura modifiers before aura apply
SetUInt64Value(PLAYER_FARSIGHT, 0); SetFarSight(NULL);
SetUInt32Value(PLAYER_TRACK_CREATURES, 0 ); SetUInt32Value(PLAYER_TRACK_CREATURES, 0 );
SetUInt32Value(PLAYER_TRACK_RESOURCES, 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 // 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()) if(HasAuraType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED) || isInFlight())
AddUnitMovementFlag(MOVEMENTFLAG_FLYING2); AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
m_mover = this;
} }
void Player::SendInitialPacketsAfterAddToMap() void Player::SendInitialPacketsAfterAddToMap()
@ -18638,7 +18642,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
//vehicle->SetUInt32Value(UNIT_FIELD_BYTES_1, 0x02000000); //vehicle->SetUInt32Value(UNIT_FIELD_BYTES_1, 0x02000000);
SetCharm(vehicle); SetCharm(vehicle);
SetUInt64Value(PLAYER_FARSIGHT, vehicle->GetGUID()); SetFarSight(vehicle->GetGUID());
SetClientControl(vehicle, 1); SetClientControl(vehicle, 1);
@ -18691,7 +18695,7 @@ void Player::ExitVehicle(Vehicle *vehicle)
//vehicle->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0); //vehicle->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 0);
SetCharm(NULL); SetCharm(NULL);
SetUInt64Value(PLAYER_FARSIGHT, 0); SetFarSight(NULL);
SetClientControl(vehicle, 0); SetClientControl(vehicle, 0);

View file

@ -1941,6 +1941,7 @@ class MANGOS_DLL_SPEC Player : public Unit
/*********************************************************/ /*********************************************************/
MovementInfo m_movementInfo; MovementInfo m_movementInfo;
MovementInfo m_fallMovementInfo; MovementInfo m_fallMovementInfo;
Unit *m_mover;
bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); } bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); }
bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); } bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); }
@ -1954,6 +1955,9 @@ class MANGOS_DLL_SPEC Player : public Unit
void EnterVehicle(Vehicle *vehicle); void EnterVehicle(Vehicle *vehicle);
void ExitVehicle(Vehicle *vehicle); void ExitVehicle(Vehicle *vehicle);
uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); }
void SetFarSight(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); }
// Transports // Transports
Transport * GetTransport() const { return m_transport; } Transport * GetTransport() const { return m_transport; }
void SetTransport(Transport * t) { m_transport = t; } void SetTransport(Transport * t) { m_transport = t; }

View file

@ -270,6 +270,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_triggeringContainer = triggeringContainer; m_triggeringContainer = triggeringContainer;
m_referencedFromCurrentSpell = false; m_referencedFromCurrentSpell = false;
m_executedCurrently = false; m_executedCurrently = false;
m_delayStart = 0;
m_delayAtDamageCount = 0; m_delayAtDamageCount = 0;
m_applyMultiplierMask = 0; m_applyMultiplierMask = 0;
@ -336,6 +337,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
gameObjTarget = NULL; gameObjTarget = NULL;
focusObject = NULL; focusObject = NULL;
m_cast_count = 0; m_cast_count = 0;
m_glyphIndex = 0;
m_triggeredByAuraSpell = NULL; m_triggeredByAuraSpell = NULL;
//Auto Shot & Shoot //Auto Shot & Shoot

View file

@ -2000,7 +2000,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
( GetSpellProto()->EffectApplyAuraName[0]==1 || GetSpellProto()->EffectApplyAuraName[0]==128 ) ) ) ( GetSpellProto()->EffectApplyAuraName[0]==1 || GetSpellProto()->EffectApplyAuraName[0]==128 ) ) )
{ {
// spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425 // 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); WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0);
((Player*)m_target)->GetSession()->SendPacket(&data); ((Player*)m_target)->GetSession()->SendPacket(&data);
return; return;
@ -2858,7 +2858,7 @@ void Aura::HandleBindSight(bool apply, bool Real)
if(!caster || caster->GetTypeId() != TYPEID_PLAYER) if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
return; 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) void Aura::HandleFarSight(bool apply, bool Real)
@ -2867,7 +2867,7 @@ void Aura::HandleFarSight(bool apply, bool Real)
if(!caster || caster->GetTypeId() != TYPEID_PLAYER) if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
return; 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) void Aura::HandleAuraTrackCreatures(bool apply, bool Real)
@ -2974,7 +2974,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
} }
} }
if(caster->GetTypeId() == TYPEID_PLAYER) 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) void Aura::HandleModPossessPet(bool apply, bool Real)
@ -2989,15 +2989,13 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
return; return;
if(apply) if(apply)
{
caster->SetUInt64Value(PLAYER_FARSIGHT, m_target->GetGUID());
m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5);
}
else else
{
caster->SetUInt64Value(PLAYER_FARSIGHT, 0);
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); 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) void Aura::HandleModCharm(bool apply, bool Real)

View file

@ -3202,7 +3202,7 @@ void Spell::EffectSummon(uint32 i)
if(duration > 0) if(duration > 0)
spawnCreature->SetDuration(duration); spawnCreature->SetDuration(duration);
spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); spawnCreature->SetOwnerGUID(m_caster->GetGUID());
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0);
spawnCreature->setPowerType(POWER_MANA); spawnCreature->setPowerType(POWER_MANA);
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction()); 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_PET_NAME_TIMESTAMP, 0);
spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); 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->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
spawnCreature->InitStatsForLevel(level); spawnCreature->InitStatsForLevel(level);
@ -3474,7 +3474,8 @@ void Spell::EffectAddFarsight(uint32 i)
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002); dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002);
m_caster->AddDynObject(dynObj); m_caster->AddDynObject(dynObj);
MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(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) void Spell::EffectSummonWild(uint32 i)
@ -3631,14 +3632,14 @@ void Spell::EffectSummonGuardian(uint32 i)
if(duration > 0) if(duration > 0)
spawnCreature->SetDuration(duration); spawnCreature->SetDuration(duration);
spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); spawnCreature->SetOwnerGUID(m_caster->GetGUID());
spawnCreature->setPowerType(POWER_MANA); spawnCreature->setPowerType(POWER_MANA);
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0);
spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0); spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0);
spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0);
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,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->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
spawnCreature->InitStatsForLevel(level); spawnCreature->InitStatsForLevel(level);
@ -4038,8 +4039,8 @@ void Spell::EffectSummonPet(uint32 i)
NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE);
} }
NewSummon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); NewSummon->SetOwnerGUID(m_caster->GetGUID());
NewSummon->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); NewSummon->SetCreatorGUID(m_caster->GetGUID());
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0); NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0);
NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction);
NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
@ -5659,8 +5660,8 @@ void Spell::EffectSummonCritter(uint32 i)
return; return;
} }
critter->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); critter->SetOwnerGUID(m_caster->GetGUID());
critter->SetUInt64Value(UNIT_FIELD_CREATEDBY,m_caster->GetGUID()); critter->SetCreatorGUID(m_caster->GetGUID());
critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);

View file

@ -128,10 +128,9 @@ void Totem::UnSummon()
void Totem::SetOwner(uint64 guid) void Totem::SetOwner(uint64 guid)
{ {
SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid); SetCreatorGUID(guid);
SetUInt64Value(UNIT_FIELD_CREATEDBY, guid); SetOwnerGUID(guid);
Unit *owner = GetOwner(); if (Unit *owner = GetOwner())
if (owner)
{ {
setFaction(owner->getFaction()); setFaction(owner->getFaction());
SetLevel(owner->getLevel()); SetLevel(owner->getLevel());

View file

@ -7151,12 +7151,15 @@ void Unit::SetPet(Pet* pet)
// FIXME: hack, speed must be set only at follow // FIXME: hack, speed must be set only at follow
if(pet) if(pet)
for(int i = 0; i < MAX_MOVE_TYPE; ++i) 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() void Unit::UnsummonAllTotems()
@ -10784,9 +10787,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
return NULL; return NULL;
} }
pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()); pet->SetOwnerGUID(GetGUID());
pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, GetGUID()); pet->SetCreatorGUID(GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,getFaction()); pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel(); uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel();

View file

@ -977,11 +977,14 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
DeathState getDeathState() { return m_deathState; }; DeathState getDeathState() { return m_deathState; };
virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet 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 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); }
uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); } 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); } 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 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); }
uint64 GetCharmerOrOwnerOrOwnGUID() const uint64 GetCharmerOrOwnerOrOwnGUID() const
@ -1010,6 +1013,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void SetPet(Pet* pet); void SetPet(Pet* pet);
void SetCharm(Unit* pet); void SetCharm(Unit* pet);
bool isCharmed() const { return GetCharmerGUID() != 0; } bool isCharmed() const { return GetCharmerGUID() != 0; }
CharmInfo* GetCharmInfo() { return m_charmInfo; } CharmInfo* GetCharmInfo() { return m_charmInfo; }

View file

@ -331,6 +331,7 @@ class MANGOS_DLL_SPEC WorldSession
void HandleMovementOpcodes(WorldPacket& recvPacket); void HandleMovementOpcodes(WorldPacket& recvPacket);
void HandleSetActiveMoverOpcode(WorldPacket &recv_data); void HandleSetActiveMoverOpcode(WorldPacket &recv_data);
void HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data);
void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data); void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data);
void HandleRequestRaidInfoOpcode( WorldPacket & recv_data ); void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );