Added changes to how zones/areas are accessed in the lua scripts too.

This commit is contained in:
Filip Maj 2022-02-05 18:00:09 -05:00
parent 4e0cf36552
commit 68e55a1c76
18 changed files with 33 additions and 35 deletions

View File

@ -107,7 +107,7 @@ function doLevequestInit(player, aetheryte)
player:SendGameMessage(worldMaster, 50036, 0x20, glId, player); player:SendGameMessage(worldMaster, 50036, 0x20, glId, player);
player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true)); player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true));
director = player:GetZone():CreateGuildleveDirector(glId, difficulty, player); director = player.CurrentArea:CreateGuildleveDirector(glId, difficulty, player);
player:AddDirector(director); player:AddDirector(director);
director:StartDirector(true, glId) director:StartDirector(true, glId)

View File

@ -142,7 +142,7 @@ function doLevequestInit(player, aetheryte)
player:SendGameMessage(worldMaster, 50036, 0x20, glId, player); player:SendGameMessage(worldMaster, 50036, 0x20, glId, player);
player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true)); player:PlayAnimation(getGLStartAnimationFromSheet(guildleveData.borderId, guildleveData.plateId, true));
director = player:GetZone():CreateGuildleveDirector(glId, difficulty, player); director = player.CurrentArea:CreateGuildleveDirector(glId, difficulty, player);
player:AddDirector(director); player:AddDirector(director);
director:StartDirector(true, glId); director:StartDirector(true, glId);

View File

@ -19,7 +19,7 @@ function onBeginLogin(player)
end end
--For Opening. Set Director and reset position incase d/c --For Opening. Set Director and reset position incase d/c
if (player:HasQuest(110001) == true and player:GetZoneID() == 193) then if (player:HasQuest(110001) == true and player.CurrentArea.ZoneId == 193) then
director = player:GetZone():CreateDirector("OpeningDirector", false); director = player:GetZone():CreateDirector("OpeningDirector", false);
player:AddDirector(director); player:AddDirector(director);
director:StartDirector(true); director:StartDirector(true);
@ -32,7 +32,7 @@ function onBeginLogin(player)
player.rotation = 0.025; player.rotation = 0.025;
player:GetQuest(110001):ClearQuestData(); player:GetQuest(110001):ClearQuestData();
player:GetQuest(110001):ClearQuestFlags(); player:GetQuest(110001):ClearQuestFlags();
elseif (player:HasQuest(110005) == true and player:GetZoneID() == 166) then elseif (player:HasQuest(110005) == true and player.CurrentArea.ZoneId == 166) then
director = player:GetZone():CreateDirector("OpeningDirector", false); director = player:GetZone():CreateDirector("OpeningDirector", false);
player:AddDirector(director); player:AddDirector(director);
director:StartDirector(false); director:StartDirector(false);
@ -45,7 +45,7 @@ function onBeginLogin(player)
player.rotation = -1.26721; player.rotation = -1.26721;
player:GetQuest(110005):ClearQuestData(); player:GetQuest(110005):ClearQuestData();
player:GetQuest(110005):ClearQuestFlags(); player:GetQuest(110005):ClearQuestFlags();
elseif (player:HasQuest(110009) == true and player:GetZoneID() == 184) then elseif (player:HasQuest(110009) == true and player.CurrentArea.ZoneId == 184) then
--director = player:GetZone():CreateDirector("OpeningDirector", false); --director = player:GetZone():CreateDirector("OpeningDirector", false);
--player:AddDirector(director); --player:AddDirector(director);
--director:StartDirector(false); --director:StartDirector(false);

View File

@ -13,9 +13,9 @@ function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, baza
local bazaarActor = nil; local bazaarActor = nil;
if (name ~= nil) then if (name ~= nil) then
bazaarActor = player:GetZone():FindPCInZone(name); bazaarActor = player.CurrentArea:FindPCInZone(name);
elseif (bazaarActorId ~= nil) then elseif (bazaarActorId ~= nil) then
bazaarActor = player:GetZone():FindActorInArea(bazaarActorId); bazaarActor = player.CurrentArea:FindActorInArea(bazaarActorId);
end end
if (bazaarActor ~= nil) then if (bazaarActor ~= nil) then

View File

@ -25,7 +25,7 @@ function onEventStarted(player, actor, triggerName, isGoobbue)
player:ChangeSpeed(0.0, 5.0, 10.0, 10.0); player:ChangeSpeed(0.0, 5.0, 10.0, 10.0);
player:ChangeState(15); player:ChangeState(15);
else else
player:ChangeMusic(player:GetZone().bgmDay); player:ChangeMusic(player.CurrentArea.bgmDay);
worldMaster = GetWorldMaster(); worldMaster = GetWorldMaster();

View File

@ -12,10 +12,10 @@ function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, acto
--ActorID Search --ActorID Search
if (actorId ~= nil) then if (actorId ~= nil) then
otherActor = player:GetZone():FindActorInArea(actorId); otherActor = player.CurrentArea):FindActorInArea(actorId);
--Name Search --Name Search
elseif (name ~= nil) then elseif (name ~= nil) then
otherActor = player:GetZone():FindPCInZone(name); otherActor = player.CurrentArea:FindPCInZone(name);
end end
if (otherActor ~= nil) then if (otherActor ~= nil) then

View File

@ -8,9 +8,8 @@ properties = {
function onTrigger(player, argc, actorName) function onTrigger(player, argc, actorName)
if (actorName ~= nil) then if (actorName ~= nil) then
zone = player:GetZone(); actor = player.CurrentArea:DespawnActor(actorName);
actor = zone:DespawnActor(actorName);
end end
end; end;

View File

@ -18,11 +18,11 @@ function onTrigger(player, argc, zone)
if player then if player then
local messageID = MESSAGE_TYPE_SYSTEM_ERROR; local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
zone = zone or player:GetZoneID(); zone = zone or player.CurrentArea.ZoneId;
player:SendMessage(messageID, "[reloadzones] ", string.format("Reloading zone: %u", zone)); player:SendMessage(messageID, "[reloadzones] ", string.format("Reloading zone: %u", zone));
--[[ todo: get this working legit --[[ todo: get this working legit
player:GetZone():Clear(); player.CurrentArea:Clear();
player:GetZone():AddActorToZone(player); player.CurrentArea:AddActorToZone(player);
player:SendInstanceUpdate(); player:SendInstanceUpdate();
]] ]]
end; end;

View File

@ -14,23 +14,22 @@ function onTrigger(player, argc, actorClassId, width, height)
end end
local pos = player:GetPos(); local pos = player:GetPos();
local x = pos[0]; local x = pos[1];
local y = pos[1]; local y = pos[2];
local z = pos[2]; local z = pos[3];
local rot = pos[3]; local rot = pos[4];
local zone = pos[4]; local zone = pos[5];
actorClassId = tonumber(actorClassId); actorClassId = tonumber(actorClassId);
if (actorClassId ~= nil) then if (actorClassId ~= nil) then
zone = player:GetZone();
local w = tonumber(width) or 0; local w = tonumber(width) or 0;
local h = tonumber(height) or 0; local h = tonumber(height) or 0;
printf("%f %f %f", x, y, z); printf("%f %f %f", x, y, z);
--local x, y, z = player.GetPos(); --local x, y, z = player.GetPos();
for i = 0, w do for i = 0, w do
for j = 0, h do for j = 0, h do
actor = zone:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]); actor = player.CurrentArea:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]);
actor.SetAppearance(1001149) actor.SetAppearance(1001149)
end end
end end

View File

@ -108,7 +108,7 @@ function onTrigger(player, argc, name, width, height, blockCount)
for b = 0, blocks do for b = 0, blocks do
for i = 0, w do for i = 0, w do
for j = 0, h do for j = 0, h do
local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true); local actor = player.CurrentArea:SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
actor.ChangeNpcAppearance(modelIds[name]); actor.ChangeNpcAppearance(modelIds[name]);
actor.SetMaxHP(5000); actor.SetMaxHP(5000);
actor.SetHP(5000); actor.SetHP(5000);

View File

@ -18,7 +18,7 @@ function onTrigger(player, argc)
player:SendGameMessage(player, worldMaster, 34108, 0x20); player:SendGameMessage(player, worldMaster, 34108, 0x20);
player:SendGameMessage(player, worldMaster, 50011, 0x20); player:SendGameMessage(player, worldMaster, 50011, 0x20);
director = player:GetZone():CreateDirector("Quest/QuestDirectorMan0l001"); director = player.CurrentArea:CreateDirector("Quest/QuestDirectorMan0l001");
player:AddDirector(director); player:AddDirector(director);
player:SetLoginDirector(director); player:SetLoginDirector(director);

View File

@ -31,7 +31,7 @@ function onTrigger(player, argc, animation, regionId, layoutId, maxLayoutId)
actorClassId = tonumber(actorClassId); actorClassId = tonumber(actorClassId);
if (actorClassId ~= nil) then if (actorClassId ~= nil) then
zone = player:GetZone(); zone = player.CurrentArea;
actor = zone:SpawnActor(actorClassId, "mapobj", pos[1], pos[2], pos[3], tonumber(regionId), tonumber(layoutId)); actor = zone:SpawnActor(actorClassId, "mapobj", pos[1], pos[2], pos[3], tonumber(regionId), tonumber(layoutId));
print("test"); print("test");

View File

@ -24,13 +24,13 @@ function onTrigger(player, argc, weather, updateTime, zonewide)
message = string.format("changed weather to %u ", weather); message = string.format("changed weather to %u ", weather);
if zonewide ~= 0 then if zonewide ~= 0 then
message = string.format(message.."for zone %u", player:GetZoneID()); message = string.format(message.."for zone %u", player.CurrentArea.ZoneId);
else else
message = message..player:GetName(); message = message..player:GetName();
end; end;
-- weatherid, updateTime -- weatherid, updateTime
player:GetZone():ChangeWeather(weather, updateTime, player, zonewide ~= 0); player.CurrentArea:ChangeWeather(weather, updateTime, player, zonewide ~= 0);
player:SendMessage(messageID, sender, message); player:SendMessage(messageID, sender, message);
end; end;
print(sender..message); print(sender..message);

View File

@ -159,7 +159,7 @@ function onTrigger(player, argc, width, height, blockCount)
for b = 0, blocks do for b = 0, blocks do
for i = 0, w do for i = 0, w do
for j = 0, h do for j = 0, h do
local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true); local actor = player.CurrentArea.SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
--actor.ChangeNpcAppearance(2200905); --actor.ChangeNpcAppearance(2200905);
actor.SetMaxHP(500); actor.SetMaxHP(500);
actor.SetHP(500); actor.SetHP(500);

View File

@ -88,7 +88,7 @@ function onEventStarted(player, actor, triggerName)
wait(5); wait(5);
player:SendMessage(0x20, "", "ContentFinished"); player:SendMessage(0x20, "", "ContentFinished");
player:GetZone():ContentFinished(); player.CurrentArea:ContentFinished();
wait(5); wait(5);
player:SendMessage(0x20, "", "Remove from party"); player:SendMessage(0x20, "", "Remove from party");
player:RemoveFromCurrentPartyAndCleanup(); player:RemoveFromCurrentPartyAndCleanup();
@ -136,5 +136,5 @@ function onCommand(player, command)
end end
function main(director, contentGroup) function main(director, contentGroup)
onCreateContentArea(director:GetPlayerMembers(), director, director:GetZone(), contentGroup); onCreateContentArea(director:GetPlayerMembers(), director, director.CurrentArea, contentGroup);
end; end;

View File

@ -73,7 +73,7 @@ function onEventStarted(player, director, triggerName)
]] ]]
man0l0Quest:StartSequence(10); man0l0Quest:StartSequence(10);
player:GetZone():ContentFinished(); player.CurrentArea:ContentFinished();
GetWorldManager():DoZoneChange(player, 230, "PrivateAreaMasterPast", 1, 15, -826.868469, 6, 193.745865, -0.008368492); GetWorldManager():DoZoneChange(player, 230, "PrivateAreaMasterPast", 1, 15, -826.868469, 6, 193.745865, -0.008368492);
player:EndEvent(); player:EndEvent();
end end

View File

@ -59,6 +59,6 @@ function onEventStarted(player, actor, triggerName)
man0u0Quest:NextPhase(10); man0u0Quest:NextPhase(10);
player:EndEvent(); player:EndEvent();
player:GetZone():ContentFinished(); player.CurrentArea:ContentFinished();
GetWorldManager():DoZoneChange(player, 175, "PrivateAreaMasterPast", 3, 15, -22.81, 196, 87.82, 2.98); GetWorldManager():DoZoneChange(player, 175, "PrivateAreaMasterPast", 3, 15, -22.81, 196, 87.82, 2.98);
end end

View File

@ -263,7 +263,7 @@ function doExitDoor(player, quest, npc)
quest:StartSequence(SEQ_005); quest:StartSequence(SEQ_005);
contentArea = player:GetZone():CreateContentArea(player, "/Area/PrivateArea/Content/PrivateAreaMasterSimpleContent", "man0l01", "SimpleContent30002", "Quest/QuestDirectorMan0l001"); contentArea = player.CurrentArea:CreateContentArea(player, "/Area/PrivateArea/Content/PrivateAreaMasterSimpleContent", "man0l01", "SimpleContent30002", "Quest/QuestDirectorMan0l001");
if (contentArea == nil) then if (contentArea == nil) then
return; return;