Merge remote branch 'origin/master' into 330

This commit is contained in:
tomrus88 2009-12-16 02:45:05 +03:00
commit c745c5072f
31 changed files with 1000 additions and 760 deletions

View file

@ -2088,6 +2088,12 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
if (npcflagmask && !unit->HasFlag( UNIT_NPC_FLAGS, npcflagmask ))
return NULL;
if (npcflagmask == UNIT_NPC_FLAG_STABLEMASTER)
{
if (getClass() != CLASS_HUNTER)
return NULL;
}
// if a dead unit should be able to talk - the creature must be alive and have special flags
if (!unit->isAlive())
return NULL;
@ -5008,8 +5014,8 @@ void Player::SetRegularAttackTime()
{
for(int i = 0; i < MAX_ATTACK; ++i)
{
Item *tmpitem = GetWeaponForAttack(WeaponAttackType(i));
if(tmpitem && !tmpitem->IsBroken())
Item *tmpitem = GetWeaponForAttack(WeaponAttackType(i),true,false);
if (tmpitem)
{
ItemPrototype const *proto = tmpitem->GetProto();
if(proto->Delay)
@ -5215,7 +5221,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
{
case BASE_ATTACK:
{
Item *tmpitem = GetWeaponForAttack(attType,true);
Item *tmpitem = GetWeaponForAttack(attType,true,true);
if (!tmpitem)
UpdateSkill(SKILL_UNARMED,weapon_skill_gain);
@ -5226,7 +5232,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
case OFF_ATTACK:
case RANGED_ATTACK:
{
Item *tmpitem = GetWeaponForAttack(attType,true);
Item *tmpitem = GetWeaponForAttack(attType,true,true);
if (tmpitem)
UpdateSkill(tmpitem->GetSkill(),weapon_skill_gain);
break;
@ -7034,8 +7040,8 @@ void Player::UpdateEquipSpellsAtFormChange()
void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
{
Item *item = GetWeaponForAttack(attType, false);
if(!item || item->IsBroken())
Item *item = GetWeaponForAttack(attType, true, false);
if(!item)
return;
ItemPrototype const *proto = item->GetProto();
@ -7355,8 +7361,8 @@ bool Player::CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const
return false;
// check ranged weapon
Item *weapon = GetWeaponForAttack( RANGED_ATTACK );
if(!weapon || weapon->IsBroken() )
Item *weapon = GetWeaponForAttack( RANGED_ATTACK, true, false );
if (!weapon)
return false;
ItemPrototype const* weapon_proto = weapon->GetProto();
@ -8173,14 +8179,14 @@ void Player::SetSheath( SheathState sheathed )
break;
case SHEATH_STATE_MELEE: // prepared melee weapon
{
SetVirtualItemSlot(0,GetWeaponForAttack(BASE_ATTACK,true));
SetVirtualItemSlot(1,GetWeaponForAttack(OFF_ATTACK,true));
SetVirtualItemSlot(0,GetWeaponForAttack(BASE_ATTACK,true,true));
SetVirtualItemSlot(1,GetWeaponForAttack(OFF_ATTACK,true,true));
SetVirtualItemSlot(2,NULL);
}; break;
case SHEATH_STATE_RANGED: // prepared ranged weapon
SetVirtualItemSlot(0,NULL);
SetVirtualItemSlot(1,NULL);
SetVirtualItemSlot(2,GetWeaponForAttack(RANGED_ATTACK,true));
SetVirtualItemSlot(2,GetWeaponForAttack(RANGED_ATTACK,true,true));
break;
default:
SetVirtualItemSlot(0,NULL);
@ -8551,7 +8557,7 @@ Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
return NULL;
}
Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable) const
Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool nonbroken, bool useable) const
{
uint16 slot;
switch (attackType)
@ -8566,10 +8572,10 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable) cons
if (!item || item->GetProto()->Class != ITEM_CLASS_WEAPON)
return NULL;
if(!useable)
return item;
if (useable && !IsUseEquipedWeapon(attackType==BASE_ATTACK))
return NULL;
if( item->IsBroken() || !IsUseEquipedWeapon(attackType==BASE_ATTACK) )
if (nonbroken && item->IsBroken())
return NULL;
return item;
@ -12491,7 +12497,7 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
uint32 Player::GetGossipTextId(WorldObject *pSource)
{
if (!pSource || pSource->GetTypeId() != TYPEID_UNIT || !((Creature*)pSource)->GetDBTableGUIDLow())
return 0;
return DEFAULT_GOSSIP_MESSAGE;
if (uint32 pos = sObjectMgr.GetNpcGossip(((Creature*)pSource)->GetDBTableGUIDLow()))
return pos;
@ -19638,7 +19644,7 @@ bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
uint32 Player::GetBaseWeaponSkillValue (WeaponAttackType attType) const
{
Item* item = GetWeaponForAttack(attType,true);
Item* item = GetWeaponForAttack(attType,true,true);
// unarmed only with base attack
if(attType != BASE_ATTACK && !item)