Core/AI: Implemented conversation ai

Port From (https://github.com/TrinityCore/TrinityCore/commit/309ba22a15e5e0b4321b99f7157ccb18e0adc8dd)
This commit is contained in:
Hondacrx
2025-05-19 17:23:36 -04:00
parent 4f63e81373
commit e44861a629
10 changed files with 160 additions and 126 deletions
+14 -12
View File
@@ -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