Core/Creatures: Implemented serverside checks for UNIT_FLAG2_INTERACT_WHILE_HOSTILE and UNIT_FLAG3_ALLOW_INTERACTION_WHILE_IN_COMBAT
* Also stop sending npc flags for hostile creatures Port From (https://github.com/TrinityCore/TrinityCore/commit/c2e36dea6c6af6139bf60454e9299447ec7d9897)
This commit is contained in:
@@ -286,6 +286,7 @@ namespace Game.Entities
|
||||
|
||||
// TODO: migrate these in DB
|
||||
_staticFlags.ApplyFlag(CreatureStaticFlags2.AllowMountedCombat, GetCreatureDifficulty().TypeFlags.HasFlag(CreatureTypeFlags.AllowMountedCombat));
|
||||
SetInteractionAllowedInCombat(GetCreatureDifficulty().TypeFlags.HasAnyFlag(CreatureTypeFlags.AllowInteractionWhileInCombat));
|
||||
SetTreatAsRaidUnit(GetCreatureDifficulty().TypeFlags.HasAnyFlag(CreatureTypeFlags.TreatAsRaidUnit));
|
||||
|
||||
return true;
|
||||
@@ -2756,6 +2757,33 @@ namespace Game.Entities
|
||||
m_respawnTime = Math.Max(m_corpseRemoveTime + m_respawnDelay, m_respawnTime);
|
||||
}
|
||||
|
||||
public override void SetInteractionAllowedWhileHostile(bool interactionAllowed)
|
||||
{
|
||||
_staticFlags.ApplyFlag(CreatureStaticFlags5.InteractWhileHostile, interactionAllowed);
|
||||
base.SetInteractionAllowedWhileHostile(interactionAllowed);
|
||||
}
|
||||
|
||||
public override void SetInteractionAllowedInCombat(bool interactionAllowed)
|
||||
{
|
||||
_staticFlags.ApplyFlag(CreatureStaticFlags3.AllowInteractionWhileInCombat, interactionAllowed);
|
||||
base.SetInteractionAllowedInCombat(interactionAllowed);
|
||||
}
|
||||
|
||||
public override void UpdateNearbyPlayersInteractions()
|
||||
{
|
||||
base.UpdateNearbyPlayersInteractions();
|
||||
|
||||
// If as a result of npcflag updates we stop seeing UNIT_NPC_FLAG_QUESTGIVER then
|
||||
// we must also send SMSG_QUEST_GIVER_STATUS_MULTIPLE because client will not request it automatically
|
||||
if (IsQuestGiver())
|
||||
{
|
||||
var sender = (Player receiver) => receiver.PlayerTalkClass.SendQuestGiverStatus(receiver.GetQuestDialogStatus(this), GetGUID());
|
||||
|
||||
MessageDistDeliverer notifier = new(this, sender, GetVisibilityRange());
|
||||
Cell.VisitWorldObjects(this, notifier, GetVisibilityRange());
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasScalableLevels()
|
||||
{
|
||||
return m_unitData.ContentTuningID != 0;
|
||||
|
||||
Reference in New Issue
Block a user