Merge commit 'origin/master' into 330

This commit is contained in:
tomrus88 2009-10-21 23:49:51 +04:00
commit 5e15a6553c
36 changed files with 351 additions and 213 deletions

View file

@ -2072,24 +2072,10 @@ void Player::RegenerateHealth(uint32 diff)
ModifyHealth(int32(addvalue));
}
bool Player::CanInteractWithNPCs(bool alive) const
{
if(alive && !isAlive())
return false;
if(isInFlight())
return false;
return true;
}
Creature*
Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
{
// unit checks
if (!guid)
return NULL;
if(!IsInWorld())
if (!guid || !IsInWorld() || isInFlight())
return NULL;
// exist (we need look pets also for some interaction (quest/etc)
@ -2097,23 +2083,23 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
if (!unit)
return NULL;
// player check
if(!CanInteractWithNPCs(!(unit->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_GHOST)))
return NULL;
// appropriate npc type
if(npcflagmask && !unit->HasFlag( UNIT_NPC_FLAGS, npcflagmask ))
if (npcflagmask && !unit->HasFlag( UNIT_NPC_FLAGS, npcflagmask ))
return NULL;
if (isAlive() && !unit->isAlive())
// if a dead unit should be able to talk - the creature must be alive and have special flags
if (!unit->isAlive())
return NULL;
if (isAlive() && unit->isInvisibleForAlive())
return NULL;
// not allow interaction under control, but allow with own pets
if(unit->GetCharmerGUID())
if (unit->GetCharmerGUID())
return NULL;
// not enemy
if( unit->IsHostileTo(this))
if (unit->IsHostileTo(this))
return NULL;
// not unfriendly
@ -14835,10 +14821,10 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
// negative effects should continue counting down after logout
if (remaintime != -1 && !IsPositiveEffect(spellid, effindex))
{
if(remaintime <= int32(timediff))
if (remaintime/IN_MILISECONDS <= int32(timediff))
continue;
remaintime -= timediff;
remaintime -= timediff*IN_MILISECONDS;
}
// prevent wrong values of remaincharges