From e36dac4258962247e4aee1c839534dd1d9b12ac3 Mon Sep 17 00:00:00 2001 From: talamortis Date: Sun, 22 Jul 2018 00:23:39 +0100 Subject: [PATCH] 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 --- src/server/scripts/Commands/cs_npc.cpp | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 15fc25638..ea5250fff 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -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) {