added two more commands to .npc set

* .npc set tempfactionid (35) - will changed the selected npc faction but will not save it.

* .npc set originalFaction - will restore the correct faction from the npc faction template in the DB.

closes #706
This commit is contained in:
talamortis
2018-07-22 00:23:39 +01:00
parent 562833c9d6
commit e36dac4258

View File

@@ -135,6 +135,8 @@ public:
{ "allowmove", SEC_ADMINISTRATOR, false, &HandleNpcSetAllowMovementCommand, "" },
{ "entry", SEC_ADMINISTRATOR, false, &HandleNpcSetEntryCommand, "" },
{ "factionid", SEC_ADMINISTRATOR, false, &HandleNpcSetFactionIdCommand, "" },
{ "factiontempid", SEC_ADMINISTRATOR, false, &HandleNpcSetFactionTempIdCommand, "" },
{ "originalFaction",SEC_ADMINISTRATOR, false, &HandleNpcSetOriginalFaction, "" },
{ "flag", SEC_ADMINISTRATOR, false, &HandleNpcSetFlagCommand, "" },
{ "level", SEC_ADMINISTRATOR, false, &HandleNpcSetLevelCommand, "" },
{ "link", SEC_ADMINISTRATOR, false, &HandleNpcSetLinkCommand, "" },
@@ -568,6 +570,44 @@ public:
return true;
}
//set tempfaction for creature
static bool HandleNpcSetFactionTempIdCommand(ChatHandler* handler, const char* args)
{
Player* me = handler->GetSession()->GetPlayer();
Creature* creature = me->GetSelectedUnit()->ToCreature();
if (!me)
return false;
if (!creature)
return false;
if (!*args)
return false;
uint32 tempfaction = (uint32)atoi((char*)args);
creature->setFaction(tempfaction);
return true;
}
//set orginal faction for npc
static bool HandleNpcSetOriginalFaction(ChatHandler* handler, const char* args)
{
Player* me = handler->GetSession()->GetPlayer();
Creature* creature = me->GetSelectedUnit()->ToCreature();
if (!me)
return false;
if (!creature)
return false;
creature->RestoreFaction();
return true;
}
//set npcflag of creature
static bool HandleNpcSetFlagCommand(ChatHandler* handler, const char* args)
{