Files
TCPlayerbotCore/src/server/game/Tools/PlayerDump.h
T

100 lines
3.3 KiB
C++
Raw Normal View History

2010-10-07 15:54:07 +02:00
/*
* Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
2008-10-02 16:23:55 -05:00
*/
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#ifndef _PLAYER_DUMP_H
#define _PLAYER_DUMP_H
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#include <string>
#include <map>
#include <set>
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
enum DumpTableType
{
DTT_CHARACTER, // // characters
2009-10-17 15:51:44 -07:00
DTT_CHAR_TABLE, // // character_achievement, character_achievement_progress,
// character_action, character_aura, character_homebind,
// character_queststatus, character_reputation, character_spell,
// character_spell_cooldown, character_ticket, character_talent,
// character_tutorial
DTT_EQSET_TABLE, // <- guid // character_equipmentsets
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
DTT_INVENTORY, // -> item guids collection // character_inventory
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
DTT_MAIL, // -> mail ids collection // mail
// -> item_text
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
DTT_MAIL_ITEM, // <- mail ids // mail_items
// -> item guids collection
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
DTT_ITEM, // <- item guids // item_instance
// -> item_text
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
DTT_ITEM_GIFT, // <- item guids // character_gifts
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
DTT_PET, // -> pet guids collection // character_pet
DTT_PET_TABLE, // <- pet guids // pet_aura, pet_spell, pet_spell_cooldown
};
2009-10-17 15:51:44 -07:00
enum DumpReturn
{
2009-02-09 08:16:34 -05:00
DUMP_SUCCESS,
DUMP_FILE_OPEN_ERROR,
DUMP_TOO_MANY_CHARS,
DUMP_UNEXPECTED_END,
DUMP_FILE_BROKEN,
2010-08-02 15:14:47 +02:00
DUMP_CHARACTER_DELETED
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
class PlayerDump
{
protected:
PlayerDump() {}
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
class PlayerDumpWriter : public PlayerDump
{
public:
PlayerDumpWriter() {}
2009-10-17 15:51:44 -07:00
2010-08-02 15:14:47 +02:00
bool GetDump(uint32 guid, std::string& dump);
2008-12-12 11:21:28 -06:00
DumpReturn WriteDump(const std::string& file, uint32 guid);
2008-10-02 16:23:55 -05:00
private:
typedef std::set<uint32> GUIDs;
2009-10-17 15:51:44 -07:00
2010-08-02 15:14:47 +02:00
bool DumpTable(std::string& dump, uint32 guid, char const*tableFrom, char const*tableTo, DumpTableType type);
2008-10-02 16:23:55 -05:00
std::string GenerateWhereStr(char const* field, GUIDs const& guids, GUIDs::const_iterator& itr);
std::string GenerateWhereStr(char const* field, uint32 guid);
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
GUIDs pets;
GUIDs mails;
GUIDs items;
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
class PlayerDumpReader : public PlayerDump
{
public:
PlayerDumpReader() {}
2009-10-17 15:51:44 -07:00
2008-12-12 11:21:28 -06:00
DumpReturn LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid);
2008-10-02 16:23:55 -05:00
};
2009-10-17 15:51:44 -07:00
2008-10-02 16:23:55 -05:00
#endif
2009-02-17 20:07:49 -06:00