Core/Creatures: Implemented UNIT_NPC_FLAG_GOSSIP as viewer dependent and update npcflags on quest changes
Port From (https://github.com/TrinityCore/TrinityCore/commit/dd15d763cc0529afc9b7f077817645d875608626)
This commit is contained in:
@@ -841,6 +841,8 @@ namespace Game.Entities
|
||||
|
||||
Global.ScriptMgr.OnQuestStatusChange(this, questId);
|
||||
Global.ScriptMgr.OnQuestStatusChange(this, quest, oldStatus, questStatusData.Status);
|
||||
|
||||
UpdateNearbyCreatureNpcFlags();
|
||||
}
|
||||
|
||||
public void CompleteQuest(uint quest_id)
|
||||
@@ -1228,6 +1230,8 @@ namespace Game.Entities
|
||||
if (quest.HasFlag(QuestFlags.UpdatePhaseshift))
|
||||
updateVisibility = PhasingHandler.OnConditionChange(this, false);
|
||||
|
||||
UpdateNearbyCreatureNpcFlags();
|
||||
|
||||
//lets remove flag for delayed teleports
|
||||
SetCanDelayTeleport(false);
|
||||
|
||||
@@ -1258,6 +1262,8 @@ namespace Game.Entities
|
||||
|
||||
if (updateVisibility)
|
||||
UpdateObjectVisibility();
|
||||
|
||||
UpdateNearbyCreatureNpcFlags();
|
||||
}
|
||||
|
||||
public void SetRewardedQuest(uint questId)
|
||||
@@ -1910,6 +1916,8 @@ namespace Game.Entities
|
||||
Global.ScriptMgr.OnQuestStatusChange(this, quest, oldStatus, status);
|
||||
}
|
||||
|
||||
UpdateNearbyCreatureNpcFlags();
|
||||
|
||||
if (update)
|
||||
SendQuestUpdate(questId);
|
||||
}
|
||||
@@ -2184,6 +2192,8 @@ namespace Game.Entities
|
||||
|
||||
if (updateVisibility)
|
||||
UpdateObjectVisibility();
|
||||
|
||||
UpdateNearbyCreatureNpcFlags();
|
||||
}
|
||||
|
||||
public void DespawnPersonalSummonsForQuest(uint questId)
|
||||
@@ -2705,6 +2715,8 @@ namespace Game.Entities
|
||||
if (updatePhaseShift)
|
||||
PhasingHandler.OnConditionChange(this);
|
||||
|
||||
UpdateNearbyCreatureNpcFlags();
|
||||
|
||||
if (updateZoneAuras)
|
||||
{
|
||||
UpdateZoneDependentAuras(GetZoneId());
|
||||
@@ -2753,6 +2765,39 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanSeeGossipOn(Creature creature)
|
||||
{
|
||||
if (creature.HasNpcFlag(NPCFlags.Gossip))
|
||||
{
|
||||
if (GetGossipMenuForSource(creature) != 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
// for cases with questgiver/ender without gossip menus
|
||||
if (creature.HasNpcFlag(NPCFlags.QuestGiver))
|
||||
{
|
||||
QuestRelationResult objectQIR = Global.ObjectMgr.GetCreatureQuestInvolvedRelations(creature.GetEntry());
|
||||
foreach (uint quest_id in objectQIR)
|
||||
{
|
||||
QuestStatus status = GetQuestStatus(quest_id);
|
||||
if (status == QuestStatus.Complete || status == QuestStatus.Incomplete)
|
||||
return true;
|
||||
}
|
||||
|
||||
QuestRelationResult objectQR = Global.ObjectMgr.GetCreatureQuestRelations(creature.GetEntry());
|
||||
foreach (uint quest_id in objectQR)
|
||||
{
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(quest_id);
|
||||
if (quest == null)
|
||||
continue;
|
||||
|
||||
if (CanTakeQuest(quest, false))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QuestObjective GetQuestObjectiveForItem(uint itemId, bool onlyIncomplete)
|
||||
{
|
||||
QuestObjective findObjectiveForItem(int tempItemId)
|
||||
|
||||
Reference in New Issue
Block a user