mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04: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
@ -73,6 +73,11 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
public const int TIMER_RETURN = 18;
|
public const int TIMER_RETURN = 18;
|
||||||
public const int TIMER_SKIRMISH = 19;
|
public const int TIMER_SKIRMISH = 19;
|
||||||
|
|
||||||
|
public const int NPCLS_GONE = 0;
|
||||||
|
public const int NPCLS_INACTIVE = 1;
|
||||||
|
public const int NPCLS_ACTIVE = 2;
|
||||||
|
public const int NPCLS_ALERT = 3;
|
||||||
|
|
||||||
public static int[] MAXEXP = {570, 700, 880, 1100, 1500, 1800, 2300, 3200, 4300, 5000, //Level <= 10
|
public static int[] MAXEXP = {570, 700, 880, 1100, 1500, 1800, 2300, 3200, 4300, 5000, //Level <= 10
|
||||||
5900, 6800, 7700, 8700, 9700, 11000, 12000, 13000, 15000, 16000, //Level <= 20
|
5900, 6800, 7700, 8700, 9700, 11000, 12000, 13000, 15000, 16000, //Level <= 20
|
||||||
20000, 22000, 23000, 25000, 27000, 29000, 31000, 33000, 35000, 38000, //Level <= 30
|
20000, 22000, 23000, 25000, 27000, 29000, 31000, 33000, 35000, 38000, //Level <= 30
|
||||||
@ -1254,8 +1259,36 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetNpcLS(uint npcLSId, bool isCalling, bool isExtra)
|
public void SetNpcLS(uint npcLSId, uint state)
|
||||||
{
|
{
|
||||||
|
bool isCalling, isExtra;
|
||||||
|
isCalling = isExtra = false;
|
||||||
|
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case NPCLS_INACTIVE:
|
||||||
|
|
||||||
|
if (playerWork.npcLinkshellChatExtra[npcLSId] == true && playerWork.npcLinkshellChatCalling[npcLSId] == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
isExtra = true;
|
||||||
|
break;
|
||||||
|
case NPCLS_ACTIVE:
|
||||||
|
|
||||||
|
if (playerWork.npcLinkshellChatExtra[npcLSId] == false && playerWork.npcLinkshellChatCalling[npcLSId] == true)
|
||||||
|
return;
|
||||||
|
|
||||||
|
isCalling = true;
|
||||||
|
break;
|
||||||
|
case NPCLS_ALERT:
|
||||||
|
|
||||||
|
if (playerWork.npcLinkshellChatExtra[npcLSId] == true && playerWork.npcLinkshellChatCalling[npcLSId] == true)
|
||||||
|
return;
|
||||||
|
|
||||||
|
isExtra = isCalling = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
playerWork.npcLinkshellChatExtra[npcLSId] = isExtra;
|
playerWork.npcLinkshellChatExtra[npcLSId] = isExtra;
|
||||||
playerWork.npcLinkshellChatCalling[npcLSId] = isCalling;
|
playerWork.npcLinkshellChatCalling[npcLSId] = isCalling;
|
||||||
|
|
||||||
|
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;
|
local id = tonumber(lsId) or 0;
|
||||||
|
|
||||||
if (state == "alert") then
|
if (state == "alert") then
|
||||||
player:SetNpcLS(id, true, true);
|
player:SetNpcLS(id, NPCLS_ALERT);
|
||||||
elseif (state == "active") then
|
elseif (state == "active") then
|
||||||
player:SetNpcLS(id, true, false);
|
player:SetNpcLS(id, NPCLS_ACTIVE);
|
||||||
elseif (state == "inactive") then
|
elseif (state == "inactive") then
|
||||||
player:SetNpcLS(id, false, true);
|
player:SetNpcLS(id, NPCLS_INACTIVE);
|
||||||
elseif (state == "gone") then
|
elseif (state == "gone") then
|
||||||
player:SetNpcLS(id, false, false);
|
player:SetNpcLS(id, NPCLS_GONE);
|
||||||
else
|
else
|
||||||
player:SendMessage(0x20, "", "Invalid state argument");
|
player:SendMessage(0x20, "", "Invalid state argument");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user