TrinityCore
Loading...
Searching...
No Matches
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 "SharedDefines.h"
24#include <string>
25#include <utility>
26#include <vector>
27
35
47
48typedef std::pair<uint32, ObjectGuid> Signature;
49typedef std::vector<Signature> SignaturesVector;
50
52{
56 std::string PetitionName;
58
59 bool IsPetitionSignedByAccount(uint32 accountId) const;
60 void AddSignature(uint32 accountId, ObjectGuid playerGuid, bool isLoading);
61 void UpdateName(std::string const& newName);
62 void RemoveSignatureBySigner(ObjectGuid playerGuid);
63};
64
66{
67 public:
70
71 static PetitionMgr* instance();
72
73 // Load from DB
74 void LoadPetitions();
75 void LoadSignatures();
76
77 // Petitions
78 void AddPetition(ObjectGuid petitionGuid, ObjectGuid ownerGuid, std::string const& name, CharterTypes type, bool isLoading);
79 void RemovePetition(ObjectGuid petitionGuid);
80 Petition* GetPetition(ObjectGuid petitionGuid);
81 Petition* GetPetitionByOwnerWithType(ObjectGuid ownerGuid, CharterTypes type);
82 void RemovePetitionsByOwnerAndType(ObjectGuid ownerGuid, CharterTypes type);
83 void RemoveSignaturesBySignerAndType(ObjectGuid signerGuid, CharterTypes type);
84};
85
86#define sPetitionMgr PetitionMgr::instance()
87
88#endif
#define TC_GAME_API
Definition Define.h:114
uint32_t uint32
Definition Define.h:133
PetitionSigns
Definition PetitionMgr.h:37
@ PETITION_SIGN_ALREADY_SIGNED
Definition PetitionMgr.h:39
@ PETITION_SIGN_ALREADY_IN_GUILD
Definition PetitionMgr.h:40
@ PETITION_SIGN_CANT_SIGN_OWN
Definition PetitionMgr.h:41
@ PETITION_SIGN_RESTRICTED_ACCOUNT
Definition PetitionMgr.h:45
@ PETITION_SIGN_OK
Definition PetitionMgr.h:38
@ PETITION_SIGN_FULL
Definition PetitionMgr.h:43
@ PETITION_SIGN_ALREADY_SIGNED_OTHER
Definition PetitionMgr.h:44
@ PETITION_SIGN_NOT_SERVER
Definition PetitionMgr.h:42
PetitionTurns
Definition PetitionMgr.h:29
@ PETITION_TURN_NEED_MORE_SIGNATURES
Definition PetitionMgr.h:32
@ PETITION_TURN_ALREADY_IN_GUILD
Definition PetitionMgr.h:31
@ PETITION_TURN_GUILD_PERMISSIONS
Definition PetitionMgr.h:33
@ PETITION_TURN_OK
Definition PetitionMgr.h:30
std::pair< uint32, ObjectGuid > Signature
Definition PetitionMgr.h:48
std::vector< Signature > SignaturesVector
Definition PetitionMgr.h:49
CharterTypes
void UpdateName(std::string const &newName)
void RemoveSignatureBySigner(ObjectGuid playerGuid)
ObjectGuid OwnerGuid
Definition PetitionMgr.h:54
SignaturesVector Signatures
Definition PetitionMgr.h:57
CharterTypes PetitionType
Definition PetitionMgr.h:55
bool IsPetitionSignedByAccount(uint32 accountId) const
ObjectGuid PetitionGuid
Definition PetitionMgr.h:53
void AddSignature(uint32 accountId, ObjectGuid playerGuid, bool isLoading)
std::string PetitionName
Definition PetitionMgr.h:56