Added the PGL200 quest The House Always Wins. Fixed quest instances not being set on spawn. Fixed PrivateAreaPast. Added You have left the instance messages when leaving a PrivateArea. Fixed EmoteEvents. DefaultTalk has been disabled temporarily to speed up warps.

This commit is contained in:
Filip Maj 2022-03-03 01:59:13 -05:00
parent f491c63b98
commit b773098abf
9 changed files with 383 additions and 53 deletions

View file

@ -2,11 +2,16 @@ function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
if (triggerName == "caution") then
worldMaster = GetWorldMaster();
player:SendGameMessage(player, worldMaster, 34109, 0x20);
elseif (triggerName == "exit") then
end
function onEventStarted(player, npc, eventType, eventName)
player:EndEvent();
if (eventName == "caution") then
player:SendGameMessage(player, GetWorldMaster(), 34109, 0x20);
elseif (eventName == "exit") then
local activeQuests = player:GetQuestsForNpc(npc);
print(tostring(#activeQuests));
if (#activeQuests >= 1) then
activeQuests[1]:OnPush(player, npc, eventName);
end
end
end

View file

@ -22,44 +22,61 @@ function init(npc)
end
function onEventStarted(player, npc, eventType, eventName)
local defaultTalk = player:GetDefaultTalkQuest(npc);
local tutorialTalk = player:GetTutorialQuest(npc);
local activeQuests = player:GetQuestsForNpc(npc);
local possibleQuests = {};
-- Create the switch table for this npc
if (defaultTalk ~= nil and eventType == ETYPE_TALK) then
table.insert(possibleQuests, defaultTalk);
end
if (tutorialTalk ~= nil and eventType == ETYPE_TALK) then
table.insert(possibleQuests, tutorialTalk);
end
if (activeQuests ~= nil) then
table.insert(possibleQuests, unpack(activeQuests));
end
-- Either let the player choose the quest or start it if it's the only one.
local chosenQuest = nil;
if (#possibleQuests > 1) then
local currentPage = 0;
local numPages = math.floor((#possibleQuests-1)/4) + 1;
print(tostring(eventType));
print(tostring(eventType));
print(tostring(eventType));
print(tostring(eventType));
print(tostring(eventType));
print(tostring(eventType));
print(tostring(eventType));
if (eventType == 1) then
local defaultTalk = player:GetDefaultTalkQuest(npc);
local tutorialTalk = player:GetTutorialQuest(npc);
local activeQuests = player:GetQuestsForNpc(npc);
local possibleQuests = {};
while (true) do
local page, index = callClientFunction(player, "switchEvent", possibleQuests[currentPage * 4 + 1], possibleQuests[currentPage * 4 + 2], possibleQuests[currentPage * 4 + 3], possibleQuests[currentPage * 4 + 4], currentPage + 1, numPages, 0x3F1);
if (page == 0) then
chosenQuest = possibleQuests[(currentPage * 4) + index];
break;
elseif (page > 0) then
currentPage = page - 1;
else
player:EndEvent();
return;
-- Create the switch table for this npc
if (defaultTalk ~= nil and eventType == ETYPE_TALK) then
table.insert(possibleQuests, defaultTalk);
end
if (tutorialTalk ~= nil and eventType == ETYPE_TALK) then
table.insert(possibleQuests, tutorialTalk);
end
if (activeQuests ~= nil) then
for i=1,#activeQuests do
table.insert(possibleQuests, activeQuests[i]);
end
end
elseif (#possibleQuests == 1) then
chosenQuest = possibleQuests[1];
end
end
-- Either let the player choose the quest or start it if it's the only one.
if (#possibleQuests > 1) then
local currentPage = 0;
local numPages = math.floor((#possibleQuests-1)/4) + 1;
while (true) do
local page, index = callClientFunction(player, "switchEvent", possibleQuests[currentPage * 4 + 1], possibleQuests[currentPage * 4 + 2], possibleQuests[currentPage * 4 + 3], possibleQuests[currentPage * 4 + 4], currentPage + 1, numPages, 0x3F1);
if (page == 0) then
chosenQuest = possibleQuests[(currentPage * 4) + index];
break;
elseif (page > 0) then
currentPage = page - 1;
else
player:EndEvent();
return;
end
end
elseif (#possibleQuests == 1) then
chosenQuest = possibleQuests[1];
end
else
local activeQuests = player:GetQuestsForNpc(npc);
if (#activeQuests != 0) then
chosenQuest = activeQuests[1];
end
end
-- Run the quest event or tell the devs it's missing.
if (chosenQuest ~= nil) then