TrinityCore
Loading...
Searching...
No Matches
PlayerChoice.h
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#ifndef TRINITYCORE_PLAYER_CHOICE_H
19#define TRINITYCORE_PLAYER_CHOICE_H
20
21#include "Define.h"
22#include "Duration.h"
23#include "EnumFlag.h"
24#include "Optional.h"
25#include <algorithm>
26#include <string>
27#include <vector>
28
30{
32 PlayerChoiceResponseRewardItem(uint32 id, std::vector<int32>&& bonusListIDs, int32 quantity) : Id(id), BonusListIDs(std::move(bonusListIDs)), Quantity(quantity) { }
33
35 std::vector<int32> BonusListIDs;
37};
38
47
49{
58 std::vector<PlayerChoiceResponseRewardItem> Items;
59 std::vector<PlayerChoiceResponseRewardEntry> Currency;
60 std::vector<PlayerChoiceResponseRewardEntry> Faction;
61 std::vector<PlayerChoiceResponseRewardItem> ItemChoices;
62};
63
71
73{
74 None = 0x000,
75 DisabledButton = 0x001, // Disables single button
76 DesaturateArt = 0x002,
77 DisabledOption = 0x004, // Disables the entire group of options
78 ConsolidateWidgets = 0x020,
79 ShowCheckmark = 0x040,
80 HideButtonShowText = 0x080,
81 Selected = 0x100,
82};
83
85
106
108{
114 std::string Question;
115 std::string PendingChoiceText;
116 std::vector<PlayerChoiceResponse> Responses;
117 bool InfiniteRange = false;
118 bool HideWarboardHeader = false;
120 bool ShowChoicesAsList = false;
122 bool RequiresSelection = false;
123
125
127
128 PlayerChoiceResponse const* GetResponse(int32 responseId) const
129 {
130 auto itr = std::ranges::find(Responses, responseId, &PlayerChoiceResponse::ResponseId);
131 return itr != Responses.end() ? &(*itr) : nullptr;
132 }
133};
134
135#endif // TRINITYCORE_PLAYER_CHOICE_H
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
#define DEFINE_ENUM_FLAG(enumType)
Definition EnumFlag.h:26
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
PlayerChoiceResponseFlags
STL namespace.
PlayerChoiceResponseRewardEntry(uint32 id, int32 quantity)
std::vector< int32 > BonusListIDs
PlayerChoiceResponseRewardItem(uint32 id, std::vector< int32 > &&bonusListIDs, int32 quantity)
std::vector< PlayerChoiceResponseRewardItem > Items
std::vector< PlayerChoiceResponseRewardEntry > Faction
std::vector< PlayerChoiceResponseRewardItem > ItemChoices
std::vector< PlayerChoiceResponseRewardEntry > Currency
std::string Confirmation
std::string ButtonTooltip
Optional< uint32 > RewardQuestID
Optional< PlayerChoiceResponseReward > Reward
Optional< PlayerChoiceResponseMawPower > MawPower
std::string Description
std::string SubHeader
EnumFlag< PlayerChoiceResponseFlags > Flags
bool ForceDontShowChoicesAsList
uint32 SoundKitId
bool HideWarboardHeader
uint32 CloseSoundKitId
bool KeepOpenAfterChoice
std::vector< PlayerChoiceResponse > Responses
std::string Question
bool RequiresSelection
int32 UiTextureKitId
Optional< uint32 > MaxResponses
Seconds Duration
std::string PendingChoiceText
bool ShowChoicesAsList
PlayerChoiceResponse const * GetResponse(int32 responseId) const