mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 05:54:50 +02:00
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:
parent
90e48f9ddd
commit
0d4ed1d1c8
3 changed files with 84 additions and 6 deletions
45
data/scripts/commands/NpcLinkshellChatCommand.lua
Normal file
45
data/scripts/commands/NpcLinkshellChatCommand.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
require ("global")
|
||||
|
||||
--[[
|
||||
|
||||
NpcLinkshellChatCommand Script
|
||||
|
||||
Handler for when a player clicks a npc ls to talk to. If adding new linkshells to the handle, make sure to add
|
||||
it to the handler table (with correct offset), and that your function is above the handler. If padding is needed
|
||||
to hit some ID, add "nils".
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
local function handleAdventurersGuild(player)
|
||||
if (player:HasQuest(110006) == true) then
|
||||
local man0g1Quest = player:GetQuest("Man0g1");
|
||||
player:SendGameMessage(man0g1Quest, 330, 39, 1300018);
|
||||
end
|
||||
end
|
||||
|
||||
local function handlePathOfTheTwelve(player)
|
||||
player:SendMessage(0x20, "", "Test");
|
||||
end
|
||||
|
||||
local npcLsHandlers = {
|
||||
handleAdventurersGuild,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
handlePathOfTheTwelve
|
||||
}
|
||||
|
||||
function onEventStarted(player, command, triggerName, npcLsId)
|
||||
|
||||
if (npcLsHandlers[npcLsId] ~= nil) then
|
||||
npcLsHandlers[npcLsId](player);
|
||||
player:SetNpcLS(npcLsId-1, NPCLS_ACTIVE);
|
||||
else
|
||||
player:SendMessage(0x20, "", "That Npc Linkshell is not implemented yet.");
|
||||
end
|
||||
|
||||
player:endEvent();
|
||||
|
||||
end
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue