Skip to content

Commit

Permalink
Chat: Implement .npc despawn command
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 21, 2023
1 parent b36a148 commit 543c52d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/game/Chat/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "showloot", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcShowLootCommand, "", nullptr },
{ "tempspawn", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcTempSpawn, "", nullptr },
{ "evade", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcEvade, "", nullptr },
{ "despawn", SEC_GAMEMASTER, false, &ChatHandler::HandleNpcDespawn, "", nullptr },
{ "formation", SEC_GAMEMASTER, false, nullptr, "", npcFormationCommandTable },
{ "group", SEC_GAMEMASTER, false, nullptr, "", npcGroupCommandTable },

Expand Down
1 change: 1 addition & 0 deletions src/game/Chat/Chat.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ class ChatHandler
bool HandleNpcYellCommand(char* args);
bool HandleNpcTempSpawn(char* args);
bool HandleNpcEvade(char* args);
bool HandleNpcDespawn(char* args);
bool HandleNpcGroupInfoCommand(char* args);
//bool HandleNpcGroupBehaviorShowCommand(char* args);
//bool HandleNpcGroupBehaviorSetCommand(char* args);
Expand Down
15 changes: 15 additions & 0 deletions src/game/Chat/Level2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,21 @@ bool ChatHandler::HandleNpcEvade(char* /*args*/)
return true;
}

bool ChatHandler::HandleNpcDespawn(char* /*args*/)
{
Creature* target = getSelectedCreature();

if (!target)
{
SendSysMessage(LANG_SELECT_CREATURE);
SetSentErrorMessage(true);
return false;
}

target->ForcedDespawn();
return true;
}

// add item in vendorlist
bool ChatHandler::HandleNpcAddVendorItemCommand(char* args)
{
Expand Down

0 comments on commit 543c52d

Please sign in to comment.