Core/Threat: Fix by faq.

Turning gm on, now drops threat.
Dead mobs no longer holds threat on player.
Also fixed some Engrish.
This commit is contained in:
Malcrom
2012-05-13 11:33:42 -02:30
parent 7190b1f336
commit 5709929d2b
6 changed files with 18 additions and 11 deletions
+4
View File
@@ -535,6 +535,10 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
setCurrentVictim(NULL); setCurrentVictim(NULL);
setDirty(true); setDirty(true);
} }
if (getOwner() && getOwner()->IsInWorld())
if (Unit* target = ObjectAccessor::GetUnit(*getOwner(), hostilRef->getUnitGuid()))
if (getOwner()->IsInMap(target))
getOwner()->SendRemoveFromThreatListOpcode(hostilRef);
iThreatContainer.remove(hostilRef); iThreatContainer.remove(hostilRef);
iThreatOfflineContainer.addReference(hostilRef); iThreatOfflineContainer.addReference(hostilRef);
} }
@@ -468,9 +468,9 @@ void Creature::Update(uint32 diff)
switch (m_deathState) switch (m_deathState)
{ {
case JUST_ALIVED: case JUST_RESPAWNED:
// Must not be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. // Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)", GetGUIDLow(), GetEntry()); sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
break; break;
case JUST_DIED: case JUST_DIED:
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. // Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
@@ -1555,7 +1555,7 @@ void Creature::setDeathState(DeathState s)
Unit::setDeathState(CORPSE); Unit::setDeathState(CORPSE);
} }
else if (s == JUST_ALIVED) else if (s == JUST_RESPAWNED)
{ {
//if (isPet()) //if (isPet())
// setActive(true); // setActive(true);
@@ -1611,7 +1611,7 @@ void Creature::Respawn(bool force)
CreatureTemplate const* cinfo = GetCreatureTemplate(); CreatureTemplate const* cinfo = GetCreatureTemplate();
SelectLevel(cinfo); SelectLevel(cinfo);
setDeathState(JUST_ALIVED); setDeathState(JUST_RESPAWNED);
uint32 displayID = GetNativeDisplayId(); uint32 displayID = GetNativeDisplayId();
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
+6 -3
View File
@@ -12823,9 +12823,8 @@ void Unit::setDeathState(DeathState s)
{ {
// death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
// it can be used to check creation of death items (such as soul shards). // it can be used to check creation of death items (such as soul shards).
m_deathState = s;
if (s != ALIVE && s != JUST_ALIVED) if (s != ALIVE && s != JUST_RESPAWNED)
{ {
CombatStop(); CombatStop();
DeleteThreatList(); DeleteThreatList();
@@ -12868,10 +12867,14 @@ void Unit::setDeathState(DeathState s)
if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript()) if (ZoneScript* zoneScript = GetZoneScript() ? GetZoneScript() : (ZoneScript*)GetInstanceScript())
zoneScript->OnUnitDeath(this); zoneScript->OnUnitDeath(this);
} }
else if (s == JUST_ALIVED) else if (s == JUST_RESPAWNED)
{
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground) RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
} }
m_deathState = s;
}
/*######################################## /*########################################
######## ######## ######## ########
######## AGGRO SYSTEM ######## ######## AGGRO SYSTEM ########
+1 -1
View File
@@ -465,7 +465,7 @@ enum DeathState
JUST_DIED = 1, JUST_DIED = 1,
CORPSE = 2, CORPSE = 2,
DEAD = 3, DEAD = 3,
JUST_ALIVED = 4, JUST_RESPAWNED = 4,
}; };
enum UnitState enum UnitState
@@ -1290,7 +1290,7 @@ struct npc_argent_captainAI : public ScriptedAI
if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead) if (spell->Id == SPELL_REVIVE_CHAMPION && !IsUndead)
{ {
IsUndead = true; IsUndead = true;
me->setDeathState(JUST_ALIVED); me->setDeathState(JUST_RESPAWNED);
uint32 newEntry = 0; uint32 newEntry = 0;
switch (me->GetEntry()) switch (me->GetEntry())
{ {
+1 -1
View File
@@ -1095,7 +1095,7 @@ class spell_item_shimmering_vessel : public SpellScriptLoader
void HandleDummy(SpellEffIndex /* effIndex */) void HandleDummy(SpellEffIndex /* effIndex */)
{ {
if (Creature* target = GetHitCreature()) if (Creature* target = GetHitCreature())
target->setDeathState(JUST_ALIVED); target->setDeathState(JUST_RESPAWNED);
} }
void Register() void Register()