* Corpse related cleanup (author: Hunuza)
* Avoid saving of the corpse in arenas (author: VladimirMangos) --HG-- branch : trunk
This commit is contained in:
@@ -217,3 +217,10 @@ bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const
|
||||
return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u->m_seer, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false);
|
||||
}
|
||||
|
||||
bool Corpse::IsExpired(time_t t) const
|
||||
{
|
||||
if (m_type == CORPSE_BONES)
|
||||
return m_time < t - 60 * MINUTE;
|
||||
else
|
||||
return m_time < t - 3 * DAY;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ class Corpse : public WorldObject, public GridObject<Corpse>
|
||||
void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); }
|
||||
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
|
||||
|
||||
bool IsExpired(time_t t) const;
|
||||
|
||||
private:
|
||||
CorpseType m_type;
|
||||
time_t m_time;
|
||||
|
||||
@@ -4834,10 +4834,8 @@ void Player::CreateCorpse()
|
||||
}
|
||||
}
|
||||
|
||||
// we don't SaveToDB for players in battlegrounds so don't do it for corpses either
|
||||
const MapEntry *entry = sMapStore.LookupEntry(corpse->GetMapId());
|
||||
ASSERT(entry);
|
||||
if (entry->map_type != MAP_BATTLEGROUND)
|
||||
// we do not need to save corpses for BG/arenas
|
||||
if (!GetMap()->IsBattleGroundOrArena())
|
||||
corpse->SaveToDB();
|
||||
|
||||
// register for player, but not show
|
||||
|
||||
Reference in New Issue
Block a user