From 27cba3f52309dad5be964fec11d80cd8cad128cf Mon Sep 17 00:00:00 2001 From: Meji Date: Tue, 8 Feb 2022 23:23:05 +0100 Subject: Core/Scripts: Added script hook to execute actions after completing an achievement (#27718) --- src/server/scripts/World/achievement_scripts.cpp | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/server/scripts') diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index 62a7621db79..30364ac5fe6 100644 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -18,8 +18,10 @@ #include "ScriptMgr.h" #include "BattlegroundSA.h" #include "BattlegroundIC.h" +#include "BattlePetMgr.h" #include "Creature.h" #include "Player.h" +#include "WorldSession.h" class achievement_resilient_victory : public AchievementCriteriaScript { @@ -289,6 +291,31 @@ class achievement_killed_exp_or_honor_target : public AchievementCriteriaScript } }; +// 7433 - Newbie +class achievement_newbie : public AchievementScript +{ +public: + achievement_newbie() : AchievementScript("achievement_newbie") { } + + void OnCompleted(Player* player, AchievementEntry const* /*achievement*/) override + { + player->GetSession()->GetBattlePetMgr()->UnlockSlot(BattlePets::BattlePetSlot::Slot1); + // TODO: Unlock trap + } +}; + +// 6566 - Just a Pup +class achievement_just_a_pup : public AchievementScript +{ +public: + achievement_just_a_pup() : AchievementScript("achievement_just_a_pup") { } + + void OnCompleted(Player* player, AchievementEntry const* /*achievement*/) override + { + player->GetSession()->GetBattlePetMgr()->UnlockSlot(BattlePets::BattlePetSlot::Slot2); + } +}; + void AddSC_achievement_scripts() { new achievement_resilient_victory(); @@ -309,4 +336,6 @@ void AddSC_achievement_scripts() new achievement_not_even_a_scratch(); new achievement_flirt_with_disaster_perf_check(); new achievement_killed_exp_or_honor_target(); + new achievement_newbie(); + new achievement_just_a_pup(); } -- cgit v1.2.3