TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CollectionMgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 CollectionMgr_h__
19 #define CollectionMgr_h__
20 
21 #include "WorldSession.h"
22 
24 {
28 };
29 
31 {
35 };
36 
38 {
39  HeirloomData(uint32 _flags = 0, uint32 _bonusId = 0) : flags(_flags), bonusId(_bonusId) { }
40 
43 };
44 
45 typedef std::map<uint32, bool> ToyBoxContainer;
46 typedef std::map<uint32, HeirloomData> HeirloomContainer;
47 
49 {
50 public:
51  explicit CollectionMgr(WorldSession* owner) : _owner(owner) { }
52 
53  WorldSession* GetOwner() const { return _owner; }
54 
55  // Account-wide toys
56  void LoadToys();
57  void LoadAccountToys(PreparedQueryResult result);
58  void SaveAccountToys(SQLTransaction& trans);
59  void ToySetFavorite(uint32 itemId, bool favorite);
60 
61  bool AddToy(uint32 itemId, bool isFavourite /*= false*/);
62  bool UpdateAccountToys(uint32 itemId, bool isFavourite /*= false*/);
63 
64  ToyBoxContainer const& GetAccountToys() const { return _toys; }
65 
66  // Account-wide heirlooms
67  void LoadHeirlooms();
68  void LoadAccountHeirlooms(PreparedQueryResult result);
69  void SaveAccountHeirlooms(SQLTransaction& trans);
70  void AddHeirloom(uint32 itemId, uint32 flags);
71  void UpgradeHeirloom(uint32 itemId, uint32 castItem);
72  void CheckHeirloomUpgrades(Item* item);
73 
74  bool UpdateAccountHeirlooms(uint32 itemId, uint32 flags);
75  bool CanApplyHeirloomXpBonus(uint32 itemId, uint32 level);
76  uint32 GetHeirloomBonus(uint32 itemId) const;
77  HeirloomContainer const& GetAccountHeirlooms() const { return _heirlooms; }
78 
79  // Account-wide mounts
80 
81 private:
83 
86 };
87 
88 #endif // CollectionMgr_h__
Definition: CollectionMgr.h:27
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
ToyBoxContainer _toys
Definition: CollectionMgr.h:84
HeirloomItemFlags
Definition: CollectionMgr.h:30
ToyBoxContainer const & GetAccountToys() const
Definition: CollectionMgr.h:64
HeirloomData(uint32 _flags=0, uint32 _bonusId=0)
Definition: CollectionMgr.h:39
std::map< uint32, bool > ToyBoxContainer
Definition: CollectionMgr.h:45
WorldSession * GetOwner() const
Definition: CollectionMgr.h:53
WorldSession * _owner
Definition: CollectionMgr.h:82
Definition: Item.h:259
Definition: CollectionMgr.h:25
std::map< uint32, HeirloomData > HeirloomContainer
Definition: CollectionMgr.h:46
uint32_t uint32
Definition: Define.h:150
uint32 flags
Definition: CollectionMgr.h:41
#define TC_GAME_API
Definition: Define.h:134
HeirloomContainer _heirlooms
Definition: CollectionMgr.h:85
Definition: CollectionMgr.h:26
Definition: CollectionMgr.h:34
Player session in the World.
Definition: WorldSession.h:882
uint8 flags
Definition: DisableMgr.cpp:44
HeirloomPlayerFlags
Definition: CollectionMgr.h:23
Definition: CollectionMgr.h:37
uint32 bonusId
Definition: CollectionMgr.h:42
Definition: CollectionMgr.h:33
Definition: CollectionMgr.h:48
HeirloomContainer const & GetAccountHeirlooms() const
Definition: CollectionMgr.h:77
Definition: CollectionMgr.h:32
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58
CollectionMgr(WorldSession *owner)
Definition: CollectionMgr.h:51