root/trunk/src/game/PlayerDump.h @ 34

Revision 2, 3.5 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
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.
8 *
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.
13 *
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
17 */
18
19#ifndef _PLAYER_DUMP_H
20#define _PLAYER_DUMP_H
21/*
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"
42*/
43#include <string>
44#include <map>
45#include <set>
46
47enum DumpTableType
48{
49    DTT_CHARACTER,      //                                  // characters
50
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
55
56    DTT_INVENTORY,      //    -> item guids collection      // character_inventory
57
58    DTT_MAIL,           //    -> mail ids collection        // mail
59                        //    -> item_text
60
61    DTT_MAIL_ITEM,      // <- mail ids                      // mail_items
62                        //    -> item guids collection
63
64    DTT_ITEM,           // <- item guids                    // item_instance
65                        //    -> item_text
66
67    DTT_ITEM_GIFT,      // <- item guids                    // character_gifts
68
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
72};
73
74class PlayerDump
75{
76    protected:
77        PlayerDump() {}
78};
79
80class PlayerDumpWriter : public PlayerDump
81{
82    public:
83        PlayerDumpWriter() {}
84
85        std::string GetDump(uint32 guid);
86        bool WriteDump(std::string file, uint32 guid);
87    private:
88        typedef std::set<uint32> GUIDs;
89
90        bool DumpTable(std::string& dump, uint32 guid, char const*tableFrom, char const*tableTo, DumpTableType type);
91        std::string GenerateWhereStr(char const* field, GUIDs const& guids, GUIDs::const_iterator& itr);
92        std::string GenerateWhereStr(char const* field, uint32 guid);
93
94        GUIDs pets;
95        GUIDs mails;
96        GUIDs items;
97        GUIDs texts;
98};
99
100class PlayerDumpReader : public PlayerDump
101{
102    public:
103        PlayerDumpReader() {}
104
105        bool LoadDump(std::string file, uint32 account, std::string name, uint32 guid);
106};
107
108#endif
Note: See TracBrowser for help on using the browser.