fix(corpse): cadavre orphelin (instance reset) ne bloque plus le fantome a l esprit guerisseur - nettoie le cadavre + ressuscite au login
This commit is contained in:
@@ -384,7 +384,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_SEL_CORPSE_PHASES, "SELECT cp.OwnerGuid, cp.PhaseId FROM corpse_phases cp LEFT JOIN corpse c ON cp.OwnerGuid = c.`guid` WHERE c.mapId = ? AND c.instanceId = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_INS_CORPSE_PHASES, "INSERT INTO corpse_phases (OwnerGuid, PhaseId) VALUES (?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CORPSE_PHASES, "DELETE FROM corpse_phases WHERE OwnerGuid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CORPSE_LOCATION, "SELECT mapId, posX, posY, posZ, orientation FROM corpse WHERE `guid` = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_CORPSE_LOCATION, "SELECT mapId, posX, posY, posZ, orientation, instanceId FROM corpse WHERE `guid` = ?", CONNECTION_ASYNC);
|
||||
|
||||
// Creature respawn
|
||||
PrepareStatement(CHAR_SEL_CREATURE_RESPAWNS, "SELECT `guid`, respawnTime FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH);
|
||||
|
||||
@@ -19565,8 +19565,22 @@ void Player::LoadCorpse(PreparedQueryResult result)
|
||||
if (result && !HasAtLoginFlag(AT_LOGIN_RESURRECT))
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
_corpseLocation.WorldRelocate(fields[0].GetUInt16(), fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat());
|
||||
ApplyModFlag(PLAYER_FIELD_LOCAL_FLAGS, PLAYER_LOCAL_FLAG_RELEASE_TIMER, !sMapStore.LookupEntry(_corpseLocation.GetMapId())->Instanceable());
|
||||
uint16 corpseMapId = fields[0].GetUInt16();
|
||||
uint32 corpseInstanceId = fields[5].GetUInt32();
|
||||
MapEntry const* corpseMapEntry = sMapStore.LookupEntry(corpseMapId);
|
||||
// SylvaniaCore: cadavre orphelin (instance reset/disparue) -> evite le blocage du fantome a l'esprit guerisseur
|
||||
if (corpseMapEntry && corpseMapEntry->Instanceable() && corpseInstanceId && !sInstanceSaveMgr->GetInstanceSave(corpseInstanceId))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* delCorpseStmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE);
|
||||
delCorpseStmt->setUInt64(0, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(delCorpseStmt);
|
||||
ResurrectPlayer(0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_corpseLocation.WorldRelocate(corpseMapId, fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat());
|
||||
ApplyModFlag(PLAYER_FIELD_LOCAL_FLAGS, PLAYER_LOCAL_FLAG_RELEASE_TIMER, !corpseMapEntry->Instanceable());
|
||||
}
|
||||
}
|
||||
else
|
||||
ResurrectPlayer(0.5f);
|
||||
|
||||
Reference in New Issue
Block a user