mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
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:
parent
c3b4735cc5
commit
5c0d2c1d7f
@ -1,23 +1,63 @@
|
|||||||
require ("global")
|
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)
|
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)
|
||||||
|
local choice = callClientFunction(player, "askLogout", player);
|
||||||
|
|
||||||
choice = callClientFunction(player, "askLogout", player);
|
-- Quit
|
||||||
|
|
||||||
if (choice == 2) then
|
if (choice == 2) then
|
||||||
player:SetSleeping();
|
player:SetSleeping();
|
||||||
player:QuitGame();
|
player:QuitGame();
|
||||||
|
-- Logout
|
||||||
elseif (choice == 3) then
|
elseif (choice == 3) then
|
||||||
player:SetSleeping();
|
player:SetSleeping();
|
||||||
player:Logout();
|
player:Logout();
|
||||||
|
-- Heck the bed
|
||||||
elseif (choice == 4) then
|
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
|
end
|
||||||
|
|
||||||
player:EndEvent();
|
player:EndEvent();
|
||||||
|
|
||||||
end
|
end
|
@ -5,14 +5,5 @@ function init(npc)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function onEventStarted(player, npc, eventType, eventName)
|
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();
|
player:EndEvent();
|
||||||
end
|
end
|
@ -27,10 +27,10 @@ function onEventStarted(player, privAreaExit, eventType, eventName)
|
|||||||
-- If you can leave, warp to public zone and show message.
|
-- If you can leave, warp to public zone and show message.
|
||||||
if (area.CanExitPrivateArea()) then
|
if (area.CanExitPrivateArea()) then
|
||||||
player:SendGameMessage(player, GetWorldMaster(), 34110, MESSAGE_TYPE_SYSTEM); -- You have left the instance.
|
player:SendGameMessage(player, GetWorldMaster(), 34110, MESSAGE_TYPE_SYSTEM); -- You have left the instance.
|
||||||
GetWorldManager():WarpToPublicArea(player);
|
--GetWorldManager():WarpToPublicArea(player);
|
||||||
-- Otherwise warp back to the center of the zone.
|
-- Otherwise warp back to the center of the zone.
|
||||||
else
|
else
|
||||||
GetWorldManager():WarpToCharaPosition(player, privAreaExit);
|
--GetWorldManager():WarpToCharaPosition(player, privAreaExit);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -127,7 +127,7 @@ function onTrigger(player, argc, arg1, arg2)
|
|||||||
targetActor:SetPos(px, y, pz, rot, true, player);
|
targetActor:SetPos(px, y, pz, rot, true, player);
|
||||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), px, y, pz, rot);
|
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), px, y, pz, rot);
|
||||||
elseif direction == 3 then
|
elseif direction == 3 then
|
||||||
targetActor:SetPos(x, y, z, distance, true, player);
|
targetActor:SetPos(x, y, z, angle + distance, true, player);
|
||||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), x, y, z, distance);
|
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), x, y, z, distance);
|
||||||
else
|
else
|
||||||
local px = x - distance * math.cos(angle);
|
local px = x - distance * math.cos(angle);
|
||||||
|
@ -23,7 +23,7 @@ function onTrigger(player, argc, name, posX, posY, posZ, rotation)
|
|||||||
|
|
||||||
actor = player.CurrentArea:FindActorInZoneByUniqueID(name);
|
actor = player.CurrentArea:FindActorInZoneByUniqueID(name);
|
||||||
if (actor ~= nil) then
|
if (actor ~= nil) then
|
||||||
actor:SetPos(x,y,z,rot,true);
|
actor:SetPos(x,y,z,rot,true, player);
|
||||||
player:SendMessage(0x20, "", string.format("Moved %s @ %f, %f, %f, %f", name, x, y, z, rot));
|
player:SendMessage(0x20, "", string.format("Moved %s @ %f, %f, %f, %f", name, x, y, z, rot));
|
||||||
else
|
else
|
||||||
player:SendMessage(0x20, "", string.format("Could not find %s.", name));
|
player:SendMessage(0x20, "", string.format("Could not find %s.", name));
|
||||||
|
@ -3,7 +3,7 @@ require("global");
|
|||||||
local initClassItems, initRaceItems;
|
local initClassItems, initRaceItems;
|
||||||
|
|
||||||
function onBeginLogin(player)
|
function onBeginLogin(player)
|
||||||
--New character, set the initial quest
|
-- New character, set the initial quest
|
||||||
if (player:GetPlayTime(false) == 0) then
|
if (player:GetPlayTime(false) == 0) then
|
||||||
initialTown = player:GetInitialTown();
|
initialTown = player:GetInitialTown();
|
||||||
if (initialTown == 1 and player:HasQuest(110001) == false) then
|
if (initialTown == 1 and player:HasQuest(110001) == false) then
|
||||||
@ -19,7 +19,28 @@ function onBeginLogin(player)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--For Opening. Set Director and reset position incase d/c
|
-- Set Dream Packet if waking up in the inn
|
||||||
|
if (player.CurrentArea.ZoneId == 244) then
|
||||||
|
local dreamCode = 35;
|
||||||
|
|
||||||
|
-- In Plain Sight wakeup dream
|
||||||
|
if (player:HasItem(10011243) and not player:HasQuest(110829)) then
|
||||||
|
dreamCode = 1;
|
||||||
|
-- The Usual Suspect wakeup dream
|
||||||
|
elseif (player:HasItem(10011252) and not player:HasQuest(110849)) then
|
||||||
|
dreamCode = 2;
|
||||||
|
-- Nael Van Darnus nightmare
|
||||||
|
elseif (player:???) then
|
||||||
|
dreamCode = 20;
|
||||||
|
-- Random item
|
||||||
|
elseif (player:???) then
|
||||||
|
dreamCode = math.random(21, 33);
|
||||||
|
end
|
||||||
|
|
||||||
|
player:SetLoginDreamCode(dreamCode);
|
||||||
|
end
|
||||||
|
|
||||||
|
-- For Opening. Set Director and reset position incase d/c
|
||||||
if (player:HasQuest(110001) == true and player.CurrentArea.ZoneId == 193) then
|
if (player:HasQuest(110001) == true and player.CurrentArea.ZoneId == 193) then
|
||||||
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
director = player.CurrentArea:CreateDirector("OpeningDirector", false);
|
||||||
player:AddDirector(director);
|
player:AddDirector(director);
|
||||||
|
@ -119,6 +119,7 @@ namespace Meteor.Map.Actors
|
|||||||
public uint lastPlayTimeUpdate;
|
public uint lastPlayTimeUpdate;
|
||||||
public bool isGM = false;
|
public bool isGM = false;
|
||||||
public bool isZoneChanging = true;
|
public bool isZoneChanging = true;
|
||||||
|
public byte LoginDreamCode = 0;
|
||||||
|
|
||||||
//Trading
|
//Trading
|
||||||
private Player otherTrader = null;
|
private Player otherTrader = null;
|
||||||
@ -420,7 +421,7 @@ namespace Meteor.Map.Actors
|
|||||||
for (int i = 0; i < 2048; i++)
|
for (int i = 0; i < 2048; i++)
|
||||||
testComplete[i] = true;
|
testComplete[i] = true;
|
||||||
QueuePacket(cutsceneBookPacket.BuildPacket(Id, SNpcNickname, SNpcSkin, SNpcPersonality, SNpcCoordinate, testComplete));
|
QueuePacket(cutsceneBookPacket.BuildPacket(Id, SNpcNickname, SNpcSkin, SNpcPersonality, SNpcCoordinate, testComplete));
|
||||||
QueuePacket(SetPlayerDreamPacket.BuildPacket(Id, 0x16, GetInnCode()));
|
QueuePacket(SetPlayerDreamPacket.BuildPacket(Id, LoginDreamCode, GetInnCode()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return subpackets;
|
return subpackets;
|
||||||
@ -869,6 +870,16 @@ namespace Meteor.Map.Actors
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLoginDreamCode(byte code)
|
||||||
|
{
|
||||||
|
LoginDreamCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte GetLoginDreamCode()
|
||||||
|
{
|
||||||
|
return LoginDreamCode;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetSleeping()
|
public void SetSleeping()
|
||||||
{
|
{
|
||||||
playerSession.LockUpdates(true);
|
playerSession.LockUpdates(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user