Hei Emudevs
Info: I´m using TrinityCore merged with Eluna - the latest version.
I have a small problem about deleting Gameobjects since its so annoying to delete a specified Object.
Its alot of work to write down The gobject GUI everytime when you want to delete a wrong placed object.
well this is what I did, trying to make life easier,
I added a ChatCommand in gobjectCommandTable
Then Added The Handler to it... like this
I also created a new permission in RBAC.h :
red: the new one
and finaly I created these one for the Database
Well, 1. I recompiled 2. then I just used the released stuff. is it wrong ? is anything I should do after all these. or maybe everything wrong ?
Thanks in advance for your patience and any kind of Help.
greats :RpS_smile:
Info: I´m using TrinityCore merged with Eluna - the latest version.
I have a small problem about deleting Gameobjects since its so annoying to delete a specified Object.
Its alot of work to write down The gobject GUI everytime when you want to delete a wrong placed object.
well this is what I did, trying to make life easier,
I added a ChatCommand in gobjectCommandTable
Code:
{ "delclosest", rbac::RBAC_PERM_COMMAND_GOBJECT_DELCLOSEST, false, &HandleGameObjectDelclosestCommand, "" },
Then Added The Handler to it... like this
Code:
//delete object without selecting any guid
static bool HandleGameObjectDelclosestCommand(ChatHandler* handler, char const* args)
{
GameObject* object = handler->GetNearbyGameObject();
if (!object)
{
handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
handler->SetSentErrorMessage(true);
return false;
}
ObjectGuid ownerGuid = object->GetOwnerGUID();
if (ownerGuid)
{
Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid);
if (!owner || !ownerGuid.IsPlayer())
{
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), guidLow);
handler->SetSentErrorMessage(true);
return false;
}
owner->RemoveGameObject(object, false);
}
object->SetRespawnTime(0); // not save respawn time
object->Delete();
object->DeleteFromDB();
handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetSpawnId());
return true;
}
I also created a new permission in RBAC.h :
Code:
RBAC_PERM_COMMAND_DEBUG_SEND_PLAYSCENE = 844, // not on 3.3.5a
RBAC_PERM_COMMAND_GO_OFFSET = 845,
[COLOR="#FF0000"]RBAC_PERM_COMMAND_GOBJECT_DELCLOSEST = 1012,[/COLOR]
// custom permissions 1000+
RBAC_PERM_MAX
};
red: the new one
and finaly I created these one for the Database
Code:
USE auth
INSERT INTO `rbac_linked_permissions` VALUES (192, 1012);
INSERT INTO `rbac_permissions` VALUES (1012, 'Command: gobject delclosest');
USE world
INSERT INTO `command` VALUES ('gobject delclosest', 1000, 'Syntax: .gobject delclosest deletes nearest gobject in world and delete it from DB.');
Well, 1. I recompiled 2. then I just used the released stuff. is it wrong ? is anything I should do after all these. or maybe everything wrong ?
Thanks in advance for your patience and any kind of Help.
greats :RpS_smile: