[6889] Backport some not client version specific changes and fixes from 303 branch.

This commit is contained in:
VladimirMangos 2008-12-09 14:05:23 +03:00
parent 480a935216
commit 3da9f3f4cc
56 changed files with 1998 additions and 377 deletions

View file

@ -50,12 +50,12 @@ float baseMoveSpeed[MAX_MOVE_TYPE] =
{
2.5f, // MOVE_WALK
7.0f, // MOVE_RUN
1.25f, // MOVE_WALKBACK
1.25f, // MOVE_RUN_BACK
4.722222f, // MOVE_SWIM
4.5f, // MOVE_SWIMBACK
3.141594f, // MOVE_TURN
7.0f, // MOVE_FLY
4.5f, // MOVE_FLYBACK
4.5f, // MOVE_SWIM_BACK
3.141594f, // MOVE_TURN_RATE
7.0f, // MOVE_FLIGHT
4.5f, // MOVE_FLIGHT_BACK
};
// auraTypes contains attacker auras capable of proc'ing cast auras
@ -1462,9 +1462,8 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage
void Unit::HandleEmoteCommand(uint32 anim_id)
{
WorldPacket data( SMSG_EMOTE, 12 );
data << anim_id << GetGUID();
WPAssert(data.size() == 12);
data << uint32(anim_id);
data << uint64(GetGUID());
SendMessageToSet(&data, true);
}
@ -2579,8 +2578,8 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
void Unit::SendAttackStart(Unit* pVictim)
{
WorldPacket data( SMSG_ATTACKSTART, 16 );
data << GetGUID();
data << pVictim->GetGUID();
data << uint64(GetGUID());
data << uint64(pVictim->GetGUID());
SendMessageToSet(&data, true);
DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" );
@ -6901,7 +6900,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
if(GetTypeId()==TYPEID_UNIT)
{
WorldPacket data(SMSG_AI_REACTION, 12);
data << GetGUID();
data << uint64(GetGUID());
data << uint32(AI_REACTION_AGGRO); // Aggro sound
((WorldObject*)this)->SendMessageToSet(&data, true);
@ -7117,17 +7116,17 @@ Unit* Unit::GetCharm() const
void Unit::SetPet(Pet* pet)
{
SetUInt64Value(UNIT_FIELD_SUMMON,pet ? pet->GetGUID() : 0);
SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0);
// 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);
}
void Unit::UnsummonAllTotems()
@ -7164,7 +7163,6 @@ void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Po
data << uint32(SpellID);
data << uint32(powertype);
data << uint32(Damage);
//data << uint8(critical ? 1 : 0); // removed in 2.4.0
SendMessageToSet(&data, true);
}
@ -7621,7 +7619,7 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic
bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType)
{
// not criting spell
// not critting spell
if((spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_CRIT))
return false;
@ -8809,16 +8807,16 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
}
break;
}
case MOVE_WALKBACK:
case MOVE_RUN_BACK:
return;
case MOVE_SWIM:
{
main_speed_mod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_SWIM_SPEED);
break;
}
case MOVE_SWIMBACK:
case MOVE_SWIM_BACK:
return;
case MOVE_FLY:
case MOVE_FLIGHT:
{
if (IsMounted()) // Use on mount auras
main_speed_mod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
@ -8828,7 +8826,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
non_stack_bonus = (100.0 + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f;
break;
}
case MOVE_FLYBACK:
case MOVE_FLIGHT_BACK:
return;
default:
sLog.outError("Unit::UpdateSpeed: Unsupported move type (%d)", mtype);
@ -8843,7 +8841,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
{
case MOVE_RUN:
case MOVE_SWIM:
case MOVE_FLY:
case MOVE_FLIGHT:
{
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
// TODO: possible affect only on MOVE_RUN
@ -8900,22 +8898,22 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
case MOVE_RUN:
data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8+4+1+4+4+4+4+4+4+4);
break;
case MOVE_WALKBACK:
case MOVE_RUN_BACK:
data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8+4+1+4+4+4+4+4+4+4);
break;
case MOVE_SWIM:
data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 8+4+1+4+4+4+4+4+4+4);
break;
case MOVE_SWIMBACK:
case MOVE_SWIM_BACK:
data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 8+4+1+4+4+4+4+4+4+4);
break;
case MOVE_TURN:
case MOVE_TURN_RATE:
data.Initialize(MSG_MOVE_SET_TURN_RATE, 8+4+1+4+4+4+4+4+4+4);
break;
case MOVE_FLY:
case MOVE_FLIGHT:
data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 8+4+1+4+4+4+4+4+4+4);
break;
case MOVE_FLYBACK:
case MOVE_FLIGHT_BACK:
data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 8+4+1+4+4+4+4+4+4+4);
break;
default:
@ -8948,22 +8946,22 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
case MOVE_RUN:
data.Initialize(SMSG_FORCE_RUN_SPEED_CHANGE, 17);
break;
case MOVE_WALKBACK:
case MOVE_RUN_BACK:
data.Initialize(SMSG_FORCE_RUN_BACK_SPEED_CHANGE, 16);
break;
case MOVE_SWIM:
data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, 16);
break;
case MOVE_SWIMBACK:
case MOVE_SWIM_BACK:
data.Initialize(SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, 16);
break;
case MOVE_TURN:
case MOVE_TURN_RATE:
data.Initialize(SMSG_FORCE_TURN_RATE_CHANGE, 16);
break;
case MOVE_FLY:
case MOVE_FLIGHT:
data.Initialize(SMSG_FORCE_FLIGHT_SPEED_CHANGE, 16);
break;
case MOVE_FLYBACK:
case MOVE_FLIGHT_BACK:
data.Initialize(SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, 16);
break;
default:
@ -8971,7 +8969,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
return;
}
data.append(GetPackGUID());
data << (uint32)0;
data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39
if (mtype == MOVE_RUN)
data << uint8(0); // new 2.1.0
data << float(GetSpeed(mtype));
@ -10753,9 +10751,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);
if(!pet->InitStatsForLevel(creatureTarget->getLevel()))