From 844f21d9a46a188cbdc2d1a3e233179b68ccbf38 Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Mon, 1 May 2017 22:55:47 -0400 Subject: [PATCH] Finished off the teleport script. Still requires all the aetheryte positions filled out. --- data/scripts/aetheryte.lua | 2 +- data/scripts/commands/TeleportCommand.lua | 75 +++++++++++++++++++---- 2 files changed, 65 insertions(+), 12 deletions(-) diff --git a/data/scripts/aetheryte.lua b/data/scripts/aetheryte.lua index 7b80c41c..031d6cf4 100644 --- a/data/scripts/aetheryte.lua +++ b/data/scripts/aetheryte.lua @@ -109,5 +109,5 @@ aetheryteChildLinks = { } aetheryteTeleportPositions = { - [1280001] = {0.0, 0.0, 0.0} + [1280002] = {128, 29.97, 45.83, -35.47} } \ No newline at end of file diff --git a/data/scripts/commands/TeleportCommand.lua b/data/scripts/commands/TeleportCommand.lua index 732d4444..9d31d79a 100644 --- a/data/scripts/commands/TeleportCommand.lua +++ b/data/scripts/commands/TeleportCommand.lua @@ -11,6 +11,45 @@ eventConfirm(isReturn, isInBattle, cityReturnNum, 138821, forceAskReturnOnly) --]] require ("global") +require ("aetheryte") + +teleportMenuToAetheryte = { + [1] = { + [1] = 1280001, + [2] = 1280002, + [3] = 1280003, + [4] = 1280004, + [5] = 1280005, + [6] = 1280006 + }, + [2] = { + [1] = 1280092, + [2] = 1280093, + [3] = 1280094, + [4] = 1280095, + [5] = 1280096 + }, + [3] = { + [1] = 1280061, + [2] = 1280062, + [3] = 1280063, + [4] = 1280064, + [5] = 1280065, + [6] = 1280066 + }, + [4] = { + [1] = 1280031, + [2] = 1280032, + [3] = 1280033, + [4] = 1280034, + [5] = 1280035, + [6] = 1280036 + }, + [5] = { + [1] = 1280121, + [2] = 1280122 + } +} function onEventStarted(player, actor, triggerName, isTeleport) @@ -28,14 +67,17 @@ function onEventStarted(player, actor, triggerName, isTeleport) if (aetheryteChoice == nil) then break end player:PlayAnimation(0x4000FFA); - player:SendGameMessage(worldMaster, 34101, 0x20, 2, 0x13883d, 100, 100); + player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][aetheryteChoice], 100, 100); confirmChoice = callClientFunction(player, "delegateCommand", actor, "eventConfirm", false, false, 1, 138824, false); if (confirmChoice == 1) then player:PlayAnimation(0x4000FFB); player:SendGameMessage(worldMaster, 34105, 0x20); - --Do teleport + --Do teleport + destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]]; + if (destination ~= nil) then + GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, destination[2], destination[3], destination[4], 0.0); + end end - player:endEvent(); return; end @@ -43,15 +85,26 @@ function onEventStarted(player, actor, triggerName, isTeleport) end else player:PlayAnimation(0x4000FFA); - local choice, wasMulti = callClientFunction(player, "delegateCommand", actor, "eventConfirm", true, false, player:GetHomePointInn(), player:GetHomePoint(), false); - if (wasMulti and choice == 1 or choice == 2) then + local choice, isInn = callClientFunction(player, "delegateCommand", actor, "eventConfirm", true, false, player:GetHomePointInn(), player:GetHomePoint(), false); + if (choice == 1) then player:PlayAnimation(0x4000FFB); - player:SendGameMessage(worldMaster, 34104, 0x20); - --Do return - elseif (not wasMulti and choice == 1) then - player:PlayAnimation(0x4000FFB); - player:SendGameMessage(worldMaster, 34104, 0x20); - --Do return + player:SendGameMessage(worldMaster, 34104, 0x20); + if (isInn) then + --Return to Inn + if (player:GetHomePointInn() == 1) then + GetWorldManager():DoZoneChange(player, 12); + elseif (player:GetHomePointInn() == 3) then + GetWorldManager():DoZoneChange(player, 13); + elseif (player:GetHomePointInn() == 3) then + GetWorldManager():DoZoneChange(player, 11); + end + elseif (choice == 1 and isInn == nil) then + --Return to Homepoint + destination = aetheryteTeleportPositions[player:GetHomePoint()]; + if (destination ~= nil) then + GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, destination[2], destination[3], destination[4], 0.0); + end + end end end