1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-06-08 17:27:45 +00:00

Got limsa opening working again

This commit is contained in:
Filip Maj 2022-01-26 01:15:02 -05:00
parent c38caffaf1
commit 93c90df797
7 changed files with 218 additions and 161 deletions

View file

@ -24,7 +24,7 @@ function onEventStarted(player, actor, triggerName)
end
function onUpdate()
function main()
end
function onTalkEvent(player, npc)

View file

@ -146,6 +146,24 @@ SPAWN_CHOCOBO_RENTAL = 0x14;
SPAWN_CUTTER_SANDS = 0x17;
SPAWN_NIGHTMARE = 0x18;
-- EVENTS
ETYPE_COMMAND = 0;
ETYPE_TALK = 1;
ETYPE_PUSH = 2;
ETYPE_EMOTE = 3;
ETYPE_NOTICE = 5;
-- QUEST INSTANCE
ENPC_PROP_QFLAG = 0;
ENPC_PROP_CAN_TALK = 1;
ENPC_PROP_CAN_PUSH = 2;
ENPC_PROP_CAN_EMOTE = 3;
ENPC_PROP_CAN_NOTICE = 4;
QFLAG_NONE = 0;
QFLAG_MAP = 1;
QFLAG_PLATE = 2;
-- Common Helper Functions
function attentionMessage(player, textId, ...)
player:SendGameMessage(GetWorldMaster(), textId, 0x20, ...);

View file

@ -31,8 +31,7 @@ function onBeginLogin(player)
player.positionY = 10.35;
player.positionZ = -36.91;
player.rotation = 0.025;
player:GetQuest(110001):ClearQuestData();
player:GetQuest(110001):ClearQuestFlags();
player:GetQuest(110001):ClearData();
elseif (player:HasQuest(110005) == true and player:GetZoneID() == 166) then
director = player:GetZone():CreateDirector("OpeningDirector", false);
player:AddDirector(director);

View file

@ -1,93 +1,99 @@
require("global");
--[[
Quest Script
Name: Shapeless Melody
Code: Man0l0
Id: 110001
Prereq: None (Given on chara creation)
]]
-- Sequence Numbers
SEQ_000 = 0; -- On the boat interior; contains the basics tutorial.
SEQ_005 = 5; -- Combat on the top of the boat.
SEQ_010 = 10; -- In Limsa Lominsa's port.
-- Actor Class Ids
WELLTRAVELED_MERCHANT = 1000438;
TIPSY_ADVENTURER = 1000439;
CULTIVATED_TENDER = 1000440;
ANXIOUS_ADVENTURER = 1000441;
BABYFACED_ADVENTURER = 1000442;
AUSTERE_ADVENTURER = 1000443;
UNDIGNIFIED_ADVENTURER = 1000444;
SHADOWY_TRAVELER = 1000445;
ASTUTE_MERCHANT = 1000446;
VOLUPTUOUS_VIXEN = 1000447;
INDIFFERENT_PASSERBY = 1000448;
PRATTLING_ADVENTURER = 1000449;
LANKY_TRAVELER = 1000450;
GRINNING_ADVENTURER = 1000451;
ROSTNSTHAL = 1001652;
EXIT_TRIGGER = 1090025;
-- Quest Markers
MRKR_ROSTNSTHAL = 11000203;
MRKR_VOLUPTUOUS_VIXEN = 11000204;
MRKR_BABYFACED_ADVENTURER = 11000205;
MRKR_TRIGGER_DOOR = 11000206;
-- Quest Flags
seq000_Flag_MainTut0 = false;
seq000_Flag_MiniTut1 = false;
seq000_Flag_MiniTut2 = false;
seq000_Flag_MiniTut3 = false;
-- Map Markers
local seq000_Markers = {
11000203, -- Rostnsthal
11000204, -- Voluptuous Vixen
11000205, -- Baby-faced Adventurer
};
-- Actors in this quest
NPC_WELLTRAVELED_MERCHANT = 0;
NPC_TIPSY_ADVENTURER = 0;
NPC_CULTIVATED_TENDER = 0;
NPC_ANXIOUS_ADVENTURER = 0;
NPC_BABYFACED_ADVENTURER = 0;
NPC_AUSTERE_ADVENTURER = 0;
NPC_UNDIGNIFIED_ADVENTURER = 0;
NPC_SHADOWY_TRAVELER = 0;
NPC_ASTUTE_MERCHANT = 0;
NPC_VOLUPTUOUS_VIXEN = 0;
NPC_INDIFFERENT_PASSERBY = 0;
NPC_PRATTLING_ADVENTURER = 0;
NPC_GRINNING_ADVENTURER = 0;
NPC_ROSTNSTHAL = 0;
NPC_EXIT_TRIGGER = 0;
FLAG_SEQ000_MINITUT0 = 0;
FLAG_SEQ000_MINITUT1 = 1;
FLAG_SEQ000_MINITUT2 = 2;
FLAG_SEQ000_MINITUT3 = 3;
function onStart(player, quest)
quest::StartSequence(SEQ_000);
quest:StartSequence(SEQ_000);
end
function onFinish(player, quest)
end
function onSequence(player, quest, seqNum)
quest::ClearENpcs();
function onSequence(player, quest, sequence)
quest:ClearENpcs();
quest:ClearData();
if (sequence == SEQ_000) then
-- Setup states incase we loaded in.
local rostnsthalQuestFlag = QFLAG_NONE;
local rostnsthalCanPush = true;
local rostnsthalCanTalk = false;
if (seq000_Flag_MainTut0 == true) then
rostnsthalCanTalk = true;
rostnsthalCanPush = false;
if (seq000_Flag_MiniTut1 == false) then
rostnsthalQuestFlag = QFLAG_BOTH;
end
else
rostnsthalCanTalk = false;
rostnsthalCanPush = true;
end
local fStrtTut = quest:GetFlag(FLAG_SEQ000_MINITUT0)
quest::AddENpc
quest::AddENpc(NPC_WELLTRAVELED_MERCHANT);
quest::AddENpc(NPC_TIPSY_ADVENTURER);
quest::AddENpc(NPC_CULTIVATED_TENDER);
quest::AddENpc(NPC_ANXIOUS_ADVENTURER);
quest::AddENpc(NPC_BABYFACED_ADVENTURER);
quest::AddENpc(NPC_AUSTERE_ADVENTURER);
quest::AddENpc(NPC_UNDIGNIFIED_ADVENTURER);
quest::AddENpc(NPC_SHADOWY_TRAVELER);
quest::AddENpc(NPC_ASTUTE_MERCHANT);
quest::AddENpc(NPC_VOLUPTUOUS_VIXEN);
quest::AddENpc(NPC_INDIFFERENT_PASSERBY);
quest::AddENpc(NPC_PRATTLING_ADVENTURER);
quest::AddENpc(NPC_GRINNING_ADVENTURER);
quest::AddENpc(NPC_ROSTNSTHAL, rostnsthalQuestFlag, rostnsthalCanTalk, false, rostnsthalCanPush);
quest::AddENpc(NPC_EXIT_TRIGGER);
-- Setup states incase we loaded in.
local rostnsthalFlag = quest:GetFlag(FLAG_SEQ000_MINITUT1) and QFLAG_PLATE or QFLAG_NONE;
local vixenFlag = quest:GetFlag(FLAG_SEQ000_MINITUT2) and QFLAG_PLATE or QFLAG_NONE;
local babyfaceFlag = quest:GetFlag(FLAG_SEQ000_MINITUT3) and QFLAG_PLATE or QFLAG_NONE;
local exitFlag = quest:GetFlags() == 0xF and QFLAG_PLATE or QFLAG_NONE;
local rostnsthalCanPush = not fStrtTut;
local exitCanPush = quest:GetFlags() == 0xF;
quest:AddENpc(WELLTRAVELED_MERCHANT);
quest:AddENpc(TIPSY_ADVENTURER);
quest:AddENpc(CULTIVATED_TENDER);
quest:AddENpc(ANXIOUS_ADVENTURER);
quest:AddENpc(BABYFACED_ADVENTURER, babyfaceFlag);
quest:AddENpc(AUSTERE_ADVENTURER);
quest:AddENpc(UNDIGNIFIED_ADVENTURER);
quest:AddENpc(SHADOWY_TRAVELER);
quest:AddENpc(ASTUTE_MERCHANT);
quest:AddENpc(VOLUPTUOUS_VIXEN, vixenFlag);
quest:AddENpc(INDIFFERENT_PASSERBY);
quest:AddENpc(PRATTLING_ADVENTURER);
quest:AddENpc(GRINNING_ADVENTURER);
quest:AddENpc(ROSTNSTHAL, rostnsthalFlag, true, rostnsthalCanPush);
quest:AddENpc(EXIT_TRIGGER, exitFlag, false, exitCanPush);
elseif (sequence == SEQ_005) then
elseif (sequence == SEQ_010) then
end
end
function onTalk(player, quest, npc)
local sequence = quest::getSequence();
local classId = npc::GetActorClassId();
local sequence = quest:getSequence();
local classId = npc:GetActorClassId();
if (sequence == SEQ_000) then
seq000_onTalk(player, quest, npc, classId);
elseif (sequence == SEQ_005) then
sequence005_onTalk(player, quest, npc, classId);
elseif (sequence == SEQ_010) then
sequence010_onTalk(player, quest, npc, classId);
end
@ -95,127 +101,133 @@ function onTalk(player, quest, npc)
end
function seq000_onTalk(player, quest, npc, classId)
if (classId == NPC_WELLTRAVELED_MERCHANT) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_4", nil, nil, nil);
elseif (classId == NPC_TIPSY_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_5", nil, nil, nil);
elseif (classId == NPC_CULTIVATED_TENDER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_6", nil, nil, nil);
elseif (classId == NPC_ANXIOUS_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_7", nil, nil, nil);
elseif (classId == NPC_BABYFACED_ADVENTURER) then
if (seq000_Flag_MiniTut3 == false) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini003", nil, nil, nil);
quest::UpdateENpc(FLAG, QFLAG_NONE);
seq000_Flag_MiniTut3 = true;
if (classId == WELLTRAVELED_MERCHANT) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_4");
elseif (classId == TIPSY_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_5");
elseif (classId == CULTIVATED_TENDER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_6");
elseif (classId == ANXIOUS_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_7");
elseif (classId == BABYFACED_ADVENTURER) then
if (not quest:GetFlag(FLAG_SEQ000_MINITUT3)) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini003");
quest:UpdateENpc(VOLUPTUOUS_VIXEN, BABYFACED_ADVENTURER, QFLAG_NONE);
quest:SetFlag(FLAG_SEQ000_MINITUT3);
else
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_8", nil, nil, nil);
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_8");
end
elseif (classId == NPC_AUSTERE_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_9", nil, nil, nil);
elseif (classId == NPC_UNDIGNIFIED_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_10", nil, nil, nil);
elseif (classId == NPC_SHADOWY_TRAVELER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_11", nil, nil, nil);
elseif (classId == NPC_ASTUTE_MERCHANT) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_12", nil, nil, nil);
elseif (classId == NPC_VOLUPTUOUS_VIXEN) then
if (seq000_Flag_MiniTut2 == false) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini002", nil, nil, nil);
quest::UpdateENpc(classId, FLAG, QFLAG_NONE);
seq000_Flag_MiniTut2 = true;
elseif (classId == AUSTERE_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_9");
elseif (classId == UNDIGNIFIED_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_10");
elseif (classId == SHADOWY_TRAVELER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_11");
elseif (classId == ASTUTE_MERCHANT) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_12");
elseif (classId == VOLUPTUOUS_VIXEN) then
if (not quest:GetFlag(FLAG_SEQ000_MINITUT2)) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrMini002");
quest:UpdateENpc(VOLUPTUOUS_VIXEN, ENPC_PROP_QFLAG, QFLAG_NONE);
quest:SetFlag(FLAG_SEQ000_MINITUT2);
else
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_13", nil, nil, nil);
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_13");
end
elseif (classId == NPC_INDIFFERENT_PASSERBY) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_14", nil, nil, nil);
elseif (classId == NPC_PRATTLING_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_15", nil, nil, nil);
elseif (classId == NPC_LANKY_TRAVELER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_16", nil, nil, nil);
elseif (classId == NPC_GRINNING_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_17", nil, nil, nil);
elseif (classId == NPC_ROSTNSTHAL) then
callClientFunction(player, "delegateEvent", player, quest, "processTtrMini001", nil, nil, nil);
if (seq000_Flag_MiniTut1 == false) then
quest::UpdateENpc(classId, FLAG, QFLAG_NONE);
seq000_Flag_MiniTut1 = true;
elseif (classId == INDIFFERENT_PASSERBY) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_14");
elseif (classId == PRATTLING_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_15");
elseif (classId == LANKY_TRAVELER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_16");
elseif (classId == GRINNING_ADVENTURER) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_17");
elseif (classId == ROSTNSTHAL) then
-- Handle the talk tutorial after the push one.
if (not quest:GetFlag(FLAG_SEQ000_MINITUT0)) then
callClientFunction(player, "delegateEvent", player, quest, "processTtrNomal003");
quest:SetFlag(FLAG_SEQ000_MINITUT0);
quest:UpdateENpc(ROSTNSTHAL, ENPC_PROP_CAN_PUSH, false);
quest:UpdateENpc(ROSTNSTHAL, ENPC_PROP_QFLAG, QFLAG_PLATE);
quest:UpdateENpc(VOLUPTUOUS_VIXEN, ENPC_PROP_QFLAG, QFLAG_PLATE);
quest:UpdateENpc(BABYFACED_ADVENTURER, ENPC_PROP_QFLAG, QFLAG_PLATE);
else
callClientFunction(player, "delegateEvent", player, quest, "processTtrMini001");
if (not quest:GetFlag(FLAG_SEQ000_MINITUT1)) then
quest:UpdateENpc(ROSTNSTHAL, ENPC_PROP_QFLAG, QFLAG_NONE);
quest:SetFlag(FLAG_SEQ000_MINITUT1);
end
end
elseif (classId == NPC_EXIT_TRIGGER) then
elseif (classId == EXIT_TRIGGER) then
doExitDoor(player, quest, npc);
return;
end
player:EndEvent();
if (seq000_Flag_MiniTut1 == true && seq000_Flag_MiniTut2 == true && seq000_Flag_MiniTut3 == true) then
quest::UpdateENpc(NPC_EXIT_TRIGGER, FLAG, QFLAG_BOTH);
quest::UpdateENpc(NPC_EXIT_TRIGGER, CANPUSH, true);
if (quest:GetFlags() == 0xF) then
quest:UpdateENpc(EXIT_TRIGGER, ENPC_PROP_CAN_PUSH, true);
quest:UpdateENpc(EXIT_TRIGGER, ENPC_PROP_QFLAG, QFLAG_MAP);
end
end
function sequence005_onTalk(player, quest, npc, classId)
player:EndEvent();
end
function sequence010_onTalk(player, quest, npc, classId)
end
function onEmote(player, quest, npc, emote)
end
function onPush(player, quest, npc)
local sequence = quest::getSequence();
local classId = npc::GetActorClassId();
local sequence = quest:getSequence();
local classId = npc:GetActorClassId();
if (sequence == SEQ_000) then
if (classId == NPC_EXIT_TRIGGER) then
if (classId == EXIT_TRIGGER) then
doExitDoor(player, quest, npc);
return;
elseif (classId == NPC_ROSTNSTHAL) then
callClientFunction(player, "delegateEvent", player, man0l0Quest, "processTtrNomal002", nil, nil, nil);
quest::UpdateENpc(NPC_ROSTNSTHAL, CANPUSH, false);
elseif (classId == ROSTNSTHAL) then
callClientFunction(player, "delegateEvent", player, quest, "processTtrNomal002");
player:EndEvent();
end
end
end
function onNotice(player, quest, npc)
end
function onNotice(player, quest, target)
local sequence = quest:getSequence();
function getJournalInformation(player, quest)
return {};
if (sequence == SEQ_000) then
callClientFunction(player, "delegateEvent", player, quest, "processTtrNomal001withHQ");
end
end
function getJournalMapMarkerList(player, quest)
local sequence = quest::getSequence();
local sequence = quest:getSequence();
if (sequence == SEQ_000) then
return seq000_Markers;
return MRKR_ROSTNSTHAL, MRKR_BABYFACED_ADVENTURER, MRKR_VOLUPTUOUS_VIXEN;
end
end
function doExitDoor(player, quest, npc)
local choice = callClientFunction(player, "delegateEvent", player, quest, "processEventNewRectAsk", nil);
if (choice == 1) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_2", nil, nil, nil, nil);
player:EndEvent();
local choice = callClientFunction(player, "delegateEvent", player, quest, "processEventNewRectAsk", nil);
if (choice == 1) then
callClientFunction(player, "delegateEvent", player, quest, "processEvent000_2", nil);
player:EndEvent();
quest::StartSequence(SEQ_005);
quest:StartSequence(SEQ_005);
contentArea = player:GetZone():CreateContentArea(player, "/Area/PrivateArea/Content/PrivateAreaMasterSimpleContent", "man0l01", "SimpleContent30002", "Quest/QuestDirectorMan0l001");
contentArea = player:GetZone():CreateContentArea(player, "/Area/PrivateArea/Content/PrivateAreaMasterSimpleContent", "man0l01", "SimpleContent30002", "Quest/QuestDirectorMan0l001");
if (contentArea == nil) then
return;
end
director = contentArea:GetContentDirector();
player:AddDirector(director);
director:StartDirector(false);
player:KickEvent(director, "noticeEvent", true);
player:SetLoginDirector(director);
GetWorldManager():DoZoneChangeContent(player, contentArea, -5, 16.35, 6, 0.5, 16);
if (contentArea == nil) then
return;
else
player::EndEvent();
end
director = contentArea:GetContentDirector();
player:AddDirector(director);
director:StartDirector(false);
player:KickEvent(director, "noticeEvent", true);
player:SetLoginDirector(director);
GetWorldManager():DoZoneChangeContent(player, contentArea, -5, 16.35, 6, 0.5, 16);
return;
else
player:EndEvent();
end
end

View file

@ -1,4 +1,4 @@
require("global.lua")
require("global")
function onStart(player, quest)
quest:StartSequence(SEQ_000);

View file

@ -30,6 +30,9 @@ namespace Meteor.Map.Actors
{
public const ushort SEQ_NOT_STARTED = ushort.MaxValue;
public enum QuestFlag { None = 0, Map = 1, Plate = 2 }
public enum ENpcProperty { QuestFlag = 0, CanTalk = 1, CanPush = 2, CanEmote = 3, CanNotice = 4}
public class ENpcQuestInstance
{
public readonly uint actorClassId;
@ -72,7 +75,7 @@ namespace Meteor.Map.Actors
private QuestData data = new QuestData();
private Dictionary<uint, ENpcQuestInstance> ActiveENpcs = new Dictionary<uint, ENpcQuestInstance>();
public void AddENpc(uint classId, byte flagType = 0, bool isTalkEnabled = false, bool isEmoteEnabled = false, bool isPushEnabled = false, bool isSpawned = false)
public void AddENpc(uint classId, byte flagType = 0, bool isTalkEnabled = true, bool isEmoteEnabled = false, bool isPushEnabled = false, bool isSpawned = false)
{
if (ActiveENpcs.ContainsKey(classId))
return;
@ -90,10 +93,33 @@ namespace Meteor.Map.Actors
ActiveENpcs.Clear();
}
public void UpdateENpc(uint classId, int param, object value)
public void UpdateENpc(uint classId, ENpcProperty property, object value)
{
if (!ActiveENpcs.ContainsKey(classId))
return;
ENpcQuestInstance instance = ActiveENpcs[classId];
switch (property)
{
case ENpcProperty.QuestFlag:
if (value is double)
instance.questFlagType = (byte)(double)value;
else if (value is int)
instance.questFlagType = (byte)value;
break;
case ENpcProperty.CanTalk:
instance.isTalkEnabled = (bool)value;
break;
case ENpcProperty.CanPush:
instance.isPushEnabled = (bool)value;
break;
case ENpcProperty.CanEmote:
instance.isEmoteEnabled = (bool)value;
break;
}
Owner.playerSession.UpdateQuestNpcInInstance(instance, false);
}
public ENpcQuestInstance GetENpcInstance(uint classId)

View file

@ -55,6 +55,8 @@ namespace Meteor.Map.dataobjects
public void QueuePacket(SubPacket subPacket)
{
////if (subPacket.gameMessage.opcode != 1)
//subPacket.DebugPrintSubPacket();
subPacket.SetTargetId(id);
Server.GetWorldConnection().QueuePacket(subPacket);
}
@ -185,7 +187,7 @@ namespace Meteor.Map.dataobjects
{
if (!clearInstance)
{
QueuePacket(actor.GetSetEventStatusPackets());
QueuePacket(actor.GetSetEventStatusPackets(questInstance.isTalkEnabled, questInstance.isEmoteEnabled, questInstance.isPushEnabled));
QueuePacket(SetActorQuestGraphicPacket.BuildPacket(actor.actorId, questInstance.questFlagType));
}
else