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