From 501fc5f7c3d71bd2298d670f42327ad9b4c7598e Mon Sep 17 00:00:00 2001 From: Jsx Date: Sat, 21 Feb 2026 14:15:02 -0500 Subject: [PATCH 1/2] [lua] Fix addallmounts Add addallwarps [Commands] Fixes addallmounts for loop to get all mounts Adds command for adding all warps --- scripts/commands/addallmounts.lua | 2 +- scripts/commands/addallwarps.lua | 55 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 scripts/commands/addallwarps.lua diff --git a/scripts/commands/addallmounts.lua b/scripts/commands/addallmounts.lua index 798035e33c0..67b0498b723 100644 --- a/scripts/commands/addallmounts.lua +++ b/scripts/commands/addallmounts.lua @@ -30,7 +30,7 @@ commandObj.onTrigger = function(player, target) end -- add all mount key items - for i = xi.ki.CHOCOBO_COMPANION, xi.ki.CHOCOBO_COMPANION + 26 do + for i = xi.ki.CHOCOBO_COMPANION, xi.ki.CRAKLAW_COMPANION do targ:addKeyItem(i) end diff --git a/scripts/commands/addallwarps.lua b/scripts/commands/addallwarps.lua new file mode 100644 index 00000000000..5df4a314ec6 --- /dev/null +++ b/scripts/commands/addallwarps.lua @@ -0,0 +1,55 @@ +----------------------------------- +-- func: addallwarps +-- desc: Adds all Survival Guides and Home Points to GM if no target is specified. +----------------------------------- +---@type TCommand +require('scripts/globals/teleports') +xi = xi or {} +xi.survivalGuide = xi.survivalGuide or {} +local commandObj = {} + +commandObj.cmdprops = +{ + permission = 1, + parameters = 's' +} + +local function error(player, msg) + player:printToPlayer(msg) + player:printToPlayer('!addallwarps (player)') +end + +commandObj.onTrigger = function(player, target, zoneId, text, guide) + -- validate target + local targ + if target == nil then + targ = player + else + targ = GetPlayerByName(target) + if targ == nil then + error(player, string.format('Player named "%s" not found!', target)) + return + end + end + + -- add all Survival Guides + for i = 1, 32 do + local groupIndex = i + local group = 1 + while(group ~= 4) do + targ:addTeleport(xi.teleport.type.SURVIVAL, groupIndex - 1, group - 1) + group = group + 1 + end + end + + -- add all Home Points + for i = 0, 121 do + local hpBit = i % 32 + local hpSet = math.floor(i / 32) + targ:addTeleport(xi.teleport.type.HOMEPOINT, hpBit, hpSet) + end + + player:printToPlayer(string.format('%s now has all Warps.', targ:getName())) +end + +return commandObj From 6c712825f5b3bb2ebe3f92d87c82f3613309b218 Mon Sep 17 00:00:00 2001 From: Jsx Date: Wed, 25 Feb 2026 23:58:31 -0500 Subject: [PATCH 2/2] correct while loop --- scripts/commands/addallwarps.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commands/addallwarps.lua b/scripts/commands/addallwarps.lua index 5df4a314ec6..06a562351c7 100644 --- a/scripts/commands/addallwarps.lua +++ b/scripts/commands/addallwarps.lua @@ -36,7 +36,7 @@ commandObj.onTrigger = function(player, target, zoneId, text, guide) for i = 1, 32 do local groupIndex = i local group = 1 - while(group ~= 4) do + while group < 4 do targ:addTeleport(xi.teleport.type.SURVIVAL, groupIndex - 1, group - 1) group = group + 1 end