Merge remote-tracking branch 'origin/ioncannon/quest_system' into Jorge/quest_system

# Conflicts:
#	Data/scripts/commands/EmoteSitCommand.lua  - Resolved using Theirs
This commit is contained in:
CuriousJorge 2022-03-11 19:21:42 -05:00
commit e94c037fb5
73 changed files with 1096 additions and 212 deletions

View file

@ -13,7 +13,7 @@ local attackMagicHandlers = {
}
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Ability(command.Id, targetActor);
player:endEvent();
end

View file

@ -1,5 +1,5 @@
require("global")
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
end

View file

@ -13,7 +13,7 @@ local attackMagicHandlers = {
}
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Ability(command.Id, targetActor);
player:endEvent();

View file

@ -13,7 +13,7 @@ local attackMagicHandlers = {
}
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();
end;

View file

@ -9,7 +9,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti
--]]
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
--Are they in active mode?
if (player:GetState() != 2) then

View file

@ -8,7 +8,7 @@ Handles what happens when you examine a player's bazaar
require ("global")
function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, bazaarActorId)
function onEventStarted(player, actor, eventType, eventName, name, arg1, arg2, arg3, bazaarActorId)
local bazaarActor = nil;

View file

@ -20,7 +20,7 @@ seekAmount: The amount of seekItem we want.
require ("global")
function onEventStarted(player, actor, triggerName, rewardItem, seekItem, bazaarMode, arg1, bazaarActor, rewardAmount, seekAmount, arg2, arg3, type9ItemIds)
function onEventStarted(player, actor, eventType, eventName, rewardItem, seekItem, bazaarMode, arg1, bazaarActor, rewardAmount, seekAmount, arg2, arg3, type9ItemIds)
local rewarding = nil;
local seeking = nil;

View file

@ -10,7 +10,7 @@ All bazaar args have a Reward (The item the person who fufills the request gets)
--TODO REFACTOR
function onEventStarted(player, actor, triggerName, rewardItem, seekItemOrCost, seekAmount, arg1, bazaarActorId, rewardAmount, rewardItemId, nameIndex, arg2, type9ItemIds)
function onEventStarted(player, actor, eventType, eventName, rewardItem, seekItemOrCost, seekAmount, arg1, bazaarActorId, rewardAmount, rewardItemId, nameIndex, arg2, type9ItemIds)
local originalReward = nil;
local originalSeek = nil;

View file

@ -13,7 +13,7 @@ Handles canceling bazaar items
--]]
function onEventStarted(player, actor, triggerName, rewardItem, seekItem, bazaarType, narg, bazaarActor, rewardAmount, seekAmount, narg, narg, type9ItemIds)
function onEventStarted(player, actor, eventType, eventName, rewardItem, seekItem, bazaarType, narg, bazaarActor, rewardAmount, seekAmount, narg, narg, type9ItemIds)
GetWorldManager():RemoveFromBazaar(player, player:GetItem(rewardItem));

View file

@ -10,7 +10,7 @@ operateUI(pointsAvailable, pointsLimit, str, vit, dex, int, min, pie)
require ("global")
function onEventStarted(player, actor, triggerName)
function onEventStarted(player, actor, eventType, eventName)
--local points = player:GetAttributePoints();
--player:RunEventFunction("delegateCommand", actor, "operateUI", points.available, points.limit, points.inSTR, points.inVIT, points.inDEX, points.inINT, points.inMIN, points.inPIT);
result = callClientFunction(player, "delegateCommand", actor, "operateUI", 100, 100, 10, 10, 10, 10, 10, 10);

View file

@ -1,4 +1,4 @@
function onEventStarted(player, caller, commandRequest, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
function onEventStarted(player, caller, eventType, eventName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
player:SetCurrentJob(17);

View file

@ -6,7 +6,7 @@ Handles player examining someone
--]]
function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId)
function onEventStarted(player, commandactor, eventType, eventName, arg1, arg2, arg3, arg4, checkedActorId)
actor = player:GetActorInInstance(checkedActorId);

View file

@ -8,9 +8,7 @@ Handles mounting and dismounting the Chocobo and Goobbue
require ("global")
function onEventStarted(player, actor, triggerName, isGoobbue)
<<<<<<< HEAD
function onEventStarted(player, actor, eventType, eventName, isGoobbue)
if (player:GetState() == 0) then
worldMaster = GetWorldMaster();
@ -45,48 +43,6 @@ function onEventStarted(player, actor, triggerName, isGoobbue)
player:SetMountState(0);
player:ChangeSpeed(0.0, 2.0, 5.0, 5.0)
player:ChangeState(0);
end
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, 5.0, 10.0, 10.0);
player:ChangeState(15);
else
player:ChangeMusic(player.CurrentArea.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();
>>>>>>> ioncannon/quest_system
end

View file

@ -124,7 +124,7 @@ local weaponskillHandlers = {
[0xA0F070EA] = nil
}
function onEventStarted(player, command, triggerName)
function onEventStarted(player, command, eventType, eventName)
--Are they in active mode?
if (player:GetState() != 2) then

View file

@ -6,7 +6,7 @@ Handles what happens when you resolve an invite to a group
--]]
function onEventStarted(player, actor, triggerName, groupType, result)
function onEventStarted(player, actor, eventType, eventName, groupType, result)
--Accept/Refuse happened, else just close the window
if (result == 1 or result == 2) then

View file

@ -6,7 +6,7 @@ Handles what happens when you accept/refuse a trade
--]]
function onEventStarted(player, actor, triggerName, groupType, result)
function onEventStarted(player, actor, eventType, eventName, groupType, result)
--Accept
if (result == 1) then

View file

@ -156,7 +156,7 @@ local skillAnim = {
local craftStartWidgetOpen = false;
function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, checkedActorId)
function onEventStarted(player, commandactor, eventType, eventName, arg1, arg2, arg3, arg4, checkedActorId)
local MENU_CANCEL, MENU_MAINHAND, MENU_OFFHAND, MENU_REQUEST = 0, 1, 2, 3;
local MENU_RECENT, MENU_AWARDED, MENU_RECENT_DETAILED, MENU_AWARDED_DETAILED = 7, 8, 9, 10;

View file

@ -1,4 +1,4 @@
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();

View file

@ -1,4 +1,4 @@
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();

View file

@ -9,7 +9,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti
--]]
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
--Are they in active mode?
if (player:GetState() != 2) then

View file

@ -4,7 +4,7 @@ DiceCommand Script
--]]
function onEventStarted(player, actor, triggerName, maxNumber)
function onEventStarted(player, actor, eventType, eventName, maxNumber)
if (maxNumber == nil or maxNumber > 1000 or maxNumber < 1) then
maxNumber = 100;

View file

@ -99,7 +99,7 @@ nodeItems = {
require ("global")
function onEventStarted(player, commandActor, triggerName, arg1, arg2, arg3, arg4, checkedActorId)
function onEventStarted(player, commandActor, eventType, eventName, arg1, arg2, arg3, arg4, checkedActorId)
debugMsg = false;

View file

@ -1,4 +1,4 @@
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();

View file

@ -4,7 +4,7 @@ EmoteSitCommand Script
--]]
function onEventStarted(player, actor, eventType, triggerName, emoteId)
function onEventStarted(player, actor, eventType, eventName, emoteId)
if (player:GetState() == 0) then
if (emoteId == 0x2712) then

View file

@ -6,7 +6,7 @@ require ("global")
--commandid: command being equipped
function onEventStarted(player, equipAbilityWidget, triggername, slot, commandid, unkown, arg1, arg2, arg3, arg4, arg5, arg6)
function onEventStarted(player, equipAbilityWidget, eventType, eventName, slot, commandid, unkown, arg1, arg2, arg3, arg4, arg5, arg6)
local worldManager = GetWorldManager();
local ability = worldManager:GetBattleCommand(commandid);

View file

@ -53,7 +53,7 @@ GRAPHICSLOT_L_RINGFINGER = 24;
GRAPHICSLOT_R_INDEXFINGER = 25;
GRAPHICSLOT_L_INDEXFINGER = 26;
function onEventStarted(player, actor, triggerName, equippedItem, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds)
function onEventStarted(player, actor, eventType, eventName, equippedItem, param1, param2, param3, param4, param5, param6, param7, equipSlot, itemDBIds)
equipSlot = equipSlot-1;
--Equip Item

View file

@ -1,4 +1,4 @@
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();

View file

@ -6,7 +6,7 @@ Handles moving items across item packages (IE: Taking loot)
--]]
function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds)
function onEventStarted(player, actor, eventType, eventName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds)
player:EndEvent();

View file

@ -6,7 +6,7 @@ Handles giving an item to another party member.
--]]
function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, targetPlayer, arg2, arg3, arg4, arg5, type9ItemIds)
function onEventStarted(player, actor, eventType, eventName, itemReference, targetPackage, sourcePackage, arg1, targetPlayer, arg2, arg3, arg4, arg5, type9ItemIds)
player:EndEvent();

View file

@ -9,7 +9,7 @@ The param "itemDBIds" has the vars: item1 and item2.
--]]
function onEventStarted(player, actor, triggerName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds)
function onEventStarted(player, actor, eventType, eventName, itemReference, targetPackage, sourcePackage, arg1, arg2, unknown, arg3, arg4, arg5, type9ItemIds)
player:GetItemPackage(itemReference.itemPackage):RemoveItemAtSlot(itemReference.slot);
player:EndEvent();
end

View file

@ -4,7 +4,7 @@ LinkshellAppointCommand Script
--]]
function onEventStarted(player, actor, triggerName, linkshellName, memberName, rank)
function onEventStarted(player, actor, eventType, eventName, linkshellName, memberName, rank)
GetWorldManager():RequestWorldLinkshellRankChange(player, linkshellName, memberName, rank);
player:EndEvent();

View file

@ -4,7 +4,7 @@ LinkshellChangeCommand Script
--]]
function onEventStarted(player, actor, triggerName, linkshellName, arg1, arg2)
function onEventStarted(player, actor, eventType, eventName, linkshellName, arg1, arg2)
if (linkshellName == nil) then
linkshellName = "";

View file

@ -6,7 +6,7 @@ Handles what happens when you cancel an invite to a linkshell
--]]
function onEventStarted(player, actor, triggerName, arg1, arg2, arg3, arg4, actorId)
function onEventStarted(player, actor, eventType, eventName, arg1, arg2, arg3, arg4, actorId)
GetWorldManager():RequestWorldLinkshellCancelInvite(player);
player:EndEvent();

View file

@ -6,7 +6,7 @@ Handles what happens when you invite a player to a linkshell
--]]
function onEventStarted(player, actor, triggerName, linkshellName, arg1, arg2, arg3, actorId)
function onEventStarted(player, actor, eventType, eventName, linkshellName, arg1, arg2, arg3, actorId)
GetWorldManager():RequestWorldLinkshellInviteMember(player, linkshellName, actorId);
player:EndEvent();

View file

@ -4,7 +4,7 @@ LinkshellKickCommand Script
--]]
function onEventStarted(player, actor, triggerName, linkshellName, kickedName)
function onEventStarted(player, actor, eventType, eventName, linkshellName, kickedName)
GetWorldManager():RequestWorldLinkshellKick(player, linkshellName, kickedName);
player:EndEvent();

View file

@ -4,7 +4,7 @@ LinkshellLeaveCommand Script
--]]
function onEventStarted(player, actor, triggerName, linkshellName)
function onEventStarted(player, actor, eventType, eventName, linkshellName)
GetWorldManager():RequestWorldLinkshellLeave(player, linkshellName);
player:EndEvent();

View file

@ -8,7 +8,7 @@ Handles post-dream events.
require ("global")
function onEventStarted(player, actor, triggerName, dreamCode, innCode, narg1, narg2, bedActor)
function onEventStarted(player, actor, eventType, eventName, dreamCode, innCode, narg1, narg2, bedActor)
--In Plain Sight
if (dreamCode == 1) then

View file

@ -12,7 +12,7 @@ eventLogoutFade()
require ("global")
function onEventStarted(player, command, triggerName)
function onEventStarted(player, command, eventType, eventName)
choice = callClientFunction(player, "delegateCommand", command, "eventConfirm");

View file

@ -40,7 +40,7 @@ updateNegotiationWidget(player, gridIndex, key, itemIconId, pointValue, ?, ?) -
require ("global")
function onEventStarted(player, commandactor, triggerName, arg1, arg2, arg3, arg4, arg5)
function onEventStarted(player, commandactor, eventType, eventName, arg1, arg2, arg3, arg4, arg5)
negotiationJudge = GetStaticActor("NegotiationJudge");

View file

@ -4,13 +4,14 @@ require ("global")
NpcLinkshellChatCommand Script
Handler for when a player clicks a npc ls to talk to. If adding new linkshells to the handle, make sure to add
it to the handler table (with correct offset), and that your function is above the handler. If padding is needed
to hit some ID, add "nils".
Player class will go through all quests and see if there are active msgs for one. If there was, it will
return true and that quest must end the event (if needed). Otherwise if nothing caught the event, the
event is ended here.
--]]
function onEventStarted(player, command, eventType, eventName, npcLsId)
player:HandleNpcLS(npcLsId);
player:EndEvent();
if (player:HandleNpcLs(npcLsId) == false) then
player:EndEvent();
end
end

View file

@ -6,7 +6,7 @@ Handles disbanding the party.
--]]
function onEventStarted(player, actor, triggerName)
function onEventStarted(player, actor, eventType, eventName)
worldMaster = GetWorldMaster();
if (player:IsPartyLeader()) then

View file

@ -15,7 +15,7 @@ TextIds:
--]]
function onEventStarted(player, actor, name)
function onEventStarted(player, actor, eventType, eventName, name)
worldMaster = GetWorldMaster();
if (player:IsPartyLeader()) then

View file

@ -6,7 +6,7 @@ Handles what happens when you invite
--]]
function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, actorId)
function onEventStarted(player, actor, eventType, eventName, name, arg1, arg2, arg3, actorId)
if (name ~= nil) then
GetWorldManager():CreateInvitePartyGroup(player, name);

View file

@ -15,7 +15,7 @@ TextIds:
--]]
function onEventStarted(player, actor, triggerName, name, arg2, arg3, arg4, actorId)
function onEventStarted(player, actor, eventType, eventName, name, arg2, arg3, arg4, actorId)
worldMaster = GetWorldMaster();
if (player:IsPartyLeader()) then

View file

@ -6,7 +6,7 @@ Handles requesting to change party leader and various errors.
--]]
function onEventStarted(player, actor, triggerName, name, arg2, arg3, arg4, actorId)
function onEventStarted(player, actor, eventType, eventName, name, arg2, arg3, arg4, actorId)
worldMaster = GetWorldMaster();
if (player:IsPartyLeader()) then

View file

@ -6,7 +6,7 @@ Handles leaving a party
--]]
function onEventStarted(player, actor, triggerName)
function onEventStarted(player, actor, eventType, eventName)
player:PartyLeave(name);
player:EndEvent();
end

View file

@ -27,7 +27,7 @@ markers = { -- [id] = {overheadIcon, textIcon}
}
function onEventStarted(player, actor, triggerName, commandValue, category, unk1, unk2, targetActor, unk3, unk4, unk5, unk6)
function onEventStarted(player, actor, eventType, eventName, commandValue, category, unk1, unk2, targetActor, unk3, unk4, unk5, unk6)
workName = "charaWork.parameterTemp.targetInformation";
uiFunc = "charaWork/stateForAll";

View file

@ -1,5 +1,5 @@
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);

View file

@ -1,4 +1,4 @@
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();

View file

@ -3,7 +3,7 @@
--]]
function onEventStarted(player, actor, questId)
function onEventStarted(player, actor, eventType, eventName, questId)
player:SendDataPacket("requestedData", "activegl", 7, nil, nil, nil, nil, nil, nil, nil);
-- player:SendRequestedInfo("requestedData", "glHist", 10, 0x1D4F2, 1009, 12464, 11727, 12485, 12526);
end

View file

@ -9,7 +9,7 @@ Finds the correct weaponskill subscript to fire when a weaponskill actor is acti
--]]
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Ability(command.Id, targetActor);
player:endEvent();
end;

View file

@ -13,7 +13,7 @@ local attackMagicHandlers = {
}
function onEventStarted(player, command, triggerName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
function onEventStarted(player, command, eventType, eventName, arg1, arg2, arg3, arg4, targetActor, arg5, arg6, arg7, arg8)
player.Cast(command.Id, targetActor);
player:endEvent();
end;

View file

@ -24,7 +24,7 @@ reedit: Target has canceled their accept.
require ("global")
function onEventStarted(player, actor, triggerName)
function onEventStarted(player, actor, eventType, eventName)
callClientFunction(player, "delegateCommand", GetStaticActor("TradeExecuteCommand"), "processTradeCommandOpenTray");

View file

@ -6,7 +6,7 @@ Handles what happens a player cancels a trade
--]]
function onEventStarted(player, actor, triggerName, commandId, result)
function onEventStarted(player, actor, eventType, eventName, commandId, result)
GetWorldManager():CancelTrade(player);
player:EndEvent();

View file

@ -6,7 +6,7 @@ Handles what happens when you invite to trade
--]]
function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, actorId)
function onEventStarted(player, actor, eventType, eventName, name, arg1, arg2, arg3, actorId)
local otherActor = nil;

View file

@ -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);

View 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

View 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