Core/Scripts: Added script hook to execute actions after completing an achievement (#27718)

This commit is contained in:
Meji
2022-02-08 23:23:05 +01:00
committed by GitHub
parent 8e2d1e328e
commit 27cba3f523
7 changed files with 143 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ class WorldSocket;
class WorldObject;
class WorldSession;
struct AchievementEntry;
struct AreaTriggerEntry;
struct AuctionPosting;
struct ConditionSourceInfo;
@@ -622,6 +623,18 @@ class TC_GAME_API TransportScript : public ScriptObject, public UpdatableScript<
virtual void OnRelocate(Transport* /*transport*/, uint32 /*waypointId*/, uint32 /*mapId*/, float /*x*/, float /*y*/, float /*z*/) { }
};
class TC_GAME_API AchievementScript : public ScriptObject
{
protected:
AchievementScript(char const* name);
public:
// Called when an achievement is completed.
virtual void OnCompleted(Player* /*player*/, AchievementEntry const* /*achievement*/) { }
};
class TC_GAME_API AchievementCriteriaScript : public ScriptObject
{
protected:
@@ -1085,6 +1098,10 @@ class TC_GAME_API ScriptMgr
void OnTransportUpdate(Transport* transport, uint32 diff);
void OnRelocate(Transport* transport, uint32 waypointId, uint32 mapId, float x, float y, float z);
public: /* AchievementScript */
void OnAchievementCompleted(Player* player, AchievementEntry const* achievement);
public: /* AchievementCriteriaScript */
bool OnCriteriaCheck(uint32 scriptId, Player* source, Unit* target);