TrinityCore
achievement_scripts.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Battleground.h"
20#include "BattlePetMgr.h"
21#include "Creature.h"
22#include "Player.h"
23#include "WorldSession.h"
24
26{
27 public:
28 achievement_arena_kills(char const* name, uint8 arenaType) : AchievementCriteriaScript(name),
29 _arenaType(arenaType)
30 {
31 }
32
33 bool OnCheck(Player* source, Unit* /*target*/) override
34 {
35 // this checks GetBattleground() for NULL already
36 if (!source->InArena())
37 return false;
38
39 return ASSERT_NOTNULL(source->GetBattleground())->GetArenaType() == _arenaType;
40 }
41
42 private:
44};
45
47{
54};
55
57{
58 public:
59 achievement_tilted() : AchievementCriteriaScript("achievement_tilted") { }
60
61 bool OnCheck(Player* player, Unit* /*target*/) override
62 {
63 if (!player)
64 return false;
65
66 bool checkArea = player->GetAreaId() == AREA_ARGENT_TOURNAMENT_FIELDS ||
67 player->GetAreaId() == AREA_RING_OF_ASPIRANTS ||
72
73 return checkArea && player->duel && player->duel->IsMounted;
74 }
75};
76
78{
82};
83
85{
86 public:
87 achievement_flirt_with_disaster_perf_check() : AchievementCriteriaScript("achievement_flirt_with_disaster_perf_check") { }
88
89 bool OnCheck(Player* player, Unit* /*target*/) override
90 {
91 if (!player)
92 return false;
93
95 return true;
96
97 return false;
98 }
99};
100
102{
103 public:
104 achievement_killed_exp_or_honor_target() : AchievementCriteriaScript("achievement_killed_exp_or_honor_target") { }
105
106 bool OnCheck(Player* player, Unit* target) override
107 {
108 return target && player->isHonorOrXPTarget(target);
109 }
110};
111
112// 7433 - Newbie
114{
115public:
116 achievement_newbie() : AchievementScript("achievement_newbie") { }
117
118 void OnCompleted(Player* player, AchievementEntry const* /*achievement*/) override
119 {
121 // TODO: Unlock trap
122 }
123};
124
125// 6566 - Just a Pup
127{
128public:
129 achievement_just_a_pup() : AchievementScript("achievement_just_a_pup") { }
130
131 void OnCompleted(Player* player, AchievementEntry const* /*achievement*/) override
132 {
134 }
135};
136
138{
139 new achievement_arena_kills("achievement_arena_2v2_kills", ARENA_TYPE_2v2);
140 new achievement_arena_kills("achievement_arena_3v3_kills", ARENA_TYPE_3v3);
141 new achievement_arena_kills("achievement_arena_5v5_kills", ARENA_TYPE_5v5);
142 new achievement_tilted();
145 new achievement_newbie();
147}
@ ARENA_TYPE_5v5
Definition: Battleground.h:192
@ ARENA_TYPE_3v3
Definition: Battleground.h:191
@ ARENA_TYPE_2v2
Definition: Battleground.h:190
uint8_t uint8
Definition: Define.h:144
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:84
ArgentTournamentAreas
@ AREA_RING_OF_ALLIANCE_VALIANTS
@ AREA_RING_OF_ARGENT_VALIANTS
@ AREA_ARGENT_TOURNAMENT_FIELDS
@ AREA_RING_OF_CHAMPIONS
@ AREA_RING_OF_ASPIRANTS
@ AREA_RING_OF_HORDE_VALIANTS
void AddSC_achievement_scripts()
FlirtWithDisaster
@ AURA_PERFUME_FOREVER
@ AURA_PERFUME_ENCHANTRESS
@ AURA_PERFUME_VICTORY
void UnlockSlot(BattlePetSlot slot)
WorldSession * GetSession() const
Definition: Player.h:2101
Battleground * GetBattleground() const
Definition: Player.cpp:24976
bool InArena() const
Definition: Player.cpp:25106
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1972
bool isHonorOrXPTarget(Unit const *victim) const
Definition: Player.cpp:25587
Definition: Unit.h:627
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
uint32 GetAreaId() const
Definition: Object.h:546
BattlePets::BattlePetMgr * GetBattlePetMgr() const
bool OnCheck(Player *source, Unit *) override
achievement_arena_kills(char const *name, uint8 arenaType)
bool OnCheck(Player *player, Unit *) override
void OnCompleted(Player *player, AchievementEntry const *) override
bool OnCheck(Player *player, Unit *target) override
void OnCompleted(Player *player, AchievementEntry const *) override
bool OnCheck(Player *player, Unit *) override