mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 05:54:50 +02:00
Finished Treasures of the Main and Legends Adrift. Fixed quests appearing in private areas (echos). Fixed other bugs. Implemented NPC Linkshells. Added more options to nudge command. Added nudgenpc command. Added testbnpckill command.
This commit is contained in:
parent
ebba56602c
commit
65ee91e49c
14 changed files with 864 additions and 38 deletions
|
@ -24,6 +24,21 @@ vertical = {
|
|||
["DESCEND"] = -1,
|
||||
}
|
||||
|
||||
horizontal = {
|
||||
["RIGHT"] = 2,
|
||||
["R"] = 2,
|
||||
["+"] = 2,
|
||||
["LEFT"] = -2,
|
||||
["L"] = -2,
|
||||
["0"] = -2
|
||||
}
|
||||
|
||||
rotation = {
|
||||
["ROTATE"] = 3,
|
||||
["ORIENTATION"] = 3,
|
||||
["O"] = 3
|
||||
}
|
||||
|
||||
function onTrigger(player, argc, arg1, arg2)
|
||||
local pos = player:GetPos();
|
||||
local x = pos[1];
|
||||
|
@ -54,16 +69,24 @@ function onTrigger(player, argc, arg1, arg2)
|
|||
distance = checkArg1;
|
||||
elseif checkArg1 and not checkArg2 then -- If first is number and second is string
|
||||
distance = checkArg1;
|
||||
if vertical[string.upper(arg2)] then -- Check vertical direction on string, otherwise throw param error
|
||||
if vertical[string.upper(arg2)] then -- Check vertical direction on string
|
||||
direction = vertical[string.upper(arg2)];
|
||||
elseif horizontal[string.upper(arg2)] then -- Check horizontal direction on string
|
||||
direction = horizontal[string.upper(arg2)];
|
||||
elseif rotation[string.upper(arg2)] then -- Check rotation on string, otherwise throw param error
|
||||
direction = rotation[string.upper(arg2)];
|
||||
else
|
||||
player:SendMessage(messageID, sender, "Unknown parameters! Usage: \n"..properties.description);
|
||||
return;
|
||||
end
|
||||
elseif (not checkArg1) and checkArg2 then -- If first is string and second is number
|
||||
distance = checkArg2;
|
||||
if vertical[string.upper(arg1)] then -- Check vertical direction on string, otherwise throw param error
|
||||
if vertical[string.upper(arg1)] then -- Check vertical direction on string
|
||||
direction = vertical[string.upper(arg1)];
|
||||
elseif horizontal[string.upper(arg1)] then -- Check horizontal direction on string
|
||||
direction = horizontal[string.upper(arg1)];
|
||||
elseif rotation[string.upper(arg1)] then -- Check rotation on string, otherwise throw param error
|
||||
direction = rotation[string.upper(arg1)];
|
||||
else
|
||||
player:SendMessage(messageID, sender, "Unknown parameters! Usage: \n"..properties.description);
|
||||
return;
|
||||
|
@ -86,6 +109,19 @@ function onTrigger(player, argc, arg1, arg2)
|
|||
y = y - distance;
|
||||
message = string.format("Positioning down %s yalms.", distance);
|
||||
worldManager:DoPlayerMoveInZone(player, x, y, z, rot, 0x0);
|
||||
elseif direction == 2 then
|
||||
local px = x - distance * math.cos(angle - math.pi/2);
|
||||
local pz = z + distance * math.sin(angle - math.pi/2);
|
||||
message = string.format("Positioning right %s yalms.", distance);
|
||||
worldManager:DoPlayerMoveInZone(player, px, y, pz, rot, 0x0);
|
||||
elseif direction == -2 then
|
||||
local px = x - distance * math.cos(angle + math.pi/2);
|
||||
local pz = z + distance * math.sin(angle + math.pi/2);
|
||||
message = string.format("Positioning left %s yalms.", distance);
|
||||
worldManager:DoPlayerMoveInZone(player, px, y, pz, rot, 0x0);
|
||||
elseif direction == 3 then
|
||||
message = string.format("ROTATE down %s yalms.", distance);
|
||||
worldManager:DoPlayerMoveInZone(player, x, y, z, distance, 0x0);
|
||||
else
|
||||
local px = x - distance * math.cos(angle);
|
||||
local pz = z + distance * math.sin(angle);
|
||||
|
|
140
Data/scripts/commands/gm/nudgenpc.lua
Normal file
140
Data/scripts/commands/gm/nudgenpc.lua
Normal file
|
@ -0,0 +1,140 @@
|
|||
require("global");
|
||||
|
||||
properties = {
|
||||
permissions = 0,
|
||||
parameters = "ss",
|
||||
description =
|
||||
[[
|
||||
Positions a targeted npc by some <distance>, defaults to 5 yalms.
|
||||
!nudge |
|
||||
!nudge <distance> |
|
||||
!nudge <distance> <up/down> |
|
||||
!nudge <distance> <left/right> |
|
||||
!nudge <distance> <rotate> |
|
||||
]],
|
||||
|
||||
}
|
||||
|
||||
vertical = {
|
||||
["UP"] = 1,
|
||||
["U"] = 1,
|
||||
["+"] = 1,
|
||||
["ASCEND"] = 1,
|
||||
["DOWN"] = -1,
|
||||
["D"] = -1,
|
||||
["-"] = -1,
|
||||
["DESCEND"] = -1,
|
||||
}
|
||||
|
||||
horizontal = {
|
||||
["RIGHT"] = 2,
|
||||
["R"] = 2,
|
||||
["+"] = 2,
|
||||
["LEFT"] = -2,
|
||||
["L"] = -2,
|
||||
["0"] = -2
|
||||
}
|
||||
|
||||
rotation = {
|
||||
["ROTATE"] = 3,
|
||||
["ORIENTATION"] = 3,
|
||||
["O"] = 3
|
||||
}
|
||||
|
||||
function onTrigger(player, argc, arg1, arg2)
|
||||
local messageID = MESSAGE_TYPE_SYSTEM;
|
||||
local sender = "[nudge] ";
|
||||
|
||||
local targetActor = player.CurrentArea.FindActorInArea(player.currentTarget) or nil;
|
||||
|
||||
|
||||
if (targetActor == nil) then
|
||||
player:SendMessage(MESSAGE_TYPE_SYSTEM, sender, "No target was selected.\n");
|
||||
return;
|
||||
end
|
||||
|
||||
local pos = targetActor:GetPos();
|
||||
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();
|
||||
local distance = 5;
|
||||
local direction = 0;
|
||||
|
||||
local checkArg1 = tonumber(arg1);
|
||||
local checkArg2 = tonumber(arg2);
|
||||
|
||||
if argc == 1 then
|
||||
if checkArg1 then
|
||||
distance = checkArg1;
|
||||
else
|
||||
player:SendMessage(messageID, sender, "Unknown parameters! Usage: \n"..properties.description);
|
||||
return;
|
||||
end
|
||||
elseif argc == 2 then
|
||||
if checkArg1 and checkArg2 then -- If both are numbers, just ignore second argument
|
||||
distance = checkArg1;
|
||||
elseif checkArg1 and not checkArg2 then -- If first is number and second is string
|
||||
distance = checkArg1;
|
||||
if vertical[string.upper(arg2)] then -- Check vertical direction on string
|
||||
direction = vertical[string.upper(arg2)];
|
||||
elseif horizontal[string.upper(arg2)] then -- Check horizontal direction on string
|
||||
direction = horizontal[string.upper(arg2)];
|
||||
elseif rotation[string.upper(arg2)] then -- Check rotation on string, otherwise throw param error
|
||||
direction = rotation[string.upper(arg2)];
|
||||
else
|
||||
player:SendMessage(messageID, sender, "Unknown parameters! Usage: \n"..properties.description);
|
||||
return;
|
||||
end
|
||||
elseif (not checkArg1) and checkArg2 then -- If first is string and second is number
|
||||
distance = checkArg2;
|
||||
if vertical[string.upper(arg1)] then -- Check vertical direction on string
|
||||
direction = vertical[string.upper(arg1)];
|
||||
elseif horizontal[string.upper(arg1)] then -- Check horizontal direction on string
|
||||
direction = horizontal[string.upper(arg1)];
|
||||
elseif rotation[string.upper(arg1)] then -- Check rotation on string, otherwise throw param error
|
||||
direction = rotation[string.upper(arg1)];
|
||||
else
|
||||
player:SendMessage(messageID, sender, "Unknown parameters! Usage: \n"..properties.description);
|
||||
return;
|
||||
end
|
||||
else
|
||||
player:SendMessage(messageID, sender, "Unknown parameters! Usage: \n"..properties.description);
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
if direction == 1 then
|
||||
y = y + distance;
|
||||
targetActor:SetPos(x,y,z,rot,true, player);
|
||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), x, y, z, rot);
|
||||
elseif direction == -1 then
|
||||
y = y - distance;
|
||||
targetActor:SetPos(x,y,z,rot,true, player);
|
||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), x, y, z, rot);
|
||||
elseif direction == 2 then
|
||||
local px = x - distance * math.cos(angle - math.pi/2);
|
||||
local pz = z + distance * math.sin(angle - math.pi/2);
|
||||
targetActor:SetPos(px, y, pz, rot, true, player);
|
||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), px, y, pz, rot);
|
||||
elseif direction == -2 then
|
||||
local px = x - distance * math.cos(angle + math.pi/2);
|
||||
local pz = z + distance * math.sin(angle + math.pi/2);
|
||||
targetActor:SetPos(px, y, pz, rot, true, player);
|
||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), px, y, pz, rot);
|
||||
elseif direction == 3 then
|
||||
targetActor:SetPos(x, y, z, distance, true, player);
|
||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), x, y, z, distance);
|
||||
else
|
||||
local px = x - distance * math.cos(angle);
|
||||
local pz = z + distance * math.sin(angle);
|
||||
targetActor:SetPos(px, y, pz, rot, true, player);
|
||||
message = string.format("Moved %s @ %f, %f, %f, %f", targetActor:GetUniqueId(), px, y, pz, rot);
|
||||
end
|
||||
|
||||
player:SendMessage(messageID, sender, message);
|
||||
end
|
16
Data/scripts/commands/gm/testbnpckill
Normal file
16
Data/scripts/commands/gm/testbnpckill
Normal file
|
@ -0,0 +1,16 @@
|
|||
require("global");
|
||||
|
||||
properties = {
|
||||
permissions = 0,
|
||||
parameters = "d",
|
||||
description = "Simulates killing a bnpc. Used for quest testing.",
|
||||
}
|
||||
|
||||
function onTrigger(player, argc, actorClassId)
|
||||
if (argc == 1) then
|
||||
player:HandleBNpcKill(actorClassId);
|
||||
player:SendMessage(0x20, "", "Simulating BNpc kill for actor class id: " .. tostring(actorClassId));
|
||||
else
|
||||
player:SendMessage(0x20, "", "No actor class id provided.");
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue