mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Players: PlayerChoice improvements
* Add missing choice properties to database (InfiniteRange, ShowChoicesAsList) * Allow limiiting the number of responses sent at the same time * Fixed duration sent in SMSG_DISPLAY_PLAYER_CHOICE * Remove dynamically generated response identifiers from database * Remove auto rewarding choice responses * Change response scripts to be bound to scriptname
This commit is contained in:
@@ -76,6 +76,8 @@ struct CreatureTemplate;
|
||||
struct CreatureData;
|
||||
struct ItemTemplate;
|
||||
struct MapEntry;
|
||||
struct PlayerChoice;
|
||||
struct PlayerChoiceResponse;
|
||||
struct Position;
|
||||
struct QuestObjective;
|
||||
struct SceneTemplate;
|
||||
@@ -789,9 +791,6 @@ class TC_GAME_API PlayerScript : public ScriptObject
|
||||
|
||||
// Called when a player completes a movie
|
||||
virtual void OnMovieComplete(Player* player, uint32 movieId);
|
||||
|
||||
// Called when a player choose a response from a PlayerChoice
|
||||
virtual void OnPlayerChoiceResponse(Player* player, uint32 choiceId, uint32 responseId);
|
||||
};
|
||||
|
||||
class TC_GAME_API AccountScript : public ScriptObject
|
||||
@@ -991,6 +990,26 @@ class TC_GAME_API EventScript : public ScriptObject
|
||||
virtual void OnTrigger(WorldObject* object, WorldObject* invoker, uint32 eventId);
|
||||
};
|
||||
|
||||
class TC_GAME_API PlayerChoiceScript : public ScriptObject
|
||||
{
|
||||
protected:
|
||||
|
||||
explicit PlayerChoiceScript(char const* name) noexcept;
|
||||
|
||||
public:
|
||||
|
||||
~PlayerChoiceScript();
|
||||
|
||||
/**
|
||||
* @param object Source object of the PlayerChoice (can be nullptr)
|
||||
* @param player Player making the choice
|
||||
* @param choice Database template of PlayerChoice
|
||||
* @param response Database template of selected PlayerChoice response
|
||||
* @param clientIdentifier Dynamically generated identifier of the response, changes every time PlayerChoice is sent to player
|
||||
*/
|
||||
virtual void OnResponse(WorldObject* object, Player* player, PlayerChoice const* choice, PlayerChoiceResponse const* response, uint16 clientIdentifier);
|
||||
};
|
||||
|
||||
// Manages registration, loading, and execution of scripts.
|
||||
class TC_GAME_API ScriptMgr
|
||||
{
|
||||
@@ -1226,7 +1245,7 @@ class TC_GAME_API ScriptMgr
|
||||
void OnQuestStatusChange(Player* player, uint32 questId);
|
||||
void OnPlayerRepop(Player* player);
|
||||
void OnMovieComplete(Player* player, uint32 movieId);
|
||||
void OnPlayerChoiceResponse(Player* player, uint32 choiceId, uint32 responseId);
|
||||
void OnPlayerChoiceResponse(WorldObject* object, Player* player, PlayerChoice const* choice, PlayerChoiceResponse const* response, uint16 clientIdentifier);
|
||||
|
||||
public: /* AccountScript */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user