TrinityCore
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
26
enum
DumpTableType
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
64
enum
DumpReturn
65
{
66
DUMP_SUCCESS
,
67
DUMP_FILE_OPEN_ERROR
,
68
DUMP_TOO_MANY_CHARS
,
69
DUMP_FILE_BROKEN
,
70
DUMP_CHARACTER_DELETED
71
};
72
73
struct
DumpTable
;
74
struct
TableStruct
;
75
class
StringTransaction
;
76
77
class
TC_GAME_API
PlayerDump
78
{
79
public
:
80
static
void
InitializeTables();
81
82
static
void
InitializeColumnDefinition
();
83
84
protected
:
85
PlayerDump
() { }
86
};
87
88
class
TC_GAME_API
PlayerDumpWriter
:
public
PlayerDump
89
{
90
public
:
91
PlayerDumpWriter
() { }
92
93
bool
GetDump(
ObjectGuid::LowType
guid, std::string& dump);
94
DumpReturn
WriteDumpToFile(std::string
const
& file,
ObjectGuid::LowType
guid);
95
DumpReturn
WriteDumpToString(std::string& dump,
ObjectGuid::LowType
guid);
96
97
private
:
98
bool
AppendTable(
StringTransaction
& trans,
ObjectGuid::LowType
guid,
TableStruct
const
& tableStruct,
DumpTable
const
& dumpTable);
99
void
PopulateGuids(
ObjectGuid::LowType
guid);
100
101
std::set<uint32>
_pets
;
102
std::set<uint32>
_mails
;
103
std::set<ObjectGuid::LowType>
_items
;
104
105
std::set<uint64>
_itemSets
;
106
};
107
108
class
TC_GAME_API
PlayerDumpReader
:
public
PlayerDump
109
{
110
public
:
111
PlayerDumpReader
() { }
112
113
DumpReturn
LoadDumpFromFile(std::string
const
& file,
uint32
account, std::string name,
ObjectGuid::LowType
guid);
114
DumpReturn
LoadDumpFromString(std::string
const
& dump,
uint32
account, std::string name,
ObjectGuid::LowType
guid);
115
116
private
:
117
DumpReturn
LoadDump(std::istream& input,
uint32
account, std::string name,
ObjectGuid::LowType
guid);
118
};
119
120
#endif
TC_GAME_API
#define TC_GAME_API
Definition:
Define.h:123
uint32
uint32_t uint32
Definition:
Define.h:142
ObjectGuid.h
DumpReturn
DumpReturn
Definition:
PlayerDump.h:65
DUMP_FILE_OPEN_ERROR
@ DUMP_FILE_OPEN_ERROR
Definition:
PlayerDump.h:67
DUMP_CHARACTER_DELETED
@ DUMP_CHARACTER_DELETED
Definition:
PlayerDump.h:70
DUMP_SUCCESS
@ DUMP_SUCCESS
Definition:
PlayerDump.h:66
DUMP_TOO_MANY_CHARS
@ DUMP_TOO_MANY_CHARS
Definition:
PlayerDump.h:68
DUMP_FILE_BROKEN
@ DUMP_FILE_BROKEN
Definition:
PlayerDump.h:69
DumpTableType
DumpTableType
Definition:
PlayerDump.h:27
DTT_EQSET_TABLE
@ DTT_EQSET_TABLE
Definition:
PlayerDump.h:38
DTT_INVENTORY
@ DTT_INVENTORY
Definition:
PlayerDump.h:40
DTT_CHAR_TABLE
@ DTT_CHAR_TABLE
Definition:
PlayerDump.h:30
DTT_CURRENCY
@ DTT_CURRENCY
Definition:
PlayerDump.h:36
DTT_PET_TABLE
@ DTT_PET_TABLE
Definition:
PlayerDump.h:61
DTT_MAIL
@ DTT_MAIL
Definition:
PlayerDump.h:44
DTT_MAIL_ITEM
@ DTT_MAIL_ITEM
Definition:
PlayerDump.h:47
DTT_ITEM_TABLE
@ DTT_ITEM_TABLE
Definition:
PlayerDump.h:55
DTT_CHAR_TRANSMOG
@ DTT_CHAR_TRANSMOG
Definition:
PlayerDump.h:42
DTT_PET
@ DTT_PET
Definition:
PlayerDump.h:60
DTT_ITEM
@ DTT_ITEM
Definition:
PlayerDump.h:50
DTT_ITEM_GIFT
@ DTT_ITEM_GIFT
Definition:
PlayerDump.h:53
DTT_CHARACTER
@ DTT_CHARACTER
Definition:
PlayerDump.h:28
ObjectGuid::LowType
uint64 LowType
Definition:
ObjectGuid.h:278
PlayerDumpReader
Definition:
PlayerDump.h:109
PlayerDumpReader::PlayerDumpReader
PlayerDumpReader()
Definition:
PlayerDump.h:111
PlayerDumpWriter
Definition:
PlayerDump.h:89
PlayerDumpWriter::_pets
std::set< uint32 > _pets
Definition:
PlayerDump.h:101
PlayerDumpWriter::PlayerDumpWriter
PlayerDumpWriter()
Definition:
PlayerDump.h:91
PlayerDumpWriter::_itemSets
std::set< uint64 > _itemSets
Definition:
PlayerDump.h:105
PlayerDumpWriter::_items
std::set< ObjectGuid::LowType > _items
Definition:
PlayerDump.h:103
PlayerDumpWriter::_mails
std::set< uint32 > _mails
Definition:
PlayerDump.h:102
PlayerDump
Definition:
PlayerDump.h:78
PlayerDump::PlayerDump
PlayerDump()
Definition:
PlayerDump.h:85
PlayerDump::InitializeColumnDefinition
static void InitializeColumnDefinition()
StringTransaction
Definition:
PlayerDump.cpp:157
DumpTable
Definition:
PlayerDump.cpp:85
TableStruct
Definition:
PlayerDump.cpp:188
server
game
Tools
PlayerDump.h
Generated on Thu Mar 14 2024 23:39:21 for TrinityCore by
1.9.4