rendered paste bodyIndex: Creature.cpp===================================================================--- Creature.cpp (revision 3735)+++ Creature.cpp (working copy)@@ -874,7 +874,8 @@ m_startMove = getMSTime(); m_moveTime = time;*/- SendMonsterMove(x,y,z,type,run,time);+ //Will be: Checked, maybe Buffered, will be send on Unit::Update()+ m_movementData.Update(x,y,z,time,run,type); } Player *Creature::GetLootRecipient() constIndex: Unit.cpp===================================================================--- Unit.cpp (revision 3735)+++ Unit.cpp (working copy)@@ -124,13 +124,20 @@ void Unit::Update( uint32 p_time ) {+ if( !m_movementData.Empty() )+ {+ // If !consecutive packet or passed 9 packet SendMonsterMove(). 1 packetCount = 50-100ms+ if( m_movementData.holdTime/100 > m_movementData.packetCount || m_movementData.packetCount > sWorld.getConfig(CONFIG_MOVE_FILTER_COUNT) )+ SendMonsterMove(0, 0, 0, 0, 0, 0, true); // send SMSG_MONSTER_MOVE specialBlend+ else+ m_movementData.holdTime += p_time; //Update the holdTime to help with consecutive packet check+ } /*if(p_time > m_AurasCheck) { m_AurasCheck = 2000; _UpdateAura(); }else m_AurasCheck -= p_time;*/- _UpdateSpells( p_time ); if (isInCombat() && GetTypeId() == TYPEID_PLAYER ) //update combat timer only for players@@ -187,44 +194,79 @@ speed *= 0.001f; transitTime = static_cast<uint32>(dist / speed + 0.5); }- //float orientation = (float)atan2((double)dy, (double)dx);- SendMonsterMove(x,y,z,0,run,transitTime);+ //Will be: Checked, maybe Buffered, will be send on Unit::Update()+ m_movementData.Update(x,y,z,transitTime,run,0); } -void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, bool Run, uint32 Time)+void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, bool Run, uint32 Time, bool specialBlend) {- WorldPacket data( SMSG_MONSTER_MOVE, (41+GetPackGUID().size()) );- data.append(GetPackGUID());- // Point A, starting location- data << GetPositionX() << GetPositionY() << GetPositionZ();- // unknown field - unrelated to orientation- // seems to increment about 1000 for every 1.7 seconds- // for now, we'll just use mstime- data << getMSTime();+ // If specialBlend will take information from m_movementData+ if( specialBlend && !m_movementData.Empty() )+ {+ WorldPacket data( SMSG_MONSTER_MOVE, (41 + GetPackGUID().size()) );+ data.append(GetPackGUID());+ + // Point A, starting location+ data << GetPositionX() << GetPositionY() << GetPositionZ();+ // unknown field - unrelated to orientation+ // seems to increment about 1000 for every 1.7 seconds+ // for now, we'll just use mstime+ data << getMSTime();+ data << m_movementData.type;+ switch(m_movementData.type)+ {+ case 0: // normal packet+ break;+ case 1: // stop packet+ SendMessageToSet( &data, true );+ return;+ case 3: // not used currently+ data << uint64(0); // probably target guid+ break;+ case 4: // not used currently+ data << float(0); // probably orientation+ break;+ }+ data << uint32(m_movementData.run ? 0x00000100 : 0x00000000);+ data << m_movementData.time;+ data << uint32(1);+ data << m_movementData.x << m_movementData.y << m_movementData.z; - data << uint8(type); // unknown- switch(type)+ SendMessageToSet( &data, true );+ m_movementData.Clear();+ }+ else if( GetTypeId() != TYPEID_UNIT) {- case 0: // normal packet- break;- case 1: // stop packet- SendMessageToSet( &data, true );- return;- case 3: // not used currently- data << uint64(0); // probably target guid- break;- case 4: // not used currently- data << float(0); // probably orientation- break;+ WorldPacket data( SMSG_MONSTER_MOVE, (41+GetPackGUID().size()) );+ data.append(GetPackGUID());+ // Point A, starting location+ data << GetPositionX() << GetPositionY() << GetPositionZ();+ data << getMSTime();++ data << uint8(type); // unknown+ switch(type)+ {+ case 0: // normal packet+ break;+ case 1: // stop packet+ SendMessageToSet( &data, true );+ return;+ case 3: // not used currently+ data << uint64(0); // probably target guid+ break;+ case 4: // not used currently+ data << float(0); // probably orientation+ break;+ }+ data << uint32(Run ? 0x00000100 : 0x00000000); // flags (0x100 - running, 0x200 - taxi)+ /* Flags:+ 512: Floating, moving without walking/running+ */+ data << Time; // Time in between points+ data << uint32(1); // 1 single waypoint+ data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B+ SendMessageToSet( &data, true ); }- data << uint32(Run ? 0x00000100 : 0x00000000); // flags (0x100 - running, 0x200 - taxi)- /* Flags:- 512: Floating, moving without walking/running- */- data << Time; // Time in between points- data << uint32(1); // 1 single waypoint- data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B- SendMessageToSet( &data, true ); } void Unit::resetAttackTimer(WeaponAttackType type)@@ -2751,7 +2793,7 @@ //Ranged switch(getClass()) {- case CLASS_HUNTER: val2 = uint32(getLevel() * 2 + GetStat(STAT_AGILITY) * 2 - 20); break;+ case CLASS_HUNTER: val2 = uint32(getLevel() * 2 + GetStat(STAT_AGILITY) * 4 - 20); break; case CLASS_ROGUE: val2 = uint32(getLevel() + GetStat(STAT_AGILITY) * 2 - 20); break; case CLASS_WARRIOR:val2 = uint32(getLevel() + GetStat(STAT_AGILITY) * 2 - 20); break; default: val2 = 0; break;@@ -2777,11 +2819,11 @@ switch(getClass()) {- case CLASS_WARRIOR: val2 = uint32(getLevel()*3 + GetStat(STAT_STRENGTH)*2 - 20); break;+ case CLASS_WARRIOR: val2 = uint32(getLevel()*3 + GetStat(STAT_STRENGTH)*4 - 20); break; case CLASS_PALADIN: val2 = uint32(getLevel()*3 + GetStat(STAT_STRENGTH)*2 - 20); break; case CLASS_ROGUE: val2 = uint32(getLevel()*2 + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20); break;- case CLASS_HUNTER: val2 = uint32(getLevel()*2 + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) - 20); break;- case CLASS_SHAMAN: val2 = uint32(getLevel()*2 + GetStat(STAT_STRENGTH)*2 - 20); break;+ case CLASS_HUNTER: val2 = uint32(getLevel()*2 + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY) * 2 - 20); break;+ case CLASS_SHAMAN: val2 = uint32(getLevel()*2 + GetStat(STAT_STRENGTH)*3 - 20); break; case CLASS_DRUID: switch(m_form) {Index: Unit.h===================================================================--- Unit.h (revision 3735)+++ Unit.h (working copy)@@ -464,6 +464,33 @@ } }; +struct MovementData+{+ MovementData() : x(0.0f), y(0.0f), z(0.0f), time(0), run(false), type(0), holdTime(0), packetCount(0) {}+ uint8 type;+ uint32 time, holdTime, packetCount;+ bool run;+ float x, y, z;+ bool Empty() { return x == 0.0f && y == 0.0f && z == 0.0f;} + //If the targetPointDistance - lastTargetPointDistance < 4.6, will not count as a consecutive packet,+ //so i continue to hold the packet, that will occur at 99% of the time when running around the target.+ void Update(float _x, float _y, float _z, uint32 _time, bool _run, uint8 _type)+ {+ if( ((x - _x) * (x - _x)) ++ ((y - _y) * (y - _y)) + + ((z - _z) * (z - _z)) > sWorld.getConfig(CONFIG_MOVE_FILTER_RANGE) )+ x = _x, y = _y, z = _z, time = _time, _run = run, type = _type;+ else+ x = _x, y = _y, z = _z, time = _time, _run = run, type = _type, packetCount += 1;+ + }+ void Clear()+ {+ x = y = z = 0.0f;+ time = 0, run = 0, type = 0, holdTime = 0, packetCount = 0;+ }+};+ typedef std::list<Hostil> ThreatList; typedef std::list<Hostil> HateOfflineList; @@ -719,7 +746,7 @@ void SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType, uint32 DamageType, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, uint32 TargetState, uint32 BlockedAmount); void SendSpellNonMeleeDamageLog(Unit *target,uint32 SpellID,uint32 Damage, uint8 DamageType,uint32 AbsorbedDamage, uint32 Resist,bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false); - void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, bool Run, uint32 Time);+ void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, bool Run, uint32 Time, bool specialBlend = false); virtual void MoveOutOfRange(Player &) { }; @@ -917,6 +944,7 @@ std::list<GameObject*> m_gameObj; ThreatList m_threatList; HateOfflineList m_offlineList;+ MovementData m_movementData; InHateListOf m_inhateList; bool m_isSorted; float m_victimThreat;