*Allow to force to respawn creatures.
*Save creature data for vehicles. *Change some visibility update sequence of respawned creatures. *Fix bugs of quest 12687: dark rider may not be on horse / horse cannot be used twice / horse does not respawn at correct phase --HG-- branch : trunk
This commit is contained in:
@@ -532,9 +532,7 @@ struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CAST_PLR(charmer)->ExitVehicle();
|
CAST_PLR(charmer)->ExitVehicle();
|
||||||
//without this we can see npc kill the horse
|
CAST_CRE(who)->Respawn(true);
|
||||||
who->setDeathState(DEAD);
|
|
||||||
CAST_CRE(who)->Respawn();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -554,18 +552,6 @@ struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {}
|
npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {}
|
||||||
|
|
||||||
void MoveInLineOfSight(Unit *who)
|
|
||||||
{
|
|
||||||
if(me->getVictim())
|
|
||||||
return;
|
|
||||||
|
|
||||||
// this should be before next one otherwise he may enter vehicle again
|
|
||||||
if(!me->m_Vehicle && who->GetEntry() == 28782 && CAST_CRE(who)->isVehicle() && CAST_VEH(who)->HasEmptySeat(0))
|
|
||||||
me->EnterVehicle(CAST_VEH(who));
|
|
||||||
|
|
||||||
ScriptedAI::MoveInLineOfSight(who);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EnterCombat(Unit *who)
|
void EnterCombat(Unit *who)
|
||||||
{
|
{
|
||||||
me->ExitVehicle();
|
me->ExitVehicle();
|
||||||
|
|||||||
+14
-13
@@ -1780,7 +1780,7 @@ void Creature::setDeathState(DeathState s)
|
|||||||
LoadCreaturesAddon(true);
|
LoadCreaturesAddon(true);
|
||||||
Motion_Initialize();
|
Motion_Initialize();
|
||||||
if(GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
|
if(GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
|
||||||
SetPhaseMask(GetCreatureData()->phaseMask, true);
|
SetPhaseMask(GetCreatureData()->phaseMask, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,16 +1802,19 @@ bool Creature::FallGround()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::Respawn()
|
void Creature::Respawn(bool force)
|
||||||
{
|
{
|
||||||
RemoveCorpse();
|
DestroyForNearbyPlayers();
|
||||||
|
|
||||||
// forced recreate creature object at clients
|
if(force)
|
||||||
UnitVisibility currentVis = GetVisibility();
|
{
|
||||||
SetVisibility(VISIBILITY_RESPAWN);
|
if(isAlive())
|
||||||
ObjectAccessor::UpdateObjectVisibility(this);
|
setDeathState(JUST_DIED);
|
||||||
SetVisibility(currentVis); // restore visibility state
|
else if(getDeathState() != CORPSE)
|
||||||
ObjectAccessor::UpdateObjectVisibility(this);
|
setDeathState(CORPSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveCorpse();
|
||||||
|
|
||||||
if(getDeathState()==DEAD)
|
if(getDeathState()==DEAD)
|
||||||
{
|
{
|
||||||
@@ -1846,11 +1849,9 @@ void Creature::Respawn()
|
|||||||
uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), GetTypeId());
|
uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), GetTypeId());
|
||||||
if (poolid)
|
if (poolid)
|
||||||
poolhandler.UpdatePool(poolid, GetGUIDLow(), GetTypeId());
|
poolhandler.UpdatePool(poolid, GetGUIDLow(), GetTypeId());
|
||||||
|
|
||||||
//GetMap()->Add(this);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetToNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
|
bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
|
||||||
|
|||||||
+4
-3
@@ -672,7 +672,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
|||||||
time_t const& GetRespawnTime() const { return m_respawnTime; }
|
time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||||
time_t GetRespawnTimeEx() const;
|
time_t GetRespawnTimeEx() const;
|
||||||
void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; }
|
void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; }
|
||||||
void Respawn();
|
void Respawn(bool force = false);
|
||||||
void SaveRespawnTime();
|
void SaveRespawnTime();
|
||||||
|
|
||||||
uint32 GetRespawnDelay() const { return m_respawnDelay; }
|
uint32 GetRespawnDelay() const { return m_respawnDelay; }
|
||||||
@@ -786,6 +786,9 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
|||||||
|
|
||||||
bool DisableReputationGain;
|
bool DisableReputationGain;
|
||||||
|
|
||||||
|
CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
||||||
|
CreatureData const* m_creatureData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//WaypointMovementGenerator vars
|
//WaypointMovementGenerator vars
|
||||||
uint32 m_waypointID;
|
uint32 m_waypointID;
|
||||||
@@ -795,8 +798,6 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
|||||||
CreatureGroup *m_formation;
|
CreatureGroup *m_formation;
|
||||||
|
|
||||||
GridReference<Creature> m_gridRef;
|
GridReference<Creature> m_gridRef;
|
||||||
CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
|
||||||
CreatureData const* m_creatureData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AssistDelayEvent : public BasicEvent
|
class AssistDelayEvent : public BasicEvent
|
||||||
|
|||||||
+2
-2
@@ -18366,8 +18366,8 @@ bool Player::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList, bool
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// forbidden to seen (at GM respawn command)
|
// forbidden to seen (at GM respawn command)
|
||||||
if(u->GetVisibility() == VISIBILITY_RESPAWN)
|
//if(u->GetVisibility() == VISIBILITY_RESPAWN)
|
||||||
return false;
|
// return false;
|
||||||
|
|
||||||
// Grid dead/alive checks
|
// Grid dead/alive checks
|
||||||
// non visible at grid for any stealth state
|
// non visible at grid for any stealth state
|
||||||
|
|||||||
+44
-23
@@ -45,26 +45,6 @@ void Vehicle::AddToWorld()
|
|||||||
m_zoneScript->OnCreatureCreate(this, true);
|
m_zoneScript->OnCreatureCreate(this, true);
|
||||||
ObjectAccessor::Instance().AddObject(this);
|
ObjectAccessor::Instance().AddObject(this);
|
||||||
|
|
||||||
switch(GetEntry())
|
|
||||||
{
|
|
||||||
//case 27850:InstallAccessory(27905,1);break;
|
|
||||||
case 28312:InstallAccessory(28319,7);break;
|
|
||||||
case 32627:InstallAccessory(32629,7);break;
|
|
||||||
case 33109:InstallAccessory(33167,1);break;
|
|
||||||
case 33060:InstallAccessory(33067,7);break;
|
|
||||||
case 33113:
|
|
||||||
InstallAccessory(33114,0);
|
|
||||||
InstallAccessory(33114,1);
|
|
||||||
InstallAccessory(33114,2);
|
|
||||||
InstallAccessory(33114,3);
|
|
||||||
InstallAccessory(33139,7);
|
|
||||||
break;
|
|
||||||
case 33114:
|
|
||||||
InstallAccessory(33143,1);
|
|
||||||
//InstallAccessory(33142,0);
|
|
||||||
InstallAccessory(33142,2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
for(uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
|
for(uint32 i = 0; i < MAX_SPELL_VEHICLE; ++i)
|
||||||
{
|
{
|
||||||
if(!m_spells[i])
|
if(!m_spells[i])
|
||||||
@@ -85,11 +65,38 @@ void Vehicle::AddToWorld()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InstallAllAccessories();
|
||||||
|
|
||||||
Unit::AddToWorld();
|
Unit::AddToWorld();
|
||||||
AIM_Initialize();
|
AIM_Initialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Vehicle::InstallAllAccessories()
|
||||||
|
{
|
||||||
|
switch(GetEntry())
|
||||||
|
{
|
||||||
|
//case 27850:InstallAccessory(27905,1);break;
|
||||||
|
case 28782:InstallAccessory(28768,0);break; // Acherus Deathcharger
|
||||||
|
case 28312:InstallAccessory(28319,7);break;
|
||||||
|
case 32627:InstallAccessory(32629,7);break;
|
||||||
|
case 33109:InstallAccessory(33167,1);break;
|
||||||
|
case 33060:InstallAccessory(33067,7);break;
|
||||||
|
case 33113:
|
||||||
|
InstallAccessory(33114,0);
|
||||||
|
InstallAccessory(33114,1);
|
||||||
|
InstallAccessory(33114,2);
|
||||||
|
InstallAccessory(33114,3);
|
||||||
|
InstallAccessory(33139,7);
|
||||||
|
break;
|
||||||
|
case 33114:
|
||||||
|
InstallAccessory(33143,1);
|
||||||
|
//InstallAccessory(33142,0);
|
||||||
|
InstallAccessory(33142,2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Vehicle::RemoveFromWorld()
|
void Vehicle::RemoveFromWorld()
|
||||||
{
|
{
|
||||||
if(IsInWorld())
|
if(IsInWorld())
|
||||||
@@ -110,7 +117,7 @@ void Vehicle::setDeathState(DeathState s) // overwrite vir
|
|||||||
for(SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
|
for(SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr)
|
||||||
{
|
{
|
||||||
if(Unit *passenger = itr->second.passenger)
|
if(Unit *passenger = itr->second.passenger)
|
||||||
if(passenger->GetTypeId() == TYPEID_UNIT && ((Creature*)passenger)->isVehicle())
|
if(passenger->GetOwnerGUID() == GetGUID())
|
||||||
{
|
{
|
||||||
passenger->ExitVehicle();
|
passenger->ExitVehicle();
|
||||||
((Vehicle*)passenger)->setDeathState(s);
|
((Vehicle*)passenger)->setDeathState(s);
|
||||||
@@ -118,12 +125,15 @@ void Vehicle::setDeathState(DeathState s) // overwrite vir
|
|||||||
}
|
}
|
||||||
RemoveAllPassengers();
|
RemoveAllPassengers();
|
||||||
}
|
}
|
||||||
else if(s == JUST_ALIVED)
|
|
||||||
|
Creature::setDeathState(s);
|
||||||
|
|
||||||
|
if(s == JUST_ALIVED)
|
||||||
{
|
{
|
||||||
|
InstallAllAccessories();
|
||||||
if(m_usableSeatNum)
|
if(m_usableSeatNum)
|
||||||
SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||||
}
|
}
|
||||||
Creature::setDeathState(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::Update(uint32 diff)
|
void Vehicle::Update(uint32 diff)
|
||||||
@@ -226,6 +236,15 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
|
|||||||
|
|
||||||
void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
|
void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
|
||||||
{
|
{
|
||||||
|
if(Unit *passenger = GetPassenger(seatId))
|
||||||
|
{
|
||||||
|
// already installed
|
||||||
|
if(passenger->GetEntry() == entry)
|
||||||
|
return;
|
||||||
|
|
||||||
|
passenger->ExitVehicle(); // this should not happen
|
||||||
|
}
|
||||||
|
|
||||||
const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
|
const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
|
||||||
if(!cInfo)
|
if(!cInfo)
|
||||||
return;
|
return;
|
||||||
@@ -421,5 +440,7 @@ bool Vehicle::LoadFromDB(uint32 guid, Map *map)
|
|||||||
// checked at creature_template loading
|
// checked at creature_template loading
|
||||||
m_defaultMovementType = MovementGeneratorType(data->movementType);
|
m_defaultMovementType = MovementGeneratorType(data->movementType);
|
||||||
|
|
||||||
|
m_creatureData = data;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -57,7 +57,7 @@ class TRINITY_DLL_SPEC Vehicle : public Creature
|
|||||||
int8 GetNextEmptySeat(int8 seatId, bool next) const;
|
int8 GetNextEmptySeat(int8 seatId, bool next) const;
|
||||||
bool AddPassenger(Unit *passenger, int8 seatId = -1);
|
bool AddPassenger(Unit *passenger, int8 seatId = -1);
|
||||||
void RemovePassenger(Unit *passenger);
|
void RemovePassenger(Unit *passenger);
|
||||||
void InstallAccessory(uint32 entry, int8 seatId);
|
void InstallAllAccessories();
|
||||||
void Dismiss();
|
void Dismiss();
|
||||||
|
|
||||||
bool LoadFromDB(uint32 guid, Map *map);
|
bool LoadFromDB(uint32 guid, Map *map);
|
||||||
@@ -68,6 +68,7 @@ class TRINITY_DLL_SPEC Vehicle : public Creature
|
|||||||
uint32 m_usableSeatNum;
|
uint32 m_usableSeatNum;
|
||||||
|
|
||||||
void RemoveAllPassengers();
|
void RemoveAllPassengers();
|
||||||
|
void InstallAccessory(uint32 entry, int8 seatId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called
|
void SaveToDB(uint32, uint8) // overwrited of Creature::SaveToDB - don't must be called
|
||||||
|
|||||||
@@ -300,8 +300,7 @@ bool OPvPWintergrasp::UpdateCreatureInfo(Creature *creature)
|
|||||||
if(entry != creature->GetEntry())
|
if(entry != creature->GetEntry())
|
||||||
{
|
{
|
||||||
creature->SetOriginalEntry(entry);
|
creature->SetOriginalEntry(entry);
|
||||||
creature->setDeathState(DEAD);
|
creature->Respawn(true);
|
||||||
creature->Respawn();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user