Fixed up some lua scripts. Fleshed out the dream stuff for Hildie quests. NOTE: Finish player.lua as it has pseudo code.

This commit is contained in:
Filip Maj 2022-04-13 20:03:46 -04:00
parent c3b4735cc5
commit 5c0d2c1d7f
7 changed files with 84 additions and 21 deletions

View file

@ -1,23 +1,63 @@
require ("global")
DREAM_ITEM = {
{[1] = 3010419, [2] = 3010420, [3] = 3010421}, -- Mizzenmast/Roost/Hourglass Biscuit
3010003, -- Boiled Egg
3010101, -- Grilled Carp
3010001, -- Meat Miq'abob
3010402, -- Ginger Cookie
3020001, -- Potion
3020101, -- Ether
1000003, -- 5x Crystal Shards (Fire)
1000004, -- 5x Crystal Shards (Ice)
1000005, -- 5x Crystal Shards (Wind)
1000006, -- 5x Crystal Shards (Earth)
1000007, -- 5x Crystal Shards (Lightning)
1000008 -- 5x Crystal Shards (Water)
}
function init(npc)
return false, false, 0, 0;
end
function onEventStarted(player, npc, triggerName)
choice = callClientFunction(player, "askLogout", player);
local choice = callClientFunction(player, "askLogout", player);
-- Quit
if (choice == 2) then
player:SetSleeping();
player:QuitGame();
-- Logout
elseif (choice == 3) then
player:SetSleeping();
player:Logout();
-- Heck the bed
elseif (choice == 4) then
player:SendMessage(33, "", "Heck the bed");
-- Give items based on dream
local dreamCode = player:GetLoginDreamCode();
if (dreamCode >= 21 and dreamCode <= 33) then
local innCode = player:GetInnCode();
local itemCode = DREAM_ITEM[dreamCode - 20];
-- Get biscuit for inn
if (dreamCode == 21) then
itemCode = itemCode[innCode];
end
-- If crystals you get x5 otherwise x1.
if (dreamCode > = 28 and dreamCode <= 33) then
player:AddItem(itemCode, 5);
else
player:AddItem(itemCode, 1);
end
-- Clear the code so they player doesn't keep getting things
player:SetLoginDreamCode(0);
else
-- Otherwise show standard message
player:SendGameMessage(player, npc, 7, 0x20);
end
end
player:EndEvent();
end