• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

A mail command to send the mailbox UI

crumpets

Enthusiast
I've been toying with this for a friend and I think that the following will work

Remove anything that says this in MailHandler.cpp:
Code:
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
        return;

And use this as your command script:
Code:
#include "ScriptPCH.h"
#include "Chat.h"
#include "Language.h"

class mail_command : public CommandScript
{
public:
	mail_command() : CommandScript("mail_command") { }


	static bool HandleMailCommand(ChatHandler* handler, const char* /*args*/)
	{
		Player* player = handler->GetSession()->GetPlayer();

		WorldPacket data(SMSG_SHOW_MAILBOX, 8);
		data << uint64(player->GetGUID());
		player->GetSession()->HandleGetMailList(data);
		return true;
	}

	ChatCommand* GetCommands() const
	{
		static ChatCommand mail_command[] =
		{
			{ "mail",           SEC_PLAYER,			false, &HandleMailCommand,           "", NULL },
			{ NULL,             0,			    	false, NULL,		    	     "", NULL }
		};
		return mail_command;
	}
};

void AddSC_mail_command()
{
	new mail_command();
}

I haven't tested ingame because my database is a little bit retarded at the moment, if someone could that would be fantastic. Then this might count as a release. If someone knows this won't work / I get around to testing and it turns out to be useless (I think it might be a bit too easy to be true) then I guess it's back to square one and getting around trinitys dastardly blizzlike-ness.
 

Epicblood

Epic Member
I see no reason why this wouldn't work (then again, only just started trying C++ and trinity xD )

I'll test it out if I have some time later.
 

Epicblood

Epic Member
Doesn't work.
Builds and runs fine
but when the .mail command is used, nothing happens :/
Checked logs for errors and found none, so there are probably some other checks that were missed.
 

crumpets

Enthusiast
Doesn't work.
Builds and runs fine
but when the .mail command is used, nothing happens :/
Checked logs for errors and found none, so there are probably some other checks that were missed.

Balls, nothings ever easy. Thanks a lot though, I'll have a trawl through.
 

lillecarl

Respected Member
Commenting / removing a line like that makes it possible for a hacker to use the mailbox from anywhere in the world, add a bool flag to the functions instead to check from where it was called, or something like that. Else you just opened a hack possibility.

- LilleCarl, the one who think about what comes next.
 

Epicblood

Epic Member
Commenting / removing a line like that makes it possible for a hacker to use the mailbox from anywhere in the world, add a bool flag to the functions instead to check from where it was called, or something like that. Else you just opened a hack possibility.

- LilleCarl, the one who think about what comes next.
but that's the point of this command, is to access the mailbox from anywhere
 

crumpets

Enthusiast
Yeah I hadn't thought about that lillecarl, I'll put something in for it, but I want to get the sending of the ui to actually work first
 

Rochet2

Moderator / Eluna Dev
Security security security ..
: / Screw hackers!

Well anyways. I guess one form of security would be to add a bool flag to the command to allow you to use the mailbox and check that.
Alternatively (I think this is better) you could just make a new mailbox function that will be called from the code, not through a packet (cant be called by the client)
Thus the normal mailbox code will stay safe (needs object) and your custom function will just be used from the code (cant be called at any time randomly by any player without a command for example)
 
Top