diff --git a/Source/Framework/Constants/SmartAIConst.cs b/Source/Framework/Constants/SmartAIConst.cs
index 6c9b9e669..56bf62e5c 100644
--- a/Source/Framework/Constants/SmartAIConst.cs
+++ b/Source/Framework/Constants/SmartAIConst.cs
@@ -208,7 +208,7 @@ namespace Framework.Constants
IsBehindTarget = 67, // Cooldownmin, Cooldownmax
GameEventStart = 68, // GameEvent.Entry
GameEventEnd = 69, // GameEvent.Entry
- GoStateChanged = 70, // Go State
+ GoLootStateChanged = 70, // Go State
GoEventInform = 71, // Eventid
ActionDone = 72, // Eventid (Shareddefines.Eventid)
OnSpellclick = 73, // Clicker (Unit)
diff --git a/Source/Game/AI/CoreAI/GameObjectAI.cs b/Source/Game/AI/CoreAI/GameObjectAI.cs
index 1bb05af9e..d942a24c8 100644
--- a/Source/Game/AI/CoreAI/GameObjectAI.cs
+++ b/Source/Game/AI/CoreAI/GameObjectAI.cs
@@ -18,14 +18,15 @@
using Framework.Dynamic;
using Game.Entities;
using Game.Spells;
+using Framework.Constants;
namespace Game.AI
{
public class GameObjectAI
{
- public GameObjectAI(GameObject g)
+ public GameObjectAI(GameObject gameObject)
{
- go = g;
+ me = gameObject;
_scheduler = new TaskScheduler();
_events = new EventMap();
}
@@ -41,27 +42,53 @@ namespace Game.AI
public virtual void SetGUID(ulong guid, int id = 0) { }
public virtual ulong GetGUID(int id = 0) { return 0; }
+ ///
+ /// Called when a player opens a gossip dialog with the gameobject.
+ ///
public virtual bool GossipHello(Player player, bool reportUse) { return false; }
- public virtual bool GossipSelect(Player player, uint sender, uint action) { return false; }
+
+ ///
+ /// Called when a player selects a gossip item in the gameobject's gossip menu.
+ ///
+ public virtual bool GossipSelect(Player player, uint menuId, uint gossipListId) { return false; }
+
+ ///
+ /// Called when a player selects a gossip with a code in the gameobject's gossip menu.
+ ///
public virtual bool GossipSelectCode(Player player, uint sender, uint action, string code) { return false; }
- public virtual bool QuestAccept(Player player, Quest quest) { return false; }
- public virtual bool QuestReward(Player player, Quest quest, uint opt) { return false; }
+
+ ///
+ /// Called when a player accepts a quest from the gameobject.
+ ///
+ public virtual void QuestAccept(Player player, Quest quest) { }
+
+ ///
+ /// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
+ ///
+ public virtual void QuestReward(Player player, Quest quest, uint opt) { }
+
+ ///
+ /// Called when the dialog status between a player and the gameobject is requested.
+ ///
public virtual uint GetDialogStatus(Player player) { return 100; }
public virtual void Destroyed(Player player, uint eventId) { }
+ public virtual void Damaged(Player player, uint eventId) { }
+
public virtual void SetData64(uint id, ulong value) { }
public virtual ulong GetData64(uint id) { return 0; }
public virtual uint GetData(uint id) { return 0; }
public virtual void SetData(uint id, uint value) { }
public virtual void OnGameEvent(bool start, ushort eventId) { }
- public virtual void OnStateChanged(uint state, Unit unit) { }
+ public virtual void OnLootStateChanged(uint state, Unit unit) { }
+ public virtual void OnStateChanged(GameObjectState state) { }
public virtual void EventInform(uint eventId) { }
public virtual void SpellHit(Unit unit, SpellInfo spellInfo) { }
protected TaskScheduler _scheduler;
protected EventMap _events;
- public GameObject go;
+ public GameObject me;
}
public class NullGameObjectAI : GameObjectAI
diff --git a/Source/Game/AI/CoreAI/UnitAI.cs b/Source/Game/AI/CoreAI/UnitAI.cs
index 21abc644f..61efe9037 100644
--- a/Source/Game/AI/CoreAI/UnitAI.cs
+++ b/Source/Game/AI/CoreAI/UnitAI.cs
@@ -378,15 +378,39 @@ namespace Game.AI
public virtual void HealDone(Unit to, uint addhealth) { }
public virtual void SpellInterrupted(uint spellId, uint unTimeMs) {}
- public virtual void GossipHello(Player player) { }
- public virtual void GossipSelect(Player player, uint menuId, uint gossipListId) { }
- public virtual void GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
+ ///
+ /// Called when a player opens a gossip dialog with the creature.
+ ///
+ public virtual bool GossipHello(Player player) { return false; }
+
+ ///
+ /// Called when a player selects a gossip item in the creature's gossip menu.
+ ///
+ public virtual bool GossipSelect(Player player, uint menuId, uint gossipListId) { return false; }
+
+ ///
+ /// Called when a player selects a gossip with a code in the creature's gossip menu.
+ ///
+ public virtual bool GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { return false; }
+
+ ///
+ /// Called when a player accepts a quest from the creature.
+ ///
public virtual void QuestAccept(Player player, Quest quest) { }
- public virtual void QuestSelect(Player player, Quest quest) { }
- public virtual void QuestComplete(Player player, Quest quest) { }
+
+ ///
+ /// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
+ ///
public virtual void QuestReward(Player player, Quest quest, uint opt) { }
+
+ ///
+ /// Called when a game event starts or ends
+ ///
public virtual void OnGameEvent(bool start, ushort eventId) { }
+ // Called when the dialog status between a player and the creature is requested.
+ public virtual QuestGiverStatus GetDialogStatus(Player player) { return QuestGiverStatus.ScriptedNoStatus; }
+
public static AISpellInfoType[] AISpellInfo;
protected Unit me { get; private set; }
diff --git a/Source/Game/AI/SmartScripts/SmartAI.cs b/Source/Game/AI/SmartScripts/SmartAI.cs
index bf317294a..637a798d9 100644
--- a/Source/Game/AI/SmartScripts/SmartAI.cs
+++ b/Source/Game/AI/SmartScripts/SmartAI.cs
@@ -789,17 +789,22 @@ namespace Game.AI
mEvadeDisabled = disable;
}
- public override void GossipHello(Player player)
+ public override bool GossipHello(Player player)
{
GetScript().ProcessEventsFor(SmartEvents.GossipHello, player);
+ return false;
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
GetScript().ProcessEventsFor(SmartEvents.GossipSelect, player, menuId, gossipListId);
+ return false;
}
- public override void GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { }
+ public override bool GossipSelectCode(Player player, uint menuId, uint gossipListId, string code)
+ {
+ return false;
+ }
public override void QuestAccept(Player player, Quest quest)
{
@@ -811,6 +816,11 @@ namespace Game.AI
GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt);
}
+ public override void OnGameEvent(bool start, ushort eventId)
+ {
+ GetScript().ProcessEventsFor(start ? SmartEvents.GameEventStart : SmartEvents.GameEventEnd, null, eventId);
+ }
+
public void SetCombatMove(bool on)
{
if (mCanCombatMove == on)
@@ -899,11 +909,6 @@ namespace Game.AI
GetScript().SetScript9(e, entry);
}
- public override void OnGameEvent(bool start, ushort eventId)
- {
- GetScript().ProcessEventsFor(start ? SmartEvents.GameEventStart : SmartEvents.GameEventEnd, null, eventId);
- }
-
public override void OnSpellClick(Unit clicker, ref bool result)
{
if (!result)
@@ -1043,9 +1048,9 @@ namespace Game.AI
public override void InitializeAI()
{
- GetScript().OnInitialize(go);
+ GetScript().OnInitialize(me);
// do not call respawn event if go is not spawned
- if (go.IsSpawned())
+ if (me.IsSpawned())
GetScript().ProcessEventsFor(SmartEvents.Respawn);
}
@@ -1060,31 +1065,29 @@ namespace Game.AI
public override bool GossipHello(Player player, bool reportUse)
{
Log.outDebug(LogFilter.ScriptsAi, "SmartGameObjectAI.GossipHello");
- GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, reportUse ? 1 : 0u, 0, false, null, go);
+ GetScript().ProcessEventsFor(SmartEvents.GossipHello, player, reportUse ? 1 : 0u, 0, false, null, me);
return false;
}
- public override bool GossipSelect(Player player, uint sender, uint action)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
- GetScript().ProcessEventsFor(SmartEvents.GossipSelect, player, sender, action, false, null, go);
+ GetScript().ProcessEventsFor(SmartEvents.GossipSelect, player, menuId, gossipListId, false, null, me);
return false;
}
- public override bool GossipSelectCode(Player player, uint sender, uint action, string code)
+ public override bool GossipSelectCode(Player player, uint menuId, uint gossipListId, string code)
{
return false;
}
- public override bool QuestAccept(Player player, Quest quest)
+ public override void QuestAccept(Player player, Quest quest)
{
- GetScript().ProcessEventsFor(SmartEvents.AcceptedQuest, player, quest.Id, 0, false, null, go);
- return false;
+ GetScript().ProcessEventsFor(SmartEvents.AcceptedQuest, player, quest.Id, 0, false, null, me);
}
- public override bool QuestReward(Player player, Quest quest, uint opt)
+ public override void QuestReward(Player player, Quest quest, uint opt)
{
- GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt, false, null, go);
- return false;
+ GetScript().ProcessEventsFor(SmartEvents.RewardQuest, player, quest.Id, opt, false, null, me);
}
public override uint GetDialogStatus(Player player)
@@ -1094,7 +1097,7 @@ namespace Game.AI
public override void Destroyed(Player player, uint eventId)
{
- GetScript().ProcessEventsFor(SmartEvents.Death, player, eventId, 0, false, null, go);
+ GetScript().ProcessEventsFor(SmartEvents.Death, player, eventId, 0, false, null, me);
}
public override void SetData(uint id, uint value)
@@ -1114,9 +1117,9 @@ namespace Game.AI
GetScript().ProcessEventsFor(start ? SmartEvents.GameEventStart : SmartEvents.GameEventEnd, null, eventId);
}
- public override void OnStateChanged(uint state, Unit unit)
+ public override void OnLootStateChanged(uint state, Unit unit)
{
- GetScript().ProcessEventsFor(SmartEvents.GoStateChanged, unit, state);
+ GetScript().ProcessEventsFor(SmartEvents.GoLootStateChanged, unit, state);
}
public override void EventInform(uint eventId)
diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs
index c761e47ef..f2936c1dc 100644
--- a/Source/Game/AI/SmartScripts/SmartAIManager.cs
+++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs
@@ -757,7 +757,7 @@ namespace Game.AI
}
break;
case SmartEvents.Link:
- case SmartEvents.GoStateChanged:
+ case SmartEvents.GoLootStateChanged:
case SmartEvents.GoEventInform:
case SmartEvents.TimedEventTriggered:
case SmartEvents.InstancePlayerEnter:
@@ -1638,7 +1638,7 @@ namespace Game.AI
{ SmartEvents.IsBehindTarget, SmartScriptTypeMaskId.Creature },
{ SmartEvents.GameEventStart, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
{ SmartEvents.GameEventEnd, SmartScriptTypeMaskId.Creature + SmartScriptTypeMaskId.Gameobject },
- { SmartEvents.GoStateChanged, SmartScriptTypeMaskId.Gameobject },
+ { SmartEvents.GoLootStateChanged, SmartScriptTypeMaskId.Gameobject },
{ SmartEvents.GoEventInform, SmartScriptTypeMaskId.Gameobject },
{ SmartEvents.ActionDone, SmartScriptTypeMaskId.Creature },
{ SmartEvents.OnSpellclick, SmartScriptTypeMaskId.Creature },
@@ -1813,7 +1813,7 @@ namespace Game.AI
public GameEvent gameEvent;
[FieldOffset(16)]
- public GoStateChanged goStateChanged;
+ public GoLootStateChanged goLootStateChanged;
[FieldOffset(16)]
public EventInform eventInform;
@@ -2009,9 +2009,9 @@ namespace Game.AI
{
public uint gameEventId;
}
- public struct GoStateChanged
+ public struct GoLootStateChanged
{
- public uint state;
+ public uint lootState;
}
public struct EventInform
{
diff --git a/Source/Game/AI/SmartScripts/SmartScript.cs b/Source/Game/AI/SmartScripts/SmartScript.cs
index def1a81e5..8857d3686 100644
--- a/Source/Game/AI/SmartScripts/SmartScript.cs
+++ b/Source/Game/AI/SmartScripts/SmartScript.cs
@@ -2736,16 +2736,16 @@ namespace Game.AI
if (go == null)
return;
//store hostage as id1
- AddEvent(SmartEvents.GoStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.StoreTargetList, 1, 0, 0, 0, 0, 0, SmartTargets.ClosestCreature, e.Action.installTtemplate.param1, 10, 0, 0);
+ AddEvent(SmartEvents.GoLootStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.StoreTargetList, 1, 0, 0, 0, 0, 0, SmartTargets.ClosestCreature, e.Action.installTtemplate.param1, 10, 0, 0);
//store invoker as id2
- AddEvent(SmartEvents.GoStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.StoreTargetList, 2, 0, 0, 0, 0, 0, SmartTargets.None, 0, 0, 0, 0);
+ AddEvent(SmartEvents.GoLootStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.StoreTargetList, 2, 0, 0, 0, 0, 0, SmartTargets.None, 0, 0, 0, 0);
//signal hostage
- AddEvent(SmartEvents.GoStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.SetData, 0, 0, 0, 0, 0, 0, SmartTargets.Stored, 1, 0, 0, 0);
+ AddEvent(SmartEvents.GoLootStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.SetData, 0, 0, 0, 0, 0, 0, SmartTargets.Stored, 1, 0, 0, 0);
//when hostage raeched end point, give credit to invoker
if (e.Action.installTtemplate.param2 != 0)
AddEvent(SmartEvents.DataSet, 0, 0, 0, 0, 0, 0, SmartActions.CallKilledmonster, e.Action.installTtemplate.param1, 0, 0, 0, 0, 0, SmartTargets.Stored, 2, 0, 0, 0);
else
- AddEvent(SmartEvents.GoStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.CallKilledmonster, e.Action.installTtemplate.param1, 0, 0, 0, 0, 0, SmartTargets.Stored, 2, 0, 0, 0);
+ AddEvent(SmartEvents.GoLootStateChanged, 0, 2, 0, 0, 0, 0, SmartActions.CallKilledmonster, e.Action.installTtemplate.param1, 0, 0, 0, 0, 0, SmartTargets.Stored, 2, 0, 0, 0);
break;
}
default:
@@ -3632,9 +3632,9 @@ namespace Game.AI
ProcessAction(e, null, var0);
break;
}
- case SmartEvents.GoStateChanged:
+ case SmartEvents.GoLootStateChanged:
{
- if (e.Event.goStateChanged.state != var0)
+ if (e.Event.goLootStateChanged.lootState != var0)
return;
ProcessAction(e, unit, var0, var1);
break;
diff --git a/Source/Game/Entities/Creature/Creature.cs b/Source/Game/Entities/Creature/Creature.cs
index b376ee834..082e397ee 100644
--- a/Source/Game/Entities/Creature/Creature.cs
+++ b/Source/Game/Entities/Creature/Creature.cs
@@ -559,8 +559,6 @@ namespace Game.Entities
}
break;
}
- Global.ScriptMgr.OnCreatureUpdate(this, diff);
-
}
public void Regenerate(PowerType power)
diff --git a/Source/Game/Entities/GameObject/GameObject.cs b/Source/Game/Entities/GameObject/GameObject.cs
index db7d962c9..b5aef8d75 100644
--- a/Source/Game/Entities/GameObject/GameObject.cs
+++ b/Source/Game/Entities/GameObject/GameObject.cs
@@ -802,7 +802,6 @@ namespace Game.Entities
break;
}
}
- Global.ScriptMgr.OnGameObjectUpdate(this, diff);
}
public void Refresh()
@@ -1306,9 +1305,7 @@ namespace Game.Entities
Player playerUser = user.ToPlayer();
if (playerUser != null)
{
- if (Global.ScriptMgr.OnGossipHello(playerUser, this))
- return;
-
+ playerUser.PlayerTalkClass.ClearMenus();
if (GetAI().GossipHello(playerUser, false))
return;
}
@@ -2207,7 +2204,7 @@ namespace Game.Entities
case GameObjectDestructibleState.Damaged:
{
EventInform(m_goInfo.DestructibleBuilding.DamagedEvent, eventInvoker);
- Global.ScriptMgr.OnGameObjectDamaged(this, eventInvoker);
+ GetAI().Damaged(eventInvoker, m_goInfo.DestructibleBuilding.DamagedEvent);
RemoveFlag(GameObjectFlags.Destroyed);
AddFlag(GameObjectFlags.Damaged);
@@ -2232,8 +2229,8 @@ namespace Game.Entities
}
case GameObjectDestructibleState.Destroyed:
{
- Global.ScriptMgr.OnGameObjectDestroyed(this, eventInvoker);
EventInform(m_goInfo.DestructibleBuilding.DestroyedEvent, eventInvoker);
+ GetAI().Destroyed(eventInvoker, m_goInfo.DestructibleBuilding.DestroyedEvent);
if (eventInvoker != null)
{
Battleground bg = eventInvoker.GetBattleground();
@@ -2287,8 +2284,7 @@ namespace Game.Entities
{
m_lootState = state;
m_lootStateUnitGUID = unit ? unit.GetGUID() : ObjectGuid.Empty;
- GetAI().OnStateChanged((uint)state, unit);
- Global.ScriptMgr.OnGameObjectLootStateChanged(this, (uint)state, unit);
+ GetAI().OnLootStateChanged((uint)state, unit);
// only set collision for doors on SetGoState
if (GetGoType() == GameObjectTypes.Door)
@@ -2308,7 +2304,8 @@ namespace Game.Entities
public void SetGoState(GameObjectState state)
{
SetUpdateFieldValue(m_values.ModifyValue(m_gameObjectData).ModifyValue(m_gameObjectData.State), (sbyte)state);
- Global.ScriptMgr.OnGameObjectStateChanged(this, state);
+ if (GetAI() != null)
+ GetAI().OnStateChanged(state);
if (m_model != null && !IsTransport())
{
if (!IsInWorld)
diff --git a/Source/Game/Entities/Player/Player.Quest.cs b/Source/Game/Entities/Player/Player.Quest.cs
index 506694be6..7c75fad03 100644
--- a/Source/Game/Entities/Player/Player.Quest.cs
+++ b/Source/Game/Entities/Player/Player.Quest.cs
@@ -578,7 +578,7 @@ namespace Game.Entities
switch (questGiver.GetTypeId())
{
case TypeId.Unit:
- Global.ScriptMgr.OnQuestAccept(this, (questGiver.ToCreature()), quest);
+ PlayerTalkClass.ClearMenus();
questGiver.ToCreature().GetAI().QuestAccept(this, quest);
break;
case TypeId.Item:
@@ -606,7 +606,7 @@ namespace Game.Entities
break;
}
case TypeId.GameObject:
- Global.ScriptMgr.OnQuestAccept(this, questGiver.ToGameObject(), quest);
+ PlayerTalkClass.ClearMenus();
questGiver.ToGameObject().GetAI().QuestAccept(this, quest);
break;
default:
@@ -1817,11 +1817,12 @@ namespace Game.Entities
List qr;
List qir;
+ PlayerTalkClass.ClearMenus();
switch (questgiver.GetTypeId())
{
case TypeId.GameObject:
{
- QuestGiverStatus questStatus = (QuestGiverStatus)Global.ScriptMgr.GetDialogStatus(this, questgiver.ToGameObject());
+ QuestGiverStatus questStatus = (QuestGiverStatus)questgiver.ToGameObject().GetAI().GetDialogStatus(this);
if (questStatus != QuestGiverStatus.ScriptedNoStatus)
return questStatus;
qr = Global.ObjectMgr.GetGOQuestRelationBounds(questgiver.GetEntry());
@@ -1830,7 +1831,7 @@ namespace Game.Entities
}
case TypeId.Unit:
{
- QuestGiverStatus questStatus = (QuestGiverStatus)Global.ScriptMgr.GetDialogStatus(this, questgiver.ToCreature());
+ QuestGiverStatus questStatus = (QuestGiverStatus)questgiver.ToCreature().GetAI().GetDialogStatus(this);
if (questStatus != QuestGiverStatus.ScriptedNoStatus)
return questStatus;
qr = Global.ObjectMgr.GetCreatureQuestRelationBounds(questgiver.GetEntry());
diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs
index 7e59efc48..3dbce4576 100644
--- a/Source/Game/Handlers/NPCHandler.cs
+++ b/Source/Game/Handlers/NPCHandler.cs
@@ -159,12 +159,12 @@ namespace Game
}
}
- if (!Global.ScriptMgr.OnGossipHello(GetPlayer(), unit))
+ _player.PlayerTalkClass.ClearMenus();
+ if (!unit.GetAI().GossipHello(_player))
{
GetPlayer().PrepareGossipMenu(unit, unit.GetCreatureTemplate().GossipMenuId, true);
GetPlayer().SendPreparedGossip(unit);
}
- unit.GetAI().GossipHello(GetPlayer());
}
[WorldPacketHandler(ClientOpcodes.GossipSelectOption)]
@@ -220,30 +220,27 @@ namespace Game
}
if (!string.IsNullOrEmpty(packet.PromotionCode))
{
- if (unit)
+ if (unit != null)
{
- unit.GetAI().GossipSelectCode(GetPlayer(), packet.GossipID, packet.GossipIndex, packet.PromotionCode);
- if (!Global.ScriptMgr.OnGossipSelectCode(GetPlayer(), unit, GetPlayer().PlayerTalkClass.GetGossipOptionSender(packet.GossipIndex), GetPlayer().PlayerTalkClass.GetGossipOptionAction(packet.GossipIndex), packet.PromotionCode))
+ if (!unit.GetAI().GossipSelectCode(_player, packet.GossipID, packet.GossipIndex, packet.PromotionCode))
GetPlayer().OnGossipSelect(unit, packet.GossipIndex, packet.GossipID);
}
else
{
- go.GetAI().GossipSelectCode(GetPlayer(), packet.GossipID, packet.GossipIndex, packet.PromotionCode);
- Global.ScriptMgr.OnGossipSelectCode(GetPlayer(), go, GetPlayer().PlayerTalkClass.GetGossipOptionSender(packet.GossipIndex), GetPlayer().PlayerTalkClass.GetGossipOptionAction(packet.GossipIndex), packet.PromotionCode);
+ if (!go.GetAI().GossipSelectCode(_player, packet.GossipID, packet.GossipIndex, packet.PromotionCode))
+ _player.OnGossipSelect(go, packet.GossipIndex, packet.GossipID);
}
}
else
{
if (unit != null)
{
- unit.GetAI().GossipSelect(GetPlayer(), packet.GossipID, packet.GossipIndex);
- if (!Global.ScriptMgr.OnGossipSelect(GetPlayer(), unit, GetPlayer().PlayerTalkClass.GetGossipOptionSender(packet.GossipIndex), GetPlayer().PlayerTalkClass.GetGossipOptionAction(packet.GossipIndex)))
+ if (!unit.GetAI().GossipSelect(_player, packet.GossipID, packet.GossipIndex))
GetPlayer().OnGossipSelect(unit, packet.GossipIndex, packet.GossipID);
}
else
{
- go.GetAI().GossipSelect(GetPlayer(), packet.GossipID, packet.GossipIndex);
- if (!Global.ScriptMgr.OnGossipSelect(GetPlayer(), go, GetPlayer().PlayerTalkClass.GetGossipOptionSender(packet.GossipIndex), GetPlayer().PlayerTalkClass.GetGossipOptionAction(packet.GossipIndex)))
+ if (!go.GetAI().GossipSelect(_player, packet.GossipID, packet.GossipIndex))
GetPlayer().OnGossipSelect(go, packet.GossipIndex, packet.GossipID);
}
}
diff --git a/Source/Game/Handlers/QuestHandler.cs b/Source/Game/Handlers/QuestHandler.cs
index 49d1cc73c..84ae1c6b1 100644
--- a/Source/Game/Handlers/QuestHandler.cs
+++ b/Source/Game/Handlers/QuestHandler.cs
@@ -74,13 +74,12 @@ namespace Game
// Stop the npc if moving
creature.StopMoving();
- if (Global.ScriptMgr.OnGossipHello(GetPlayer(), creature))
+ _player.PlayerTalkClass.ClearMenus();
+ if (creature.GetAI().GossipHello(_player))
return;
GetPlayer().PrepareGossipMenu(creature, creature.GetCreatureTemplate().GossipMenuId, true);
GetPlayer().SendPreparedGossip(creature);
-
- creature.GetAI().GossipHello(GetPlayer());
}
[WorldPacketHandler(ClientOpcodes.QuestGiverAcceptQuest)]
@@ -348,8 +347,8 @@ namespace Game
}
}
- if (creatureQGiver && !Global.ScriptMgr.OnQuestReward(_player, creatureQGiver, quest, packet.ItemChoiceID))
- creatureQGiver.GetAI().QuestReward(_player, quest, packet.ItemChoiceID);
+ _player.PlayerTalkClass.ClearMenus();
+ creatureQGiver.GetAI().QuestReward(_player, quest, packet.ItemChoiceID);
break;
}
case TypeId.GameObject:
@@ -369,9 +368,8 @@ namespace Game
}
}
- if (!Global.ScriptMgr.OnQuestReward(_player, questGiver, quest, packet.ItemChoiceID))
- questGiver.GetAI().QuestReward(_player, quest, packet.ItemChoiceID);
-
+ _player.PlayerTalkClass.ClearMenus();
+ questGiver.GetAI().QuestReward(_player, quest, packet.ItemChoiceID);
break;
}
default:
diff --git a/Source/Game/Scripting/CoreScripts.cs b/Source/Game/Scripting/CoreScripts.cs
index 460ab02cc..662822b0b 100644
--- a/Source/Game/Scripting/CoreScripts.cs
+++ b/Source/Game/Scripting/CoreScripts.cs
@@ -54,25 +54,25 @@ namespace Game.Scripting
return null;
}
- public void ClearGossipMenuFor(Player player) { player.PlayerTalkClass.ClearMenus(); }
+ public static void ClearGossipMenuFor(Player player) { player.PlayerTalkClass.ClearMenus(); }
// Using provided text, not from DB
- public void AddGossipItemFor(Player player, GossipOptionIcon icon, string text, uint sender, uint action)
+ public static void AddGossipItemFor(Player player, GossipOptionIcon icon, string text, uint sender, uint action)
{
player.PlayerTalkClass.GetGossipMenu().AddMenuItem(-1, icon, text, sender, action, "", 0);
}
// Using provided texts, not from DB
- public void AddGossipItemFor(Player player, GossipOptionIcon icon, string text, uint sender, uint action, string popupText, uint popupMoney, bool coded)
+ public static void AddGossipItemFor(Player player, GossipOptionIcon icon, string text, uint sender, uint action, string popupText, uint popupMoney, bool coded)
{
player.PlayerTalkClass.GetGossipMenu().AddMenuItem(-1, icon, text, sender, action, popupText, popupMoney, coded);
}
// Uses gossip item info from DB
- public void AddGossipItemFor(Player player, uint gossipMenuID, uint gossipMenuItemID, uint sender, uint action)
+ public static void AddGossipItemFor(Player player, uint gossipMenuID, uint gossipMenuItemID, uint sender, uint action)
{
player.PlayerTalkClass.GetGossipMenu().AddMenuItem(gossipMenuID, gossipMenuItemID, sender, action);
}
- public void SendGossipMenuFor(Player player, uint npcTextID, ObjectGuid guid) { player.PlayerTalkClass.SendGossipMenu(npcTextID, guid); }
- public void SendGossipMenuFor(Player player, uint npcTextID, Creature creature) { if (creature) SendGossipMenuFor(player, npcTextID, creature.GetGUID()); }
- public void CloseGossipMenuFor(Player player) { player.PlayerTalkClass.SendCloseGossip(); }
+ public static void SendGossipMenuFor(Player player, uint npcTextID, ObjectGuid guid) { player.PlayerTalkClass.SendGossipMenu(npcTextID, guid); }
+ public static void SendGossipMenuFor(Player player, uint npcTextID, Creature creature) { if (creature) SendGossipMenuFor(player, npcTextID, creature.GetGUID()); }
+ public static void CloseGossipMenuFor(Player player) { player.PlayerTalkClass.SendCloseGossip(); }
string _name;
}
@@ -333,37 +333,11 @@ namespace Game.Scripting
public override bool IsDatabaseBound() { return true; }
- // Called when a player opens a gossip dialog with the creature.
- public virtual bool OnGossipHello(Player player, Creature creature) { return false; }
-
- // Called when a player selects a gossip item in the creature's gossip menu.
- public virtual bool OnGossipSelect(Player player, Creature creature, uint sender, uint action) { return false; }
-
- // Called when a player selects a gossip with a code in the creature's gossip menu.
- public virtual bool OnGossipSelectCode(Player player, Creature creature, uint sender, uint action, string code) { return false; }
-
- // Called when a player accepts a quest from the creature.
- public virtual bool OnQuestAccept(Player player, Creature creature, Quest quest) { return false; }
-
- // Called when a player selects a quest in the creature's quest menu.
- public virtual bool OnQuestSelect(Player player, Creature creature, Quest quest) { return false; }
-
- // Called when a player completes a quest with the creature.
- public virtual bool OnQuestComplete(Player player, Creature creature, Quest quest) { return false; }
-
- // Called when a player selects a quest reward.
- public virtual bool OnQuestReward(Player player, Creature creature, Quest quest, uint opt) { return false; }
-
- // Called when the dialog status between a player and the creature is requested.
- public virtual uint GetDialogStatus(Player player, Creature creature) { return (uint)QuestGiverStatus.ScriptedNoStatus; }
-
// Called when the creature tries to spawn. Return false to block spawn and re-evaluate on next tick.
public virtual bool CanSpawn(ulong spawnId, uint entry, CreatureTemplate baseTemplate, CreatureTemplate actTemplate, CreatureData cData, Map map) { return true; }
// Called when a CreatureAI object is needed for the creature.
public virtual CreatureAI GetAI(Creature creature) { return null; }
-
- public virtual void OnUpdate(Creature obj, uint diff) { }
}
public class GameObjectScript : ScriptObject
@@ -375,40 +349,8 @@ namespace Game.Scripting
public override bool IsDatabaseBound() { return true; }
- // Called when a player opens a gossip dialog with the gameobject.
- public virtual bool OnGossipHello(Player player, GameObject go) { return false; }
-
- // Called when a player selects a gossip item in the gameobject's gossip menu.
- public virtual bool OnGossipSelect(Player player, GameObject go, uint sender, uint action) { return false; }
-
- // Called when a player selects a gossip with a code in the gameobject's gossip menu.
- public virtual bool OnGossipSelectCode(Player player, GameObject go, uint sender, uint action, string code) { return false; }
-
- // Called when a player accepts a quest from the gameobject.
- public virtual bool OnQuestAccept(Player player, GameObject go, Quest quest) { return false; }
-
- // Called when a player selects a quest reward.
- public virtual bool OnQuestReward(Player player, GameObject go, Quest quest, uint opt) { return false; }
-
- // Called when the dialog status between a player and the gameobject is requested.
- public virtual uint GetDialogStatus(Player player, GameObject go) { return 100; }
-
- // Called when the game object is destroyed (destructible buildings only).
- public virtual void OnDestroyed(GameObject go, Player player) { }
-
- // Called when the game object is damaged (destructible buildings only).
- public virtual void OnDamaged(GameObject go, Player player) { }
-
- // Called when the game object loot state is changed.
- public virtual void OnLootStateChanged(GameObject go, uint state, Unit unit) { }
-
- // Called when the game object state is changed.
- public virtual void OnGameObjectStateChanged(GameObject go, GameObjectState state) { }
-
// Called when a GameObjectAI object is needed for the gameobject.
public virtual GameObjectAI GetAI(GameObject go) { return null; }
-
- public virtual void OnUpdate(GameObject obj, uint diff) { }
}
public class AreaTriggerScript : ScriptObject
diff --git a/Source/Game/Scripting/ScriptManager.cs b/Source/Game/Scripting/ScriptManager.cs
index 8cbe5784e..5579a1dab 100644
--- a/Source/Game/Scripting/ScriptManager.cs
+++ b/Source/Game/Scripting/ScriptManager.cs
@@ -749,68 +749,6 @@ namespace Game.Scripting
}
//CreatureScript
- public bool OnGossipHello(Player player, Creature creature)
- {
- Cypher.Assert(player);
- Cypher.Assert(creature);
-
- return RunScriptRet(p => p.OnGossipHello(player, creature), creature.GetScriptId());
- }
- public bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
-
- return RunScriptRet(p => p.OnGossipSelect(player, creature, sender, action), creature.GetScriptId());
- }
- public bool OnGossipSelectCode(Player player, Creature creature, uint sender, uint action, string code)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
- Cypher.Assert(code != null);
-
- return RunScriptRet(p => p.OnGossipSelectCode(player, creature, sender, action, code), creature.GetScriptId());
- }
- public bool OnQuestAccept(Player player, Creature creature, Quest quest)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
- Cypher.Assert(quest != null);
-
- return RunScriptRet(p => p.OnQuestAccept(player, creature, quest), creature.GetScriptId());
- }
- public bool OnQuestSelect(Player player, Creature creature, Quest quest)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
- Cypher.Assert(quest != null);
-
- return RunScriptRet(p => p.OnQuestSelect(player, creature, quest), creature.GetScriptId());
- }
- public bool OnQuestComplete(Player player, Creature creature, Quest quest)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
- Cypher.Assert(quest != null);
-
- return RunScriptRet(p => p.OnQuestComplete(player, creature, quest), creature.GetScriptId());
- }
- public bool OnQuestReward(Player player, Creature creature, Quest quest, uint opt)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
- Cypher.Assert(quest != null);
-
- return RunScriptRet(p => p.OnQuestReward(player, creature, quest, opt), creature.GetScriptId());
- }
- public uint GetDialogStatus(Player player, Creature creature)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(creature != null);
-
- player.PlayerTalkClass.ClearMenus();
- return RunScriptRet(p => p.GetDialogStatus(player, creature), creature.GetScriptId(), (uint)QuestGiverStatus.ScriptedNoStatus);
- }
public bool CanSpawn(ulong spawnId, uint entry, CreatureTemplate actTemplate, CreatureData cData, Map map)
{
Cypher.Assert(actTemplate != null);
@@ -826,90 +764,8 @@ namespace Game.Scripting
return RunScriptRet(p => p.GetAI(creature), creature.GetScriptId());
}
- public void OnCreatureUpdate(Creature creature, uint diff)
- {
- Cypher.Assert(creature != null);
-
- RunScript(p => p.OnUpdate(creature, diff), creature.GetScriptId());
- }
//GameObjectScript
- public bool OnGossipHello(Player player, GameObject go)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(go != null);
-
- player.PlayerTalkClass.ClearMenus();
- return RunScriptRet(p => p.OnGossipHello(player, go), go.GetScriptId());
- }
- public bool OnGossipSelect(Player player, GameObject go, uint sender, uint action)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(go != null);
-
- return RunScriptRet(p => p.OnGossipSelect(player, go, sender, action), go.GetScriptId());
- }
- public bool OnGossipSelectCode(Player player, GameObject go, uint sender, uint action, string code)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(go != null);
- Cypher.Assert(code != null);
-
- return RunScriptRet(p => p.OnGossipSelectCode(player, go, sender, action, code), go.GetScriptId());
- }
- public bool OnQuestAccept(Player player, GameObject go, Quest quest)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(go != null);
- Cypher.Assert(quest != null);
-
- return RunScriptRet(p => p.OnQuestAccept(player, go, quest), go.GetScriptId());
- }
- public bool OnQuestReward(Player player, GameObject go, Quest quest, uint opt)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(go != null);
- Cypher.Assert(quest != null);
-
- return RunScriptRet(p => p.OnQuestReward(player, go, quest, opt), go.GetScriptId());
- }
- public uint GetDialogStatus(Player player, GameObject go)
- {
- Cypher.Assert(player != null);
- Cypher.Assert(go != null);
-
- return RunScriptRet(p => p.GetDialogStatus(player, go), go.GetScriptId(), (uint)QuestGiverStatus.ScriptedNoStatus);
- }
- public void OnGameObjectDestroyed(GameObject go, Player player)
- {
- Cypher.Assert(go != null);
-
- RunScript(p => p.OnDestroyed(go, player), go.GetScriptId());
- }
- public void OnGameObjectDamaged(GameObject go, Player player)
- {
- Cypher.Assert(go != null);
-
- RunScript(p => p.OnDamaged(go, player), go.GetScriptId());
- }
- public void OnGameObjectLootStateChanged(GameObject go, uint state, Unit unit)
- {
- Cypher.Assert(go != null);
-
- RunScript(p => p.OnLootStateChanged(go, state, unit), go.GetScriptId());
- }
- public void OnGameObjectStateChanged(GameObject go, GameObjectState state)
- {
- Cypher.Assert(go != null);
-
- RunScript(p => p.OnGameObjectStateChanged(go, state), go.GetScriptId());
- }
- public void OnGameObjectUpdate(GameObject go, uint diff)
- {
- Cypher.Assert(go != null);
-
- RunScript(p => p.OnUpdate(go, diff), go.GetScriptId());
- }
public GameObjectAI GetGameObjectAI(GameObject go)
{
Cypher.Assert(go != null);
diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs
index 0980f5603..ee2e19291 100644
--- a/Source/Game/Spells/SpellEffects.cs
+++ b/Source/Game/Spells/SpellEffects.cs
@@ -1321,9 +1321,7 @@ namespace Game.Spells
return;
}
- if (Global.ScriptMgr.OnGossipHello(player, gameObjTarget))
- return;
-
+ player.PlayerTalkClass.ClearMenus();
if (gameObjTarget.GetAI().GossipHello(player, false))
return;
diff --git a/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs b/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs
index 2c8aa4eff..10e59cb1f 100644
--- a/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs
+++ b/Source/Scripts/EasternKingdoms/Karazhan/OperaEvent.cs
@@ -692,7 +692,7 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
{
public npc_grandmother(Creature creature) : base(creature) { }
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId == RedRidingHood.OptionWhatPhatLewtsYouHave && gossipListId == 0)
{
@@ -704,6 +704,7 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
me.DespawnOrUnsummon();
}
+ return false;
}
}
@@ -1574,6 +1575,67 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
}
}
+ public override bool GossipHello(Player player)
+ {
+ // Check for death of Moroes and if opera event is not done already
+ if (instance.GetBossState(DataTypes.Moroes) == EncounterState.Done && instance.GetBossState(DataTypes.OperaPerformance) != EncounterState.Done)
+ {
+ AddGossipItemFor(player, GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+
+ if (player.IsGameMaster())
+ {
+ AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
+ AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
+ AddGossipItemFor(player, GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
+ }
+
+ if (!RaidWiped)
+ SendGossipMenuFor(player, 8970, me.GetGUID());
+ else
+ SendGossipMenuFor(player, 8975, me.GetGUID());
+
+ return true;
+ }
+
+ SendGossipMenuFor(player, 8978, me.GetGUID());
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef + 1:
+ AddGossipItemFor(player, GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ SendGossipMenuFor(player, 8971, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 2:
+ player.CLOSE_GOSSIP_MENU();
+ StartEvent();
+ break;
+ case eTradeskill.GossipActionInfoDef + 3:
+ CloseGossipMenuFor(player);
+ m_uiEventId = OperaEvents.Oz;
+ Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_OZ", player.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 4:
+ CloseGossipMenuFor(player);
+ m_uiEventId = OperaEvents.Hood;
+ Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_HOOD", player.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 5:
+ CloseGossipMenuFor(player);
+ m_uiEventId = OperaEvents.RAJ;
+ Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_RAJ", player.GetGUID());
+ break;
+ }
+
+ return true;
+ }
+
InstanceScript instance;
ObjectGuid m_uiSpotlightGUID;
@@ -1587,75 +1649,6 @@ namespace Scripts.EasternKingdoms.Karazhan.OperaEvent
public bool RaidWiped;
}
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
- npc_barnesAI pBarnesAI = (npc_barnesAI)creature.GetAI();
-
- switch (action)
- {
- case eTradeskill.GossipActionInfoDef + 1:
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(8971, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 2:
- player.CLOSE_GOSSIP_MENU();
- pBarnesAI.StartEvent();
- break;
- case eTradeskill.GossipActionInfoDef + 3:
- player.CLOSE_GOSSIP_MENU();
- pBarnesAI.m_uiEventId = OperaEvents.Oz;
- Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_OZ", player.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 4:
- player.CLOSE_GOSSIP_MENU();
- pBarnesAI.m_uiEventId = OperaEvents.Hood;
- Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_HOOD", player.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 5:
- player.CLOSE_GOSSIP_MENU();
- pBarnesAI.m_uiEventId = OperaEvents.RAJ;
- Log.outInfo(LogFilter.Scripts, "player (GUID {0}) manually set Opera event to EVENT_RAJ", player.GetGUID());
- break;
- }
-
- return true;
- }
-
- public override bool OnGossipHello(Player player, Creature creature)
- {
- InstanceScript instance = creature.GetInstanceScript();
- if (instance != null)
- {
- // Check for death of Moroes and if opera event is not done already
- if (instance.GetBossState(DataTypes.Moroes) == EncounterState.Done && instance.GetBossState(DataTypes.OperaPerformance) != EncounterState.Done)
- {
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, karazhanConst.OZ_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
-
- if (player.IsGameMaster())
- {
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Dot, karazhanConst.OZ_GM_GOSSIP3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
- }
-
- npc_barnesAI pBarnesAI = (npc_barnesAI)creature.GetAI();
- if (pBarnesAI != null)
- {
- if (!pBarnesAI.RaidWiped)
- player.SEND_GOSSIP_MENU(8970, creature.GetGUID());
- else
- player.SEND_GOSSIP_MENU(8975, creature.GetGUID());
-
- return true;
- }
- }
- }
-
- player.SEND_GOSSIP_MENU(8978, creature.GetGUID());
- return true;
- }
-
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI(creature);
diff --git a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs
index a25e36d4f..069463f5d 100644
--- a/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs
+++ b/Source/Scripts/EasternKingdoms/ScarletEnclave/Chapter1.cs
@@ -349,21 +349,31 @@ namespace Scripts.EasternKingdoms
{
public go_acherus_soul_prison() : base("go_acherus_soul_prison") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_acherus_soul_prisonAI : GameObjectAI
{
- Creature anchor = go.FindNearestCreature(29521, 15);
- if (anchor)
- {
- ObjectGuid prisonerGUID = anchor.GetAI().GetGUID();
- if (!prisonerGUID.IsEmpty())
- {
- Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID);
- if (prisoner)
- ((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player);
- }
- }
+ public go_acherus_soul_prisonAI(GameObject go) : base(go) { }
- return false;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ Creature anchor = me.FindNearestCreature(29521, 15);
+ if (anchor)
+ {
+ ObjectGuid prisonerGUID = anchor.GetAI().GetGUID();
+ if (!prisonerGUID.IsEmpty())
+ {
+ Creature prisoner = ObjectAccessor.GetCreature(player, prisonerGUID);
+ if (prisoner)
+ ((npc_unworthy_initiate)prisoner.GetAI()).EventStart(anchor, player);
+ }
+ }
+
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_acherus_soul_prisonAI(go);
}
}
@@ -545,54 +555,51 @@ namespace Scripts.EasternKingdoms
base.UpdateAI(uiDiff);
}
+ public override bool GossipHello(Player player)
+ {
+ if (player.GetQuestStatus(MiscConst.QuestDeathChallenge) == QuestStatus.Incomplete && me.IsFullHealth())
+ {
+ if (player.HealthBelowPct(10))
+ return true;
+
+ if (player.IsInCombat() || me.IsInCombat())
+ return true;
+
+ AddGossipItemFor(player, Player.GetDefaultGossipMenuForSource(me), 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+ SendGossipMenuFor(player, player.GetGossipTextId(me), me.GetGUID());
+ }
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == eTradeskill.GossipActionInfoDef)
+ {
+ CloseGossipMenuFor(player);
+
+ if (player.IsInCombat() || me.IsInCombat())
+ return true;
+
+ if (m_bIsDuelInProgress)
+ return true;
+
+ me.RemoveUnitFlag(UnitFlags.ImmuneToPc);
+ me.RemoveUnitFlag(UnitFlags.Unk15);
+
+ player.CastSpell(me, SpellIds.Duel, false);
+ player.CastSpell(player, SpellIds.DuelFlag, true);
+ }
+ return true;
+ }
+
bool lose;
ObjectGuid m_uiDuelerGUID;
uint m_uiDuelTimer;
public bool m_bIsDuelInProgress;
}
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- ClearGossipMenuFor(player);
- if (action == eTradeskill.GossipActionInfoDef)
- {
- CloseGossipMenuFor(player);
-
- if (player.IsInCombat() || creature.IsInCombat())
- return true;
-
- npc_death_knight_initiateAI pInitiateAI = creature.GetAI();
- if (pInitiateAI != null)
- {
- if (pInitiateAI.m_bIsDuelInProgress)
- return true;
- }
-
- creature.RemoveUnitFlag(UnitFlags.ImmuneToPc);
- creature.RemoveUnitFlag(UnitFlags.Unk15);
-
- player.CastSpell(creature, SpellIds.Duel, false);
- player.CastSpell(player, SpellIds.DuelFlag, true);
- }
- return true;
- }
-
- public override bool OnGossipHello(Player player, Creature creature)
- {
- if (player.GetQuestStatus(MiscConst.QuestDeathChallenge) == QuestStatus.Incomplete && creature.IsFullHealth())
- {
- if (player.HealthBelowPct(10))
- return true;
-
- if (player.IsInCombat() || creature.IsInCombat())
- return true;
-
- AddGossipItemFor(player, Player.GetDefaultGossipMenuForSource(creature), 0, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
- SendGossipMenuFor(player, player.GetGossipTextId(creature), creature.GetGUID());
- }
- return true;
- }
-
public override CreatureAI GetAI(Creature creature)
{
return new npc_death_knight_initiateAI(creature);
@@ -681,13 +688,14 @@ namespace Scripts.EasternKingdoms
{
public npc_salanar_the_horseman(Creature creature) : base(creature) { }
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId == MiscConst.GossipSalanarMenu && gossipListId == MiscConst.GossipSalanarOption)
{
player.CastSpell(player, SpellIds.RealmOfShadows, true);
player.PlayerTalkClass.SendCloseGossip();
}
+ return false;
}
public override void SpellHit(Unit caster, SpellInfo spell)
diff --git a/Source/Scripts/Kalimdor/ZoneAshenvale.cs b/Source/Scripts/Kalimdor/ZoneAshenvale.cs
index 01264cf56..f8a9b6d5d 100644
--- a/Source/Scripts/Kalimdor/ZoneAshenvale.cs
+++ b/Source/Scripts/Kalimdor/ZoneAshenvale.cs
@@ -319,22 +319,32 @@ namespace Scripts.Kalimdor.ZoneAshenvale
{
public go_naga_brazier() : base("go_naga_brazier") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_naga_brazierAI : GameObjectAI
{
- Creature creature = ScriptedAI.GetClosestCreatureWithEntry(go, CreatureIds.Muglash, SharedConst.InteractionDistance * 2);
- if (creature)
+ public go_naga_brazierAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- npc_muglash pEscortAI = creature.GetAI();
- if (pEscortAI != null)
+ Creature creature = ScriptedAI.GetClosestCreatureWithEntry(me, CreatureIds.Muglash, SharedConst.InteractionDistance * 2);
+ if (creature)
{
- creature.GetAI().Talk(TextIds.SayMugBrazierWait);
+ npc_muglash pEscortAI = creature.GetAI();
+ if (pEscortAI != null)
+ {
+ creature.GetAI().Talk(TextIds.SayMugBrazierWait);
- pEscortAI._isBrazierExtinguished = true;
- return false;
+ pEscortAI._isBrazierExtinguished = true;
+ return false;
+ }
}
- }
- return true;
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_naga_brazierAI(go);
}
}
diff --git a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs
index 75f5c4634..dd8cd46c7 100644
--- a/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs
+++ b/Source/Scripts/Northrend/AzjolNerub/Ahnkahet/BossPrinceTaldaram.cs
@@ -364,33 +364,44 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.PrinceTaldaram
{
public go_prince_taldaram_sphere() : base("go_prince_taldaram_sphere") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_prince_taldaram_sphereAI : GameObjectAI
{
- InstanceScript instance = go.GetInstanceScript();
- if (instance == null)
- return false;
-
- Creature PrinceTaldaram = ObjectAccessor.GetCreature(go, instance.GetGuidData(DataTypes.PrinceTaldaram));
- if (PrinceTaldaram && PrinceTaldaram.IsAlive())
+ public go_prince_taldaram_sphereAI(GameObject go) : base(go)
{
- go.AddFlag(GameObjectFlags.NotSelectable);
- go.SetGoState(GameObjectState.Active);
-
- switch (go.GetEntry())
- {
- case GameObjectIds.Sphere1:
- instance.SetData(DataTypes.Sphere1, (uint)EncounterState.InProgress);
- PrinceTaldaram.GetAI().Talk(TextIds.Say1);
- break;
- case GameObjectIds.Sphere2:
- instance.SetData(DataTypes.Sphere2, (uint)EncounterState.InProgress);
- PrinceTaldaram.GetAI().Talk(TextIds.Say1);
- break;
- }
-
- PrinceTaldaram.GetAI().CheckSpheres();
+ instance = go.GetInstanceScript();
}
- return true;
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ Creature PrinceTaldaram = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.PrinceTaldaram));
+ if (PrinceTaldaram && PrinceTaldaram.IsAlive())
+ {
+ me.AddFlag(GameObjectFlags.NotSelectable);
+ me.SetGoState(GameObjectState.Active);
+
+ switch (me.GetEntry())
+ {
+ case GameObjectIds.Sphere1:
+ instance.SetData(DataTypes.Sphere1, (uint)EncounterState.InProgress);
+ PrinceTaldaram.GetAI().Talk(TextIds.Say1);
+ break;
+ case GameObjectIds.Sphere2:
+ instance.SetData(DataTypes.Sphere2, (uint)EncounterState.InProgress);
+ PrinceTaldaram.GetAI().Talk(TextIds.Say1);
+ break;
+ }
+
+ PrinceTaldaram.GetAI().CheckSpheres();
+ }
+ return true;
+ }
+
+ InstanceScript instance;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return GetInstanceAI(go);
}
}
diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs
index 40e7b6f15..65e58d9c8 100644
--- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs
+++ b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/TrialOfTheChampion.cs
@@ -518,6 +518,40 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
}
}
+ public override bool GossipHello(Player player)
+ {
+ if (((instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done &&
+ instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.Done &&
+ instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.Done) ||
+ instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.Done))
+ return false;
+
+ if (instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted &&
+ instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.NotStarted &&
+ instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.NotStarted &&
+ instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.NotStarted)
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ else if (instance != null)
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+
+ SendGossipMenuFor(player, player.GetGossipTextId(me), me.GetGUID());
+
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ ClearGossipMenuFor(player);
+ if (action == eTradeskill.GossipActionInfoDef + 1)
+ {
+ CloseGossipMenuFor(player);
+ StartEncounter();
+ }
+
+ return true;
+ }
+
InstanceScript instance;
byte uiSummonTimes;
@@ -543,43 +577,6 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheChampion
Position SpawnPosition = new Position(746.261f, 657.401f, 411.681f, 4.65f);
}
- public override bool OnGossipHello(Player player, Creature creature)
- {
- InstanceScript instance = creature.GetInstanceScript();
-
- if (instance != null &&
- ((instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.Done &&
- instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.Done &&
- instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.Done) ||
- instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.Done))
- return false;
-
- if (instance != null &&
- instance.GetData((uint)Data.BOSS_GRAND_CHAMPIONS) == (uint)EncounterState.NotStarted &&
- instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_E) == (uint)EncounterState.NotStarted &&
- instance.GetData((uint)Data.BOSS_ARGENT_CHALLENGE_P) == (uint)EncounterState.NotStarted &&
- instance.GetData((uint)Data.BOSS_BLACK_KNIGHT) == (uint)EncounterState.NotStarted)
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- else if (instance != null)
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, TrialOfTheChampionConst.GOSSIP_START_EVENT2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
-
- player.SEND_GOSSIP_MENU(player.GetGossipTextId(creature), creature.GetGUID());
-
- return true;
- }
-
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
- if (action == eTradeskill.GossipActionInfoDef + 1)
- {
- player.CLOSE_GOSSIP_MENU();
- ((npc_announcer_toc5AI)creature.GetAI()).StartEncounter();
- }
-
- return true;
- }
-
public override CreatureAI GetAI(Creature creature)
{
return GetInstanceAI(creature);
diff --git a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs
index 1c4b5f1fb..7cf97307e 100644
--- a/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs
+++ b/Source/Scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/TrialOfTheCrusader.cs
@@ -22,6 +22,7 @@ using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
+using System.Linq;
namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
{
@@ -779,7 +780,10 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
class npc_announcer_toc10AI : ScriptedAI
{
- public npc_announcer_toc10AI(Creature creature) : base(creature) { }
+ public npc_announcer_toc10AI(Creature creature) : base(creature)
+ {
+ instance = creature.GetInstanceScript();
+ }
public override void Reset()
{
@@ -794,101 +798,86 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
}
public override void AttackStart(Unit who) { }
- }
- public override bool OnGossipHello(Player player, Creature creature)
- {
- InstanceScript instance = creature.GetInstanceScript();
- if (instance == null)
- return true;
-
- string _message = "We are ready!";
-
- if (player.IsInCombat() || instance.IsEncounterInProgress() || instance.GetData(DataTypes.Event) != 0)
- return true;
-
- byte i = 0;
- for (; i < MiscData._GossipMessage.Length; ++i)
+ public override bool GossipHello(Player player)
{
- if ((!MiscData._GossipMessage[i].state && instance.GetBossState(MiscData._GossipMessage[i].encounter) != EncounterState.Done)
- || (MiscData._GossipMessage[i].state && instance.GetBossState(MiscData._GossipMessage[i].encounter) == EncounterState.Done))
+ string _message = "We are ready!";
+
+ if (player.IsInCombat() || instance.IsEncounterInProgress() || instance.GetData(DataTypes.Event) != 0)
+ return true;
+
+ byte i = 0;
+ for (; i < MiscData._GossipMessage.Length; ++i)
{
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, _message, eTradeskill.GossipSenderMain, MiscData._GossipMessage[i].id);
- break;
+ if ((!MiscData._GossipMessage[i].state && instance.GetBossState(MiscData._GossipMessage[i].encounter) != EncounterState.Done)
+ || (MiscData._GossipMessage[i].state && instance.GetBossState(MiscData._GossipMessage[i].encounter) == EncounterState.Done))
+ {
+ AddGossipItemFor(player, GossipOptionIcon.Chat, _message, eTradeskill.GossipSenderMain, MiscData._GossipMessage[i].id);
+ break;
+ }
}
- }
- if (i >= MiscData._GossipMessage.Length)
- return false;
+ if (i >= MiscData._GossipMessage.Length)
+ return false;
- player.SEND_GOSSIP_MENU((uint)MiscData._GossipMessage[i].msgnum, creature.GetGUID());
- return true;
- }
-
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
- player.CLOSE_GOSSIP_MENU();
- InstanceScript instance = creature.GetInstanceScript();
- if (instance == null)
+ SendGossipMenuFor(player, (uint)MiscData._GossipMessage[i].msgnum, me.GetGUID());
return true;
-
- if (instance.GetBossState(DataTypes.BossBeasts) != EncounterState.Done)
- {
- instance.SetData(DataTypes.Event, 110);
- instance.SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.NotStarted);
- instance.SetBossState(DataTypes.BossBeasts, EncounterState.NotStarted);
}
- else if (instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.Done)
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
- // if Jaraxxus is spawned, but the raid wiped
- Creature jaraxxus = ObjectAccessor.GetCreature(player, instance.GetGuidData(CreatureIds.Jaraxxus));
- if (jaraxxus)
+ ClearGossipMenuFor(player);
+ CloseGossipMenuFor(player);
+
+ if (instance.GetBossState(DataTypes.BossBeasts) != EncounterState.Done)
{
- jaraxxus.RemoveAurasDueToSpell(Spells.JaraxxusChains);
- jaraxxus.RemoveUnitFlag(UnitFlags.NonAttackable);
- jaraxxus.SetReactState(ReactStates.Defensive);
- jaraxxus.SetInCombatWithZone();
+ instance.SetData(DataTypes.Event, 110);
+ instance.SetData(DataTypes.NorthrendBeasts, (uint)EncounterState.NotStarted);
+ instance.SetBossState(DataTypes.BossBeasts, EncounterState.NotStarted);
}
- else
+ else if (instance.GetBossState(DataTypes.BossJaraxxus) != EncounterState.Done)
{
- instance.SetData(DataTypes.Event, 1010);
- instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.NotStarted);
+ // if Jaraxxus is spawned, but the raid wiped
+ Creature jaraxxus = ObjectAccessor.GetCreature(player, instance.GetGuidData(CreatureIds.Jaraxxus));
+ if (jaraxxus)
+ {
+ jaraxxus.RemoveAurasDueToSpell(Spells.JaraxxusChains);
+ jaraxxus.RemoveUnitFlag(UnitFlags.NonAttackable);
+ jaraxxus.SetReactState(ReactStates.Defensive);
+ jaraxxus.SetInCombatWithZone();
+ }
+ else
+ {
+ instance.SetData(DataTypes.Event, 1010);
+ instance.SetBossState(DataTypes.BossJaraxxus, EncounterState.NotStarted);
+ }
}
+ else if (instance.GetBossState(DataTypes.BossCrusaders) != EncounterState.Done)
+ {
+ if (player.GetTeam() == Team.Alliance)
+ instance.SetData(DataTypes.Event, 3000);
+ else
+ instance.SetData(DataTypes.Event, 3001);
+ instance.SetBossState(DataTypes.BossCrusaders, EncounterState.NotStarted);
+ }
+ else if (instance.GetBossState(DataTypes.BossValkiries) != EncounterState.Done)
+ {
+ instance.SetData(DataTypes.Event, 4000);
+ instance.SetBossState(DataTypes.BossValkiries, EncounterState.NotStarted);
+ }
+ else if (instance.GetBossState(DataTypes.BossLichKing) != EncounterState.Done)
+ {
+ if (me.GetMap().GetPlayers().First().GetTeam() == Team.Alliance)
+ instance.SetData(DataTypes.Event, 4020);
+ else
+ instance.SetData(DataTypes.Event, 4030);
+ instance.SetBossState(DataTypes.BossLichKing, EncounterState.NotStarted);
+ }
+ me.RemoveNpcFlag(NPCFlags.Gossip);
+ return true;
}
- else if (instance.GetBossState(DataTypes.BossCrusaders) != EncounterState.Done)
- {
- if (player.GetTeam() == Team.Alliance)
- instance.SetData(DataTypes.Event, 3000);
- else
- instance.SetData(DataTypes.Event, 3001);
- instance.SetBossState(DataTypes.BossCrusaders, EncounterState.NotStarted);
- }
- else if (instance.GetBossState(DataTypes.BossValkiries) != EncounterState.Done)
- {
- instance.SetData(DataTypes.Event, 4000);
- instance.SetBossState(DataTypes.BossValkiries, EncounterState.NotStarted);
- }
- else if (instance.GetBossState(DataTypes.BossLichKing) != EncounterState.Done)
- {
- GameObject floor = ObjectAccessor.GetGameObject(player, instance.GetGuidData(GameObjectIds.ArgentColiseumFloor));
- if (floor)
- floor.SetDestructibleState(GameObjectDestructibleState.Damaged);
- creature.CastSpell(creature, Spells.CorpseTeleport, false);
- creature.CastSpell(creature, Spells.DestroyFloorKnockup, false);
-
- Creature anubArak = ObjectAccessor.GetCreature(creature, instance.GetGuidData(CreatureIds.Anubarak));
- if (!anubArak || !anubArak.IsAlive())
- anubArak = creature.SummonCreature(CreatureIds.Anubarak, MiscData.AnubarakLoc[0].GetPositionX(), MiscData.AnubarakLoc[0].GetPositionY(), MiscData.AnubarakLoc[0].GetPositionZ(), 3, TempSummonType.CorpseTimedDespawn, MiscData.DespawnTime);
-
- instance.SetBossState(DataTypes.BossAnubarak, EncounterState.NotStarted);
-
- if (creature.IsVisible())
- creature.SetVisible(false);
- }
- creature.RemoveNpcFlag(NPCFlags.Gossip);
- return true;
+ InstanceScript instance;
}
public override CreatureAI GetAI(Creature creature)
diff --git a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs
index fd6c0ac82..c88e1dac6 100644
--- a/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs
+++ b/Source/Scripts/Northrend/FrozenHalls/ForgeOfSouls/InstanceForgeOfSouls.cs
@@ -220,7 +220,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls
Initialize();
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId == Misc.MenuIdSylvanas && gossipListId == Misc.GossipOptionId)
{
@@ -231,6 +231,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls
_events.Reset();
_events.ScheduleEvent(EventIds.Intro1, 1000);
}
+ return false;
}
public override void UpdateAI(uint diff)
@@ -304,7 +305,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls
Initialize();
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId == Misc.MenuIdJaina && gossipListId == Misc.GossipOptionId)
{
@@ -314,6 +315,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls
_events.Reset();
_events.ScheduleEvent(EventIds.Intro1, 1000);
}
+ return false;
}
public override void UpdateAI(uint diff)
diff --git a/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs b/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs
index c24067433..476ec2c19 100644
--- a/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs
+++ b/Source/Scripts/Northrend/Gundrak/InstanceGundrak.cs
@@ -17,6 +17,7 @@
using Framework.Constants;
using Framework.IO;
+using Game.AI;
using Game.Entities;
using Game.Maps;
using Game.Scripting;
@@ -421,19 +422,28 @@ namespace Scripts.Northrend.Gundrak
{
public go_gundrak_altar() : base("go_gundrak_altar") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_gundrak_altarAI : GameObjectAI
{
- go.AddFlag(GameObjectFlags.NotSelectable);
- go.SetGoState(GameObjectState.Active);
-
- InstanceScript instance = go.GetInstanceScript();
- if (instance != null)
+ public go_gundrak_altarAI(GameObject go) : base(go)
{
- instance.SetData(GDDataTypes.StatueActivate, go.GetEntry());
+ instance = go.GetInstanceScript();
+ }
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ me.AddFlag(GameObjectFlags.NotSelectable);
+ me.SetGoState(GameObjectState.Active);
+
+ instance.SetData(GDDataTypes.StatueActivate, me.GetEntry());
return true;
}
- return false;
+ InstanceScript instance;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return GetInstanceAI(go);
}
}
}
diff --git a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs
index 33c9e074d..7575a56bd 100644
--- a/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs
+++ b/Source/Scripts/Northrend/IcecrownCitadel/GunshipBattle.cs
@@ -955,7 +955,7 @@ namespace Scripts.Northrend.IcecrownCitadel
}
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
me.RemoveNpcFlag(NPCFlags.Gossip);
me.GetTransport().EnableMovement(true);
@@ -965,6 +965,7 @@ namespace Scripts.Northrend.IcecrownCitadel
_events.ScheduleEvent(GunshipEvents.IntroSummonSkybreaker, 24600, 0, GunshipMiscData.PhaseIntro);
_events.ScheduleEvent(GunshipEvents.IntroH3, 29600, 0, GunshipMiscData.PhaseIntro);
_events.ScheduleEvent(GunshipEvents.IntroH4, 39200, 0, GunshipMiscData.PhaseIntro);
+ return false;
}
public override void DamageTaken(Unit u, ref uint damage)
@@ -1200,7 +1201,7 @@ namespace Scripts.Northrend.IcecrownCitadel
}
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
me.RemoveNpcFlag(NPCFlags.Gossip);
me.GetTransport().EnableMovement(true);
@@ -1211,6 +1212,7 @@ namespace Scripts.Northrend.IcecrownCitadel
_events.ScheduleEvent(GunshipEvents.IntroA3, 33000, 0, GunshipMiscData.PhaseIntro);
_events.ScheduleEvent(GunshipEvents.IntroA4, 39000, 0, GunshipMiscData.PhaseIntro);
_events.ScheduleEvent(GunshipEvents.IntroA5, 45000, 0, GunshipMiscData.PhaseIntro);
+ return false;
}
public override void DamageTaken(Unit u, ref uint damage)
@@ -1358,10 +1360,11 @@ namespace Scripts.Northrend.IcecrownCitadel
me.SetReactState(ReactStates.Passive);
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
player.AddItem(GunshipMiscData.ItemGoblinRocketPack, 1);
player.PlayerTalkClass.SendCloseGossip();
+ return false;
}
public override void UpdateAI(uint diff)
diff --git a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs
index 06b2423fe..ffa5d543f 100644
--- a/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs
+++ b/Source/Scripts/Northrend/IcecrownCitadel/IcecrownCitadel.cs
@@ -441,12 +441,22 @@ namespace Scripts.Northrend.IcecrownCitadel
{
public npc_alchemist_adrianna() : base("npc_alchemist_adrianna") { }
- public override bool OnGossipHello(Player player, Creature creature)
+ class npc_alchemist_adriannaAI : ScriptedAI
{
- if (!creature.FindCurrentSpellBySpellId(InstanceSpells.HarvestBlightSpecimen) && !creature.FindCurrentSpellBySpellId(InstanceSpells.HarvestBlightSpecimen25))
- if (player.HasAura(InstanceSpells.OrangeBlightResidue) && player.HasAura(InstanceSpells.GreenBlightResidue))
- creature.CastSpell(creature, InstanceSpells.HarvestBlightSpecimen, false);
- return false;
+ public npc_alchemist_adriannaAI(Creature creature) : base(creature) { }
+
+ public override bool GossipHello(Player player)
+ {
+ if (!me.FindCurrentSpellBySpellId(InstanceSpells.HarvestBlightSpecimen) && !me.FindCurrentSpellBySpellId(InstanceSpells.HarvestBlightSpecimen25))
+ if (player.HasAura(InstanceSpells.OrangeBlightResidue) && player.HasAura(InstanceSpells.GreenBlightResidue))
+ DoCastSelf(InstanceSpells.HarvestBlightSpecimen, false);
+ return false;
+ }
+ }
+
+ public override CreatureAI GetAI(Creature creature)
+ {
+ return new npc_alchemist_adriannaAI(creature);
}
}
diff --git a/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs b/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs
index 15945bacf..b894da772 100644
--- a/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs
+++ b/Source/Scripts/Northrend/Nexus/Nexus/BossKeristrasza.cs
@@ -194,22 +194,34 @@ namespace Scripts.Northrend.Nexus.Nexus
{
public containment_sphere() : base("containment_sphere") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class containment_sphereAI : GameObjectAI
{
- InstanceScript instance = go.GetInstanceScript();
-
- Creature pKeristrasza = ObjectAccessor.GetCreature(go, instance.GetGuidData(DataTypes.Keristrasza));
- if (pKeristrasza && pKeristrasza.IsAlive())
+ public containment_sphereAI(GameObject go) : base(go)
{
- // maybe these are hacks :(
- go.AddFlag(GameObjectFlags.NotSelectable);
- go.SetGoState(GameObjectState.Active);
-
- ((boss_keristrasza)pKeristrasza.GetAI()).CheckContainmentSpheres(true);
+ instance = go.GetInstanceScript();
}
- return true;
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ Creature pKeristrasza = ObjectAccessor.GetCreature(me, instance.GetGuidData(DataTypes.Keristrasza));
+ if (pKeristrasza && pKeristrasza.IsAlive())
+ {
+ // maybe these are hacks :(
+ me.AddFlag(GameObjectFlags.NotSelectable);
+ me.SetGoState(GameObjectState.Active);
+
+ ((boss_keristrasza)pKeristrasza.GetAI()).CheckContainmentSpheres(true);
+ }
+ return true;
+ }
+
+ InstanceScript instance;
}
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return GetInstanceAI(go);
+ }
}
[Script]
diff --git a/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs b/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs
index 1d663b15c..b6553baf5 100644
--- a/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs
+++ b/Source/Scripts/Northrend/Ulduar/FlameLeviathan.cs
@@ -1034,7 +1034,7 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan
}
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
if (menuId == GossipIds.MenuLoreKeeper && gossipListId == GossipIds.OptionLoreKeeper)
{
@@ -1062,6 +1062,7 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan
}
}
}
+ return false;
}
InstanceScript _instance;
@@ -1072,31 +1073,42 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan
{
public go_ulduar_tower() : base("go_ulduar_tower") { }
- public override void OnDestroyed(GameObject go, Player player)
+ class go_ulduar_towerAI : GameObjectAI
{
- InstanceScript instance = go.GetInstanceScript();
- if (instance == null)
- return;
-
- switch (go.GetEntry())
+ public go_ulduar_towerAI(GameObject go) : base(go)
{
- case Towers.ofStorms:
- instance.ProcessEvent(go, InstanceEventIds.TowerOfStormDestroyed);
- break;
- case Towers.ofFlames:
- instance.ProcessEvent(go, InstanceEventIds.TowerOfFlamesDestroyed);
- break;
- case Towers.ofFrost:
- instance.ProcessEvent(go, InstanceEventIds.TowerOfFrostDestroyed);
- break;
- case Towers.ofLife:
- instance.ProcessEvent(go, InstanceEventIds.TowerOfLifeDestroyed);
- break;
+ instance = go.GetInstanceScript();
}
- Creature trigger = go.FindNearestCreature(CreatureIds.UlduarGauntletGenerator, 15.0f, true);
- if (trigger)
- trigger.DisappearAndDie();
+ public override void Destroyed(Player player, uint eventId)
+ {
+ switch (me.GetEntry())
+ {
+ case Towers.ofStorms:
+ instance.ProcessEvent(me, InstanceEventIds.TowerOfStormDestroyed);
+ break;
+ case Towers.ofFlames:
+ instance.ProcessEvent(me, InstanceEventIds.TowerOfFlamesDestroyed);
+ break;
+ case Towers.ofFrost:
+ instance.ProcessEvent(me, InstanceEventIds.TowerOfFrostDestroyed);
+ break;
+ case Towers.ofLife:
+ instance.ProcessEvent(me, InstanceEventIds.TowerOfLifeDestroyed);
+ break;
+ }
+
+ Creature trigger = me.FindNearestCreature(CreatureIds.UlduarGauntletGenerator, 15.0f, true);
+ if (trigger)
+ trigger.DisappearAndDie();
+ }
+
+ InstanceScript instance;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return GetInstanceAI(go);
}
}
diff --git a/Source/Scripts/Northrend/Ulduar/Mimiron.cs b/Source/Scripts/Northrend/Ulduar/Mimiron.cs
index fdea091c3..cefb656ff 100644
--- a/Source/Scripts/Northrend/Ulduar/Mimiron.cs
+++ b/Source/Scripts/Northrend/Ulduar/Mimiron.cs
@@ -24,6 +24,7 @@ using Game.Scripting;
using Game.Spells;
using System;
using System.Collections.Generic;
+using System.Dynamic;
using System.Linq;
namespace Scripts.Northrend.Ulduar
@@ -1594,21 +1595,32 @@ namespace Scripts.Northrend.Ulduar
{
public go_mimiron_hardmode_button() : base("go_mimiron_hardmode_button") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_mimiron_hardmode_buttonAI : GameObjectAI
{
- if (go.HasFlag(GameObjectFlags.NotSelectable))
+ go_mimiron_hardmode_buttonAI(GameObject go) : base(go)
+ {
+ instance = go.GetInstanceScript();
+ }
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (me.HasFlag(GameObjectFlags.NotSelectable))
+ return true;
+
+ Creature computer = ObjectAccessor.GetCreature(me, instance.GetGuidData(InstanceData.Computer));
+ if (computer)
+ computer.GetAI().DoAction(Actions.ActivateComputer);
+ me.SetGoState(GameObjectState.Active);
+ me.AddFlag(GameObjectFlags.NotSelectable);
return true;
+ }
- InstanceScript instance = go.GetInstanceScript();
- if (instance == null)
- return false;
+ InstanceScript instance;
+ }
- Creature computer = ObjectAccessor.GetCreature(go, instance.GetGuidData(InstanceData.Computer));
- if (computer)
- computer.GetAI().DoAction(Actions.ActivateComputer);
- go.SetGoState(GameObjectState.Active);
- go.AddFlag(GameObjectFlags.NotSelectable);
- return true;
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return GetInstanceAI(go);
}
}
diff --git a/Source/Scripts/Outlands/Zangarmarsh.cs b/Source/Scripts/Outlands/Zangarmarsh.cs
index 99fd75517..022044bdf 100644
--- a/Source/Scripts/Outlands/Zangarmarsh.cs
+++ b/Source/Scripts/Outlands/Zangarmarsh.cs
@@ -29,108 +29,119 @@ namespace Scripts.Outlands
{
public npcs_ashyen_and_keleth() : base("npcs_ashyen_and_keleth") { }
- public override bool OnGossipHello(Player player, Creature creature)
+ class npcs_ashyen_and_kelethAI : ScriptedAI
{
- if (player.GetReputationRank(942) > ReputationRank.Neutral)
+ public npcs_ashyen_and_kelethAI(Creature creature) : base(creature) { }
+
+ public override bool GossipHello(Player player)
{
- if (creature.GetEntry() == NPC_ASHYEN)
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_BLESS_ASH, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ if (player.GetReputationRank(942) > ReputationRank.Neutral)
+ {
+ if (me.GetEntry() == NPC_ASHYEN)
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_BLESS_ASH, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- if (creature.GetEntry() == NPC_KELETH)
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_BLESS_KEL, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ if (me.GetEntry() == NPC_KELETH)
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_BLESS_KEL, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ }
+ player.SEND_GOSSIP_MENU(player.GetGossipTextId(me), me.GetGUID());
+
+ return true;
}
- player.SEND_GOSSIP_MENU(player.GetGossipTextId(creature), creature.GetGUID());
- return true;
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ if (action == eTradeskill.GossipActionInfoDef + 1)
+ {
+ me.SetPowerType(PowerType.Mana);
+ me.SetMaxPower(PowerType.Mana, 200); //set a "fake" mana value, we can't depend on database doing it in this case
+ me.SetPower(PowerType.Mana, 200);
+
+ if (me.GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
+ {
+ uint spell = 0;
+ switch (player.GetReputationRank(942))
+ { //mark of lore
+ case ReputationRank.Friendly:
+ spell = SPELL_BLESS_ASH_FRI;
+ break;
+ case ReputationRank.Honored:
+ spell = SPELL_BLESS_ASH_HON;
+ break;
+ case ReputationRank.Revered:
+ spell = SPELL_BLESS_ASH_REV;
+ break;
+ case ReputationRank.Exalted:
+ spell = SPELL_BLESS_ASH_EXA;
+ break;
+ default:
+ break;
+ }
+
+ if (spell != 0)
+ {
+ DoCast(player, spell, true);
+ me.GetAI().Talk(GOSSIP_REWARD_BLESS);
+ }
+ }
+
+ if (me.GetEntry() == NPC_KELETH)
+ {
+ uint spell = 0;
+ switch (player.GetReputationRank(942)) //mark of war
+ {
+ case ReputationRank.Friendly:
+ spell = SPELL_BLESS_KEL_FRI;
+ break;
+ case ReputationRank.Honored:
+ spell = SPELL_BLESS_KEL_HON;
+ break;
+ case ReputationRank.Revered:
+ spell = SPELL_BLESS_KEL_REV;
+ break;
+ case ReputationRank.Exalted:
+ spell = SPELL_BLESS_KEL_EXA;
+ break;
+ default:
+ break;
+ }
+
+ if (spell != 0)
+ {
+ DoCast(player, spell, true);
+ me.GetAI().Talk(GOSSIP_REWARD_BLESS);
+ }
+ }
+ player.CLOSE_GOSSIP_MENU();
+ player.TalkedToCreature(me.GetEntry(), me.GetGUID());
+ }
+ return true;
+ }
+
+ const uint GOSSIP_REWARD_BLESS = 0;
+
+ const uint NPC_ASHYEN = 17900;
+ const uint NPC_KELETH = 17901;
+
+ const uint SPELL_BLESS_ASH_EXA = 31815;
+ const uint SPELL_BLESS_ASH_REV = 31811;
+ const uint SPELL_BLESS_ASH_HON = 31810;
+ const uint SPELL_BLESS_ASH_FRI = 31808;
+
+ const uint SPELL_BLESS_KEL_EXA = 31814;
+ const uint SPELL_BLESS_KEL_REV = 31813;
+ const uint SPELL_BLESS_KEL_HON = 31812;
+ const uint SPELL_BLESS_KEL_FRI = 31807;
+
+ const string GOSSIP_ITEM_BLESS_ASH = "Grant me your mark, wise ancient.";
+ const string GOSSIP_ITEM_BLESS_KEL = "Grant me your mark, mighty ancient.";
}
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
+ public override CreatureAI GetAI(Creature creature)
{
- player.PlayerTalkClass.ClearMenus();
- if (action == eTradeskill.GossipActionInfoDef + 1)
- {
- creature.SetPowerType(PowerType.Mana);
- creature.SetMaxPower(PowerType.Mana, 200); //set a "fake" mana value, we can't depend on database doing it in this case
- creature.SetPower(PowerType.Mana, 200);
-
- if (creature.GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
- {
- uint spell = 0;
- switch (player.GetReputationRank(942))
- { //mark of lore
- case ReputationRank.Friendly:
- spell = SPELL_BLESS_ASH_FRI;
- break;
- case ReputationRank.Honored:
- spell = SPELL_BLESS_ASH_HON;
- break;
- case ReputationRank.Revered:
- spell = SPELL_BLESS_ASH_REV;
- break;
- case ReputationRank.Exalted:
- spell = SPELL_BLESS_ASH_EXA;
- break;
- default:
- break;
- }
-
- if (spell != 0)
- {
- creature.CastSpell(player, spell, true);
- creature.GetAI().Talk(GOSSIP_REWARD_BLESS);
- }
- }
-
- if (creature.GetEntry() == NPC_KELETH)
- {
- uint spell = 0;
- switch (player.GetReputationRank(942)) //mark of war
- {
- case ReputationRank.Friendly:
- spell = SPELL_BLESS_KEL_FRI;
- break;
- case ReputationRank.Honored:
- spell = SPELL_BLESS_KEL_HON;
- break;
- case ReputationRank.Revered:
- spell = SPELL_BLESS_KEL_REV;
- break;
- case ReputationRank.Exalted:
- spell = SPELL_BLESS_KEL_EXA;
- break;
- default:
- break;
- }
-
- if (spell != 0)
- {
- creature.CastSpell(player, spell, true);
- creature.GetAI().Talk(GOSSIP_REWARD_BLESS);
- }
- }
- player.CLOSE_GOSSIP_MENU();
- player.TalkedToCreature(creature.GetEntry(), creature.GetGUID());
- }
- return true;
+ return new npcs_ashyen_and_kelethAI(creature);
}
-
- const uint GOSSIP_REWARD_BLESS = 0;
-
- const uint NPC_ASHYEN = 17900;
- const uint NPC_KELETH = 17901;
-
- const uint SPELL_BLESS_ASH_EXA = 31815;
- const uint SPELL_BLESS_ASH_REV = 31811;
- const uint SPELL_BLESS_ASH_HON = 31810;
- const uint SPELL_BLESS_ASH_FRI = 31808;
-
- const uint SPELL_BLESS_KEL_EXA = 31814;
- const uint SPELL_BLESS_KEL_REV = 31813;
- const uint SPELL_BLESS_KEL_HON = 31812;
- const uint SPELL_BLESS_KEL_FRI = 31807;
-
- const string GOSSIP_ITEM_BLESS_ASH = "Grant me your mark, wise ancient.";
- const string GOSSIP_ITEM_BLESS_KEL = "Grant me your mark, mighty ancient.";
}
[Script]
@@ -171,6 +182,28 @@ namespace Scripts.Outlands
DoMeleeAttackIfReady();
}
+
+ public override bool GossipHello(Player player)
+ {
+ if (player.GetQuestStatus(QUEST_CRACK_SKULLS) == QuestStatus.Incomplete)
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_COOSH, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+
+ player.SEND_GOSSIP_MENU(9441, me.GetGUID());
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ if (action == eTradeskill.GossipActionInfoDef)
+ {
+ player.CLOSE_GOSSIP_MENU();
+ me.SetFaction(FACTION_HOSTILE_CO);
+ me.GetAI().AttackStart(player);
+ }
+ return true;
+ }
}
public override CreatureAI GetAI(Creature creature)
@@ -178,27 +211,6 @@ namespace Scripts.Outlands
return new npc_cooshcooshAI(creature);
}
- public override bool OnGossipHello(Player player, Creature creature)
- {
- if (player.GetQuestStatus(QUEST_CRACK_SKULLS) == QuestStatus.Incomplete)
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_COOSH, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
-
- player.SEND_GOSSIP_MENU(9441, creature.GetGUID());
- return true;
- }
-
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
- if (action == eTradeskill.GossipActionInfoDef)
- {
- player.CLOSE_GOSSIP_MENU();
- creature.SetFaction(FACTION_HOSTILE_CO);
- creature.GetAI().AttackStart(player);
- }
- return true;
- }
-
const uint SPELL_LIGHTNING_BOLT = 9532;
const uint QUEST_CRACK_SKULLS = 10009;
const uint FACTION_HOSTILE_CO = 45;
@@ -212,54 +224,64 @@ namespace Scripts.Outlands
{
public npc_elder_kuruti() : base("npc_elder_kuruti") { }
- public override bool OnGossipHello(Player player, Creature creature)
+ class npc_elder_kurutiAI : ScriptedAI
{
- if (player.GetQuestStatus(9803) == QuestStatus.Incomplete)
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+ public npc_elder_kurutiAI(Creature creature) : base(creature) { }
- player.SEND_GOSSIP_MENU(9226, creature.GetGUID());
-
- return true;
- }
-
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
- switch (action)
+ public override bool GossipHello(Player player)
{
- case eTradeskill.GossipActionInfoDef:
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.SEND_GOSSIP_MENU(9227, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 1:
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(9229, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 2:
- {
- if (!player.HasItemCount(24573))
- {
- List dest = new List();
- uint itemId = 24573;
- uint temp;
- InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, 1, out temp);
- if (msg == InventoryResult.Ok)
- {
- player.StoreNewItem(dest, itemId, true);
- }
- else
- player.SendEquipError(msg, null, null, itemId);
- }
- player.SEND_GOSSIP_MENU(9231, creature.GetGUID());
- break;
- }
+ if (player.GetQuestStatus(9803) == QuestStatus.Incomplete)
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+
+ player.SEND_GOSSIP_MENU(9226, me.GetGUID());
+ return true;
}
- return true;
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef:
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.SEND_GOSSIP_MENU(9227, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 1:
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GOSSIP_ITEM_KUR3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.SEND_GOSSIP_MENU(9229, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 2:
+ {
+ if (!player.HasItemCount(24573))
+ {
+ List dest = new List();
+ uint itemId = 24573;
+ uint temp;
+ InventoryResult msg = player.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, 1, out temp);
+ if (msg == InventoryResult.Ok)
+ {
+ player.StoreNewItem(dest, itemId, true);
+ }
+ else
+ player.SendEquipError(msg, null, null, itemId);
+ }
+ player.SEND_GOSSIP_MENU(9231, me.GetGUID());
+ break;
+ }
+ }
+ return true;
+ }
+
+ const string GOSSIP_ITEM_KUR1 = "Greetings, elder. It is time for your people to end their hostility towards the draenei and their allies.";
+ const string GOSSIP_ITEM_KUR2 = "I did not mean to deceive you, elder. The draenei of Telredor thought to approach you in a way that would seem familiar to you.";
+ const string GOSSIP_ITEM_KUR3 = "I will tell them. Farewell, elder.";
}
- const string GOSSIP_ITEM_KUR1 = "Greetings, elder. It is time for your people to end their hostility towards the draenei and their allies.";
- const string GOSSIP_ITEM_KUR2 = "I did not mean to deceive you, elder. The draenei of Telredor thought to approach you in a way that would seem familiar to you.";
- const string GOSSIP_ITEM_KUR3 = "I will tell them. Farewell, elder.";
+ public override CreatureAI GetAI(Creature creature)
+ {
+ return new npc_elder_kurutiAI(creature);
+ }
}
[Script]
@@ -304,19 +326,15 @@ namespace Scripts.Outlands
break;
}
}
- }
- public override bool OnQuestAccept(Player player, Creature creature, Quest quest)
- {
- if (quest.Id == QUEST_ESCAPE_FROM)
+ public override void QuestAccept(Player player, Quest quest)
{
- creature.GetAI().Talk(SAY_START, player);
-
- NpcEscortAI pEscortAI = (npc_kayra_longmaneAI)creature.GetAI();
- if (pEscortAI != null)
- pEscortAI.Start(false, false, player.GetGUID());
+ if (quest.Id == QUEST_ESCAPE_FROM)
+ {
+ Talk(SAY_START, player);
+ Start(false, false, player.GetGUID());
+ }
}
- return true;
}
public override CreatureAI GetAI(Creature creature)
diff --git a/Source/Scripts/World/GameObjects.cs b/Source/Scripts/World/GameObjects.cs
index 26eaf2b32..a36630797 100644
--- a/Source/Scripts/World/GameObjects.cs
+++ b/Source/Scripts/World/GameObjects.cs
@@ -256,10 +256,20 @@ namespace Scripts.World
{
public go_cat_figurine() : base("go_cat_figurine") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_cat_figurineAI : GameObjectAI
{
- player.CastSpell(player, GameobjectConst.SpellSummonGhostSaber, true);
- return false;
+ public go_cat_figurineAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ player.CastSpell(player, GameobjectConst.SpellSummonGhostSaber, true);
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_cat_figurineAI(go);
}
}
@@ -268,12 +278,22 @@ namespace Scripts.World
{
public go_barov_journal() : base("go_barov_journal") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_barov_journalAI : GameObjectAI
{
- if (player.HasSkill(SkillType.Tailoring) && player.GetBaseSkillValue(SkillType.Tailoring) >= 280 && !player.HasSpell(26086))
- player.CastSpell(player, 26095, false);
+ public go_barov_journalAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.HasSkill(SkillType.Tailoring) && player.GetBaseSkillValue(SkillType.Tailoring) >= 280 && !player.HasSpell(26086))
+ player.CastSpell(player, 26095, false);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_barov_journalAI(go);
}
}
@@ -282,18 +302,28 @@ namespace Scripts.World
{
public go_gilded_brazier() : base("go_gilded_brazier") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_gilded_brazierAI : GameObjectAI
{
- if (go.GetGoType() == GameObjectTypes.Goober)
+ public go_gilded_brazierAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- if (player.GetQuestStatus(GameobjectConst.QuestTheFirstTrial) == QuestStatus.Incomplete)
+ if (me.GetGoType() == GameObjectTypes.Goober)
{
- Creature Stillblade = player.SummonCreature(GameobjectConst.NpcStillblade, 8106.11f, -7542.06f, 151.775f, 3.02598f, TempSummonType.DeadDespawn, 60000);
- if (Stillblade)
- Stillblade.GetAI().AttackStart(player);
+ if (player.GetQuestStatus(GameobjectConst.QuestTheFirstTrial) == QuestStatus.Incomplete)
+ {
+ Creature Stillblade = player.SummonCreature(GameobjectConst.NpcStillblade, 8106.11f, -7542.06f, 151.775f, 3.02598f, TempSummonType.DeadDespawn, 60000);
+ if (Stillblade)
+ Stillblade.GetAI().AttackStart(player);
+ }
}
+ return true;
}
- return true;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_gilded_brazierAI(go);
}
}
@@ -302,12 +332,22 @@ namespace Scripts.World
{
public go_orb_of_command() : base("go_orb_of_command") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_orb_of_commandAI : GameObjectAI
{
- if (player.GetQuestRewardStatus(7761))
- player.CastSpell(player, 23460, true);
+ public go_orb_of_commandAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.GetQuestRewardStatus(7761))
+ player.CastSpell(player, 23460, true);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_orb_of_commandAI(go);
}
}
@@ -316,12 +356,22 @@ namespace Scripts.World
{
public go_tablet_of_madness() : base("go_tablet_of_madness") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_tablet_of_madnessAI : GameObjectAI
{
- if (player.HasSkill(SkillType.Alchemy) && player.GetSkillValue(SkillType.Alchemy) >= 300 && !player.HasSpell(24266))
- player.CastSpell(player, 24267, false);
+ public go_tablet_of_madnessAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.HasSkill(SkillType.Alchemy) && player.GetSkillValue(SkillType.Alchemy) >= 300 && !player.HasSpell(24266))
+ player.CastSpell(player, 24267, false);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_tablet_of_madnessAI(go);
}
}
@@ -330,16 +380,26 @@ namespace Scripts.World
{
public go_tablet_of_the_seven() : base("go_tablet_of_the_seven") { }
- // @todo use gossip option ("Transcript the Tablet") instead, if Trinity adds support.
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_tablet_of_the_sevenAI : GameObjectAI
{
- if (go.GetGoType() != GameObjectTypes.QuestGiver)
+ 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)
+ {
+ if (me.GetGoType() != GameObjectTypes.QuestGiver)
+ return true;
+
+ if (player.GetQuestStatus(4296) == QuestStatus.Incomplete)
+ player.CastSpell(player, 15065, false);
+
return true;
+ }
+ }
- if (player.GetQuestStatus(4296) == QuestStatus.Incomplete)
- player.CastSpell(player, 15065, false);
-
- return true;
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_tablet_of_the_sevenAI(go);
}
}
@@ -348,12 +408,22 @@ namespace Scripts.World
{
public go_jump_a_tron() : base("go_jump_a_tron") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_jump_a_tronAI : GameObjectAI
{
- if (player.GetQuestStatus(10111) == QuestStatus.Incomplete)
- player.CastSpell(player, 33382, true);
+ public go_jump_a_tronAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.GetQuestStatus(10111) == QuestStatus.Incomplete)
+ player.CastSpell(player, 33382, true);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_jump_a_tronAI(go);
}
}
@@ -362,39 +432,49 @@ namespace Scripts.World
{
public go_ethereum_prison() : base("go_ethereum_prison") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_ethereum_prisonAI : GameObjectAI
{
- go.UseDoorOrButton();
- int Random = (int)(RandomHelper.Rand32() % (GameobjectConst.NpcPrisonEntry.Length / sizeof(uint)));
- Creature creature = player.SummonCreature(GameobjectConst.NpcPrisonEntry[Random], go.GetPositionX(), go.GetPositionY(), go.GetPositionZ(), go.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000);
- if (creature)
+ public go_ethereum_prisonAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- if (!creature.IsHostileTo(player))
+ me.UseDoorOrButton();
+ int Random = (int)(RandomHelper.Rand32() % (GameobjectConst.NpcPrisonEntry.Length / sizeof(uint)));
+ Creature creature = player.SummonCreature(GameobjectConst.NpcPrisonEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000);
+ if (creature)
{
- FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry();
- if (pFaction != null)
+ if (!creature.IsHostileTo(player))
{
- uint Spell = 0;
-
- switch (pFaction.Faction)
+ FactionTemplateRecord pFaction = creature.GetFactionTemplateEntry();
+ if (pFaction != null)
{
- case 1011: Spell = GameobjectConst.SpellRepLc; break;
- case 935: Spell = GameobjectConst.SpellRepShat; break;
- case 942: Spell = GameobjectConst.SpellRepCe; break;
- case 933: Spell = GameobjectConst.SpellRepCon; break;
- case 989: Spell = GameobjectConst.SpellRepKt; break;
- case 970: Spell = GameobjectConst.SpellRepSpor; break;
- }
+ uint Spell = 0;
- if (Spell != 0)
- creature.CastSpell(player, Spell, false);
- else
- Log.outError(LogFilter.Scripts, "go_ethereum_prison summoned Creature (entry {0}) but faction ({1}) are not expected by script.", creature.GetEntry(), creature.GetFaction());
+ switch (pFaction.Faction)
+ {
+ case 1011: Spell = GameobjectConst.SpellRepLc; break;
+ case 935: Spell = GameobjectConst.SpellRepShat; break;
+ case 942: Spell = GameobjectConst.SpellRepCe; break;
+ case 933: Spell = GameobjectConst.SpellRepCon; break;
+ case 989: Spell = GameobjectConst.SpellRepKt; break;
+ case 970: Spell = GameobjectConst.SpellRepSpor; break;
+ }
+
+ if (Spell != 0)
+ creature.CastSpell(player, Spell, false);
+ else
+ Log.outError(LogFilter.Scripts, "go_ethereum_prison summoned Creature (entry {0}) but faction ({1}) are not expected by script.", creature.GetEntry(), creature.GetFaction());
+ }
}
}
- }
- return false;
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_ethereum_prisonAI(go);
}
}
@@ -403,14 +483,24 @@ namespace Scripts.World
{
public go_ethereum_stasis() : base("go_ethereum_stasis") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_ethereum_stasisAI : GameObjectAI
{
- go.UseDoorOrButton();
- int Random = (int)(RandomHelper.Rand32() % GameobjectConst.NpcStasisEntry.Length / sizeof(uint));
+ public go_ethereum_stasisAI(GameObject go) : base(go) { }
- player.SummonCreature(GameobjectConst.NpcStasisEntry[Random], go.GetPositionX(), go.GetPositionY(), go.GetPositionZ(), go.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000);
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ me.UseDoorOrButton();
+ int Random = (int)(RandomHelper.Rand32() % GameobjectConst.NpcStasisEntry.Length / sizeof(uint));
- return false;
+ player.SummonCreature(GameobjectConst.NpcStasisEntry[Random], me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedDespawnOOC, 30000);
+
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_ethereum_stasisAI(go);
}
}
@@ -419,12 +509,22 @@ namespace Scripts.World
{
public go_resonite_cask() : base("go_resonite_cask") { }
- public override bool OnGossipHello(Player Player, GameObject go)
+ class go_resonite_caskAI : GameObjectAI
{
- if (go.GetGoType() == GameObjectTypes.Goober)
- go.SummonCreature(GameobjectConst.NpcGoggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 300000);
+ public go_resonite_caskAI(GameObject go) : base(go) { }
- return false;
+ public override bool GossipHello(Player Player, bool reportUse)
+ {
+ if (me.GetGoType() == GameObjectTypes.Goober)
+ me.SummonCreature(GameobjectConst.NpcGoggeroc, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.TimedDespawnOOC, 300000);
+
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_resonite_caskAI(go);
}
}
@@ -433,12 +533,22 @@ namespace Scripts.World
{
public go_sacred_fire_of_life() : base("go_sacred_fire_of_life") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_sacred_fire_of_lifeAI : GameObjectAI
{
- if (go.GetGoType() == GameObjectTypes.Goober)
- player.SummonCreature(GameobjectConst.NpcArikara, -5008.338f, -2118.894f, 83.657f, 0.874f, TempSummonType.TimedDespawnOOC, 30000);
+ public go_sacred_fire_of_lifeAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (me.GetGoType() == GameObjectTypes.Goober)
+ player.SummonCreature(GameobjectConst.NpcArikara, -5008.338f, -2118.894f, 83.657f, 0.874f, TempSummonType.TimedDespawnOOC, 30000);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_sacred_fire_of_lifeAI(go);
}
}
@@ -447,30 +557,40 @@ namespace Scripts.World
{
public go_shrine_of_the_birds() : base("go_shrine_of_the_birds") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_shrine_of_the_birdsAI : GameObjectAI
{
- uint BirdEntry = 0;
+ public go_shrine_of_the_birdsAI(GameObject go) : base(go) { }
- float fX, fY, fZ;
- go.GetClosePoint(out fX, out fY, out fZ, go.GetCombatReach(), SharedConst.InteractionDistance);
-
- switch (go.GetEntry())
+ public override bool GossipHello(Player player, bool reportUse)
{
- case GameobjectConst.GoShrineHawk:
- BirdEntry = GameobjectConst.NpcHawkGuard;
- break;
- case GameobjectConst.GoShrineEagle:
- BirdEntry = GameobjectConst.NpcEagleGuard;
- break;
- case GameobjectConst.GoShrineFalcon:
- BirdEntry = GameobjectConst.NpcFalconGuard;
- break;
+ uint BirdEntry = 0;
+
+ float fX, fY, fZ;
+ me.GetClosePoint(out fX, out fY, out fZ, me.GetCombatReach(), SharedConst.InteractionDistance);
+
+ switch (me.GetEntry())
+ {
+ case GameobjectConst.GoShrineHawk:
+ BirdEntry = GameobjectConst.NpcHawkGuard;
+ break;
+ case GameobjectConst.GoShrineEagle:
+ BirdEntry = GameobjectConst.NpcEagleGuard;
+ break;
+ case GameobjectConst.GoShrineFalcon:
+ BirdEntry = GameobjectConst.NpcFalconGuard;
+ break;
+ }
+
+ if (BirdEntry != 0)
+ player.SummonCreature(BirdEntry, fX, fY, fZ, me.GetOrientation(), TempSummonType.TimedDespawnOOC, 60000);
+
+ return false;
}
+ }
- if (BirdEntry != 0)
- player.SummonCreature(BirdEntry, fX, fY, fZ, go.GetOrientation(), TempSummonType.TimedDespawnOOC, 60000);
-
- return false;
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_shrine_of_the_birdsAI(go);
}
}
@@ -479,16 +599,26 @@ namespace Scripts.World
{
public go_southfury_moonstone() : base("go_southfury_moonstone") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_southfury_moonstoneAI : GameObjectAI
{
- //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);
+ public go_southfury_moonstoneAI(GameObject go) : base(go) { }
- Creature creature = player.SummonCreature(GameobjectConst.NpcRizzle, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.DeadDespawn, 0);
- if (creature)
- creature.CastSpell(player, GameobjectConst.SpellBlackjack, false);
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ //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);
- return false;
+ Creature creature = player.SummonCreature(GameobjectConst.NpcRizzle, 0.0f, 0.0f, 0.0f, 0.0f, TempSummonType.DeadDespawn, 0);
+ if (creature)
+ creature.CastSpell(player, GameobjectConst.SpellBlackjack, false);
+
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_southfury_moonstoneAI(go);
}
}
@@ -497,14 +627,24 @@ namespace Scripts.World
{
public go_tele_to_dalaran_crystal() : base("go_tele_to_dalaran_crystal") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_tele_to_dalaran_crystalAI : GameObjectAI
{
- if (player.GetQuestRewardStatus(GameobjectConst.QuestTeleCrystalFlag))
- return false;
+ public go_tele_to_dalaran_crystalAI(GameObject go) : base(go) { }
- player.GetSession().SendNotification(GameobjectConst.GoTeleToDalaranCrystalFailed);
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.GetQuestRewardStatus(GameobjectConst.QuestTeleCrystalFlag))
+ return false;
- return true;
+ player.GetSession().SendNotification(GameobjectConst.GoTeleToDalaranCrystalFailed);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_tele_to_dalaran_crystalAI(go);
}
}
@@ -513,12 +653,22 @@ namespace Scripts.World
{
public go_tele_to_violet_stand() : base("go_tele_to_violet_stand") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_tele_to_violet_standAI : GameObjectAI
{
- if (player.GetQuestRewardStatus(GameobjectConst.QuestLearnLeaveReturn) || player.GetQuestStatus(GameobjectConst.QuestLearnLeaveReturn) == QuestStatus.Incomplete)
- return false;
+ public go_tele_to_violet_standAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.GetQuestRewardStatus(GameobjectConst.QuestLearnLeaveReturn) || player.GetQuestStatus(GameobjectConst.QuestLearnLeaveReturn) == QuestStatus.Incomplete)
+ return false;
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_tele_to_violet_standAI(go);
}
}
@@ -527,41 +677,52 @@ namespace Scripts.World
{
public go_fel_crystalforge() : base("go_fel_crystalforge") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_fel_crystalforgeAI : GameObjectAI
{
- if (go.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */
- player.PrepareQuestMenu(go.GetGUID()); /* return true*/
+ public go_fel_crystalforgeAI(GameObject go) : base(go) { }
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */
+ player.PrepareQuestMenu(me.GetGUID()); /* return true*/
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeText, go.GetGUID());
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- return true;
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeText, me.GetGUID());
+
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef:
+ player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfBeast, false);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeItemTextReturn, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 1:
+ player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeItemTextReturn, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 2:
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeText, me.GetGUID());
+ break;
+ }
+ return true;
+ }
}
- public override bool OnGossipSelect(Player player, GameObject go, uint sender, uint action)
+ public override GameObjectAI GetAI(GameObject go)
{
- player.PlayerTalkClass.ClearMenus();
- switch (action)
- {
- case eTradeskill.GossipActionInfoDef:
- player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfBeast, false);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeItemTextReturn, go.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 1:
- player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeItemTextReturn, go.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 2:
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipFelCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipFelCrystalforgeText, go.GetGUID());
- break;
- }
- return true;
+ return new go_fel_crystalforgeAI(go);
}
}
@@ -570,41 +731,52 @@ namespace Scripts.World
{
public go_bashir_crystalforge() : base("go_bashir_crystalforge") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_bashir_crystalforgeAI : GameObjectAI
{
- if (go.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */
- player.PrepareQuestMenu(go.GetGUID()); /* return true*/
+ public go_bashir_crystalforgeAI(GameObject go) : base(go) { }
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (me.GetGoType() == GameObjectTypes.QuestGiver) /* != GAMEOBJECT_TYPE_QUESTGIVER) */
+ player.PrepareQuestMenu(me.GetGUID()); /* return true*/
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeText, go.GetGUID());
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- return true;
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeText, me.GetGUID());
+
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef:
+ player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfSorcerer, false);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 1:
+ player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 2:
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeText, me.GetGUID());
+ break;
+ }
+ return true;
+ }
}
- public override bool OnGossipSelect(Player player, GameObject go, uint sender, uint action)
+ public override GameObjectAI GetAI(GameObject go)
{
- player.PlayerTalkClass.ClearMenus();
- switch (action)
- {
- case eTradeskill.GossipActionInfoDef:
- player.CastSpell(player, GameobjectConst.SpellCreate1FlaskOfSorcerer, false);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, go.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 1:
- player.CastSpell(player, GameobjectConst.SpellCreate5FlaskOfBeast, false);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItemReturn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeItemTextReturn, go.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 2:
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipBashirCrystalforgeItem5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipBashirCrystalforgeText, go.GetGUID());
- break;
- }
- return true;
+ return new go_bashir_crystalforgeAI(go);
}
}
@@ -613,42 +785,52 @@ namespace Scripts.World
{
public go_matrix_punchograph() : base("go_matrix_punchograph") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_matrix_punchographAI : GameObjectAI
{
- switch (go.GetEntry())
+ public go_matrix_punchographAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- case GameobjectConst.MatrixPunchograph3005A:
- if (player.HasItemCount(GameobjectConst.ItemWhitePunchCard))
- {
- player.DestroyItemCount(GameobjectConst.ItemWhitePunchCard, 1, true);
- player.CastSpell(player, GameobjectConst.SpellYellowPunchCard, true);
- }
- break;
- case GameobjectConst.MatrixPunchograph3005B:
- if (player.HasItemCount(GameobjectConst.ItemYellowPunchCard))
- {
- player.DestroyItemCount(GameobjectConst.ItemYellowPunchCard, 1, true);
- player.CastSpell(player, GameobjectConst.SpellBluePunchCard, true);
- }
- break;
- case GameobjectConst.MatrixPunchograph3005C:
- if (player.HasItemCount(GameobjectConst.ItemBluePunchCard))
- {
- player.DestroyItemCount(GameobjectConst.ItemBluePunchCard, 1, true);
- player.CastSpell(player, GameobjectConst.SpellRedPunchCard, true);
- }
- break;
- case GameobjectConst.MatrixPunchograph3005D:
- if (player.HasItemCount(GameobjectConst.ItemRedPunchCard))
- {
- player.DestroyItemCount(GameobjectConst.ItemRedPunchCard, 1, true);
- player.CastSpell(player, GameobjectConst.SpellPrismaticPunchCard, true);
- }
- break;
- default:
- break;
+ switch (me.GetEntry())
+ {
+ case GameobjectConst.MatrixPunchograph3005A:
+ if (player.HasItemCount(GameobjectConst.ItemWhitePunchCard))
+ {
+ player.DestroyItemCount(GameobjectConst.ItemWhitePunchCard, 1, true);
+ player.CastSpell(player, GameobjectConst.SpellYellowPunchCard, true);
+ }
+ break;
+ case GameobjectConst.MatrixPunchograph3005B:
+ if (player.HasItemCount(GameobjectConst.ItemYellowPunchCard))
+ {
+ player.DestroyItemCount(GameobjectConst.ItemYellowPunchCard, 1, true);
+ player.CastSpell(player, GameobjectConst.SpellBluePunchCard, true);
+ }
+ break;
+ case GameobjectConst.MatrixPunchograph3005C:
+ if (player.HasItemCount(GameobjectConst.ItemBluePunchCard))
+ {
+ player.DestroyItemCount(GameobjectConst.ItemBluePunchCard, 1, true);
+ player.CastSpell(player, GameobjectConst.SpellRedPunchCard, true);
+ }
+ break;
+ case GameobjectConst.MatrixPunchograph3005D:
+ if (player.HasItemCount(GameobjectConst.ItemRedPunchCard))
+ {
+ player.DestroyItemCount(GameobjectConst.ItemRedPunchCard, 1, true);
+ player.CastSpell(player, GameobjectConst.SpellPrismaticPunchCard, true);
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
}
- return false;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_matrix_punchographAI(go);
}
}
@@ -657,17 +839,27 @@ namespace Scripts.World
{
public go_scourge_cage() : base("go_scourge_cage") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_scourge_cageAI : GameObjectAI
{
- go.UseDoorOrButton();
- Creature pNearestPrisoner = go.FindNearestCreature(GameobjectConst.NpcScourgePrisoner, 5.0f, true);
- if (pNearestPrisoner)
- {
- player.KilledMonsterCredit(GameobjectConst.NpcScourgePrisoner, pNearestPrisoner.GetGUID());
- pNearestPrisoner.DisappearAndDie();
- }
+ public go_scourge_cageAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ me.UseDoorOrButton();
+ Creature pNearestPrisoner = me.FindNearestCreature(GameobjectConst.NpcScourgePrisoner, 5.0f, true);
+ if (pNearestPrisoner)
+ {
+ player.KilledMonsterCredit(GameobjectConst.NpcScourgePrisoner, pNearestPrisoner.GetGUID());
+ pNearestPrisoner.DisappearAndDie();
+ }
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_scourge_cageAI(go);
}
}
@@ -676,15 +868,25 @@ namespace Scripts.World
{
public go_arcane_prison() : base("go_arcane_prison") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_arcane_prisonAI : GameObjectAI
{
- if (player.GetQuestStatus(GameobjectConst.QuestPrisonBreak) == QuestStatus.Incomplete)
+ public go_arcane_prisonAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- go.SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TempSummonType.TimedDespawn, 60000);
- player.CastSpell(player, GameobjectConst.SpellArcanePrisonerKillCredit, true);
- return true;
+ if (player.GetQuestStatus(GameobjectConst.QuestPrisonBreak) == QuestStatus.Incomplete)
+ {
+ me.SummonCreature(25318, 3485.089844f, 6115.7422188f, 70.966812f, 0, TempSummonType.TimedDespawn, 60000);
+ player.CastSpell(player, GameobjectConst.SpellArcanePrisonerKillCredit, true);
+ return true;
+ }
+ return false;
}
- return false;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_arcane_prisonAI(go);
}
}
@@ -693,12 +895,22 @@ namespace Scripts.World
{
public go_blood_filled_orb() : base("go_blood_filled_orb") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_blood_filled_orbAI : GameObjectAI
{
- if (go.GetGoType() == GameObjectTypes.Goober)
- player.SummonCreature(GameobjectConst.NpcZelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOOC, 30000);
+ public go_blood_filled_orbAI(GameObject go) : base(go) { }
- return true;
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (me.GetGoType() == GameObjectTypes.Goober)
+ player.SummonCreature(GameobjectConst.NpcZelemar, -369.746f, 166.759f, -21.50f, 5.235f, TempSummonType.TimedDespawnOOC, 30000);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_blood_filled_orbAI(go);
}
}
@@ -707,41 +919,51 @@ namespace Scripts.World
{
public go_jotunheim_cage() : base("go_jotunheim_cage") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_jotunheim_cageAI : GameObjectAI
{
- go.UseDoorOrButton();
- Creature pPrisoner = go.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerHuman, 5.0f, true);
- if (!pPrisoner)
+ public go_jotunheim_cageAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- pPrisoner = go.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerTroll, 5.0f, true);
+ me.UseDoorOrButton();
+ Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerHuman, 5.0f, true);
if (!pPrisoner)
{
- pPrisoner = go.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerOrc, 5.0f, true);
+ pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerTroll, 5.0f, true);
if (!pPrisoner)
- pPrisoner = go.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerNe, 5.0f, true);
+ {
+ pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerOrc, 5.0f, true);
+ if (!pPrisoner)
+ pPrisoner = me.FindNearestCreature(GameobjectConst.NpcEbonBladePrisonerNe, 5.0f, true);
+ }
}
- }
- if (!pPrisoner || !pPrisoner.IsAlive())
- return false;
+ if (!pPrisoner || !pPrisoner.IsAlive())
+ return false;
- pPrisoner.DisappearAndDie();
- player.KilledMonsterCredit(GameobjectConst.NpcEbonBladePrisonerHuman);
- switch (pPrisoner.GetEntry())
- {
- case GameobjectConst.NpcEbonBladePrisonerHuman:
- player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightH, true);
- break;
- case GameobjectConst.NpcEbonBladePrisonerNe:
- player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightNe, true);
- break;
- case GameobjectConst.NpcEbonBladePrisonerTroll:
- player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightTroll, true);
- break;
- case GameobjectConst.NpcEbonBladePrisonerOrc:
- player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightOrc, true);
- break;
+ pPrisoner.DisappearAndDie();
+ player.KilledMonsterCredit(GameobjectConst.NpcEbonBladePrisonerHuman);
+ switch (pPrisoner.GetEntry())
+ {
+ case GameobjectConst.NpcEbonBladePrisonerHuman:
+ player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightH, true);
+ break;
+ case GameobjectConst.NpcEbonBladePrisonerNe:
+ player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightNe, true);
+ break;
+ case GameobjectConst.NpcEbonBladePrisonerTroll:
+ player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightTroll, true);
+ break;
+ case GameobjectConst.NpcEbonBladePrisonerOrc:
+ player.CastSpell(player, GameobjectConst.SpellSummonBladeKnightOrc, true);
+ break;
+ }
+ return true;
}
- return true;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_jotunheim_cageAI(go);
}
}
@@ -750,14 +972,24 @@ namespace Scripts.World
{
public go_table_theka() : base("go_table_theka") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_table_thekaAI : GameObjectAI
{
- if (player.GetQuestStatus(GameobjectConst.QuestSpiderGold) == QuestStatus.Incomplete)
- player.AreaExploredOrEventHappens(GameobjectConst.QuestSpiderGold);
+ public go_table_thekaAI(GameObject go) : base(go) { }
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipTableTheka, go.GetGUID());
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.GetQuestStatus(GameobjectConst.QuestSpiderGold) == QuestStatus.Incomplete)
+ player.AreaExploredOrEventHappens(GameobjectConst.QuestSpiderGold);
- return true;
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipTableTheka, me.GetGUID());
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_table_thekaAI(go);
}
}
@@ -766,14 +998,24 @@ namespace Scripts.World
{
public go_inconspicuous_landmark() : base("go_inconspicuous_landmark") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_inconspicuous_landmarkAI : GameObjectAI
{
- if (player.HasItemCount(GameobjectConst.ItemCuergosKey))
- return false;
+ public go_inconspicuous_landmarkAI(GameObject go) : base(go) { }
- player.CastSpell(player, GameobjectConst.SpellSummonPiratesTreasureAndTriggerMob, true);
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ if (player.HasItemCount(GameobjectConst.ItemCuergosKey))
+ return false;
- return true;
+ player.CastSpell(player, GameobjectConst.SpellSummonPiratesTreasureAndTriggerMob, true);
+
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_inconspicuous_landmarkAI(go);
}
}
@@ -791,7 +1033,7 @@ namespace Scripts.World
if (!reportUse)
return true;
- Unit owner = go.GetOwner();
+ Unit owner = me.GetOwner();
if (!owner || !owner.IsTypeId(TypeId.Player) || !player.IsInSameRaidWith(owner.ToPlayer()))
return true;
return false;
@@ -804,31 +1046,41 @@ namespace Scripts.World
{
public go_dragonflayer_cage() : base("go_dragonflayer_cage") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_dragonflayer_cageAI : GameObjectAI
{
- go.UseDoorOrButton();
- if (player.GetQuestStatus(GameobjectConst.QuestPrisonersOfWyrmskull) != QuestStatus.Incomplete)
- return true;
+ public go_dragonflayer_cageAI(GameObject go) : base(go) { }
- Creature pPrisoner = go.FindNearestCreature(GameobjectConst.NpcPrisonerPriest, 2.0f);
- if (!pPrisoner)
+ public override bool GossipHello(Player player, bool reportUse)
{
- pPrisoner = go.FindNearestCreature(GameobjectConst.NpcPrisonerMage, 2.0f);
+ me.UseDoorOrButton();
+ if (player.GetQuestStatus(GameobjectConst.QuestPrisonersOfWyrmskull) != QuestStatus.Incomplete)
+ return true;
+
+ Creature pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerPriest, 2.0f);
if (!pPrisoner)
{
- pPrisoner = go.FindNearestCreature(GameobjectConst.NpcPrisonerWarrior, 2.0f);
+ pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerMage, 2.0f);
if (!pPrisoner)
- pPrisoner = go.FindNearestCreature(GameobjectConst.NpcPrisonerPaladin, 2.0f);
+ {
+ pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerWarrior, 2.0f);
+ if (!pPrisoner)
+ pPrisoner = me.FindNearestCreature(GameobjectConst.NpcPrisonerPaladin, 2.0f);
+ }
}
- }
- if (!pPrisoner || !pPrisoner.IsAlive())
+ if (!pPrisoner || !pPrisoner.IsAlive())
+ return true;
+
+ // @todo prisoner should help player for a short period of time
+ player.KilledMonsterCredit(GameobjectConst.NpcCapturedValgardePrisonerProxy);
+ pPrisoner.DespawnOrUnsummon();
return true;
+ }
+ }
- // @todo prisoner should help player for a short period of time
- player.KilledMonsterCredit(GameobjectConst.NpcCapturedValgardePrisonerProxy);
- pPrisoner.DespawnOrUnsummon();
- return true;
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_dragonflayer_cageAI(go);
}
}
@@ -837,20 +1089,30 @@ namespace Scripts.World
{
public go_tadpole_cage() : base("go_tadpole_cage") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_tadpole_cageAI : GameObjectAI
{
- go.UseDoorOrButton();
- if (player.GetQuestStatus(GameobjectConst.QuestOhNoesTheTadpoles) == QuestStatus.Incomplete)
+ public go_tadpole_cageAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- Creature pTadpole = go.FindNearestCreature(GameobjectConst.NpcWinterfinTadpole, 1.0f);
- if (pTadpole)
+ me.UseDoorOrButton();
+ if (player.GetQuestStatus(GameobjectConst.QuestOhNoesTheTadpoles) == QuestStatus.Incomplete)
{
- pTadpole.DisappearAndDie();
- player.KilledMonsterCredit(GameobjectConst.NpcWinterfinTadpole);
- //FIX: Summon minion tadpole
+ Creature pTadpole = me.FindNearestCreature(GameobjectConst.NpcWinterfinTadpole, 1.0f);
+ if (pTadpole)
+ {
+ pTadpole.DisappearAndDie();
+ player.KilledMonsterCredit(GameobjectConst.NpcWinterfinTadpole);
+ //FIX: Summon minion tadpole
+ }
}
+ return true;
}
- return true;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_tadpole_cageAI(go);
}
}
@@ -859,44 +1121,55 @@ namespace Scripts.World
{
public go_amberpine_outhouse() : base("go_amberpine_outhouse") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_amberpine_outhouseAI : GameObjectAI
{
- QuestStatus status = player.GetQuestStatus(GameobjectConst.QuestDoingYourDuty);
- if (status == QuestStatus.Incomplete || status == QuestStatus.Complete || status == QuestStatus.Rewarded)
- {
- player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipUseOuthouse, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipOuthouseVacant, go.GetGUID());
- }
- else
- player.SEND_GOSSIP_MENU(GameobjectConst.GossipOuthouseInuse, go.GetGUID());
+ public go_amberpine_outhouseAI(GameObject go) : base(go) { }
- return true;
- }
-
- public override bool OnGossipSelect(Player player, GameObject go, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
- if (action == eTradeskill.GossipActionInfoDef + 1)
+ public override bool GossipHello(Player player, bool reportUse)
{
- player.CLOSE_GOSSIP_MENU();
- Creature target = ScriptedAI.GetClosestCreatureWithEntry(player, GameobjectConst.NpcOuthouseBunny, 3.0f);
- if (target)
+ QuestStatus status = player.GetQuestStatus(GameobjectConst.QuestDoingYourDuty);
+ if (status == QuestStatus.Incomplete || status == QuestStatus.Complete || status == QuestStatus.Rewarded)
{
- target.GetAI().SetData(1, (uint)player.GetGender());
- go.CastSpell(target, GameobjectConst.SpellIndisposedIii);
+ player.ADD_GOSSIP_ITEM(GossipOptionIcon.Chat, GameobjectConst.GossipUseOuthouse, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipOuthouseVacant, me.GetGUID());
}
- go.CastSpell(player, GameobjectConst.SpellIndisposed);
- if (player.HasItemCount(GameobjectConst.ItemAnderholsSliderCider))
- go.CastSpell(player, GameobjectConst.SpellCreateAmberseeds);
+ else
+ player.SEND_GOSSIP_MENU(GameobjectConst.GossipOuthouseInuse, me.GetGUID());
+
return true;
}
- else
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
- player.CLOSE_GOSSIP_MENU();
- player.GetSession().SendNotification(GameobjectConst.GoAnderholsSliderCiderNotFound);
- return false;
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ if (action == eTradeskill.GossipActionInfoDef + 1)
+ {
+ player.CLOSE_GOSSIP_MENU();
+ Creature target = ScriptedAI.GetClosestCreatureWithEntry(player, GameobjectConst.NpcOuthouseBunny, 3.0f);
+ if (target)
+ {
+ target.GetAI().SetData(1, (uint)player.GetGender());
+ me.CastSpell(target, GameobjectConst.SpellIndisposedIii);
+ }
+ me.CastSpell(player, GameobjectConst.SpellIndisposed);
+ if (player.HasItemCount(GameobjectConst.ItemAnderholsSliderCider))
+ me.CastSpell(player, GameobjectConst.SpellCreateAmberseeds);
+ return true;
+ }
+ else
+ {
+ player.CLOSE_GOSSIP_MENU();
+ player.GetSession().SendNotification(GameobjectConst.GoAnderholsSliderCiderNotFound);
+ return false;
+ }
}
}
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_amberpine_outhouseAI(go);
+ }
}
[Script] //go_hive_pod
@@ -904,12 +1177,22 @@ namespace Scripts.World
{
public go_hive_pod() : base("go_hive_pod") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_hive_podAI : GameObjectAI
{
- player.SendLoot(go.GetGUID(), LootType.Corpse);
- go.SummonCreature(GameobjectConst.NpcHiveAmbusher, go.GetPositionX() + 1, go.GetPositionY(), go.GetPositionZ(), go.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000);
- go.SummonCreature(GameobjectConst.NpcHiveAmbusher, go.GetPositionX(), go.GetPositionY() + 1, go.GetPositionZ(), go.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000);
- return true;
+ public go_hive_podAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ player.SendLoot(me.GetGUID(), LootType.Corpse);
+ me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX() + 1, me.GetPositionY(), me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000);
+ me.SummonCreature(GameobjectConst.NpcHiveAmbusher, me.GetPositionX(), me.GetPositionY() + 1, me.GetPositionZ(), me.GetAngle(player), TempSummonType.TimedOrDeadDespawn, 60000);
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_hive_podAI(go);
}
}
@@ -918,10 +1201,20 @@ namespace Scripts.World
{
public go_massive_seaforium_charge() : base("go_massive_seaforium_charge") { }
- public override bool OnGossipHello(Player Player, GameObject go)
+ class go_massive_seaforium_chargeAI : GameObjectAI
{
- go.SetLootState(LootState.JustDeactivated);
- return true;
+ public go_massive_seaforium_chargeAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player Player, bool reportUse)
+ {
+ me.SetLootState(LootState.JustDeactivated);
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_massive_seaforium_chargeAI(go);
}
}
@@ -930,23 +1223,33 @@ namespace Scripts.World
{
public go_veil_skith_cage() : base("go_veil_skith_cage") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_veil_skith_cageAI : GameObjectAI
{
- go.UseDoorOrButton();
- if (player.GetQuestStatus(GameobjectConst.QuestMissingFriends) == QuestStatus.Incomplete)
+ public go_veil_skith_cageAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- List childrenList = new List();
- go.GetCreatureListWithEntryInGrid(childrenList, GameobjectConst.NpcCaptiveChild, SharedConst.InteractionDistance);
- foreach (var creature in childrenList)
+ me.UseDoorOrButton();
+ if (player.GetQuestStatus(GameobjectConst.QuestMissingFriends) == QuestStatus.Incomplete)
{
- player.KilledMonsterCredit(GameobjectConst.NpcCaptiveChild, creature.GetGUID());
- creature.DespawnOrUnsummon(5000);
- creature.GetMotionMaster().MovePoint(1, go.GetPositionX() + 5, go.GetPositionY(), go.GetPositionZ());
- creature.GetAI().Talk(GameobjectConst.SayFree0);
- creature.GetMotionMaster().Clear();
+ List childrenList = new List();
+ me.GetCreatureListWithEntryInGrid(childrenList, GameobjectConst.NpcCaptiveChild, SharedConst.InteractionDistance);
+ foreach (var creature in childrenList)
+ {
+ player.KilledMonsterCredit(GameobjectConst.NpcCaptiveChild, creature.GetGUID());
+ creature.DespawnOrUnsummon(5000);
+ creature.GetMotionMaster().MovePoint(1, me.GetPositionX() + 5, me.GetPositionY(), me.GetPositionZ());
+ creature.GetAI().Talk(GameobjectConst.SayFree0);
+ creature.GetMotionMaster().Clear();
+ }
}
+ return false;
}
- return false;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_veil_skith_cageAI(go);
}
}
@@ -955,16 +1258,26 @@ namespace Scripts.World
{
public go_frostblade_shrine() : base("go_frostblade_shrine") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_frostblade_shrineAI : GameObjectAI
{
- go.UseDoorOrButton(10);
- if (!player.HasAura(GameobjectConst.SpellRecentMeditation))
- if (player.GetQuestStatus(GameobjectConst.QuestTheCleansingHorde) == QuestStatus.Incomplete || player.GetQuestStatus(GameobjectConst.QuestTheCleansingAlliance) == QuestStatus.Incomplete)
- {
- player.CastSpell(player, GameobjectConst.SpellCleansingSoul);
- player.SetStandState(UnitStandStateType.Sit);
- }
- return true;
+ public go_frostblade_shrineAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
+ {
+ me.UseDoorOrButton(10);
+ if (!player.HasAura(GameobjectConst.SpellRecentMeditation))
+ if (player.GetQuestStatus(GameobjectConst.QuestTheCleansingHorde) == QuestStatus.Incomplete || player.GetQuestStatus(GameobjectConst.QuestTheCleansingAlliance) == QuestStatus.Incomplete)
+ {
+ player.CastSpell(player, GameobjectConst.SpellCleansingSoul);
+ player.SetStandState(UnitStandStateType.Sit);
+ }
+ return true;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_frostblade_shrineAI(go);
}
}
@@ -973,11 +1286,21 @@ namespace Scripts.World
{
public go_midsummer_bonfire() : base("go_midsummer_bonfire") { }
- public override bool OnGossipSelect(Player player, GameObject go, uint sender, uint action)
+ class go_midsummer_bonfireAI : GameObjectAI
{
- player.CastSpell(player, GameobjectConst.StampOutBonfireQuestComplete, true);
- player.CLOSE_GOSSIP_MENU();
- return false;
+ public go_midsummer_bonfireAI(GameObject go) : base(go) { }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ player.CastSpell(player, GameobjectConst.StampOutBonfireQuestComplete, true);
+ player.CLOSE_GOSSIP_MENU();
+ return false;
+ }
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_midsummer_bonfireAI(go);
}
}
@@ -986,15 +1309,25 @@ namespace Scripts.World
{
public go_midsummer_ribbon_pole() : base("go_midsummer_ribbon_pole") { }
- public override bool OnGossipHello(Player player, GameObject go)
+ class go_midsummer_ribbon_poleAI : GameObjectAI
{
- Creature creature = go.FindNearestCreature(GameobjectConst.NpcPoleRibbonBunny, 10.0f);
- if (creature)
+ public go_midsummer_ribbon_poleAI(GameObject go) : base(go) { }
+
+ public override bool GossipHello(Player player, bool reportUse)
{
- creature.GetAI().DoAction(0);
- player.CastSpell(creature, GameobjectConst.SpellPoleDance, true);
+ Creature creature = me.FindNearestCreature(GameobjectConst.NpcPoleRibbonBunny, 10.0f);
+ if (creature)
+ {
+ creature.GetAI().DoAction(0);
+ player.CastSpell(creature, GameobjectConst.SpellPoleDance, true);
+ }
+ return true;
}
- return true;
+ }
+
+ public override GameObjectAI GetAI(GameObject go)
+ {
+ return new go_midsummer_ribbon_poleAI(go);
}
}
@@ -1009,7 +1342,7 @@ namespace Scripts.World
{
_scheduler.Schedule(TimeSpan.FromSeconds(3), task =>
{
- go.CastSpell(null, GameobjectConst.SpellToyTrainPulse, true);
+ me.CastSpell(null, GameobjectConst.SpellToyTrainPulse, true);
task.Repeat(TimeSpan.FromSeconds(6));
});
}
@@ -1022,7 +1355,7 @@ namespace Scripts.World
// triggered on wrecker'd
public override void DoAction(int action)
{
- go.Delete();
+ me.Delete();
}
}
@@ -1063,39 +1396,39 @@ namespace Scripts.World
if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.Brewfest)) // Check if Brewfest is active
break;
// Check if gob is correct area, play music, set time of music
- if (go.GetAreaId() == GameobjectConst.Silvermoon || go.GetAreaId() == GameobjectConst.Undercity || go.GetAreaId() == GameobjectConst.Orgrimmar1 || go.GetAreaId() == GameobjectConst.Orgrimmar2 || go.GetAreaId() == GameobjectConst.Thunderbluff || go.GetAreaId() == GameobjectConst.Shattrath)
+ if (me.GetAreaId() == GameobjectConst.Silvermoon || me.GetAreaId() == GameobjectConst.Undercity || me.GetAreaId() == GameobjectConst.Orgrimmar1 || me.GetAreaId() == GameobjectConst.Orgrimmar2 || me.GetAreaId() == GameobjectConst.Thunderbluff || me.GetAreaId() == GameobjectConst.Shattrath)
{
if (rnd == 0)
{
- go.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin01);
+ me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin01);
musicTime = GameobjectConst.EventBrewfestgoblin01Time;
}
else if (rnd == 1)
{
- go.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin02);
+ me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin02);
musicTime = GameobjectConst.EventBrewfestgoblin02Time;
}
else
{
- go.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin03);
+ me.PlayDirectMusic(GameobjectConst.EventBrewfestgoblin03);
musicTime = GameobjectConst.EventBrewfestgoblin03Time;
}
}
- if (go.GetAreaId() == GameobjectConst.Ironforge1 || go.GetAreaId() == GameobjectConst.Ironforge2 || go.GetAreaId() == GameobjectConst.Stormwind || go.GetAreaId() == GameobjectConst.Exodar || go.GetAreaId() == GameobjectConst.Darnassus || go.GetAreaId() == GameobjectConst.Shattrath)
+ if (me.GetAreaId() == GameobjectConst.Ironforge1 || me.GetAreaId() == GameobjectConst.Ironforge2 || me.GetAreaId() == GameobjectConst.Stormwind || me.GetAreaId() == GameobjectConst.Exodar || me.GetAreaId() == GameobjectConst.Darnassus || me.GetAreaId() == GameobjectConst.Shattrath)
{
if (rnd == 0)
{
- go.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf01);
+ me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf01);
musicTime = GameobjectConst.EventBrewfestdwarf01Time;
}
else if (rnd == 1)
{
- go.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf02);
+ me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf02);
musicTime = GameobjectConst.EventBrewfestdwarf02Time;
}
else
{
- go.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf03);
+ me.PlayDirectMusic(GameobjectConst.EventBrewfestdwarf03);
musicTime = GameobjectConst.EventBrewfestdwarf03Time;
}
}
@@ -1131,13 +1464,13 @@ namespace Scripts.World
if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.FireFestival))
return;
- var playersNearby = go.GetPlayerListInGrid(go.GetMap().GetVisibilityRange());
+ var playersNearby = me.GetPlayerListInGrid(me.GetMap().GetVisibilityRange());
foreach (var player in playersNearby)
{
if (player.GetTeam() == Team.Horde)
- go.PlayDirectMusic(12325, player);
+ me.PlayDirectMusic(12325, player);
else
- go.PlayDirectMusic(12319, player);
+ me.PlayDirectMusic(12319, player);
}
task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value)
@@ -1169,7 +1502,7 @@ namespace Scripts.World
{
if (Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireElwynn) || !Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireThunder) || !Global.GameEventMgr.IsHolidayActive(HolidayIds.DarkmoonFaireShattrath))
{
- go.PlayDirectMusic(8440);
+ me.PlayDirectMusic(8440);
task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value)
}
});
@@ -1200,7 +1533,7 @@ namespace Scripts.World
{
if (!Global.GameEventMgr.IsHolidayActive(HolidayIds.PiratesDay))
return;
- go.PlayDirectMusic(12845);
+ me.PlayDirectMusic(12845);
task.Repeat(TimeSpan.FromSeconds(5)); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value)
});
}
@@ -1228,16 +1561,16 @@ namespace Scripts.World
public override void InitializeAI()
{
- switch (go.GetEntry())
+ switch (me.GetEntry())
{
case GameobjectConst.GoHordeBell:
- _soundId = go.GetAreaId() == GameobjectConst.UndercityArea ? GameobjectConst.BellTollhorde : GameobjectConst.BellTolltribal;
+ _soundId = me.GetAreaId() == GameobjectConst.UndercityArea ? GameobjectConst.BellTollhorde : GameobjectConst.BellTolltribal;
break;
case GameobjectConst.GoAllianceBell:
{
- if (go.GetAreaId() == GameobjectConst.Ironforge1Area || go.GetAreaId() == GameobjectConst.Ironforge2Area)
+ if (me.GetAreaId() == GameobjectConst.Ironforge1Area || me.GetAreaId() == GameobjectConst.Ironforge2Area)
_soundId = GameobjectConst.BellTolldwarfgnome;
- else if (go.GetAreaId() == GameobjectConst.DarnassusArea || go.GetZoneId() == GameobjectConst.TeldrassilZone)
+ else if (me.GetAreaId() == GameobjectConst.DarnassusArea || me.GetZoneId() == GameobjectConst.TeldrassilZone)
_soundId = GameobjectConst.BellTollnightelf;
else
_soundId = GameobjectConst.BellTollalliance;
@@ -1271,7 +1604,7 @@ namespace Scripts.World
switch (eventId)
{
case GameobjectConst.EventRingBell:
- go.PlayDirectSound(_soundId);
+ me.PlayDirectSound(_soundId);
break;
default:
break;
diff --git a/Source/Scripts/World/NpcSpecial.cs b/Source/Scripts/World/NpcSpecial.cs
index 02e75bd29..93a78d2cb 100644
--- a/Source/Scripts/World/NpcSpecial.cs
+++ b/Source/Scripts/World/NpcSpecial.cs
@@ -629,22 +629,18 @@ namespace Scripts.World.NpcSpecial
break;
}
}
- }
- public override bool OnQuestAccept(Player player, Creature creature, Quest quest)
- {
- if (quest.Id == QuestConst.Cluck)
- ((npc_chicken_cluckAI)creature.GetAI()).Reset();
+ public override void QuestAccept(Player player, Quest quest)
+ {
+ if (quest.Id == QuestConst.Cluck)
+ Reset();
+ }
- return true;
- }
-
- public override bool OnQuestReward(Player player, Creature creature, Quest quest, uint opt)
- {
- if (quest.Id == QuestConst.Cluck)
- ((npc_chicken_cluckAI)creature.GetAI()).Reset();
-
- return true;
+ public override void QuestReward(Player player, Quest quest, uint opt)
+ {
+ if (quest.Id == QuestConst.Cluck)
+ Reset();
+ }
}
public override CreatureAI GetAI(Creature creature)
@@ -1022,6 +1018,12 @@ namespace Scripts.World.NpcSpecial
public override void EnterCombat(Unit who) { }
+ public override void QuestAccept(Player player, Quest quest)
+ {
+ if ((quest.Id == 6624) || (quest.Id == 6622))
+ BeginEvent(player);
+ }
+
ObjectGuid PlayerGUID;
uint SummonPatientTimer;
@@ -1035,14 +1037,6 @@ namespace Scripts.World.NpcSpecial
List Coordinates = new List();
}
- public override bool OnQuestAccept(Player player, Creature creature, Quest quest)
- {
- if ((quest.Id == 6624) || (quest.Id == 6622))
- ((npc_doctorAI)creature.GetAI()).BeginEvent(player);
-
- return true;
- }
-
public override CreatureAI GetAI(Creature creature)
{
return new npc_doctorAI(creature);
@@ -1332,117 +1326,129 @@ namespace Scripts.World.NpcSpecial
{
public npc_sayge() : base("npc_sayge") { }
- public override bool OnGossipHello(Player player, Creature creature)
+ class npc_saygeAI : ScriptedAI
{
- if (creature.IsQuestGiver())
- player.PrepareQuestMenu(creature.GetGUID());
+ public npc_saygeAI(Creature creature) : base(creature) { }
- if (player.GetSpellHistory().HasCooldown(Spells.Strength) ||
- player.GetSpellHistory().HasCooldown(Spells.Agility) ||
- player.GetSpellHistory().HasCooldown(Spells.Stamina) ||
- player.GetSpellHistory().HasCooldown(Spells.Spirit) ||
- player.GetSpellHistory().HasCooldown(Spells.Intellect) ||
- player.GetSpellHistory().HasCooldown(Spells.Armor) ||
- player.GetSpellHistory().HasCooldown(Spells.Damage) ||
- player.GetSpellHistory().HasCooldown(Spells.Resistance))
- player.SEND_GOSSIP_MENU(GossipMenus.CantGiveYouYour, creature.GetGUID());
- else
+ public override bool GossipHello(Player player)
{
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.IAmReadyToDiscover, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.SEND_GOSSIP_MENU(GossipMenus.IHaveLongKnown, creature.GetGUID());
+ if (me.IsQuestGiver())
+ player.PrepareQuestMenu(me.GetGUID());
+
+ if (player.GetSpellHistory().HasCooldown(Spells.Strength) ||
+ player.GetSpellHistory().HasCooldown(Spells.Agility) ||
+ player.GetSpellHistory().HasCooldown(Spells.Stamina) ||
+ player.GetSpellHistory().HasCooldown(Spells.Spirit) ||
+ player.GetSpellHistory().HasCooldown(Spells.Intellect) ||
+ player.GetSpellHistory().HasCooldown(Spells.Armor) ||
+ player.GetSpellHistory().HasCooldown(Spells.Damage) ||
+ player.GetSpellHistory().HasCooldown(Spells.Resistance))
+ player.SEND_GOSSIP_MENU(GossipMenus.CantGiveYouYour, me.GetGUID());
+ else
+ {
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.IAmReadyToDiscover, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.SEND_GOSSIP_MENU(GossipMenus.IHaveLongKnown, me.GetGUID());
+ }
+
+ return true;
}
- return true;
- }
-
- void SendAction(Player player, Creature creature, uint action)
- {
- switch (action)
+ void SendAction(Player player, uint action)
{
- case eTradeskill.GossipActionInfoDef + 1:
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
- player.SEND_GOSSIP_MENU(GossipMenus.YouHaveBeenTasked, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 2:
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 1, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef);
- player.SEND_GOSSIP_MENU(GossipMenus.SwornExecutioner, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 3:
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef);
- player.SEND_GOSSIP_MENU(GossipMenus.DiplomaticMission, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 4:
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 6, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 7, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 8, eTradeskill.GossipActionInfoDef);
- player.SEND_GOSSIP_MENU(GossipMenus.YourBrotherSeeks, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 5:
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef);
- player.SEND_GOSSIP_MENU(GossipMenus.ATerribleBeast, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef:
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge6, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6);
- player.SEND_GOSSIP_MENU(GossipMenus.YourFortuneIsCast, creature.GetGUID());
- break;
- case eTradeskill.GossipActionInfoDef + 6:
- creature.CastSpell(player, Spells.Fortune, false);
- player.SEND_GOSSIP_MENU(GossipMenus.HereIsYourFortune, creature.GetGUID());
- break;
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef + 1:
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge, GossipMenus.OptionIdAnswer4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
+ player.SEND_GOSSIP_MENU(GossipMenus.YouHaveBeenTasked, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 2:
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 1, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge2, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef);
+ player.SEND_GOSSIP_MENU(GossipMenus.SwornExecutioner, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 3:
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge3, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 2, eTradeskill.GossipActionInfoDef);
+ player.SEND_GOSSIP_MENU(GossipMenus.DiplomaticMission, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 4:
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 6, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 7, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge4, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 8, eTradeskill.GossipActionInfoDef);
+ player.SEND_GOSSIP_MENU(GossipMenus.YourBrotherSeeks, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 5:
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain + 5, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer2, eTradeskill.GossipSenderMain + 4, eTradeskill.GossipActionInfoDef);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge5, GossipMenus.OptionIdAnswer3, eTradeskill.GossipSenderMain + 3, eTradeskill.GossipActionInfoDef);
+ player.SEND_GOSSIP_MENU(GossipMenus.ATerribleBeast, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef:
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.OptionSayge6, GossipMenus.OptionIdAnswer1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6);
+ player.SEND_GOSSIP_MENU(GossipMenus.YourFortuneIsCast, me.GetGUID());
+ break;
+ case eTradeskill.GossipActionInfoDef + 6:
+ DoCast(player, Spells.Fortune, false);
+ player.SEND_GOSSIP_MENU(GossipMenus.HereIsYourFortune, me.GetGUID());
+ break;
+ }
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint sender = player.PlayerTalkClass.GetGossipOptionSender(gossipListId);
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+ uint spellId = 0;
+ switch (sender)
+ {
+ case eTradeskill.GossipSenderMain:
+ SendAction(player, action);
+ break;
+ case eTradeskill.GossipSenderMain + 1:
+ spellId = Spells.Damage;
+ break;
+ case eTradeskill.GossipSenderMain + 2:
+ spellId = Spells.Resistance;
+ break;
+ case eTradeskill.GossipSenderMain + 3:
+ spellId = Spells.Armor;
+ break;
+ case eTradeskill.GossipSenderMain + 4:
+ spellId = Spells.Spirit;
+ break;
+ case eTradeskill.GossipSenderMain + 5:
+ spellId = Spells.Intellect;
+ break;
+ case eTradeskill.GossipSenderMain + 6:
+ spellId = Spells.Stamina;
+ break;
+ case eTradeskill.GossipSenderMain + 7:
+ spellId = Spells.Strength;
+ break;
+ case eTradeskill.GossipSenderMain + 8:
+ spellId = Spells.Agility;
+ break;
+ }
+
+ if (spellId != 0)
+ {
+ DoCast(player, spellId, false);
+ player.GetSpellHistory().AddCooldown(spellId, 0, TimeSpan.FromHours(2));
+ SendAction(player, action);
+ }
+ return true;
}
}
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
+ public override CreatureAI GetAI(Creature creature)
{
- player.PlayerTalkClass.ClearMenus();
- uint spellId = 0;
- switch (sender)
- {
- case eTradeskill.GossipSenderMain:
- SendAction(player, creature, action);
- break;
- case eTradeskill.GossipSenderMain + 1:
- spellId = Spells.Damage;
- break;
- case eTradeskill.GossipSenderMain + 2:
- spellId = Spells.Resistance;
- break;
- case eTradeskill.GossipSenderMain + 3:
- spellId = Spells.Armor;
- break;
- case eTradeskill.GossipSenderMain + 4:
- spellId = Spells.Spirit;
- break;
- case eTradeskill.GossipSenderMain + 5:
- spellId = Spells.Intellect;
- break;
- case eTradeskill.GossipSenderMain + 6:
- spellId = Spells.Stamina;
- break;
- case eTradeskill.GossipSenderMain + 7:
- spellId = Spells.Strength;
- break;
- case eTradeskill.GossipSenderMain + 8:
- spellId = Spells.Agility;
- break;
- }
-
- if (spellId != 0)
- {
- creature.CastSpell(player, spellId, false);
- player.GetSpellHistory().AddCooldown(spellId, 0, TimeSpan.FromHours(2));
- SendAction(player, creature, action);
- }
- return true;
+ return new npc_saygeAI(creature);
}
}
@@ -1627,71 +1633,67 @@ namespace Scripts.World.NpcSpecial
Initialize();
}
- public override uint GetData(uint type)
+ public override bool GossipHello(Player player)
{
- return (type == NpcSpecialConst.DataShowUnderground && _showUnderground) ? 1 : 0u;
+ if (me.IsSummon())
+ {
+ if (player == me.ToTempSummon().GetSummoner())
+ {
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
+
+ if (_showUnderground)
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole6, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6);
+
+ player.SEND_GOSSIP_MENU(Texts.Wormhole, me.GetGUID());
+ }
+ }
+
+ return true;
+ }
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
+ {
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef + 1: // Borean Tundra
+ player.CLOSE_GOSSIP_MENU();
+ DoCast(player, Spells.BoreanTundra, false);
+ break;
+ case eTradeskill.GossipActionInfoDef + 2: // Howling Fjord
+ player.CLOSE_GOSSIP_MENU();
+ DoCast(player, Spells.HowlingFjord, false);
+ break;
+ case eTradeskill.GossipActionInfoDef + 3: // Sholazar Basin
+ player.CLOSE_GOSSIP_MENU();
+ DoCast(player, Spells.SholazarBasin, false);
+ break;
+ case eTradeskill.GossipActionInfoDef + 4: // Icecrown
+ player.CLOSE_GOSSIP_MENU();
+ DoCast(player, Spells.Icecrown, false);
+ break;
+ case eTradeskill.GossipActionInfoDef + 5: // Storm peaks
+ player.CLOSE_GOSSIP_MENU();
+ DoCast(player, Spells.StormPeaks, false);
+ break;
+ case eTradeskill.GossipActionInfoDef + 6: // Underground
+ player.CLOSE_GOSSIP_MENU();
+ DoCast(player, Spells.Underground, false);
+ break;
+ }
+
+ return true;
}
bool _showUnderground;
}
- public override bool OnGossipHello(Player player, Creature creature)
- {
- if (creature.IsSummon())
- {
- if (player == creature.ToTempSummon().GetSummoner())
- {
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole1, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole2, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole3, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 3);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole4, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 4);
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole5, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 5);
-
- if (creature.GetAI().GetData(NpcSpecialConst.DataShowUnderground) != 0)
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdWormhole, GossipMenus.OptionIdWormhole6, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 6);
-
- player.SEND_GOSSIP_MENU(Texts.Wormhole, creature.GetGUID());
- }
- }
-
- return true;
- }
-
- public override bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
- {
- player.PlayerTalkClass.ClearMenus();
-
- switch (action)
- {
- case eTradeskill.GossipActionInfoDef + 1: // Borean Tundra
- player.CLOSE_GOSSIP_MENU();
- creature.CastSpell(player, Spells.BoreanTundra, false);
- break;
- case eTradeskill.GossipActionInfoDef + 2: // Howling Fjord
- player.CLOSE_GOSSIP_MENU();
- creature.CastSpell(player, Spells.HowlingFjord, false);
- break;
- case eTradeskill.GossipActionInfoDef + 3: // Sholazar Basin
- player.CLOSE_GOSSIP_MENU();
- creature.CastSpell(player, Spells.SholazarBasin, false);
- break;
- case eTradeskill.GossipActionInfoDef + 4: // Icecrown
- player.CLOSE_GOSSIP_MENU();
- creature.CastSpell(player, Spells.Icecrown, false);
- break;
- case eTradeskill.GossipActionInfoDef + 5: // Storm peaks
- player.CLOSE_GOSSIP_MENU();
- creature.CastSpell(player, Spells.StormPeaks, false);
- break;
- case eTradeskill.GossipActionInfoDef + 6: // Underground
- player.CLOSE_GOSSIP_MENU();
- creature.CastSpell(player, Spells.Underground, false);
- break;
- }
-
- return true;
- }
-
public override CreatureAI GetAI(Creature creature)
{
return new npc_wormholeAI(creature);
@@ -1703,37 +1705,48 @@ namespace Scripts.World.NpcSpecial
{
public npc_experience() : base("npc_experience") { }
- public override bool OnGossipHello(Player player, Creature creature)
+ class npc_experienceAI : ScriptedAI
{
- if (player.HasPlayerFlag(PlayerFlags.NoXPGain)) // not gaining XP
+ public npc_experienceAI(Creature creature) : base(creature) { }
+
+ public override bool GossipHello(Player player)
{
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
- player.SEND_GOSSIP_MENU(Texts.XpOnOff, creature.GetGUID());
+ if (player.HasPlayerFlag(PlayerFlags.NoXPGain)) // not gaining XP
+ {
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOn, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 1);
+ player.SEND_GOSSIP_MENU(Texts.XpOnOff, me.GetGUID());
+ }
+ else // currently gaining XP
+ {
+ player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOff, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
+ player.SEND_GOSSIP_MENU(Texts.XpOnOff, me.GetGUID());
+ }
+ return true;
}
- else // currently gaining XP
+
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
- player.ADD_GOSSIP_ITEM_DB(GossipMenus.MenuIdXpOnOff, GossipMenus.OptionIdXpOff, eTradeskill.GossipSenderMain, eTradeskill.GossipActionInfoDef + 2);
- player.SEND_GOSSIP_MENU(Texts.XpOnOff, creature.GetGUID());
+ uint action = player.PlayerTalkClass.GetGossipOptionAction(gossipListId);
+ player.PlayerTalkClass.ClearMenus();
+
+ switch (action)
+ {
+ case eTradeskill.GossipActionInfoDef + 1:// XP ON selected
+ player.RemovePlayerFlag(PlayerFlags.NoXPGain); // turn on XP gain
+ break;
+ case eTradeskill.GossipActionInfoDef + 2:// XP OFF selected
+ player.AddPlayerFlag(PlayerFlags.NoXPGain); // turn off XP gain
+ break;
+ }
+
+ player.PlayerTalkClass.SendCloseGossip();
+ return true;
}
- return true;
}
- public override bool OnGossipSelect(Player player, Creature Creature, uint sender, uint action)
+ public override CreatureAI GetAI(Creature creature)
{
- player.PlayerTalkClass.ClearMenus();
-
- switch (action)
- {
- case eTradeskill.GossipActionInfoDef + 1:// XP ON selected
- player.RemovePlayerFlag(PlayerFlags.NoXPGain); // turn on XP gain
- break;
- case eTradeskill.GossipActionInfoDef + 2:// XP OFF selected
- player.AddPlayerFlag(PlayerFlags.NoXPGain); // turn off XP gain
- break;
- }
-
- player.PlayerTalkClass.SendCloseGossip();
- return true;
+ return new npc_experienceAI(creature);
}
}
@@ -2221,7 +2234,7 @@ namespace Scripts.World.NpcSpecial
});
}
- public override void GossipSelect(Player player, uint menuId, uint gossipListId)
+ public override bool GossipSelect(Player player, uint menuId, uint gossipListId)
{
switch (gossipListId)
{
@@ -2272,6 +2285,7 @@ namespace Scripts.World.NpcSpecial
break;
}
player.PlayerTalkClass.SendCloseGossip();
+ return false;
}
public override void UpdateAI(uint diff)