Merge pull request #88 from H0zen/develop21

Various external fixes - part 4
This commit is contained in:
Antz 2016-02-20 22:07:46 +00:00
commit 0974681da2
7 changed files with 91 additions and 106 deletions

View File

@ -251,72 +251,49 @@ void Object::DestroyForPlayer(Player* target) const
void Object::BuildMovementUpdate(ByteBuffer* data, uint8 updateFlags) const void Object::BuildMovementUpdate(ByteBuffer* data, uint8 updateFlags) const
{ {
uint32 moveFlags = MOVEFLAG_NONE; Unit const* unit = NULL;
uint32 highGuid = 0;
MovementFlags moveflags = MOVEFLAG_NONE;
*data << uint8(updateFlags); // update flags switch (m_objectTypeId)
{
case TYPEID_OBJECT:
case TYPEID_ITEM:
case TYPEID_CONTAINER:
case TYPEID_GAMEOBJECT:
case TYPEID_DYNAMICOBJECT:
case TYPEID_CORPSE:
highGuid = uint32(GetObjectGuid().GetHigh());
break;
case TYPEID_PLAYER:
// TODO: this code must not be here
if (static_cast<Player const*>(this)->GetTransport())
((Unit*)this)->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
else
((Unit*)this)->m_movementInfo.RemoveMovementFlag(MOVEFLAG_ONTRANSPORT);
case TYPEID_UNIT:
unit = static_cast<Unit const*>(this);
moveflags = unit->m_movementInfo.GetMovementFlags();
break;
default:
break;
}
*data << uint8(updateFlags);
if (updateFlags & UPDATEFLAG_LIVING) if (updateFlags & UPDATEFLAG_LIVING)
{ {
if (m_objectTypeId == TYPEID_PLAYER && ((Player*)this)->GetTransport()) MANGOS_ASSERT(unit);
if (unit->IsStopped() && unit->m_movementInfo.HasMovementFlag(MOVEFLAG_SPLINE_ENABLED))
{ {
moveFlags |= MOVEFLAG_ONTRANSPORT; sLog.outError("%s is not moving but have spline movement enabled!", GetGuidStr().c_str());
} ((Unit*)this)->m_movementInfo.RemoveMovementFlag(MovementFlags(MOVEFLAG_SPLINE_ENABLED | MOVEFLAG_FORWARD));
float x; // not used anywhere
if (m_objectTypeId == TYPEID_UNIT && ((Unit*)this)->movespline && ((Unit*)this)->GetMotionMaster()->GetDestination(x, x, x))
{
moveFlags |= MOVEFLAG_WALK_MODE | MOVEFLAG_FORWARD | MOVEFLAG_SPLINE_ENABLED;
}
*data << uint32(moveFlags); // movement flags
*data << uint32(WorldTimer::getMSTime()); // time (in milliseconds)
}
if (updateFlags & UPDATEFLAG_HAS_POSITION) // 0x40
{
if (m_objectTypeId == TYPEID_PLAYER && ((Player*)this)->GetTransport())
{
*data << float(((Player*)this)->GetTransport()->GetPositionX());
*data << float(((Player*)this)->GetTransport()->GetPositionY());
*data << float(((Player*)this)->GetTransport()->GetPositionZ());
*data << float(((Player*)this)->GetTransport()->GetOrientation());
*data << ObjectGuid(((Player*)this)->GetTransport()->GetObjectGuid());
*data << float(((Player*)this)->GetTransOffsetX());
*data << float(((Player*)this)->GetTransOffsetY());
*data << float(((Player*)this)->GetTransOffsetZ());
*data << float(((Player*)this)->GetTransOffsetO());
}
else if (GetObjectGuid().GetHigh() == HIGHGUID_TRANSPORT)
{
*data << float(0);
*data << float(0);
*data << float(0);
*data << float(((WorldObject*)this)->GetOrientation());
}
else
{
*data << float(((WorldObject*)this)->GetPositionX());
*data << float(((WorldObject*)this)->GetPositionY());
*data << float(((WorldObject*)this)->GetPositionZ());
*data << float(((WorldObject*)this)->GetOrientation());
}
}
if (updateFlags & UPDATEFLAG_LIVING) // 0x20
{
Unit* unit = ((Unit*)this);
*data << (float)0;
if (moveFlags & 0x02000) // update self MOVEFLAG_FALLING
{
*data << (float)0;
*data << (float)1.0;
*data << (float)0;
*data << (float)0;
} }
*data << unit->m_movementInfo;
// Unit speeds // Unit speeds
*data << float(unit->GetSpeed(MOVE_WALK)); *data << float(unit->GetSpeed(MOVE_WALK));
*data << float(unit->GetSpeed(MOVE_RUN)); *data << float(unit->GetSpeed(MOVE_RUN));
@ -325,25 +302,33 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint8 updateFlags) const
*data << float(unit->GetSpeed(MOVE_SWIM_BACK)); *data << float(unit->GetSpeed(MOVE_SWIM_BACK));
*data << float(unit->GetSpeed(MOVE_TURN_RATE)); *data << float(unit->GetSpeed(MOVE_TURN_RATE));
if (m_objectTypeId == TYPEID_UNIT) if (unit->m_movementInfo.HasMovementFlag(MOVEFLAG_SPLINE_ENABLED))
{ Movement::PacketBuilder::WriteCreate(*unit->movespline, *data);
if (moveFlags & MOVEFLAG_SPLINE_ENABLED && ((Unit*)this)->movespline) // 0x00400000 }
{ else if (updateFlags & UPDATEFLAG_HAS_POSITION)
Movement::PacketBuilder::WriteCreate((*((Unit*)this)->movespline), *data); {
} *data << ((WorldObject*)this)->GetPositionX();
} *data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
*data << ((WorldObject*)this)->GetOrientation();
} }
if (updateFlags & UPDATEFLAG_ALL) // 0x10 if (updateFlags & UPDATEFLAG_HIGHGUID)
{ *data << highGuid;
if (updateFlags & UPDATEFLAG_ALL)
*data << (uint32)0x1; *data << (uint32)0x1;
if (updateFlags & UPDATEFLAG_FULLGUID)
{
if (unit && unit->getVictim())
*data << unit->getVictim()->GetPackGUID();
else
data->appendPackGUID(0);
} }
// 0x2
if (updateFlags & UPDATEFLAG_TRANSPORT) if (updateFlags & UPDATEFLAG_TRANSPORT)
{ *data << uint32(WorldTimer::getMSTime());
*data << uint32(WorldTimer::getMSTime()); // ms time
}
} }
void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, UpdateMask* updateMask, Player* target) const

View File

@ -230,7 +230,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo&
PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friend_lowguid); PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friend_lowguid);
if (itr != player->GetSocial()->m_playerSocialMap.end()) if (itr != player->GetSocial()->m_playerSocialMap.end())
{
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all // MODERATOR, GAME MASTER, ADMINISTRATOR can see all
if (pFriend && pFriend->GetName() && if (pFriend && pFriend->GetName() &&
@ -254,6 +254,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo&
friendInfo.Level = 0; friendInfo.Level = 0;
friendInfo.Class = 0; friendInfo.Class = 0;
} }
}
} }
void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket* data) void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket* data)

View File

@ -577,32 +577,32 @@ enum NPCFlags
*/ */
enum MovementFlags enum MovementFlags
{ {
MOVEFLAG_NONE = 0x00000000, MOVEFLAG_NONE = 0x00000000,
MOVEFLAG_FORWARD = 0x00000001, MOVEFLAG_FORWARD = 0x00000001,
MOVEFLAG_BACKWARD = 0x00000002, MOVEFLAG_BACKWARD = 0x00000002,
MOVEFLAG_STRAFE_LEFT = 0x00000004, MOVEFLAG_STRAFE_LEFT = 0x00000004,
MOVEFLAG_STRAFE_RIGHT = 0x00000008, MOVEFLAG_STRAFE_RIGHT = 0x00000008,
MOVEFLAG_TURN_LEFT = 0x00000010, MOVEFLAG_TURN_LEFT = 0x00000010,
MOVEFLAG_TURN_RIGHT = 0x00000020, MOVEFLAG_TURN_RIGHT = 0x00000020,
MOVEFLAG_PITCH_UP = 0x00000040, MOVEFLAG_PITCH_UP = 0x00000040,
MOVEFLAG_PITCH_DOWN = 0x00000080, MOVEFLAG_PITCH_DOWN = 0x00000080,
MOVEFLAG_WALK_MODE = 0x00000100, // Walking MOVEFLAG_WALK_MODE = 0x00000100, // Walking
MOVEFLAG_LEVITATING = 0x00000400, MOVEFLAG_LEVITATING = 0x00000400,
MOVEFLAG_ROOT = 0x00000800, // [-ZERO] is it really need and correct value MOVEFLAG_FLYING = 0x00000800, // [-ZERO] is it really need and correct value
MOVEFLAG_FALLING = 0x00002000, MOVEFLAG_FALLING = 0x00002000,
MOVEFLAG_FALLINGFAR = 0x00004000, MOVEFLAG_FALLINGFAR = 0x00004000,
MOVEFLAG_SWIMMING = 0x00200000, // appears with fly flag also MOVEFLAG_SWIMMING = 0x00200000, // appears with fly flag also
MOVEFLAG_SPLINE_ENABLED = 0x00400000, MOVEFLAG_SPLINE_ENABLED = 0x00400000,
MOVEFLAG_CAN_FLY = 0x00800000, // [-ZERO] is it really need and correct value MOVEFLAG_CAN_FLY = 0x00800000, // [-ZERO] is it really need and correct value
MOVEFLAG_FLYING = 0x01000000, // [-ZERO] is it really need and correct value MOVEFLAG_FLYING_OLD = 0x01000000, // [-ZERO] is it really need and correct value
MOVEFLAG_ONTRANSPORT = 0x02000000, // Used for flying on some creatures MOVEFLAG_ONTRANSPORT = 0x02000000, // Used for flying on some creatures
MOVEFLAG_SPLINE_ELEVATION = 0x04000000, // [-ZERO] checkme! used for flight paths MOVEFLAG_SPLINE_ELEVATION = 0x04000000, // used for flight paths
//MOVEFLAG_SPLINE_ENABLED = 0x08000000, // [-ZERO] wrong! MOVEFLAG_ROOT = 0x08000000, // used for flight paths
MOVEFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water MOVEFLAG_WATERWALKING = 0x10000000, // prevent unit from falling through water
MOVEFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive) MOVEFLAG_SAFE_FALL = 0x20000000, // active rogue safe fall spell (passive)
MOVEFLAG_HOVER = 0x40000000 MOVEFLAG_HOVER = 0x40000000
}; };
// flags that use in movement check for example at spell casting // flags that use in movement check for example at spell casting

View File

@ -331,7 +331,7 @@ enum SpellAttributesEx
SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE = 0x00010000, // 16 unaffected by school immunity SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE = 0x00010000, // 16 unaffected by school immunity
SPELL_ATTR_EX_UNK17 = 0x00020000, // 17 for auras SPELL_AURA_TRACK_CREATURES, SPELL_AURA_TRACK_RESOURCES and SPELL_AURA_TRACK_STEALTHED select non-stacking tracking spells SPELL_ATTR_EX_UNK17 = 0x00020000, // 17 for auras SPELL_AURA_TRACK_CREATURES, SPELL_AURA_TRACK_RESOURCES and SPELL_AURA_TRACK_STEALTHED select non-stacking tracking spells
SPELL_ATTR_EX_UNK18 = 0x00040000, // 18 SPELL_ATTR_EX_UNK18 = 0x00040000, // 18
SPELL_ATTR_EX_UNK19 = 0x00080000, // 19 SPELL_ATTR_EX_CANT_TARGET_SELF = 0x00080000, // 19 spells that exclude the caster
SPELL_ATTR_EX_REQ_TARGET_COMBO_POINTS = 0x00100000, // 20 Req combo points on target SPELL_ATTR_EX_REQ_TARGET_COMBO_POINTS = 0x00100000, // 20 Req combo points on target
SPELL_ATTR_EX_UNK21 = 0x00200000, // 21 SPELL_ATTR_EX_UNK21 = 0x00200000, // 21
SPELL_ATTR_EX_REQ_COMBO_POINTS = 0x00400000, // 22 Use combo points (in 4.x not required combo point target selected) SPELL_ATTR_EX_REQ_COMBO_POINTS = 0x00400000, // 22 Use combo points (in 4.x not required combo point target selected)

View File

@ -56,6 +56,9 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recv_data)
return; return;
} }
if (!unit->CanTrainAndResetTalentsOf(_player))
{ return; }
// remove fake death // remove fake death
if (GetPlayer()->hasUnitState(UNIT_STAT_DIED)) if (GetPlayer()->hasUnitState(UNIT_STAT_DIED))
{ GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); } { GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); }

View File

@ -1749,8 +1749,6 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
} }
} }
// exclude caster
targetUnitMap.remove(m_caster);
break; break;
} }
case TARGET_AREAEFFECT_CUSTOM: case TARGET_AREAEFFECT_CUSTOM:
@ -2449,6 +2447,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
break; break;
} }
if (targetMode != TARGET_SELF && m_spellInfo->HasAttribute(SPELL_ATTR_EX_CANT_TARGET_SELF))
{ targetUnitMap.remove(m_caster); }
if (unMaxTargets && targetUnitMap.size() > unMaxTargets) if (unMaxTargets && targetUnitMap.size() > unMaxTargets)
{ {
// make sure one unit is always removed per iteration // make sure one unit is always removed per iteration
@ -4671,11 +4672,6 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth() * 0.2) if (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth() * 0.2)
{ return SPELL_FAILED_BAD_TARGETS; } { return SPELL_FAILED_BAD_TARGETS; }
} }
else if (m_spellInfo->Id == 51582) // Rocket Boots Engaged
{
if (m_caster->IsInWater())
{ return SPELL_FAILED_ONLY_ABOVEWATER; }
}
else if (m_spellInfo->SpellIconID == 156) // Holy Shock else if (m_spellInfo->SpellIconID == 156) // Holy Shock
{ {
// spell different for friends and enemies // spell different for friends and enemies

View File

@ -176,7 +176,7 @@ bool Weather::ReGenerate()
uint32 chance2 = chance1 + m_weatherChances->data[season].snowChance; uint32 chance2 = chance1 + m_weatherChances->data[season].snowChance;
uint32 chance3 = chance2 + m_weatherChances->data[season].stormChance; uint32 chance3 = chance2 + m_weatherChances->data[season].stormChance;
uint32 rnd = urand(0, 99); uint32 rnd = urand(1, 100);
if (rnd <= chance1) if (rnd <= chance1)
{ m_type = WEATHER_TYPE_RAIN; } { m_type = WEATHER_TYPE_RAIN; }
else if (rnd <= chance2) else if (rnd <= chance2)