Core/AI: Implemented conversation ai
Port From (https://github.com/TrinityCore/TrinityCore/commit/309ba22a15e5e0b4321b99f7157ccb18e0adc8dd)
This commit is contained in:
@@ -110,5 +110,14 @@ namespace Game.AI
|
||||
_ => new GameObjectAI(go),
|
||||
};
|
||||
}
|
||||
|
||||
public static ConversationAI SelectConversationAI(Conversation conversation)
|
||||
{
|
||||
ConversationAI ai = Global.ScriptMgr.GetConversationAI(conversation);
|
||||
if ( ai != null)
|
||||
return ai;
|
||||
|
||||
return new NullConversationAI(conversation, Global.ObjectMgr.GetScriptId("NullConversationAI", false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Game.Entities;
|
||||
using Game.Spells;
|
||||
|
||||
namespace Game.AI
|
||||
{
|
||||
public class ConversationAI
|
||||
{
|
||||
uint _scriptId;
|
||||
public Conversation conversation;
|
||||
|
||||
public ConversationAI(Conversation c, uint scriptId = 0)
|
||||
{
|
||||
_scriptId = scriptId != 0 ? scriptId : c.GetScriptId();
|
||||
conversation = c;
|
||||
|
||||
Cypher.Assert(_scriptId != 0, "A ConversationAI was initialized with an invalid scriptId!");
|
||||
}
|
||||
|
||||
// Called when the Conversation has just been initialized, just before added to map
|
||||
public virtual void OnInitialize() { }
|
||||
|
||||
// Called when Conversation is created but not added to Map yet.
|
||||
public virtual void OnCreate(Unit creator) { }
|
||||
|
||||
// Called when Conversation is started
|
||||
public virtual void OnStart() { }
|
||||
|
||||
// Called when player sends CMSG_CONVERSATION_LINE_STARTED with valid conversation guid
|
||||
public virtual void OnLineStarted(uint lineId, Player sender) { }
|
||||
|
||||
// Called for each update tick
|
||||
public virtual void OnUpdate(uint diff) { }
|
||||
|
||||
// Called when the Conversation is removed
|
||||
public virtual void OnRemove() { }
|
||||
|
||||
// Pass parameters between AI
|
||||
public virtual void DoAction(int param) { }
|
||||
public virtual uint GetData(uint id = 0) { return 0; }
|
||||
public virtual void SetData(uint id, uint value) { }
|
||||
public virtual void SetGUID(ObjectGuid guid, int id = 0) { }
|
||||
public virtual ObjectGuid GetGUID(int id = 0) { return ObjectGuid.Empty; }
|
||||
|
||||
// Gets the id of the AI (script id)
|
||||
public uint GetId() { return _scriptId; }
|
||||
}
|
||||
|
||||
class NullConversationAI : ConversationAI
|
||||
{
|
||||
public NullConversationAI(Conversation c, uint scriptId) : base(c, scriptId) { }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
using Game.Networking;
|
||||
@@ -43,6 +44,8 @@ namespace Game.Entities
|
||||
//- Remove the Conversation from the accessor and from all lists of objects in world
|
||||
if (IsInWorld)
|
||||
{
|
||||
_ai.OnRemove();
|
||||
|
||||
base.RemoveFromWorld();
|
||||
GetMap().GetObjectsStore().Remove(GetGUID());
|
||||
}
|
||||
@@ -50,7 +53,7 @@ namespace Game.Entities
|
||||
|
||||
public override void Update(uint diff)
|
||||
{
|
||||
Global.ScriptMgr.OnConversationUpdate(this, diff);
|
||||
_ai.OnUpdate(diff);
|
||||
|
||||
if (GetDuration() > TimeSpan.FromMilliseconds(diff))
|
||||
{
|
||||
@@ -116,13 +119,13 @@ namespace Game.Entities
|
||||
SetEntry(conversationEntry);
|
||||
SetObjectScale(1.0f);
|
||||
|
||||
AI_Initialize();
|
||||
|
||||
_textureKitId = conversationTemplate.TextureKitId;
|
||||
|
||||
foreach (var actor in conversationTemplate.Actors)
|
||||
new ConversationActorFillVisitor(this, creator, map, actor).Invoke(actor);
|
||||
|
||||
Global.ScriptMgr.OnConversationCreate(this, creator);
|
||||
|
||||
List<ConversationLine> lines = new();
|
||||
foreach (ConversationLineTemplate line in conversationTemplate.Lines)
|
||||
{
|
||||
@@ -165,7 +168,7 @@ namespace Game.Entities
|
||||
// conversations are despawned 5-20s after LastLineEndTime
|
||||
_duration += TimeSpan.FromSeconds(10);
|
||||
|
||||
Global.ScriptMgr.OnConversationCreate(this, creator);
|
||||
_ai.OnCreate(creator);
|
||||
}
|
||||
|
||||
public bool Start()
|
||||
@@ -193,7 +196,7 @@ namespace Game.Entities
|
||||
if (!GetMap().AddToMap(this))
|
||||
return false;
|
||||
|
||||
Global.ScriptMgr.OnConversationStart(this);
|
||||
_ai.OnStart();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -284,6 +287,20 @@ namespace Game.Entities
|
||||
return actor.ToCreature();
|
||||
}
|
||||
|
||||
void AI_Initialize()
|
||||
{
|
||||
AI_Destroy();
|
||||
_ai = AISelector.SelectConversationAI(this);
|
||||
_ai.OnInitialize();
|
||||
}
|
||||
|
||||
void AI_Destroy()
|
||||
{
|
||||
_ai = null;
|
||||
}
|
||||
|
||||
public ConversationAI GetAI() { return _ai; }
|
||||
|
||||
public uint GetScriptId()
|
||||
{
|
||||
return Global.ConversationDataStorage.GetConversationTemplate(GetEntry()).ScriptId;
|
||||
@@ -363,6 +380,8 @@ namespace Game.Entities
|
||||
Dictionary<(Locale locale, uint lineId), TimeSpan> _lineStartTimes = new();
|
||||
TimeSpan[] _lastLineEndTimes = new TimeSpan[(int)Locale.Total];
|
||||
|
||||
ConversationAI _ai;
|
||||
|
||||
class ValuesUpdateForPlayerWithMaskSender : IDoWork<Player>
|
||||
{
|
||||
Conversation Owner;
|
||||
|
||||
@@ -632,7 +632,8 @@ namespace Game.Entities
|
||||
stmt.AddValue(5, homebind.GetPositionZ());
|
||||
stmt.AddValue(6, homebind.GetOrientation());
|
||||
DB.Characters.Execute(stmt);
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
if (!ok && HasAtLoginFlag(AtLoginFlags.FirstLogin))
|
||||
{
|
||||
@@ -869,11 +870,7 @@ namespace Game.Entities
|
||||
// Skip loading special quests - they are also added to rewarded quests but only once and remain there forever
|
||||
// instead add them separately from load daily/weekly/monthly/seasonal
|
||||
if (!quest.IsDailyOrWeekly() && !quest.IsMonthly() && !quest.IsSeasonal())
|
||||
{
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(quest_id);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
}
|
||||
SetQuestCompletedBit(quest_id, true);
|
||||
|
||||
for (uint i = 0; i < quest.GetRewChoiceItemsCount(); ++i)
|
||||
GetSession().GetCollectionMgr().AddItemAppearance(quest.RewardChoiceItemId[i]);
|
||||
@@ -929,9 +926,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
AddDynamicUpdateFieldValue(m_values.ModifyValue(m_activePlayerData).ModifyValue(m_activePlayerData.DailyQuestsCompleted), quest_id);
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(quest_id);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
SetQuestCompletedBit(quest_id, true);
|
||||
|
||||
Log.outDebug(LogFilter.Player, "Daily quest ({0}) cooldown for player (GUID: {1})", quest_id, GetGUID().ToString());
|
||||
}
|
||||
@@ -954,9 +949,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
m_weeklyquests.Add(quest_id);
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(quest_id);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
SetQuestCompletedBit(quest_id, true);
|
||||
|
||||
Log.outDebug(LogFilter.Player, "Weekly quest {0} cooldown for player (GUID: {1})", quest_id, GetGUID().ToString());
|
||||
}
|
||||
@@ -984,10 +977,7 @@ namespace Game.Entities
|
||||
m_seasonalquests[event_id] = new();
|
||||
|
||||
m_seasonalquests[event_id][quest_id] = completedTime;
|
||||
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(quest_id);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
SetQuestCompletedBit(quest_id, true);
|
||||
|
||||
Log.outDebug(LogFilter.Player, "Seasonal quest {0} cooldown for player (GUID: {1})", quest_id, GetGUID().ToString());
|
||||
}
|
||||
@@ -996,12 +986,8 @@ namespace Game.Entities
|
||||
|
||||
m_SeasonalQuestChanged = false;
|
||||
}
|
||||
void _LoadMonthlyQuestStatus()
|
||||
void _LoadMonthlyQuestStatus(SQLResult result)
|
||||
{
|
||||
PreparedStatement stmt = CharacterDatabase.GetPreparedStatement(CharStatements.SEL_CHARACTER_QUESTSTATUS_MONTHLY);
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
SQLResult result = DB.Characters.Query(stmt);
|
||||
|
||||
m_monthlyquests.Clear();
|
||||
|
||||
if (!result.IsEmpty())
|
||||
@@ -1014,9 +1000,7 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
m_monthlyquests.Add(quest_id);
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(quest_id);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
SetQuestCompletedBit(quest_id, true);
|
||||
|
||||
Log.outDebug(LogFilter.Player, "Monthly quest {0} cooldown for player (GUID: {1})", quest_id, GetGUID().ToString());
|
||||
}
|
||||
@@ -3447,6 +3431,7 @@ namespace Game.Entities
|
||||
_LoadDailyQuestStatus(holder.GetResult(PlayerLoginQueryLoad.DailyQuestStatus));
|
||||
_LoadWeeklyQuestStatus(holder.GetResult(PlayerLoginQueryLoad.WeeklyQuestStatus));
|
||||
_LoadSeasonalQuestStatus(holder.GetResult(PlayerLoginQueryLoad.SeasonalQuestStatus));
|
||||
_LoadMonthlyQuestStatus(holder.GetResult(PlayerLoginQueryLoad.MonthlyQuestStatus));
|
||||
_LoadRandomBGStatus(holder.GetResult(PlayerLoginQueryLoad.RandomBg));
|
||||
|
||||
// after spell and quest load
|
||||
@@ -3705,7 +3690,8 @@ namespace Game.Entities
|
||||
stmt.AddValue(0, GetGUID().GetCounter());
|
||||
characterTransaction.Append(stmt);
|
||||
|
||||
static float finiteAlways(float f) { return float.IsFinite(f) ? f : 0.0f; };
|
||||
static float finiteAlways(float f) { return float.IsFinite(f) ? f : 0.0f; }
|
||||
;
|
||||
|
||||
if (create)
|
||||
{
|
||||
|
||||
@@ -156,11 +156,7 @@ namespace Game.Entities
|
||||
public void DailyReset()
|
||||
{
|
||||
foreach (uint questId in m_activePlayerData.DailyQuestsCompleted)
|
||||
{
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, false);
|
||||
}
|
||||
SetQuestCompletedBit(questId, false);
|
||||
|
||||
DailyQuestsReset dailyQuestsReset = new();
|
||||
dailyQuestsReset.Count = m_activePlayerData.DailyQuestsCompleted.Size();
|
||||
@@ -207,11 +203,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
foreach (uint questId in m_weeklyquests)
|
||||
{
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, false);
|
||||
}
|
||||
SetQuestCompletedBit(questId, false);
|
||||
|
||||
for (ushort slot = 0; slot < SharedConst.MaxQuestLogSize; ++slot)
|
||||
{
|
||||
@@ -253,9 +245,7 @@ namespace Game.Entities
|
||||
{
|
||||
if (completedTime < eventStartTime)
|
||||
{
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, false);
|
||||
SetQuestCompletedBit(questId, false);
|
||||
|
||||
eventList.Remove(questId);
|
||||
}
|
||||
@@ -271,11 +261,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
foreach (uint questId in m_monthlyquests)
|
||||
{
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, false);
|
||||
}
|
||||
SetQuestCompletedBit(questId, false);
|
||||
|
||||
m_monthlyquests.Clear();
|
||||
// DB data deleted in caller
|
||||
@@ -1203,9 +1189,7 @@ namespace Game.Entities
|
||||
// make full db save
|
||||
SaveToDB(false);
|
||||
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
SetQuestCompletedBit(questId, true);
|
||||
|
||||
if (quest.HasFlag(QuestFlags.Pvp))
|
||||
{
|
||||
@@ -1256,9 +1240,7 @@ namespace Game.Entities
|
||||
m_RewardedQuests.Add(questId);
|
||||
m_RewardedQuestsSave[questId] = QuestSaveType.Default;
|
||||
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, true);
|
||||
SetQuestCompletedBit(questId, true);
|
||||
}
|
||||
|
||||
public void FailQuest(uint questId)
|
||||
@@ -1952,9 +1934,7 @@ namespace Game.Entities
|
||||
m_RewardedQuestsSave[questId] = QuestSaveType.ForceDelete;
|
||||
}
|
||||
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit != 0)
|
||||
SetQuestCompletedBit(questBit, false);
|
||||
SetQuestCompletedBit(questId, false);
|
||||
|
||||
// Remove seasonal quest also
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(questId);
|
||||
@@ -2429,8 +2409,9 @@ namespace Game.Entities
|
||||
return (m_activePlayerData.BitVectors.GetValue().Values[(int)PlayerDataFlag.CharacterQuestCompletedIndex].Values[fieldOffset] & flag) != 0;
|
||||
}
|
||||
|
||||
void SetQuestCompletedBit(uint questBit, bool completed)
|
||||
void SetQuestCompletedBit(uint questId, bool completed)
|
||||
{
|
||||
uint questBit = Global.DB2Mgr.GetQuestUniqueBitFlag(questId);
|
||||
if (questBit == 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -446,9 +446,9 @@ namespace Game
|
||||
[WorldPacketHandler(ClientOpcodes.ConversationLineStarted)]
|
||||
void HandleConversationLineStarted(ConversationLineStarted conversationLineStarted)
|
||||
{
|
||||
Conversation convo = ObjectAccessor.GetConversation(_player, conversationLineStarted.ConversationGUID);
|
||||
if (convo != null)
|
||||
Global.ScriptMgr.OnConversationLineStarted(convo, conversationLineStarted.LineID, _player);
|
||||
Conversation conversation = ObjectAccessor.GetConversation(_player, conversationLineStarted.ConversationGUID);
|
||||
if (conversation != null)
|
||||
conversation.GetAI().OnLineStarted(conversationLineStarted.LineID, _player);
|
||||
}
|
||||
|
||||
[WorldPacketHandler(ClientOpcodes.RequestLatestSplashScreen)]
|
||||
|
||||
@@ -247,13 +247,24 @@ namespace Game.Scripting
|
||||
public virtual BattlegroundScript GetBattlegroundScript(BattlegroundMap map) { return null; }
|
||||
}
|
||||
|
||||
public class GenericConversationScript<Script> : ConversationScript where Script : ConversationAI
|
||||
{
|
||||
public GenericConversationScript(string name) : base(name) { }
|
||||
|
||||
public override ConversationAI GetAI(Conversation conversation)
|
||||
{
|
||||
return (Script)Activator.CreateInstance(typeof(Script), [conversation]);
|
||||
}
|
||||
}
|
||||
|
||||
class GenericBattlegroundMapScript<Script> : BattlegroundMapScript where Script : BattlegroundScript
|
||||
{
|
||||
public GenericBattlegroundMapScript(string name, uint mapId) : base(name, mapId) { }
|
||||
|
||||
public override BattlegroundScript GetBattlegroundScript(BattlegroundMap map)
|
||||
{
|
||||
return (Script)Activator.CreateInstance(typeof(Script), new object[] { map });
|
||||
|
||||
return (Script)Activator.CreateInstance(typeof(Script), [map]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -806,17 +817,8 @@ namespace Game.Scripting
|
||||
|
||||
public override bool IsDatabaseBound() { return true; }
|
||||
|
||||
// Called when Conversation is created but not added to Map yet.
|
||||
public virtual void OnConversationCreate(Conversation conversation, Unit creator) { }
|
||||
|
||||
// Called when Conversation is started
|
||||
public virtual void OnConversationStart(Conversation conversation) { }
|
||||
|
||||
// Called when player sends CMSG_CONVERSATION_LINE_STARTED with valid conversation guid
|
||||
public virtual void OnConversationLineStarted(Conversation conversation, uint lineId, Player sender) { }
|
||||
|
||||
// Called for each update tick
|
||||
public virtual void OnConversationUpdate(Conversation conversation, uint diff) { }
|
||||
// Called when a ConversationAI object is needed for the conversation.
|
||||
public virtual ConversationAI GetAI(Conversation conversation) { return null; }
|
||||
}
|
||||
|
||||
public class SceneScript : ScriptObject
|
||||
|
||||
@@ -601,6 +601,18 @@ namespace Game.Scripting
|
||||
return RunScriptRet<AreaTriggerScript>(p => entered ? p.OnTrigger(player, trigger) : p.OnExit(player, trigger), Global.ObjectMgr.GetAreaTriggerScriptId(trigger.Id));
|
||||
}
|
||||
|
||||
public bool CanCreateConversationAI(uint scriptId)
|
||||
{
|
||||
return GetScriptRegistry<ConversationScript>().GetScriptById(scriptId) == null;
|
||||
}
|
||||
|
||||
public ConversationAI GetConversationAI(Conversation conversation)
|
||||
{
|
||||
Cypher.Assert(conversation != null);
|
||||
|
||||
return RunScriptRet<ConversationScript, ConversationAI>(p => p.GetAI(conversation), conversation.GetScriptId());
|
||||
}
|
||||
|
||||
//BattlefieldScript
|
||||
public BattleField CreateBattlefield(uint scriptId, Map map)
|
||||
{
|
||||
@@ -1044,36 +1056,6 @@ namespace Game.Scripting
|
||||
return RunScriptRet<AreaTriggerEntityScript, AreaTriggerAI>(p => p.GetAI(areaTrigger), areaTrigger.GetScriptId(), null);
|
||||
}
|
||||
|
||||
// ConversationScript
|
||||
public void OnConversationCreate(Conversation conversation, Unit creator)
|
||||
{
|
||||
Cypher.Assert(conversation != null);
|
||||
|
||||
RunScript<ConversationScript>(script => script.OnConversationCreate(conversation, creator), conversation.GetScriptId());
|
||||
}
|
||||
|
||||
public void OnConversationStart(Conversation conversation)
|
||||
{
|
||||
Cypher.Assert(conversation != null);
|
||||
|
||||
RunScript<ConversationScript>(script => script.OnConversationStart(conversation), conversation.GetScriptId());
|
||||
}
|
||||
|
||||
public void OnConversationLineStarted(Conversation conversation, uint lineId, Player sender)
|
||||
{
|
||||
Cypher.Assert(conversation != null);
|
||||
Cypher.Assert(sender != null);
|
||||
|
||||
RunScript<ConversationScript>(script => script.OnConversationLineStarted(conversation, lineId, sender), conversation.GetScriptId());
|
||||
}
|
||||
|
||||
public void OnConversationUpdate(Conversation conversation, uint diff)
|
||||
{
|
||||
Cypher.Assert(conversation != null);
|
||||
|
||||
RunScript<ConversationScript>(script => script.OnConversationUpdate(conversation, diff), conversation.GetScriptId());
|
||||
}
|
||||
|
||||
//SceneScript
|
||||
public void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
|
||||
{
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
}
|
||||
|
||||
[Script] // 922 - The Invasion Begins
|
||||
class conversation_the_invasion_begins : ConversationScript
|
||||
class conversation_the_invasion_begins : ConversationAI
|
||||
{
|
||||
const int ConvoLineTriggerFacing = 2529;
|
||||
const int ConvoLineStartPath = 2288;
|
||||
@@ -345,9 +345,9 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
ObjectGuid _cyanaGUID;
|
||||
ObjectGuid _sevisGUID;
|
||||
|
||||
public conversation_the_invasion_begins() : base("conversation_the_invasion_begins") { }
|
||||
public conversation_the_invasion_begins(Conversation conversation) : base(conversation) { }
|
||||
|
||||
public override void OnConversationCreate(Conversation conversation, Unit creator)
|
||||
public override void OnCreate(Unit creator)
|
||||
{
|
||||
Creature kaynObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcKaynSunfuryInvasionBegins, IgnorePhases = true });
|
||||
Creature jayceObject = creator.FindNearestCreatureWithOptions(10.0f, new FindCreatureOptions() { CreatureId = TheInvasionBeginsConst.NpcJayceDarkweaverInvasionBegins, IgnorePhases = true });
|
||||
@@ -379,7 +379,7 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
conversation.Start();
|
||||
}
|
||||
|
||||
public override void OnConversationStart(Conversation conversation)
|
||||
public override void OnStart()
|
||||
{
|
||||
Locale privateOwnerLocale = conversation.GetPrivateObjectOwnerLocale();
|
||||
|
||||
@@ -388,12 +388,12 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
{
|
||||
_scheduler.Schedule(illidariFacingLineStarted, _ =>
|
||||
{
|
||||
StartCloneChannel(conversation.GetActorUnit(ConvoActorIdxKayn).GetGUID(), conversation);
|
||||
StartCloneChannel(conversation.GetActorUnit(ConvoActorIdxKorvas).GetGUID(), conversation);
|
||||
StartCloneChannel(_jayceGUID, conversation);
|
||||
StartCloneChannel(_allariGUID, conversation);
|
||||
StartCloneChannel(_cyanaGUID, conversation);
|
||||
StartCloneChannel(_sevisGUID, conversation);
|
||||
StartCloneChannel(conversation.GetActorUnit(ConvoActorIdxKayn).GetGUID());
|
||||
StartCloneChannel(conversation.GetActorUnit(ConvoActorIdxKorvas).GetGUID());
|
||||
StartCloneChannel(_jayceGUID);
|
||||
StartCloneChannel(_allariGUID);
|
||||
StartCloneChannel(_cyanaGUID);
|
||||
StartCloneChannel(_sevisGUID);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -421,16 +421,16 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
kaynClone.SetSheath(SheathState.Melee);
|
||||
kaynClone.SetNpcFlag(NPCFlags.QuestGiver);
|
||||
|
||||
StartCloneMovement(conversation.GetActorUnit(ConvoActorIdxKorvas).GetGUID(), TheInvasionBeginsConst.PathKorvasinvasionBegins, TheInvasionBeginsConst.AnimDhRun, conversation);
|
||||
StartCloneMovement(_jayceGUID, TheInvasionBeginsConst.PathJayceInvasionBegins, 0, conversation);
|
||||
StartCloneMovement(_allariGUID, TheInvasionBeginsConst.PathAllariInvasionBegins, TheInvasionBeginsConst.AnimDhRunAllari, conversation);
|
||||
StartCloneMovement(_cyanaGUID, TheInvasionBeginsConst.PathCyanaInvasionBegins, 0, conversation);
|
||||
StartCloneMovement(_sevisGUID, TheInvasionBeginsConst.PathSevisinvasionBegins, TheInvasionBeginsConst.AnimDhRun, conversation);
|
||||
StartCloneMovement(conversation.GetActorUnit(ConvoActorIdxKorvas).GetGUID(), TheInvasionBeginsConst.PathKorvasinvasionBegins, TheInvasionBeginsConst.AnimDhRun);
|
||||
StartCloneMovement(_jayceGUID, TheInvasionBeginsConst.PathJayceInvasionBegins, 0);
|
||||
StartCloneMovement(_allariGUID, TheInvasionBeginsConst.PathAllariInvasionBegins, TheInvasionBeginsConst.AnimDhRunAllari);
|
||||
StartCloneMovement(_cyanaGUID, TheInvasionBeginsConst.PathCyanaInvasionBegins, 0);
|
||||
StartCloneMovement(_sevisGUID, TheInvasionBeginsConst.PathSevisinvasionBegins, TheInvasionBeginsConst.AnimDhRun);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void StartCloneChannel(ObjectGuid guid, Conversation conversation)
|
||||
void StartCloneChannel(ObjectGuid guid)
|
||||
{
|
||||
Unit privateObjectOwner = ObjAccessor.GetUnit(conversation, conversation.GetPrivateObjectOwner());
|
||||
if (privateObjectOwner == null)
|
||||
@@ -443,7 +443,7 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
clone.CastSpell(privateObjectOwner, TheInvasionBeginsConst.SpellTrackTargetInChannel, false);
|
||||
}
|
||||
|
||||
void StartCloneMovement(ObjectGuid cloneGUID, uint pathId, uint animKit, Conversation conversation)
|
||||
void StartCloneMovement(ObjectGuid cloneGUID, uint pathId, uint animKit)
|
||||
{
|
||||
Creature clone = ObjectAccessor.GetCreature(conversation, cloneGUID);
|
||||
if (clone == null)
|
||||
@@ -455,7 +455,7 @@ namespace Scripts.BrokenIsles.ZoneMardum
|
||||
clone.SetAIAnimKitId((ushort)animKit);
|
||||
}
|
||||
|
||||
public override void OnConversationUpdate(Conversation conversation, uint diff)
|
||||
public override void OnUpdate(uint diff)
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using Game.Scripting;
|
||||
|
||||
namespace Scripts.World.Conversations
|
||||
{
|
||||
class conversation_allied_race_dk_defender_of_azeroth : ConversationScript
|
||||
class conversation_allied_race_dk_defender_of_azeroth : ConversationAI
|
||||
{
|
||||
const uint NpcTalkToYourCommanderCredit = 161709;
|
||||
const uint NpcListenToYourCommanderCredit = 163027;
|
||||
|
||||
const uint ConversationLinePlayer = 32926;
|
||||
|
||||
public conversation_allied_race_dk_defender_of_azeroth() : base("conversation_allied_race_dk_defender_of_azeroth") { }
|
||||
public conversation_allied_race_dk_defender_of_azeroth(Conversation conversation) : base(conversation) { }
|
||||
|
||||
public override void OnConversationCreate(Conversation conversation, Unit creator)
|
||||
public override void OnCreate(Unit creator)
|
||||
{
|
||||
Player player = creator.ToPlayer();
|
||||
if (player != null)
|
||||
player.KilledMonsterCredit(NpcTalkToYourCommanderCredit);
|
||||
}
|
||||
|
||||
public override void OnConversationLineStarted(Conversation conversation, uint lineId, Player sender)
|
||||
public override void OnLineStarted(uint lineId, Player sender)
|
||||
{
|
||||
if (lineId != ConversationLinePlayer)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user