Created
September 3, 2015 16:09
-
-
Save Shauren/998c4ffb54fc71f1369d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h | |
index b394bc9..3b50526 100644 | |
--- a/src/server/game/DataStores/DBCStores.h | |
+++ b/src/server/game/DataStores/DBCStores.h | |
@@ -109,6 +109,35 @@ public: | |
uint32 GetTableRowCount() const { return _gtEntry->NumRows; } | |
uint32 GetTableColumnCount() const { return _gtEntry->NumColumns; } | |
+ std::string Dump() | |
+ { | |
+ std::ostringstream strm; | |
+ strm << "DROP TABLE IF EXISTS `gt" << _gtEntry->Name << "`;" << std::endl; | |
+ strm << "CREATE TABLE `gt" << _gtEntry->Name << "` (" << std::endl; | |
+ strm << " `id` int(10) unsigned not null," << std::endl; | |
+ for (uint32 c = 0; c < GetTableColumnCount(); ++c) | |
+ strm << " `data" << c << "` float not null default '0'," << std::endl; | |
+ strm << " PRIMARY KEY (`id`)" << std::endl; | |
+ strm << ") ENGINE=MyISAM;" << std::endl; | |
+ | |
+ strm << "INSERT INTO gt" << _gtEntry->Name << " VALUES" << std::endl; | |
+ for (uint32 r = 0; r < GetTableRowCount(); ++r) | |
+ { | |
+ T const* t = EvaluateTable(r, 0); | |
+ strm << "INSERT INTO gt" << _gtEntry->Name << " VALUES "; | |
+ strm << '(' << r << ',' << (t ? *reinterpret_cast<float const*>(t) : 0.0f); | |
+ for (uint32 c = 1; c < GetTableColumnCount(); ++c) | |
+ { | |
+ t = EvaluateTable(r, c); | |
+ strm << ',' << (t ? *reinterpret_cast<float const*>(EvaluateTable(r, c)) : 0.0f); | |
+ } | |
+ | |
+ strm << ')' << ';' << std::endl; | |
+ } | |
+ | |
+ return strm.str(); | |
+ } | |
+ | |
private: | |
DBCStorage<T> _storage; | |
GameTablesEntry const* _gtEntry; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment