TrinityCore
Loading...
Searching...
No Matches
PlayerDump.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 _PLAYER_DUMP_H
19#define _PLAYER_DUMP_H
20
21#include "ObjectGuid.h"
22#include <string>
23#include <iosfwd>
24#include <set>
25
27{
28 DTT_CHARACTER, // // characters
29
30 DTT_CHAR_TABLE, // // character_achievement, character_achievement_progress,
31 // character_action, character_aura, character_homebind,
32 // character_queststatus, character_queststatus_rewarded, character_reputation,
33 // character_spell, character_spell_cooldown, character_ticket, character_talent,
34 // character_cuf_profiles
35
36 DTT_CURRENCY, // // character_currency
37
38 DTT_EQSET_TABLE, // <- guid // character_equipmentsets
39
40 DTT_INVENTORY, // -> item guids collection // character_inventory
41
42 DTT_CHAR_TRANSMOG, // <- guid // character_transmog_outfits
43
44 DTT_MAIL, // -> mail ids collection // mail
45 // -> item_text
46
47 DTT_MAIL_ITEM, // <- mail ids // mail_items
48 // -> item guids collection
49
50 DTT_ITEM, // <- item guids // item_instance
51 // -> item_text
52
53 DTT_ITEM_GIFT, // <- item guids // character_gifts
54
55 DTT_ITEM_TABLE, // <- item guids // item_instance_artifact, item_instance_artifact_powers, item_instance_azerite
56 // item_instance_azerite_empowered, item_instance_azerite_milestone_power,
57 // item_instance_azerite_unlocked_essence, item_instance_gems, item_instance_modifiers,
58 // item_instance_transmog
59
60 DTT_PET, // -> pet guids collection // character_pet
61 DTT_PET_TABLE // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
62};
63
72
73struct DumpTable;
74struct TableStruct;
76
78{
79 public:
80 PlayerDump(PlayerDump const&) = delete;
82 PlayerDump& operator=(PlayerDump const&) = delete;
84
85 static void InitializeTables();
86
87 protected:
88 PlayerDump() = default;
89 ~PlayerDump() = default;
90};
91
93{
94 public:
96
97 bool GetDump(ObjectGuid::LowType guid, std::string& dump);
98 DumpReturn WriteDumpToFile(std::string const& file, ObjectGuid::LowType guid);
99 DumpReturn WriteDumpToString(std::string& dump, ObjectGuid::LowType guid);
100
101 private:
102 bool AppendTable(StringTransaction& trans, ObjectGuid::LowType guid, TableStruct const& tableStruct, DumpTable const& dumpTable);
103 void PopulateGuids(ObjectGuid::LowType guid);
104
105 std::set<uint32> _pets;
106 std::set<uint32> _mails;
107 std::set<ObjectGuid::LowType> _items;
108
109 std::set<uint64> _itemSets;
110};
111
113{
114 public:
115 PlayerDumpReader() = default;
116
117 DumpReturn LoadDumpFromFile(std::string const& file, uint32 account, std::string name, ObjectGuid::LowType guid);
118 DumpReturn LoadDumpFromString(std::string const& dump, uint32 account, std::string name, ObjectGuid::LowType guid);
119
120 private:
121 DumpReturn LoadDump(std::istream& input, uint32 account, std::string name, ObjectGuid::LowType guid);
122};
123
124#endif
#define TC_GAME_API
Definition Define.h:129
uint32_t uint32
Definition Define.h:154
DumpReturn
Definition PlayerDump.h:65
@ DUMP_FILE_OPEN_ERROR
Definition PlayerDump.h:67
@ DUMP_CHARACTER_DELETED
Definition PlayerDump.h:70
@ DUMP_SUCCESS
Definition PlayerDump.h:66
@ DUMP_TOO_MANY_CHARS
Definition PlayerDump.h:68
@ DUMP_FILE_BROKEN
Definition PlayerDump.h:69
DumpTableType
Definition PlayerDump.h:27
@ DTT_EQSET_TABLE
Definition PlayerDump.h:38
@ DTT_INVENTORY
Definition PlayerDump.h:40
@ DTT_CHAR_TABLE
Definition PlayerDump.h:30
@ DTT_CURRENCY
Definition PlayerDump.h:36
@ DTT_PET_TABLE
Definition PlayerDump.h:61
@ DTT_MAIL
Definition PlayerDump.h:44
@ DTT_MAIL_ITEM
Definition PlayerDump.h:47
@ DTT_ITEM_TABLE
Definition PlayerDump.h:55
@ DTT_CHAR_TRANSMOG
Definition PlayerDump.h:42
@ DTT_PET
Definition PlayerDump.h:60
@ DTT_ITEM
Definition PlayerDump.h:50
@ DTT_ITEM_GIFT
Definition PlayerDump.h:53
@ DTT_CHARACTER
Definition PlayerDump.h:28
uint64 LowType
Definition ObjectGuid.h:321
PlayerDumpReader()=default
std::set< uint32 > _pets
Definition PlayerDump.h:105
std::set< uint64 > _itemSets
Definition PlayerDump.h:109
std::set< ObjectGuid::LowType > _items
Definition PlayerDump.h:107
std::set< uint32 > _mails
Definition PlayerDump.h:106
PlayerDump & operator=(PlayerDump &&)=delete
~PlayerDump()=default
PlayerDump(PlayerDump const &)=delete
PlayerDump & operator=(PlayerDump const &)=delete
PlayerDump()=default
PlayerDump(PlayerDump &&)=delete