Core/GameObjects: Fixed the interaction/highlight logic for GAMEOBJECT_TYPE_CHEST and quest objectives
Port From (https://github.com/TrinityCore/TrinityCore/commit/31bd3804e35f63915a5d6d669b31add6c82d7010)
This commit is contained in:
@@ -1367,6 +1367,20 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasConditionalInteraction()
|
||||
{
|
||||
if (GetGoInfo().GetQuestID() != 0)
|
||||
return true;
|
||||
|
||||
if (GetGoType() != GameObjectTypes.AuraGenerator && GetGoInfo().GetConditionID1() != 0)
|
||||
return true;
|
||||
|
||||
if (Global.ObjectMgr.IsGameObjectForQuests(GetEntry()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CanActivateForPlayer(Player target)
|
||||
{
|
||||
if (!MeetsInteractCondition(target))
|
||||
@@ -1427,6 +1441,12 @@ namespace Game.Entities
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case GameObjectTypes.GatheringNode:
|
||||
{
|
||||
if (LootStorage.Gameobject.HaveQuestLootForPlayer(GetGoInfo().GatheringNode.chestLoot, target))
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -114,14 +114,11 @@ namespace Game.Entities
|
||||
{
|
||||
case GameObjectTypes.Button:
|
||||
case GameObjectTypes.Goober:
|
||||
if (gameObject.GetGoInfo().GetQuestID() != 0 || gameObject.GetGoInfo().GetConditionID1() != 0)
|
||||
if (gameObject.HasConditionalInteraction() && gameObject.CanActivateForPlayer(receiver))
|
||||
{
|
||||
if (gameObject.CanActivateForPlayer(receiver))
|
||||
{
|
||||
dynFlags |= GameObjectDynamicLowFlags.Highlight;
|
||||
if (gameObject.GetGoStateFor(receiver.GetGUID()) != GameObjectState.Active)
|
||||
dynFlags |= GameObjectDynamicLowFlags.Activate;
|
||||
}
|
||||
dynFlags |= GameObjectDynamicLowFlags.Highlight;
|
||||
if (gameObject.GetGoStateFor(receiver.GetGUID()) != GameObjectState.Active)
|
||||
dynFlags |= GameObjectDynamicLowFlags.Activate;
|
||||
}
|
||||
break;
|
||||
case GameObjectTypes.QuestGiver:
|
||||
@@ -129,16 +126,15 @@ namespace Game.Entities
|
||||
dynFlags |= GameObjectDynamicLowFlags.Activate;
|
||||
break;
|
||||
case GameObjectTypes.Chest:
|
||||
if (gameObject.CanActivateForPlayer(receiver))
|
||||
if (gameObject.HasConditionalInteraction() && gameObject.CanActivateForPlayer(receiver))
|
||||
dynFlags |= GameObjectDynamicLowFlags.Activate | GameObjectDynamicLowFlags.Sparkle | GameObjectDynamicLowFlags.Highlight;
|
||||
else if (receiver.IsGameMaster())
|
||||
dynFlags |= GameObjectDynamicLowFlags.Activate | GameObjectDynamicLowFlags.Sparkle;
|
||||
break;
|
||||
case GameObjectTypes.Generic:
|
||||
case GameObjectTypes.SpellFocus:
|
||||
if (gameObject.GetGoInfo().GetQuestID() != 0 || gameObject.GetGoInfo().GetConditionID1() != 0)
|
||||
if (gameObject.CanActivateForPlayer(receiver))
|
||||
dynFlags |= GameObjectDynamicLowFlags.Sparkle | GameObjectDynamicLowFlags.Highlight;
|
||||
if (gameObject.HasConditionalInteraction() && gameObject.CanActivateForPlayer(receiver))
|
||||
dynFlags |= GameObjectDynamicLowFlags.Sparkle | GameObjectDynamicLowFlags.Highlight;
|
||||
break;
|
||||
case GameObjectTypes.Transport:
|
||||
case GameObjectTypes.MapObjTransport:
|
||||
@@ -154,7 +150,7 @@ namespace Game.Entities
|
||||
dynFlags &= ~GameObjectDynamicLowFlags.NoInterract;
|
||||
break;
|
||||
case GameObjectTypes.GatheringNode:
|
||||
if (gameObject.GetGoInfo().GetConditionID1() != 0 && gameObject.CanActivateForPlayer(receiver))
|
||||
if (gameObject.HasConditionalInteraction() && gameObject.CanActivateForPlayer(receiver))
|
||||
dynFlags |= GameObjectDynamicLowFlags.Activate | GameObjectDynamicLowFlags.Sparkle | GameObjectDynamicLowFlags.Highlight;
|
||||
if (gameObject.GetGoStateFor(receiver.GetGUID()) == GameObjectState.Active)
|
||||
dynFlags |= GameObjectDynamicLowFlags.Depleted;
|
||||
|
||||
@@ -4698,6 +4698,15 @@ namespace Game
|
||||
++count;
|
||||
}
|
||||
|
||||
foreach (var (questObjectiveId, objective) in _questObjectives)
|
||||
{
|
||||
if (objective.Type != QuestObjectiveType.GameObject)
|
||||
continue;
|
||||
|
||||
_gameObjectForQuestStorage.Add((uint)objective.ObjectID);
|
||||
++count;
|
||||
}
|
||||
|
||||
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} GameObjects for quests in {1} ms", count, Time.GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user