TrinityCore
PetitionMgr.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 _PETITIONMGR_H
19#define _PETITIONMGR_H
20
21#include "Define.h"
22#include "ObjectGuid.h"
23#include <string>
24#include <utility>
25#include <vector>
26
28{
35};
36
38{
48};
49
50typedef std::pair<uint32, ObjectGuid> Signature;
51typedef std::vector<Signature> SignaturesVector;
52
54{
57 std::string PetitionName;
59
60 bool IsPetitionSignedByAccount(uint32 accountId) const;
61 void AddSignature(uint32 accountId, ObjectGuid playerGuid, bool isLoading);
62 void UpdateName(std::string const& newName);
63 void RemoveSignatureBySigner(ObjectGuid playerGuid);
64};
65
67{
68 public:
71
72 static PetitionMgr* instance();
73
74 // Load from DB
75 void LoadPetitions();
76 void LoadSignatures();
77
78 // Petitions
79 void AddPetition(ObjectGuid petitionGuid, ObjectGuid ownerGuid, std::string const& name, bool isLoading);
80 void RemovePetition(ObjectGuid petitionGuid);
81 Petition* GetPetition(ObjectGuid petitionGuid);
82 Petition* GetPetitionByOwner(ObjectGuid ownerGuid);
83 void RemovePetitionsByOwner(ObjectGuid ownerGuid);
84 void RemoveSignaturesBySigner(ObjectGuid signerGuid);
85};
86
87#define sPetitionMgr PetitionMgr::instance()
88
89#endif
#define TC_GAME_API
Definition: Define.h:123
uint32_t uint32
Definition: Define.h:142
PetitionSigns
Definition: PetitionMgr.h:38
@ PETITION_SIGN_ALREADY_SIGNED
Definition: PetitionMgr.h:40
@ PETITION_SIGN_ALREADY_IN_GUILD
Definition: PetitionMgr.h:41
@ PETITION_SIGN_CANT_SIGN_OWN
Definition: PetitionMgr.h:42
@ PETITION_SIGN_OK
Definition: PetitionMgr.h:39
@ PETITION_SIGN_FULL
Definition: PetitionMgr.h:44
@ PETITION_SIGN_RESTRICTED_ACCOUNT_TRIAL
Definition: PetitionMgr.h:46
@ PETITION_SIGN_ALREADY_SIGNED_OTHER
Definition: PetitionMgr.h:45
@ PETITION_SIGN_NOT_SERVER
Definition: PetitionMgr.h:43
@ PETITION_SIGN_HAS_RESTRICTION
Definition: PetitionMgr.h:47
PetitionTurns
Definition: PetitionMgr.h:28
@ PETITION_TURN_NEED_MORE_SIGNATURES
Definition: PetitionMgr.h:31
@ PETITION_TURN_ALREADY_IN_GUILD
Definition: PetitionMgr.h:30
@ PETITION_TURN_GUILD_NAME_INVALID
Definition: PetitionMgr.h:33
@ PETITION_TURN_HAS_RESTRICTION
Definition: PetitionMgr.h:34
@ PETITION_TURN_GUILD_PERMISSIONS
Definition: PetitionMgr.h:32
@ PETITION_TURN_OK
Definition: PetitionMgr.h:29
std::pair< uint32, ObjectGuid > Signature
Definition: PetitionMgr.h:50
std::vector< Signature > SignaturesVector
Definition: PetitionMgr.h:51
void UpdateName(std::string const &newName)
void RemoveSignatureBySigner(ObjectGuid playerGuid)
ObjectGuid OwnerGuid
Definition: PetitionMgr.h:56
SignaturesVector Signatures
Definition: PetitionMgr.h:58
bool IsPetitionSignedByAccount(uint32 accountId) const
ObjectGuid PetitionGuid
Definition: PetitionMgr.h:55
void AddSignature(uint32 accountId, ObjectGuid playerGuid, bool isLoading)
std::string PetitionName
Definition: PetitionMgr.h:57