[6844] Daily quest fixes.
[getmangos.git] / src / game / PlayerDump.h
blob2e83102f9c872dd071295677282ee0354e8bdf1a
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef _PLAYER_DUMP_H
20 #define _PLAYER_DUMP_H
22 #include "Log.h"
23 #include "Object.h"
24 #include "Bag.h"
25 #include "Creature.h"
26 #include "Player.h"
27 #include "DynamicObject.h"
28 #include "GameObject.h"
29 #include "Corpse.h"
30 #include "QuestDef.h"
31 #include "Path.h"
32 #include "ItemPrototype.h"
33 #include "NPCHandler.h"
34 #include "Database/DatabaseEnv.h"
35 #include "AuctionHouseObject.h"
36 #include "Mail.h"
37 #include "Map.h"
38 #include "ObjectAccessor.h"
39 #include "ObjectDefines.h"
40 #include "Policies/Singleton.h"
41 #include "Database/SQLStorage.h"
43 #include <string>
44 #include <map>
45 #include <set>
47 enum DumpTableType
49 DTT_CHARACTER, // // characters
51 DTT_CHAR_TABLE, // // character_action, character_aura, character_homebind,
52 // character_queststatus, character_reputation,
53 // character_spell, character_spell_cooldown, character_ticket,
54 // character_tutorial
56 DTT_INVENTORY, // -> item guids collection // character_inventory
58 DTT_MAIL, // -> mail ids collection // mail
59 // -> item_text
61 DTT_MAIL_ITEM, // <- mail ids // mail_items
62 // -> item guids collection
64 DTT_ITEM, // <- item guids // item_instance
65 // -> item_text
67 DTT_ITEM_GIFT, // <- item guids // character_gifts
69 DTT_PET, // -> pet guids collection // character_pet
70 DTT_PET_TABLE, // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
71 DTT_ITEM_TEXT, // <- item_text // item_text
74 enum DumpReturn
76 DUMP_SUCCESS,
77 DUMP_FILE_OPEN_ERROR,
78 DUMP_TOO_MANY_CHARS,
79 DUMP_UNEXPECTED_END,
80 DUMP_FILE_BROKEN,
83 class PlayerDump
85 protected:
86 PlayerDump() {}
89 class PlayerDumpWriter : public PlayerDump
91 public:
92 PlayerDumpWriter() {}
94 std::string GetDump(uint32 guid);
95 DumpReturn WriteDump(std::string file, uint32 guid);
96 private:
97 typedef std::set<uint32> GUIDs;
99 void DumpTable(std::string& dump, uint32 guid, char const*tableFrom, char const*tableTo, DumpTableType type);
100 std::string GenerateWhereStr(char const* field, GUIDs const& guids, GUIDs::const_iterator& itr);
101 std::string GenerateWhereStr(char const* field, uint32 guid);
103 GUIDs pets;
104 GUIDs mails;
105 GUIDs items;
106 GUIDs texts;
109 class PlayerDumpReader : public PlayerDump
111 public:
112 PlayerDumpReader() {}
114 DumpReturn LoadDump(std::string file, uint32 account, std::string name, uint32 guid);
117 #endif