Core/Players: PlayerChoice improvements
Port From (https://github.com/TrinityCore/TrinityCore/commit/e59059e1bd2f67691e2da0105771b0cb55b123a4)
This commit is contained in:
@@ -703,9 +703,6 @@ namespace Game.Scripting
|
||||
|
||||
// Called when a player completes a movie
|
||||
public virtual void OnMovieComplete(Player player, uint movieId) { }
|
||||
|
||||
// Called when a player choose a response from a PlayerChoice
|
||||
public virtual void OnPlayerChoiceResponse(Player player, uint choiceId, uint responseId) { }
|
||||
}
|
||||
|
||||
public class AccountScript : ScriptObject
|
||||
@@ -892,4 +889,16 @@ namespace Game.Scripting
|
||||
// Called when a game event is triggered
|
||||
public virtual void OnTrigger(WorldObject obj, WorldObject invoker, uint eventId) { }
|
||||
}
|
||||
|
||||
public class PlayerChoiceScript : ScriptObject
|
||||
{
|
||||
public PlayerChoiceScript(string name) : base(name)
|
||||
{
|
||||
Global.ScriptMgr.AddScript(this);
|
||||
}
|
||||
|
||||
public override bool IsDatabaseBound() { return true; }
|
||||
|
||||
public virtual void OnResponse(WorldObject obj, Player player, PlayerChoice choice, PlayerChoiceResponse response, ushort clientIdentifier) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -915,9 +915,12 @@ namespace Game.Scripting
|
||||
{
|
||||
ForEach<PlayerScript>(p => p.OnMovieComplete(player, movieId));
|
||||
}
|
||||
public void OnPlayerChoiceResponse(Player player, uint choiceId, uint responseId)
|
||||
public void OnPlayerChoiceResponse(WorldObject obj, Player player, PlayerChoice choice, PlayerChoiceResponse response, ushort clientIdentifier)
|
||||
{
|
||||
ForEach<PlayerScript>(p => p.OnPlayerChoiceResponse(player, choiceId, responseId));
|
||||
Cypher.Assert(choice != null);
|
||||
Cypher.Assert(response != null);
|
||||
|
||||
ForEach<PlayerChoiceScript>(p => p.OnResponse(obj, player, choice, response, clientIdentifier));
|
||||
}
|
||||
|
||||
// Account
|
||||
|
||||
Reference in New Issue
Block a user