Core/Map: New Map::ForceRespawn to override objections and force a respawn (equivalent to force = true). Use this to fix various GM commands.
Port From (https://github.com/TrinityCore/TrinityCore/commit/8b7728f82e6e7c326b7945efd719218179e9767a)
This commit is contained in:
@@ -250,7 +250,7 @@ namespace Game.AI
|
||||
|
||||
|
||||
//Check if player or any member of his group is within range
|
||||
if (_despawnAtFar && HasEscortState(EscortState.Escorting) && !_playerGUID.IsEmpty() && !me.GetVictim() && !HasEscortState(EscortState.Returning))
|
||||
if (_despawnAtFar && HasEscortState(EscortState.Escorting) && !_playerGUID.IsEmpty() && !me.IsEngaged() && !HasEscortState(EscortState.Returning))
|
||||
{
|
||||
if (_playerCheckTimer <= diff)
|
||||
{
|
||||
@@ -263,10 +263,13 @@ namespace Game.AI
|
||||
if (creatureData != null)
|
||||
isEscort = (WorldConfig.GetBoolValue(WorldCfg.RespawnDynamicEscortNpc) && creatureData.spawnGroupData.flags.HasAnyFlag(SpawnGroupFlags.EscortQuestNpc));
|
||||
|
||||
if (_instantRespawn && !isEscort)
|
||||
me.DespawnOrUnsummon(0, TimeSpan.FromSeconds(1));
|
||||
else if (_instantRespawn && isEscort)
|
||||
me.GetMap().RemoveRespawnTime(SpawnObjectType.Creature, me.GetSpawnId(), true);
|
||||
if (_instantRespawn)
|
||||
{
|
||||
if (!isEscort)
|
||||
me.DespawnOrUnsummon(0, TimeSpan.FromSeconds(1));
|
||||
else
|
||||
me.GetMap().RemoveRespawnTime(SpawnObjectType.Creature, me.GetSpawnId(), true);
|
||||
}
|
||||
else
|
||||
me.DespawnOrUnsummon();
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Game.Chat
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
// force respawn to make sure we find something
|
||||
player.GetMap().RemoveRespawnTime(SpawnObjectType.GameObject, guidLow, true);
|
||||
player.GetMap().ForceRespawn(SpawnObjectType.GameObject, guidLow);
|
||||
GameObject obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Game.Chat
|
||||
uint mechanicImmuneMask = cInfo.MechanicImmuneMask;
|
||||
uint displayid = target.GetDisplayId();
|
||||
uint nativeid = target.GetNativeDisplayId();
|
||||
uint Entry = target.GetEntry();
|
||||
uint entry = target.GetEntry();
|
||||
|
||||
long curRespawnDelay = target.GetRespawnCompatibilityMode() ? target.GetRespawnTimeEx() - GameTime.GetGameTime() : target.GetMap().GetCreatureRespawnTime(target.GetSpawnId()) - GameTime.GetGameTime();
|
||||
if (curRespawnDelay < 0)
|
||||
@@ -138,7 +138,7 @@ namespace Game.Chat
|
||||
string curRespawnDelayStr = Time.secsToTimeString((ulong)curRespawnDelay, true);
|
||||
string defRespawnDelayStr = Time.secsToTimeString(target.GetRespawnDelay(), true);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoChar, target.GetSpawnId(), target.GetGUID().ToString(), faction, npcflags, Entry, displayid, nativeid);
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoChar, target.GetName(), target.GetSpawnId(), target.GetGUID().ToString(), entry, faction, npcflags, displayid, nativeid);
|
||||
if (target.GetCreatureData() != null && target.GetCreatureData().spawnGroupData.groupId != 0)
|
||||
{
|
||||
SpawnGroupTemplateData groupData = target.GetCreatureData().spawnGroupData;
|
||||
@@ -184,7 +184,7 @@ namespace Game.Chat
|
||||
if (cInfo.FlagsExtra.HasAnyFlag((CreatureFlagsExtra)value))
|
||||
handler.SendSysMessage("{0} (0x{1:X})", (CreatureFlagsExtra)value, value);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoNpcFlags, npcflags);
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoNpcFlags, target.m_unitData.NpcFlags[0]);
|
||||
foreach (uint value in Enum.GetValues(typeof(NPCFlags)))
|
||||
if (npcflags.HasAnyFlag(value))
|
||||
handler.SendSysMessage("{0} (0x{1:X})", (NPCFlags)value, value);
|
||||
@@ -880,7 +880,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
|
||||
// force respawn to make sure we find something
|
||||
handler.GetSession().GetPlayer().GetMap().RemoveRespawnTime(SpawnObjectType.Creature, guidLow, true);
|
||||
handler.GetSession().GetPlayer().GetMap().ForceRespawn(SpawnObjectType.Creature, guidLow);
|
||||
// then try to find it
|
||||
creature = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace Game.Combat
|
||||
{
|
||||
if (!CanHaveThreatList() || !IsEngaged())
|
||||
return;
|
||||
|
||||
if (_updateClientTimer <= tdiff)
|
||||
{
|
||||
_updateClientTimer = CLIENT_THREAT_UPDATE_INTERVAL;
|
||||
|
||||
@@ -2555,6 +2555,13 @@ namespace Game.Maps
|
||||
_respawnTimes.Remove(info);
|
||||
}
|
||||
|
||||
public void ForceRespawn(SpawnObjectType type, ulong spawnId)
|
||||
{
|
||||
RespawnInfo info = GetRespawnInfo(type, spawnId);
|
||||
if (info != null)
|
||||
Respawn(info, true);
|
||||
}
|
||||
|
||||
public void RemoveRespawnTime(RespawnInfo info, bool doRespawn = false, SQLTransaction dbTrans = null)
|
||||
{
|
||||
PreparedStatement stmt;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--
|
||||
DELETE FROM `linked_respawn` WHERE `guid`=137752 AND `linkedguid`=137752 AND `linkType`=0;
|
||||
UPDATE `trinity_string` SET `content_default`='NPC currently selected by player:
|
||||
Name: %s
|
||||
SpawnID: %s.
|
||||
GUID: %s.
|
||||
Entry: %u.
|
||||
Faction: %u.
|
||||
NPC Flags: %s.
|
||||
DisplayID: %u (Native: %u).' WHERE `entry`=539;
|
||||
Reference in New Issue
Block a user