diff --git a/Data/scripts/commands/ChocoboRideCommand.lua b/Data/scripts/commands/ChocoboRideCommand.lua index 59bb989d..f28bd8f1 100644 --- a/Data/scripts/commands/ChocoboRideCommand.lua +++ b/Data/scripts/commands/ChocoboRideCommand.lua @@ -8,42 +8,42 @@ Handles mounting and dismounting the Chocobo and Goobbue function onEventStarted(player, actor, triggerName, isGoobbue) - if (player:GetState() == 0) then - - worldMaster = GetWorldMaster(); - - if (isGoobbue ~= true) then - player:ChangeMusic(83); - player:SendGameMessage(player, worldMaster, 26001, 0x20); - player:SetMountState(1); - else - player:ChangeMusic(98); - player:SendGameMessage(player, worldMaster, 26019, 0x20); - player:SetMountState(2); - end - - player:ChangeSpeed(0.0, 5.0, 10.0, 10.0); - player:ChangeState(15); - else - player:ChangeMusic(player:GetZone().bgmDay); - - worldMaster = GetWorldMaster(); - - if (player.rentalExpireTime != 0) then - player:SendGameMessage(player, worldMaster, 26004, 0x20); --You dismount. - else - if (player:GetMountState() == 1) then - player:SendGameMessage(player, worldMaster, 26003, 0x20); --You dismount X. - else - player:SendGameMessage(player, worldMaster, 26021, 0x20); --You dismount your Gobbue. - end - end - - player:SetMountState(0); - player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) - player:ChangeState(0); - end - - player:EndEvent(); - + if (player:GetState() == 0) then + + worldMaster = GetWorldMaster(); + + if (isGoobbue ~= true) then + player:ChangeMusic(83); + player:SendGameMessage(player, worldMaster, 26001, 0x20); + player:SetMountState(1); + else + player:ChangeMusic(98); + player:SendGameMessage(player, worldMaster, 26019, 0x20); + player:SetMountState(2); + end + + player:ChangeSpeed(0.0, 3.6, 9.0, 9.0); + player:ChangeState(15); + else + player:ChangeMusic(player:GetZone().bgmDay); + + worldMaster = GetWorldMaster(); + + if (player.rentalExpireTime != 0) then + player:SendGameMessage(player, worldMaster, 26004, 0x20); --You dismount. + else + if (player:GetMountState() == 1) then + player:SendGameMessage(player, worldMaster, 26003, 0x20); --You dismount X. + else + player:SendGameMessage(player, worldMaster, 26021, 0x20); --You dismount your Gobbue. + end + end + + player:SetMountState(0); + player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) + player:ChangeState(0); + end + + player:EndEvent(); + end \ No newline at end of file diff --git a/Data/scripts/commands/TeleportCommand.lua b/Data/scripts/commands/TeleportCommand.lua index 69971f59..e7c7a3bb 100644 --- a/Data/scripts/commands/TeleportCommand.lua +++ b/Data/scripts/commands/TeleportCommand.lua @@ -6,7 +6,7 @@ Functions: eventRegion(numAnima) eventAetheryte(region, animaCost1, animaCost2, animaCost3, animaCost4, animaCost5, animaCost6) -eventConfirm(isReturn, isInBattle, cityReturnNum, 138821, forceAskReturnOnly) +eventConfirm(isReturn, isInBattle, HomePointInn, HomePoint, forceAskReturnOnly) --]] @@ -15,112 +15,190 @@ require ("aetheryte") require ("utils") 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 - } + [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 + }, + } +zoneIdToRegionChoice = +{ + [128] = 1, [129] = 1, [130] = 1, [131] = 1, [132] = 1, [133] = 1, [134] = 1, [135] = 1, [230] = 1, + [143] = 2, [144] = 2, [145] = 2, [147] = 2, [148] = 2, + [150] = 3, [151] = 3, [152] = 3, [153] = 3, [154] = 3, [155] = 3, [157] = 3, [158] = 3, [159] = 3, [160] = 3, [206] = 3, + [170] = 4, [171] = 4, [172] = 4, [173] = 4, [174] = 4, [175] = 4, [176] = 4, [178] = 4, [180] = 4, [181] = 4, [209] = 4, + [190] = 5 +} + + function onEventStarted(player, actor, eventType, eventName, isTeleport) - local worldMaster = GetWorldMaster(); + local worldMaster = GetWorldMaster(); + local playerState = player:GetState(); + local currentAnima = 100; + local baseAnimaCost = 6; + local animaCost = 0; + local favoredLocation = {1280003, 1280005, 1280062}; + local currentRegion = zoneIdToRegionChoice[player:GetPos()[5]] or 0; + local isCity = {[1280001] = true, [1280061] = true, [1280031] = true}; + local isRegion = true; + local destination = 0; - if (isTeleport == 0) then - while (true) do - regionChoice = callClientFunction(player, "delegateCommand", actor, "eventRegion", 100); - - if (regionChoice == nil) then break end - - while (true) do - aetheryteChoice = callClientFunction(player, "delegateCommand", actor, "eventAetheryte", regionChoice, 2, 2, 2, 4, 4, 4); - - if (aetheryteChoice == nil) then break end - - player:PlayAnimation(0x4000FFA); - 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 - destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]]; - if (destination ~= nil) then - randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); - rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); - GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); - end - end - player:endEvent(); - return; - end - - end - else - player:PlayAnimation(0x4000FFA); - 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); - --bandaid fix for returning while dead, missing things like weakness and the heal number - if (player:GetHP() == 0) then - player:SetHP(player.GetMaxHP()); - player:ChangeState(0); - player:PlayAnimation(0x01000066); - end + if (isTeleport == 0) then -- Teleport hit + while (true) do + regionChoice = callClientFunction(player, "delegateCommand", actor, "eventRegion", currentAnima); + + if (regionChoice == nil) then break end + + while (true) do + if (regionChoice > 0 and regionChoice < 6) then -- If Region selected - if (isInn) then - --Return to Inn - if (player:GetHomePointInn() == 1) then - GetWorldManager():DoZoneChange(player, 244, nil, 0, 15, -160.048, 0, -165.737, 0); - elseif (player:GetHomePointInn() == 2) then - GetWorldManager():DoZoneChange(player, 244, nil, 0, 15, 160.048, 0, 154.263, 0); - elseif (player:GetHomePointInn() == 3) then - GetWorldManager():DoZoneChange(player, 244, nil, 0, 15, 0.048, 0, -5.737, 0); - end - elseif (choice == 1 and isInn == nil) then - --Return to Homepoint - destination = aetheryteTeleportPositions[player:GetHomePoint()]; - if (destination ~= nil) then - randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); - rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); - GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); + if (regionChoice == currentRegion) then -- Check if selected region matches player's region, reduce cost if so. + baseAnimaCost = baseAnimaCost - 2; + else + baseAnimaCost = 6; + end + + -- Assign anima cost to the six possible slots after factoring in same region or not. + animaCost = {baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost}; + + if (isCity[teleportMenuToAetheryte[regionChoice][1]] == true) then + -- Halve the cost of applicable city aetheryte + animaCost[1] = animaCost[1] / 2; + end - end - end - end - end + elseif (regionChoice == 6) then -- Favored Destinations selected. + -- Dummy info. Favored would be half price after factoring in same region cost or not. + animaCost = {2, 3, 3, favoredLocation[1], favoredLocation[2], favoredLocation[3]}; + isRegion = false; + end + + + aetheryteChoice = callClientFunction( + player, + "delegateCommand", + actor, + "eventAetheryte", + regionChoice, + animaCost[1], + animaCost[2], + animaCost[3], + animaCost[4], + animaCost[5], + animaCost[6] + ); + + + if (aetheryteChoice == nil) then break end + + player:PlayAnimation(0x4000FFA); + + if (isRegion == true) then + destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]]; + player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][aetheryteChoice], animaCost[aetheryteChoice], currentAnima); + else + destination = aetheryteTeleportPositions[favoredLocation[aetheryteChoice]]; + player:SendGameMessage(worldMaster, 34101, 0x20, 2, favoredLocation[aetheryteChoice], animaCost[aetheryteChoice], currentAnima); + end + + confirmChoice = callClientFunction(player, "delegateCommand", actor, "eventConfirm", false, false, 1, 138824, false); + + if (confirmChoice == 1) then + player:PlayAnimation(0x4000FFB); + player:SendGameMessage(worldMaster, 34105, 0x20); + + if (destination ~= 0) then + randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); + rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); + if (playerState == ACTORSTATE_MOUNTED) then + player:SetMountState(0); + player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) + player:ChangeState(ACTORSTATE_PASSIVE); + end + + GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); + end + end + + player:endEvent(); + return; + end + end + + else -- Return hit + player:PlayAnimation(0x4000FFA); + 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); + + --bandaid fix for returning while dead, missing things like weakness and the heal number + if (player:GetHP() == 0) then + player:SetHP(player.GetMaxHP()); + player:ChangeState(0); + player:PlayAnimation(0x01000066); + end + + if (isInn) then + --Return to Inn + if (player:GetHomePointInn() == 1) then + GetWorldManager():DoZoneChange(player, 244, nil, 0, 15, -160.048, 0, -165.737, 0); + elseif (player:GetHomePointInn() == 2) then + GetWorldManager():DoZoneChange(player, 244, nil, 0, 15, 160.048, 0, 154.263, 0); + elseif (player:GetHomePointInn() == 3) then + GetWorldManager():DoZoneChange(player, 244, nil, 0, 15, 0.048, 0, -5.737, 0); + end + elseif (choice == 1 and isInn == nil) then + --Return to Homepoint + destination = aetheryteTeleportPositions[player:GetHomePoint()]; + if (destination ~= nil) then + randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5); + rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]); + if (playerState == ACTORSTATE_MOUNTED) then + player:SetMountState(0); + player:ChangeSpeed(0.0, 2.0, 5.0, 5.0) + player:ChangeState(ACTORSTATE_PASSIVE); + end + + GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation); + end + end + end + end + + player:endEvent(); +end - player:endEvent(); -end \ No newline at end of file diff --git a/Data/scripts/commands/gm/nudge.lua b/Data/scripts/commands/gm/nudge.lua index 65b79140..bb3ceb50 100644 --- a/Data/scripts/commands/gm/nudge.lua +++ b/Data/scripts/commands/gm/nudge.lua @@ -26,11 +26,11 @@ vertical = { function onTrigger(player, argc, arg1, arg2) local pos = player:GetPos(); - local x = pos[0]; - local y = pos[1]; - local z = pos[2]; - local rot = pos[3]; - local zone = pos[4]; + local x = pos[1]; + local y = pos[2]; + local z = pos[3]; + local rot = pos[4]; + local zone = pos[5]; local angle = rot + (math.pi/2); local worldManager = GetWorldManager(); diff --git a/Data/scripts/commands/gm/spawn.lua b/Data/scripts/commands/gm/spawn.lua index 1f3f1852..196dc08c 100644 --- a/Data/scripts/commands/gm/spawn.lua +++ b/Data/scripts/commands/gm/spawn.lua @@ -8,36 +8,36 @@ properties = { function onTrigger(player, argc, actorClassId, width, height) - if (actorClassId == nil) then - player:SendMessage(0x20, "", "No actor class id provided."); - return; - end + if (actorClassId == nil) then + player:SendMessage(0x20, "", "No actor class id provided."); + return; + end local pos = player:GetPos(); - local x = pos[0]; - local y = pos[1]; - local z = pos[2]; - local rot = pos[3]; - local zone = pos[4]; + local x = pos[1]; + local y = pos[2]; + local z = pos[3]; + local rot = pos[4]; + local zone = pos[5]; - actorClassId = tonumber(actorClassId); - - if (actorClassId ~= nil) then - zone = player:GetZone(); - local w = tonumber(width) or 0; + actorClassId = tonumber(actorClassId); + + if (actorClassId ~= nil) then + zone = player:GetZone(); + local w = tonumber(width) or 0; local h = tonumber(height) or 0; printf("%f %f %f", x, y, z); --local x, y, z = player.GetPos(); for i = 0, w 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.SetAppearance(1001149) - end - end - end - - if (actor == nil) then - player:SendMessage(0x20, "", "This actor class id cannot be spawned."); - end - + actor = zone:SpawnActor(actorClassId, "test", x + (i - (w / 2) * 3), y, z + (j - (h / 2) * 3), rot); + actor.SetAppearance(1001149) + end + end + end + + if (actor == nil) then + player:SendMessage(0x20, "", "This actor class id cannot be spawned."); + end + end; \ No newline at end of file diff --git a/Data/scripts/commands/gm/warpid.lua b/Data/scripts/commands/gm/warpid.lua index 66301140..d8099ef4 100644 --- a/Data/scripts/commands/gm/warpid.lua +++ b/Data/scripts/commands/gm/warpid.lua @@ -18,22 +18,23 @@ function onTrigger(player, argc, uID) end; actor = GetWorldManager():GetActorInWorldByUniqueId(uID); - + actorId = actor:GetActorClassId(); if (actor ~= nil) then local actorPos = actor:GetPos(); local playerPos = player:GetPos(); - if actorPos[4] == playerPos[4] then - worldManager:DoPlayerMoveInZone(player, actorPos[0], actorPos[1], actorPos[2], actorPos[3], 0x00); + if actorPos[5] == playerPos[5] then + worldManager:DoPlayerMoveInZone(player, actorPos[1], actorPos[2], actorPos[3], actorPos[4], 0x00); else - worldManager:DoZoneChange(player, actorPos[4], nil, 0, 0x02, actorPos[0], actorPos[1], actorPos[2], actorPos[3]); + worldManager:DoZoneChange(player, actorPos[5], nil, 0, 0x02, actorPos[1], actorPos[2], actorPos[3], actorPos[4]); end - message = string.format("Moving to %s 's coordinates @ zone %s, %.3f %.3f %.3f ", uID, actorPos[4], actorPos[0], actorPos[1], actorPos[2]); + message = string.format("Moving to %s 's coordinates @ zone %s, %.3f %.3f %.3f ", uID, actorPos[5], actorPos[1], actorPos[2], actorPos[3]); end ; player:SendMessage(messageID, sender, message); - + player:SendMessage(0x20, "", "Actor Class Id: "..actorId); + end \ No newline at end of file