Cleaned up the way a npc ls is set. Added an optimization, no changes are made if it is being set to the same value already set. Added the handler for npc linkshells when they are used.

This commit is contained in:
Filip Maj 2017-04-09 14:01:15 -04:00
parent 90e48f9ddd
commit 0d4ed1d1c8
3 changed files with 84 additions and 6 deletions

View file

@ -10,13 +10,13 @@ function onTrigger(player, argc, lsId, state)
local id = tonumber(lsId) or 0;
if (state == "alert") then
player:SetNpcLS(id, true, true);
player:SetNpcLS(id, NPCLS_ALERT);
elseif (state == "active") then
player:SetNpcLS(id, true, false);
player:SetNpcLS(id, NPCLS_ACTIVE);
elseif (state == "inactive") then
player:SetNpcLS(id, false, true);
player:SetNpcLS(id, NPCLS_INACTIVE);
elseif (state == "gone") then
player:SetNpcLS(id, false, false);
player:SetNpcLS(id, NPCLS_GONE);
else
player:SendMessage(0x20, "", "Invalid state argument");
return;