Merge branch 'Jorge/quest_system' into ioncannon/quest_system

This commit is contained in:
Filip Maj 2022-02-13 18:57:08 -05:00
commit cfe6ef2e5e
50 changed files with 1554 additions and 684 deletions

View file

@ -0,0 +1,3 @@
function init(npc)
return false, false, 0, 0, 0, 0;
end

View file

@ -0,0 +1,18 @@
require("global");
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, eventType, eventName)
if (eventType == ETYPE_PUSH) then
if (eventName == "caution") then
worldMaster = GetWorldMaster();
player:SendGameMessage(player, worldMaster, 34109, 0x20);
elseif (eventName == "exit") then
GetWorldManager():DoPlayerMoveInZone(player, 5.36433, 196, 133.656, -2.84938);
end
end
player:EndEvent();
end

View file

@ -49,8 +49,9 @@ function init(npc)
end
function onEventStarted(player, npc, triggerName)
local classId = npc:GetActorClassId();
local curLevel = 20; -- TODO: pull from character
local hasIssuance = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(gcIssuances[npc:GetActorClassId()]);
local hasIssuance = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(gcIssuances[classId]);
local hasChocobo = player.hasChocobo;
if (hasChocobo == false) then -- Let GMs auto have the issuance for debugging
@ -58,50 +59,64 @@ function onEventStarted(player, npc, triggerName)
end
local hasFunds = (player:GetCurrentGil() >= rentalPrice);
callClientFunction(player, "eventTalkWelcome", player);
local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 0);
if (menuChoice == 1) then -- Issuance option
callClientFunction(player, "eventTalkMyChocobo", player);
local nameResponse = callClientFunction(player, "eventSetChocoboName", true);
if (nameResponse == "") then -- Cancel Chocobo naming
callClientFunction(player, "eventCancelChocoboName", player);
callClientFunction(player, "eventTalkStepBreak", player);
player:EndEvent();
return;
else
local appearance = startAppearances[npc:GetActorClassId()];
player:IssueChocobo(appearance, nameResponse);
callClientFunction(player, "eventAfterChocoboName", player);
--Add Chocobo License and remove issuance
if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(2001007) == false) then
player:GetItemPackage(INVENTORY_KEYITEMS):AddItem(2001007);
end
player:GetItemPackage(INVENTORY_KEYITEMS):RemoveItem(gcIssuances[npc:GetActorClassId()], 1);
--Warp with the special chocobo warp mode.
mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()][1], nil, 0, SPAWN_CHOCOBO_GET, cityExits[npc:GetActorClassId()][2], cityExits[npc:GetActorClassId()][3], cityExits[npc:GetActorClassId()][4], cityExits[npc:GetActorClassId()][5]);
end
elseif(menuChoice == 2) then -- Summon Bird
mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()][1], nil, 0, SPAWN_NO_ANIM, cityExits[npc:GetActorClassId()][2], cityExits[npc:GetActorClassId()][3], cityExits[npc:GetActorClassId()][4], cityExits[npc:GetActorClassId()][5]);
elseif(menuChoice == 3) then -- Change Barding
callClientFunction(player, "eventTalkStepBreak", player);
elseif(menuChoice == 5) then -- Rent Bird
mountChocobo(player, true, 1);
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()][1], nil, 0, SPAWN_CHOCOBO_RENTAL, cityExits[npc:GetActorClassId()][2], cityExits[npc:GetActorClassId()][3], cityExits[npc:GetActorClassId()][4], cityExits[npc:GetActorClassId()][5]);
else
callClientFunction(player, "eventTalkStepBreak", player);
end
if ((classId == 1000840) and (player:HasQuest(110009))) then -- Cross-script Man0u0 dialog
local sequence = player:GetQuest(110009):getSequence();
if (sequence == 0) then
callClientFunction(player, "delegateEvent", player, GetStaticActor("Man0u0"), "processEvent000_13");
elseif (sequence == 10) then
callClientFunction(player, "delegateEvent", player, GetStaticActor("Man0u0"), "processEvent020_7");
else
player:EndEvent();
end
else
callClientFunction(player, "eventTalkWelcome", player);
local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 0);
if (menuChoice == 1) then -- Issuance option
callClientFunction(player, "eventTalkMyChocobo", player);
local nameResponse = callClientFunction(player, "eventSetChocoboName", true);
if (nameResponse == "") then -- Cancel Chocobo naming
callClientFunction(player, "eventCancelChocoboName", player);
callClientFunction(player, "eventTalkStepBreak", player);
player:EndEvent();
return;
else
local appearance = startAppearances[classId];
player:IssueChocobo(appearance, nameResponse);
callClientFunction(player, "eventAfterChocoboName", player);
--Add Chocobo License and remove issuance
if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(2001007) == false) then
player:GetItemPackage(INVENTORY_KEYITEMS):AddItem(2001007);
end
player:GetItemPackage(INVENTORY_KEYITEMS):RemoveItem(gcIssuances[classId], 1);
--Warp with the special chocobo warp mode.
mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_CHOCOBO_GET, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]);
end
elseif(menuChoice == 2) then -- Summon Bird
mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_NO_ANIM, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]);
elseif(menuChoice == 3) then -- Change Barding
callClientFunction(player, "eventTalkStepBreak", player);
elseif(menuChoice == 5) then -- Rent Bird
mountChocobo(player, true, 1);
GetWorldManager():DoZoneChange(player, cityExits[classId][1], nil, 0, SPAWN_CHOCOBO_RENTAL, cityExits[classId][2], cityExits[classId][3], cityExits[classId][4], cityExits[classId][5]);
else
callClientFunction(player, "eventTalkStepBreak", player);
end
end
player:EndEvent();
end
@ -115,6 +130,6 @@ function mountChocobo(player, isRental, rentalMinutes)
player:SendMountAppearance();
player:SetMountState(1);
player:ChangeSpeed(0.0, 5.0, 10.0, 10.0);
player:ChangeSpeed(0.0, 3.6, 9.0, 9.0);
player:ChangeState(15);
end

View file

@ -4,10 +4,10 @@ PopulaceCompanyWarp Script
Functions:
eventTalkWelcome(player) - Start Text
eventTalkWelcome(player) - Start Text
eventAskMainMenu(player, index) - Shows teleport menu, hides the teleport location at index value to prevent warping to the spot you're at
eventAfterWarpOtherZone(player) - Fades out for warp
eventTalkStepBreak() - Ends talk
eventTalkStepBreak() - Holds the client up for whatever reason?
--]]
require ("global")
@ -82,39 +82,50 @@ function onEventStarted(player, npc, triggerName)
npcId = npc:GetActorClassId();
city = warpNpc[npcId][2];
if city == 1 then
if (city == 1) then
if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passLimsa) then
passCheck = 1;
else
if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end
if (passCheck == 0) then callClientFunction(player, "eventTalkWelcome", player); end
end;
elseif city == 2 then
if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passGrid) then
elseif (city == 2) then
-- if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passGrid) then
passCheck = 1;
-- else
-- if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end
--end;
elseif (city == 3) then
if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passUldah)) then
passCheck = 1;
else
if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end
end;
elseif city == 3 then
if player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(passUldah) then
passCheck = 1;
else
if passCheck == 0 then callClientFunction(player, "eventTalkWelcome", player); end
if (passCheck == 0) then callClientFunction(player, "eventTalkWelcome", player); end
end
end
if passCheck == 1 then
if (passCheck == 1) then
choice = callClientFunction(player, "eventAskMainMenu", player, warpNpc[npcId][1]);
if choice == 0 then
--callClientFunction(player, "playereventTalkStepBreak");
player:EndEvent();
else
-- callClientFunction(player, "eventAfterWarpOtherZone", player); -- Commented out for now to prevent double fade-to-black for warp
if (choice ~= 0) then
callClientFunction(player, "eventAfterWarpOtherZone", player);
wait(1);
player:EndEvent();
GetWorldManager():DoZoneChange(player, aethernet[city][choice].zone, nil, 0, 15, aethernet[city][choice].x, aethernet[city][choice].y, aethernet[city][choice].z, aethernet[city][choice].r);
local player_zone = player:GetPos()[5];
spawnType = 0x0A;
if (player_zone == aethernet[city][choice].zone) then
GetWorldManager():DoPlayerMoveInZone(player, aethernet[city][choice].x, aethernet[city][choice].y, aethernet[city][choice].z, aethernet[city][choice].r, spawnType);
else
GetWorldManager():DoZoneChange(player, aethernet[city][choice].zone, nil, 0, spawnType, aethernet[city][choice].x, aethernet[city][choice].y, aethernet[city][choice].z, aethernet[city][choice].r);
end;
else
player:EndEvent();
end
end
player:EndEvent();
end