Core/Scripts: unified scripted gossip/quest api

Port From (https://github.com/TrinityCore/TrinityCore/commit/6604849716bc73d82a4cdbf8c66bb188086ceae4)
This commit is contained in:
hondacrx
2020-05-22 13:28:20 -04:00
parent 87b63b0975
commit c2aee387a8
30 changed files with 1642 additions and 1367 deletions
+1 -1
View File
@@ -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)
+34 -7
View File
@@ -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; }
/// <summary>
/// Called when a player opens a gossip dialog with the gameobject.
/// </summary>
public virtual bool GossipHello(Player player, bool reportUse) { return false; }
public virtual bool GossipSelect(Player player, uint sender, uint action) { return false; }
/// <summary>
/// Called when a player selects a gossip item in the gameobject's gossip menu.
/// </summary>
public virtual bool GossipSelect(Player player, uint menuId, uint gossipListId) { return false; }
/// <summary>
/// Called when a player selects a gossip with a code in the gameobject's gossip menu.
/// </summary>
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; }
/// <summary>
/// Called when a player accepts a quest from the gameobject.
/// </summary>
public virtual void QuestAccept(Player player, Quest quest) { }
/// <summary>
/// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
/// </summary>
public virtual void QuestReward(Player player, Quest quest, uint opt) { }
/// <summary>
/// Called when the dialog status between a player and the gameobject is requested.
/// </summary>
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
+29 -5
View File
@@ -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) { }
/// <summary>
/// Called when a player opens a gossip dialog with the creature.
/// </summary>
public virtual bool GossipHello(Player player) { return false; }
/// <summary>
/// Called when a player selects a gossip item in the creature's gossip menu.
/// </summary>
public virtual bool GossipSelect(Player player, uint menuId, uint gossipListId) { return false; }
/// <summary>
/// Called when a player selects a gossip with a code in the creature's gossip menu.
/// </summary>
public virtual bool GossipSelectCode(Player player, uint menuId, uint gossipListId, string code) { return false; }
/// <summary>
/// Called when a player accepts a quest from the creature.
/// </summary>
public virtual void QuestAccept(Player player, Quest quest) { }
public virtual void QuestSelect(Player player, Quest quest) { }
public virtual void QuestComplete(Player player, Quest quest) { }
/// <summary>
/// Called when a player completes a quest and is rewarded, opt is the selected item's index or 0
/// </summary>
public virtual void QuestReward(Player player, Quest quest, uint opt) { }
/// <summary>
/// Called when a game event starts or ends
/// </summary>
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; }
+26 -23
View File
@@ -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)
@@ -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
{
+6 -6
View File
@@ -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;
@@ -559,8 +559,6 @@ namespace Game.Entities
}
break;
}
Global.ScriptMgr.OnCreatureUpdate(this, diff);
}
public void Regenerate(PowerType power)
@@ -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)
+5 -4
View File
@@ -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<uint> qr;
List<uint> 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());
+8 -11
View File
@@ -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);
}
}
+6 -8
View File
@@ -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:
+7 -65
View File
@@ -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
-144
View File
@@ -749,68 +749,6 @@ namespace Game.Scripting
}
//CreatureScript
public bool OnGossipHello(Player player, Creature creature)
{
Cypher.Assert(player);
Cypher.Assert(creature);
return RunScriptRet<CreatureScript>(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<CreatureScript>(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<CreatureScript>(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<CreatureScript>(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<CreatureScript>(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<CreatureScript>(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<CreatureScript>(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<CreatureScript, uint>(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<CreatureScript, CreatureAI>(p => p.GetAI(creature), creature.GetScriptId());
}
public void OnCreatureUpdate(Creature creature, uint diff)
{
Cypher.Assert(creature != null);
RunScript<CreatureScript>(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<GameObjectScript>(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<GameObjectScript>(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<GameObjectScript>(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<GameObjectScript>(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<GameObjectScript>(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<GameObjectScript, uint>(p => p.GetDialogStatus(player, go), go.GetScriptId(), (uint)QuestGiverStatus.ScriptedNoStatus);
}
public void OnGameObjectDestroyed(GameObject go, Player player)
{
Cypher.Assert(go != null);
RunScript<GameObjectScript>(p => p.OnDestroyed(go, player), go.GetScriptId());
}
public void OnGameObjectDamaged(GameObject go, Player player)
{
Cypher.Assert(go != null);
RunScript<GameObjectScript>(p => p.OnDamaged(go, player), go.GetScriptId());
}
public void OnGameObjectLootStateChanged(GameObject go, uint state, Unit unit)
{
Cypher.Assert(go != null);
RunScript<GameObjectScript>(p => p.OnLootStateChanged(go, state, unit), go.GetScriptId());
}
public void OnGameObjectStateChanged(GameObject go, GameObjectState state)
{
Cypher.Assert(go != null);
RunScript<GameObjectScript>(p => p.OnGameObjectStateChanged(go, state), go.GetScriptId());
}
public void OnGameObjectUpdate(GameObject go, uint diff)
{
Cypher.Assert(go != null);
RunScript<GameObjectScript>(p => p.OnUpdate(go, diff), go.GetScriptId());
}
public GameObjectAI GetGameObjectAI(GameObject go)
{
Cypher.Assert(go != null);
+1 -3
View File
@@ -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;
@@ -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<npc_barnesAI>(creature);
@@ -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<npc_death_knight_initiateAI>();
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)
+20 -10
View File
@@ -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<npc_muglash>();
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<npc_muglash>();
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);
}
}
@@ -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<boss_prince_taldaram>().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<boss_prince_taldaram>().CheckSpheres();
}
return true;
}
InstanceScript instance;
}
public override GameObjectAI GetAI(GameObject go)
{
return GetInstanceAI<go_prince_taldaram_sphereAI>(go);
}
}
@@ -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<npc_announcer_toc5AI>(creature);
@@ -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)
@@ -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)
@@ -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_gundrak_altarAI>(go);
}
}
}
@@ -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)
@@ -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);
}
}
@@ -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<containment_sphereAI>(go);
}
}
[Script]
@@ -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_ulduar_towerAI>(go);
}
}
+23 -11
View File
@@ -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_mimiron_hardmode_buttonAI>(go);
}
}
+184 -166
View File
@@ -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<ItemPosCount> dest = new List<ItemPosCount>();
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<ItemPosCount> dest = new List<ItemPosCount>();
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)
File diff suppressed because it is too large Load Diff
+220 -206
View File
@@ -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<Position> Coordinates = new List<Position>();
}
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)