Merge branch 'master' into 310

Conflicts:
	src/game/GameObject.cpp
This commit is contained in:
tomrus88 2009-03-18 07:45:29 +03:00
commit 9d2acc22b4
47 changed files with 1772 additions and 1246 deletions

View file

@ -2830,7 +2830,7 @@ uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target)
if(attType != BASE_ATTACK && !item )
return 0;
if(((Player*)this)->IsInFeralForm())
if(IsInFeralForm())
return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
// weapon skill or (unarmed for base attack)
@ -2956,7 +2956,7 @@ void Unit::_UpdateAutoRepeatSpell()
if (isAttackReady(RANGED_ATTACK))
{
// Check if able to cast
if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CanCast(true))
if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true) != SPELL_CAST_OK)
{
InterruptSpell(CURRENT_AUTOREPEAT_SPELL);
return;
@ -7120,6 +7120,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
RemoveSpellsCausingAura(SPELL_AURA_MOD_UNATTACKABLE);
// in fighting already
if (m_attacking)
{
if (m_attacking == victim)
@ -7133,7 +7134,16 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
}
return false;
}
AttackStop();
// remove old target data
AttackStop(true);
}
// new battle
else
{
// set position before any AI calls/assistance
if(GetTypeId()==TYPEID_UNIT)
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
}
//Set our target
@ -7142,10 +7152,6 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
if(meleeAttack)
addUnitState(UNIT_STAT_MELEE_ATTACKING);
// set position before any AI calls/assistance
if(GetTypeId()==TYPEID_UNIT)
((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
m_attacking = victim;
m_attacking->_addAttacker(this);
@ -7172,7 +7178,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
return true;
}
bool Unit::AttackStop()
bool Unit::AttackStop(bool targetSwitch /*=false*/)
{
if (!m_attacking)
return false;
@ -7189,11 +7195,9 @@ bool Unit::AttackStop()
InterruptSpell(CURRENT_MELEE_SPELL);
if( GetTypeId()==TYPEID_UNIT )
{
// reset call assistance
// reset only at real combat stop
if(!targetSwitch && GetTypeId()==TYPEID_UNIT )
((Creature*)this)->SetNoCallAssistance(false);
}
SendAttackStop(victim);
@ -9629,7 +9633,7 @@ uint32 Unit::GetCreatureType() const
{
if(GetTypeId() == TYPEID_PLAYER)
{
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(((Player*)this)->m_form);
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form);
if(ssEntry && ssEntry->creatureType > 0)
return ssEntry->creatureType;
else
@ -10599,8 +10603,11 @@ Player* Unit::GetSpellModOwner()
}
///----------Pet responses methods-----------------
void Unit::SendPetCastFail(uint32 spellid, uint8 msg)
void Unit::SendPetCastFail(uint32 spellid, SpellCastResult msg)
{
if(msg == SPELL_CAST_OK)
return;
Unit *owner = GetCharmerOrOwner();
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
@ -11361,3 +11368,19 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
if(Pet* pet = GetPet())
pet->SetPhaseMask(newPhaseMask,true);
}
void Unit::NearTeleportTo( float x, float y, float z, float orientation, bool casting /*= false*/ )
{
if(GetTypeId() == TYPEID_PLAYER)
((Player*)this)->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_TRANSPORT | TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0));
else
{
GetMap()->CreatureRelocation((Creature*)this, x, y, z, orientation);
WorldPacket data;
// Work strange for many spells: triggered active mover set for targeted player to creature
//BuildTeleportAckMsg(&data, x, y, z, orientation);
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, false);
}
}