1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-21 04:07:48 +00:00
project-meteor-server/Data/scripts/commands/gm/warp.lua
CuriousJorge b6c9825b2d - Man0u0 about as polished as one can get the Talking sections for now, minus some very specific retail quirks that need replicating at some point (all revolving around the starting 15 seconds of the forced tutorial)
- Man0u1 barely started.  Just enough there to get the player out of the PrivateArea and into the public zone.
- All of the old Populace uniqueId scripts for both quests nuked into high orbit.
- DftSea:  Master list of function names and argument counts added to the list.  Will be whittling away at this over the coming week.
- GM Warp: For whatever reason using "" to compare against a nil wasn't working anymore.  Set it to nil instead.
2022-02-13 13:18:20 -05:00

77 lines
No EOL
2.7 KiB
Lua

require("global");
properties = {
permissions = 0,
parameters = "sssssss",
description =
[[
Warp player or <targetname> to a location from a list, or enter a zoneID with coordinates.
!warp <spawn list> |
!warp <zone> <x> <y> <z> |
!warp <zone> <x> <y> <z> <privateArea> <targetname> |
]],
}
function onTrigger(player, argc, p1, p2, p3, p4, privateArea, privateAreaType, name, lastName)
if name then
if lastName then
player = GetWorldManager():GetPCInWorld(name.." "..lastName) or nil;
else
player = GetWorldManager():GetPCInWorld(name) or nil;
end;
end;
if not player then
printf("[Command] [warp] error! No target or player specified!");
return;
end;
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
local sender = "[warp] ";
-- we're getting a list/array from c# so 0 index
local pos = player:GetPos();
local player_x = pos[1];
local player_y = pos[2];
local player_z = pos[3];
local player_rot = pos[4];
local player_zone = pos[5];
local worldManager = GetWorldManager();
if argc >= 3 then
if argc == 3 then
local x = tonumber(applyPositionOffset(p1, player_x)) or player_x;
local y = tonumber(applyPositionOffset(p2, player_y)) or player_y;
local z = tonumber(applyPositionOffset(p3, player_z)) or player_z;
player:SendMessage(messageID, sender, string.format("setting coordinates X:%d Y:%d Z:%d within current zone (%d)", x, y, z, player_zone));
worldManager:DoPlayerMoveInZone(player, x, y, z, player_rot, 0x00);
else
local zone = tonumber(applyPositionOffset(p1, player_zone)) or player_zone;
local x = tonumber(applyPositionOffset(p2, player_x)) or player_x;
local y = tonumber(applyPositionOffset(p3, player_y)) or player_y;
local z = tonumber(applyPositionOffset(p4, player_z)) or player_z;
if privateArea == nil then privateArea = nil end;
if privateAreaType == nila then privateAreaType = 0 end;
player:SendMessage(messageID, sender, string.format("setting coordinates X:%d Y:%d Z:%d to new zone (%d) private area:%s", x, y, z, zone, privateArea or "unspecified"));
worldManager:DoZoneChange(player, zone, privateArea, tonumber(privateAreaType), 0x02, x, y, z, 0.00);
end
else
player:SendMessage(messageID, sender, "Unknown parameters! Usage: "..properties.description);
end;
end;
function applyPositionOffset(str, offset)
local s = str;
if s:find("@") then
s = tonumber(s:sub(s:find("@") + 1, s:len()));
if s then s = s + offset end;
end
print(s);
return s;
end;