diff --git a/Source/Game/AI/CoreAI/GameObjectAI.cs b/Source/Game/AI/CoreAI/GameObjectAI.cs index d942a24c8..b4e808fb7 100644 --- a/Source/Game/AI/CoreAI/GameObjectAI.cs +++ b/Source/Game/AI/CoreAI/GameObjectAI.cs @@ -45,7 +45,7 @@ namespace Game.AI /// /// Called when a player opens a gossip dialog with the gameobject. /// - public virtual bool GossipHello(Player player, bool reportUse) { return false; } + public virtual bool GossipHello(Player player) { return false; } /// /// Called when a player selects a gossip item in the gameobject's gossip menu. @@ -71,6 +71,11 @@ namespace Game.AI /// Called when the dialog status between a player and the gameobject is requested. /// public virtual uint GetDialogStatus(Player player) { return 100; } + + // Called when a Player clicks a GameObject, before GossipHello + // prevents achievement tracking if returning true + public virtual bool OnReportUse(Player player) { return false; } + public virtual void Destroyed(Player player, uint eventId) { } public virtual void Damaged(Player player, uint eventId) { } diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs index b9fe3c1a4..340f53862 100644 --- a/Source/Game/AI/SmartScripts/SmartAI.cs +++ b/Source/Game/AI/SmartScripts/SmartAI.cs @@ -1069,10 +1069,17 @@ namespace Game.AI GetScript().OnReset(); } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { _gossipReturn = false; - GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, reportUse ? 1 : 0u, 0, false, null, me); + GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, 0, 0, false, null, me); + return _gossipReturn; + } + + public override bool OnReportUse(Player player) + { + _gossipReturn = false; + GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, 1, 0, false, null, me); return _gossipReturn; } diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs index ba883a00e..2796c43f9 100644 --- a/Source/Game/AI/SmartScripts/SmartScript.cs +++ b/Source/Game/AI/SmartScripts/SmartScript.cs @@ -2228,9 +2228,8 @@ namespace Game.AI // We may want to execute action rarely and because of this if condition is not fulfilled the action will be rechecked in a long time if (Global.ConditionMgr.IsObjectMeetingSmartEventConditions(e.entryOrGuid, e.event_id, e.source_type, unit, GetBaseObject())) { - ProcessAction(e, unit, var0, var1, bvar, spell, gob, varString); - RecalcTimer(e, min, max); + ProcessAction(e, unit, var0, var1, bvar, spell, gob, varString); } else RecalcTimer(e, Math.Min(min, 5000), Math.Min(min, 5000)); diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs index 297fd4f86..c690f6f7a 100644 --- a/Source/Game/Entities/GameObject/GameObject.cs +++ b/Source/Game/Entities/GameObject/GameObject.cs @@ -1306,7 +1306,7 @@ namespace Game.Entities if (playerUser != null) { playerUser.PlayerTalkClass.ClearMenus(); - if (GetAI().GossipHello(playerUser, false)) + if (GetAI().GossipHello(playerUser)) return; } diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index 99fa82032..b9d7feee9 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -259,7 +259,7 @@ namespace Game GameObject go = GetPlayer().GetGameObjectIfCanInteractWith(packet.Guid); if (go) { - if (go.GetAI().GossipHello(GetPlayer(), true)) + if (go.GetAI().GossipHello(GetPlayer())) return; GetPlayer().UpdateCriteria(CriteriaTypes.UseGameobject, go.GetEntry()); diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 1454898c3..a4d3dc642 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1322,7 +1322,7 @@ namespace Game.Spells } player.PlayerTalkClass.ClearMenus(); - if (gameObjTarget.GetAI().GossipHello(player, false)) + if (gameObjTarget.GetAI().GossipHello(player)) return; switch (gameObjTarget.GetGoType()) diff --git a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs index 069463f5d..afec798fa 100644 --- a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs +++ b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs @@ -353,7 +353,7 @@ namespace Scripts.EasternKingdoms { public go_acherus_soul_prisonAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { Creature anchor = me.FindNearestCreature(29521, 15); if (anchor) diff --git a/Source/Scripts/Kalimdor/ZoneAshenvale.cs b/Source/Scripts/Kalimdor/ZoneAshenvale.cs index f8a9b6d5d..bcd58d65a 100644 --- a/Source/Scripts/Kalimdor/ZoneAshenvale.cs +++ b/Source/Scripts/Kalimdor/ZoneAshenvale.cs @@ -323,7 +323,7 @@ namespace Scripts.Kalimdor.ZoneAshenvale { public go_naga_brazierAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { Creature creature = ScriptedAI.GetClosestCreatureWithEntry(me, CreatureIds.Muglash, SharedConst.InteractionDistance * 2); if (creature) diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs index dd8cd46c7..2cdf567b7 100644 --- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs +++ b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs @@ -371,7 +371,7 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.PrinceTaldaram instance = go.GetInstanceScript(); } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { Creature PrinceTaldaram = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.PrinceTaldaram)); if (PrinceTaldaram && PrinceTaldaram.IsAlive()) diff --git a/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs b/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs index 476ec2c19..9d32fd479 100644 --- a/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs +++ b/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs @@ -429,7 +429,7 @@ namespace Scripts.Northrend.Gundrak instance = go.GetInstanceScript(); } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.AddFlag(GameObjectFlags.NotSelectable); me.SetGoState(GameObjectState.Active); diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs index b894da772..c28a8e6f1 100644 --- a/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs +++ b/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs @@ -201,7 +201,7 @@ namespace Scripts.Northrend.Nexus.Nexus instance = go.GetInstanceScript(); } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { Creature pKeristrasza = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Keristrasza)); if (pKeristrasza && pKeristrasza.IsAlive()) diff --git a/Source/Scripts/Northrend/Ulduar/Mimiron.cs b/Source/Scripts/Northrend/Ulduar/Mimiron.cs index cefb656ff..61982e07e 100644 --- a/Source/Scripts/Northrend/Ulduar/Mimiron.cs +++ b/Source/Scripts/Northrend/Ulduar/Mimiron.cs @@ -1602,7 +1602,7 @@ namespace Scripts.Northrend.Ulduar instance = go.GetInstanceScript(); } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.HasFlag(GameObjectFlags.NotSelectable)) return true; diff --git a/Source/Scripts/World/GameObjects.cs b/Source/Scripts/World/GameObjects.cs index a36630797..b2bf1e89b 100644 --- a/Source/Scripts/World/GameObjects.cs +++ b/Source/Scripts/World/GameObjects.cs @@ -260,7 +260,7 @@ namespace Scripts.World { public go_cat_figurineAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { player.CastSpell(player, GameobjectConst.SpellSummonGhostSaber, true); return false; @@ -282,7 +282,7 @@ namespace Scripts.World { public go_barov_journalAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.HasSkill(SkillType.Tailoring) && player.GetBaseSkillValue(SkillType.Tailoring) >= 280 && !player.HasSpell(26086)) player.CastSpell(player, 26095, false); @@ -306,7 +306,7 @@ namespace Scripts.World { public go_gilded_brazierAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() == GameObjectTypes.Goober) { @@ -336,7 +336,7 @@ namespace Scripts.World { public go_orb_of_commandAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.GetQuestRewardStatus(7761)) player.CastSpell(player, 23460, true); @@ -360,7 +360,7 @@ namespace Scripts.World { public go_tablet_of_madnessAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.HasSkill(SkillType.Alchemy) && player.GetSkillValue(SkillType.Alchemy) >= 300 && !player.HasSpell(24266)) player.CastSpell(player, 24267, false); @@ -385,7 +385,7 @@ namespace Scripts.World public go_tablet_of_the_sevenAI(GameObject go) : base(go) { } // @todo use gossip option ("Transcript the Tablet") instead, if Trinity adds support. - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() != GameObjectTypes.QuestGiver) return true; @@ -412,7 +412,7 @@ namespace Scripts.World { public go_jump_a_tronAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.GetQuestStatus(10111) == QuestStatus.Incomplete) player.CastSpell(player, 33382, true); @@ -436,7 +436,7 @@ namespace Scripts.World { public go_ethereum_prisonAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); int Random = (int)(RandomHelper.Rand32() % (GameobjectConst.NpcPrisonEntry.Length / sizeof(uint))); @@ -487,7 +487,7 @@ namespace Scripts.World { public go_ethereum_stasisAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); int Random = (int)(RandomHelper.Rand32() % GameobjectConst.NpcStasisEntry.Length / sizeof(uint)); @@ -513,7 +513,7 @@ namespace Scripts.World { public go_resonite_caskAI(GameObject go) : base(go) { } - public override bool GossipHello(Player Player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() == GameObjectTypes.Goober) me.SummonCreature(GameobjectConst.NpcGoggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 300000); @@ -537,7 +537,7 @@ namespace Scripts.World { public go_sacred_fire_of_lifeAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() == GameObjectTypes.Goober) player.SummonCreature(GameobjectConst.NpcArikara, -5008.338f, -2118.894f, 83.657f, 0.874f, TempSummonType.TimedDespawnOOC, 30000); @@ -561,7 +561,7 @@ namespace Scripts.World { public go_shrine_of_the_birdsAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { uint BirdEntry = 0; @@ -603,7 +603,7 @@ namespace Scripts.World { public go_southfury_moonstoneAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { //implicitTarget=48 not implemented as of writing this code, and manual summon may be just ok for our purpose //player.CastSpell(player, SPELL_SUMMON_RIZZLE, false); @@ -631,7 +631,7 @@ namespace Scripts.World { public go_tele_to_dalaran_crystalAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.GetQuestRewardStatus(GameobjectConst.QuestTeleCrystalFlag)) return false; @@ -657,7 +657,7 @@ namespace Scripts.World { public go_tele_to_violet_standAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.GetQuestRewardStatus(GameobjectConst.QuestLearnLeaveReturn) || player.GetQuestStatus(GameobjectConst.QuestLearnLeaveReturn) == QuestStatus.Incomplete) return false; @@ -681,7 +681,7 @@ namespace Scripts.World { public go_fel_crystalforgeAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ player.PrepareQuestMenu(me.GetGUID()); /* return true*/ @@ -735,7 +735,7 @@ namespace Scripts.World { public go_bashir_crystalforgeAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */ player.PrepareQuestMenu(me.GetGUID()); /* return true*/ @@ -789,7 +789,7 @@ namespace Scripts.World { public go_matrix_punchographAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { switch (me.GetEntry()) { @@ -843,7 +843,7 @@ namespace Scripts.World { public go_scourge_cageAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); Creature pNearestPrisoner = me.FindNearestCreature(GameobjectConst.NpcScourgePrisoner, 5.0f, true); @@ -872,7 +872,7 @@ namespace Scripts.World { public go_arcane_prisonAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.GetQuestStatus(GameobjectConst.QuestPrisonBreak) == QuestStatus.Incomplete) { @@ -899,7 +899,7 @@ namespace Scripts.World { public go_blood_filled_orbAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (me.GetGoType() == GameObjectTypes.Goober) player.SummonCreature(GameobjectConst.NpcZelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOOC, 30000); @@ -923,7 +923,7 @@ namespace Scripts.World { public go_jotunheim_cageAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerHuman, 5.0f, true); @@ -976,7 +976,7 @@ namespace Scripts.World { public go_table_thekaAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.GetQuestStatus(GameobjectConst.QuestSpiderGold) == QuestStatus.Incomplete) player.AreaExploredOrEventHappens(GameobjectConst.QuestSpiderGold); @@ -1002,7 +1002,7 @@ namespace Scripts.World { public go_inconspicuous_landmarkAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { if (player.HasItemCount(GameobjectConst.ItemCuergosKey)) return false; @@ -1028,11 +1028,8 @@ namespace Scripts.World { public go_soulwellAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { - if (!reportUse) - return true; - Unit owner = me.GetOwner(); if (!owner || !owner.IsTypeId(TypeId.Player) || !player.IsInSameRaidWith(owner.ToPlayer())) return true; @@ -1050,7 +1047,7 @@ namespace Scripts.World { public go_dragonflayer_cageAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); if (player.GetQuestStatus(GameobjectConst.QuestPrisonersOfWyrmskull) != QuestStatus.Incomplete) @@ -1093,7 +1090,7 @@ namespace Scripts.World { public go_tadpole_cageAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); if (player.GetQuestStatus(GameobjectConst.QuestOhNoesTheTadpoles) == QuestStatus.Incomplete) @@ -1125,7 +1122,7 @@ namespace Scripts.World { public go_amberpine_outhouseAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { QuestStatus status = player.GetQuestStatus(GameobjectConst.QuestDoingYourDuty); if (status == QuestStatus.Incomplete || status == QuestStatus.Complete || status == QuestStatus.Rewarded) @@ -1181,7 +1178,7 @@ namespace Scripts.World { public go_hive_podAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { player.SendLoot(me.GetGUID(), LootType.Corpse); me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX() + 1, me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000); @@ -1205,7 +1202,7 @@ namespace Scripts.World { public go_massive_seaforium_chargeAI(GameObject go) : base(go) { } - public override bool GossipHello(Player Player, bool reportUse) + public override bool GossipHello(Player player) { me.SetLootState(LootState.JustDeactivated); return true; @@ -1227,7 +1224,7 @@ namespace Scripts.World { public go_veil_skith_cageAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(); if (player.GetQuestStatus(GameobjectConst.QuestMissingFriends) == QuestStatus.Incomplete) @@ -1262,7 +1259,7 @@ namespace Scripts.World { public go_frostblade_shrineAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { me.UseDoorOrButton(10); if (!player.HasAura(GameobjectConst.SpellRecentMeditation)) @@ -1313,7 +1310,7 @@ namespace Scripts.World { public go_midsummer_ribbon_poleAI(GameObject go) : base(go) { } - public override bool GossipHello(Player player, bool reportUse) + public override bool GossipHello(Player player) { Creature creature = me.FindNearestCreature(GameobjectConst.NpcPoleRibbonBunny, 10.0f); if (creature)