PDA

View Full Version : Trinity .mall command script (working with RBAC)



Wise
12-10-13, 10:04 AM
Here is my updated .mall command (helped muchly by JCarter)

This is compatible with latest trinity with RBAC system.



#include "ScriptPCH.h"
#include "language.h"

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

ChatCommand* GetCommands() const
{
static ChatCommand mallTeleCommandTable[] =
{
{ "mall", rbac::RBAC_PERM_COMMAND_MALL, false, &HandlemallTeleCommand, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
return mallTeleCommandTable;
}

static bool HandlemallTeleCommand(ChatHandler* handler, const char* args)
{

Player* me = handler->GetSession()->GetPlayer();

if (me->IsInCombat())
{
handler->SendSysMessage(LANG_YOU_IN_COMBAT);
handler->SetSentErrorMessage(true);
return false;
}

// stop flight if need
if (me->IsInFlight())
{
me->GetMotionMaster()->MovementExpired();
me->CleanupAfterTaxiFlight();
}
// save only in non-flight case
else
me->SaveRecallPosition();

me->TeleportTo(0, -1716.653809f, -4228.059082f, 1.997937f, 3.675219f); // MapId, X, Y, Z, O, don't remove the "f" after X,Y,Z,O or it won't work.
return true;
}
};
void AddSC_mall_commandscript()
{
new mall_tele_commandscript();
}



SQL

INSERT INTO `rbac_permissions` (`id`, `name`) VALUES
(1007, 'Command: mall');

INSERT INTO `rbac_linked_permissions` (`id`,`linkedId`) VALUES
(195, 1007);


Add to rbac.h around line 683

RBAC_PERM_COMMAND_MALL = 1007,


This can also be used to create other tele locations. Just replace all occurances of 'mall' with a desired name and replace the included location to suit.
Dont forget to change sql's id's / linkedid's to match new command too.


Original Post/Credits : Vextah