Jump to content

[9767][patch]Don't delete chars finally


Guest DasBlub

Recommended Posts

  • 5 months later...
  • Replies 90
  • Created
  • Last Reply

Top Posters In This Topic

i haven't been working on this patch since longer time, and i haven't been keeping my repo up to date. so maybe you get a few merge errors, but it should (theoretically) work with the newest version(s) too. just try it, if you get merge error... merge it and post a diff :)

sorry, but as already stated in the udb forum, i'm out of time, so i can't update it.

-- DasBlub

Link to comment
Share on other sites

i haven't been working on this patch since longer time, and i haven't been keeping my repo up to date. so maybe you get a few merge errors, but it should (theoretically) work with the newest version(s) too. just try it, if you get merge error... merge it and post a diff :)

sorry, but as already stated in the udb forum, i'm out of time, so i can't update it.

-- DasBlub

ok thanks for the reply:) certainly try and I try to patch it

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...

i am currently rewriting no_char_delete: http://github.com/DasBlub/mangos/commits/no_char_delete

the base functionality (everything which existed in the old patch) is done, i'm now implementing commands (for the console & ingame).

i'm doing the rewrite on the master branch and will then backport the changes to 0.12 (which should then also be usable on mangoszero).

the following commands will be supported:

.character deleted list {$name | $guid}

.character deleted restore {$name | $guid}

.character deleted delete {$name | $guid}

the list command is already implemented (but only with $name as search possibility, not with $guid), the others will be implemented *soon*.

Link to comment
Share on other sites

i'm done with implementing it: http://github.com/DasBlub/mangos/commits/no_char_delete

tomorrow, i'll play around a bit with git-rebase to merge the commits (thanks for the tutorial, vladimir! :D)

if anyone here is using pgsql instead of mysql it would be awesome if you could test this for me, thanks! (just to be *really* sure that it also works there =))

Link to comment
Share on other sites

i'm done with implementing it: http://github.com/DasBlub/mangos/commits/no_char_delete

tomorrow, i'll play around a bit with git-rebase to merge the commits (thanks for the tutorial, vladimir! :D)

if anyone here is using pgsql instead of mysql it would be awesome if you could test this for me, thanks! (just to be *really* sure that it also works there =))

Tutorial, what tutorial are we talking about here, interactive rebase ? (Sorry for off-topic)

Link to comment
Share on other sites

ok maybe your patch have better features, but if you are interested in just dumping chars > than a level, specifying directory of .sql pdumped files and switch this feature on and off, here is a patch that i wrote some days ago:

Index: Player.cpp
===================================================================
--- Player.cpp  (revisione 917)
+++ Player.cpp  (revisione 918)
@@ -16,6 +16,10 @@
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

+#include "Config/Config.h"
+#include "PlayerDump.h"
#include "Common.h"
#include "Language.h"
#include "Database/DatabaseEnv.h"
@@ -4097,6 +4101,31 @@

void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars)
{
+       if(sConfig.GetBoolDefault("DumpActive", 0))
+       {
+               QueryResult *resultPlayer = CharacterDatabase.PQuery("SELECT name, level FROM characters WHERE guid='%u' ", playerguid);
+               if(resultPlayer)
+               {
+                       Field *fields = resultPlayer->Fetch();
+
+                       std::string pname = "";
+                       uint32 plevel = fields[1].GetUInt32();
+                       if(sConfig.GetBoolDefault("DumpTimestamp", 0))
+                               pname = fields[0].GetCppString() + "_" + Log::GetTimestampStr() + ".sql";
+                       else
+                               pname = fields[0].GetCppString() + ".sql";
+
+                       if(plevel >= sConfig.GetIntDefault("DumpMinLevel", 0))
+                       {
+                               std::string directory = sConfig.GetStringDefault("DumpPath", "") + pname;
+                               PlayerDumpWriter().WriteDump(directory, playerguid);
+                       }
+                       delete resultPlayer;
+               }
+       }
+
    uint32 guid = GUID_LOPART(playerguid);

    // convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry)

really simple and short, maybe is not so good because it have to access to database everytime a character is deleted, but works both in 3.2.2a and 3.3.2a (i think also in 2.4.3 because is really simple but not yet tested)

you have to add in mangosd.conf file these lines (explanation excluded if u want :P) :

###################################################################################################################
# Pdumps
#
#     DumpActive 
#         Enable/disable dumps before character delete, 0 by default
#
#     DumpPath
#         Path where dump files are stored, default empty
#
#     DumpMinLevel
#         Minimum level to dump characters, default 0
#
#     DumpTimestamp
#         Add timestamps to dumped files, default 0
#
###################################################################################################################

DumpActive = 1
DumpPath = ""
DumpMinLevel = 40
DumpTimestamp = 1

Directory/path works exactly as DataDir or LogsDir.

Hope this helps.

Link to comment
Share on other sites

i found out, that pgsql does not have the DATE_ADD function, therefore i'll have to redo that part of the patch, probably using c++ and the date_t struct. i'll do that in the next few days and then merge all commits.

@oceanor: my patch adds the "delete option". maybe i can merge pdump with it later (meaning: adding it as another delete option)

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use