1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-21 12:17:46 +00:00

Finished filling out lua script for rentals/summons/new chocos.

This commit is contained in:
Filip Maj 2019-07-25 19:46:05 -04:00
parent ca4f00cfe3
commit b627ecf0fe
2 changed files with 40 additions and 151 deletions

View file

@ -11,10 +11,20 @@ eventSetChocoboName(true) - Opens the set name dialog
eventAfterChocoboName(player) - Called if player done naming chocobo, shows cutscene, returns state and waits to teleport outside city. eventAfterChocoboName(player) - Called if player done naming chocobo, shows cutscene, returns state and waits to teleport outside city.
eventCancelChocoboName(player) - Called if player cancels naming chocobo, returns state. eventCancelChocoboName(player) - Called if player cancels naming chocobo, returns state.
eventTalkStepBreak(player) - Finishes talkTurn and says a goodbye eventTalkStepBreak(player) - Finishes talkTurn and says a goodbye
Notes:
* Rent price and time seems to be hardcoded into the client. Price is always 800gil and time is 10m.
* The func eventSetChocoboName *requires* the actor with id `1080101` to be present in the client instance or it will crash (thanks Jorge for finding that).
* Special spawn codes must be sent for getting your chocobo or renting for it to work properly.
--]] --]]
require ("global") require ("global")
local rentalPrice = 800;
local rentalTime = 10;
local gcIssuances = { local gcIssuances = {
[1500006] = 2001004, [1500006] = 2001004,
[1500061] = 2001005, [1500061] = 2001005,
@ -28,39 +38,32 @@ local startAppearances = {
}; };
local cityExits = { local cityExits = {
[1500006] = 15, [1500006] = {133, -6.032, 46.356, 132.572, 3.034},
[1500061] = 14, [1500061] = {150, 333.271, 5.889, -943.275, 0.794},
[1000840] = 16 [1000840] = {170, -26.088, 181.846, -79.438, 2.579}
}; };
function init(npc) function init(npc)
return false, false, 0, 0; return false, false, 0, 0;
end end
function onEventStarted(player, npc, triggerName) function onEventStarted(player, npc, triggerName)
--callClientFunction(player, "eventTalkWelcome", player);
--callClientFunction(player, "eventAskMainMenu", player, 20, true, true, true, true, 4);
--callClientFunction(player, "eventTalkMyChocobo", player);
--callClientFunction(player, "eventSetChocoboName", false);
--callClientFunction(player, "eventAfterChocoboName", player);
local curLevel = 20; -- TODO: pull from character 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[npc:GetActorClassId()]);
local hasChocobo = player.hasChocobo; local hasChocobo = player.hasChocobo;
if (player.isGM and hasChocobo == false) then -- Let GMs auto have the issuance for debugging if (hasChocobo == false) then -- Let GMs auto have the issuance for debugging
hasIssuance = true; hasIssuance = true;
end end
local rentPrice = 800; local hasFunds = (player:GetCurrentGil() >= rentalPrice);
local hasFunds = (player:GetCurrentGil() >= rentPrice);
callClientFunction(player, "eventTalkWelcome", player); callClientFunction(player, "eventTalkWelcome", player);
local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, true, true, player.chocoboAppearance); local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, hasChocobo, hasChocobo, 0);
if (menuChoice == 1) then -- Issuance option if (menuChoice == 1) then -- Issuance option
callClientFunction(player, "eventTalkMyChocobo", player); callClientFunction(player, "eventTalkMyChocobo", player);
local nameResponse = callClientFunction(player, "eventSetChocoboName", true); local nameResponse = callClientFunction(player, "eventSetChocoboName", true);
@ -70,31 +73,28 @@ function onEventStarted(player, npc, triggerName)
player:EndEvent(); player:EndEvent();
return; return;
else else
local appearance = startAppearances[npc:GetActorClassId()]; player:IssueChocobo(appearance, startAppearances[npc:GetActorClassId()]);
player:IssueChocobo(appearance, nameResponse); callClientFunction(player, "eventAfterChocoboName", player);
callClientFunction(player, "eventAfterChocoboName", player);
mountChocobo(player); --Add Chocobo License and remove issuance
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()]);
player:SendGameMessage(player, GetWorldMaster(), 25248, 0x20, 2001007);
player:SendDataPacket("attention", GetWorldMaster(), "", 25248, 2001007);
if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(2001007) == false) then if (player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(2001007) == false) then
player:GetItemPackage(INVENTORY_KEYITEMS):AddItem(2001007); player:GetItemPackage(INVENTORY_KEYITEMS):AddItem(2001007);
end end
player:GetItemPackage(INVENTORY_KEYITEMS):RemoveItem(gcIssuances[npc:GetActorClassId()], 1); player:GetItemPackage(INVENTORY_KEYITEMS):RemoveItem(gcIssuances[npc:GetActorClassId()], 1);
player:EndEvent(); --Warp with the special chocobo warp mode.
return; 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 end
elseif(menuChoice == 2) then -- Summon Bird elseif(menuChoice == 2) then -- Summon Bird
mountChocobo(player); mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()]); 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 elseif(menuChoice == 3) then -- Change Barding
callClientFunction(player, "eventTalkStepBreak", player); callClientFunction(player, "eventTalkStepBreak", player);
elseif(menuChoice == 5) then -- Rent Bird elseif(menuChoice == 5) then -- Rent Bird
issueRentalChocobo(player); 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 else
callClientFunction(player, "eventTalkStepBreak", player); callClientFunction(player, "eventTalkStepBreak", player);
end end
@ -102,13 +102,16 @@ function onEventStarted(player, npc, triggerName)
player:EndEvent(); player:EndEvent();
end end
function mountChocobo(player) function mountChocobo(player, isRental, rentalMinutes)
player:SendChocoboAppearance(); if (isRental) then
player:ChangeMusic(64);
player:StartChocoboRental(rentalMinutes);
else
player:ChangeMusic(83);
end
player:SendMountAppearance();
player:SetMountState(1); player:SetMountState(1);
player:ChangeSpeed(0.0, 5.0, 10.0); player:ChangeSpeed(0.0, 5.0, 10.0, 10.0);
player:ChangeState(15); player:ChangeState(15);
end end
function issueRentalChocobo(player)
--TODO: Write issue rental chocobo code
end

View file

@ -1,114 +0,0 @@
--[[
PopulaceChocoboLender Script
Functions:
eventTalkWelcome(player) - Start Text
eventAskMainMenu(player, curLevel, hasFundsForRent, isPresentChocoboIssuance, isSummonMyChocobo, isChangeBarding, currentChocoboWare) - Shows the main menu
eventTalkMyChocobo(player) - Starts the cutscene for getting a chocobo
eventSetChocoboName(true) - Opens the set name dialog
eventAfterChocoboName(player) - Called if player done naming chocobo, shows cutscene, returns state and waits to teleport outside city.
eventCancelChocoboName(player) - Called if player cancels naming chocobo, returns state.
eventTalkStepBreak(player) - Finishes talkTurn and says a goodbye
--]]
require ("global")
local gcIssuances = {
[1500006] = 2001004,
[1500061] = 2001005,
[1000840] = 2001006
};
local startAppearances = {
[1500006] = CHOCOBO_LIMSA1,
[1500061] = CHOCOBO_GRIDANIA1,
[1000840] = CHOCOBO_ULDAH1
};
local cityExits = {
[1500006] = 15,
[1500061] = 14,
[1000840] = 16
};
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
--callClientFunction(player, "eventTalkWelcome", player);
--callClientFunction(player, "eventAskMainMenu", player, 20, true, true, true, true, 4);
--callClientFunction(player, "eventTalkMyChocobo", player);
--callClientFunction(player, "eventSetChocoboName", false);
--callClientFunction(player, "eventAfterChocoboName", player);
local curLevel = 20; -- TODO: pull from character
local hasIssuance = player:GetItemPackage(INVENTORY_KEYITEMS):HasItem(gcIssuances[npc:GetActorClassId()]);
local hasChocobo = player.hasChocobo;
if (player.isGM and hasChocobo == false) then -- Let GMs auto have the issuance for debugging
hasIssuance = true;
end
local rentPrice = 800;
local hasFunds = (player:GetCurrentGil() >= rentPrice);
callClientFunction(player, "eventTalkWelcome", player);
local menuChoice = callClientFunction(player, "eventAskMainMenu", player, curLevel, hasFunds, hasIssuance, true, true, player.chocoboAppearance);
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);
mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()]);
player:SendGameMessage(player, GetWorldMaster(), 25248, 0x20, 2001007);
player:SendDataPacket("attention", GetWorldMaster(), "", 25248, 2001007);
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);
player:EndEvent();
return;
end
elseif(menuChoice == 2) then -- Summon Bird
mountChocobo(player);
GetWorldManager():DoZoneChange(player, cityExits[npc:GetActorClassId()]);
elseif(menuChoice == 3) then -- Change Barding
callClientFunction(player, "eventTalkStepBreak", player);
elseif(menuChoice == 5) then -- Rent Bird
issueRentalChocobo(player);
else
callClientFunction(player, "eventTalkStepBreak", player);
end
player:EndEvent();
end
function mountChocobo(player)
player:SendChocoboAppearance();
player:SetMountState(1);
player:ChangeSpeed(0.0, 5.0, 10.0);
player:ChangeState(15);
end
function issueRentalChocobo(player)
--TODO: Write issue rental chocobo code
end