mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-09 05:54:50 +02:00
Merge branch 'Jorge/quest_system' into ioncannon/quest_system
This commit is contained in:
commit
cfe6ef2e5e
50 changed files with 1554 additions and 684 deletions
|
@ -6,8 +6,50 @@ Handles mounting and dismounting the Chocobo and Goobbue
|
|||
|
||||
--]]
|
||||
|
||||
require ("global")
|
||||
|
||||
function onEventStarted(player, actor, triggerName, isGoobbue)
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (player:GetState() == 0) then
|
||||
|
||||
worldMaster = GetWorldMaster();
|
||||
|
||||
if (isGoobbue ~= true) then
|
||||
player:ChangeMusic(83, MUSIC_FADEIN);
|
||||
player:SendGameMessage(player, worldMaster, 26001, 0x20);
|
||||
player:SetMountState(1);
|
||||
else
|
||||
player:ChangeMusic(98, MUSIC_FADEIN);
|
||||
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, MUSIC_FADEIN);
|
||||
|
||||
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();
|
||||
|
@ -46,4 +88,5 @@ function onEventStarted(player, actor, triggerName, isGoobbue)
|
|||
|
||||
player:EndEvent();
|
||||
|
||||
>>>>>>> ioncannon/quest_system
|
||||
end
|
|
@ -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,189 @@ 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 isFavoredDesination = false;
|
||||
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]};
|
||||
isFavoredDesination = true;
|
||||
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 (isFavoredDesination == true) then
|
||||
destination = aetheryteTeleportPositions[favoredLocation[aetheryteChoice]];
|
||||
player:SendGameMessage(worldMaster, 34101, 0x20, 2, favoredLocation[aetheryteChoice], animaCost[aetheryteChoice], currentAnima);
|
||||
else
|
||||
destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]];
|
||||
player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][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
|
|
@ -1,14 +1,17 @@
|
|||
properties = {
|
||||
permissions = 0,
|
||||
parameters = "s",
|
||||
parameters = "ss",
|
||||
description =
|
||||
[[
|
||||
Plays music <id> to player.
|
||||
!music <id>
|
||||
!music <id> <transition_type>
|
||||
]],
|
||||
}
|
||||
|
||||
function onTrigger(player, argc, music)
|
||||
function onTrigger(player, argc, music, transition)
|
||||
music = tonumber(music) or 0;
|
||||
player:ChangeMusic(music);
|
||||
transition = tonumber(transition) or nil;
|
||||
player:SendMessage(0x20, "", tostring(argc).." "..tostring(music).." "..tostring(transition));
|
||||
player:ChangeMusic(music, transition);
|
||||
end;
|
|
@ -22,6 +22,5 @@ function onTrigger(player, argc, actorClassId)
|
|||
if actor then
|
||||
actor:ChangeNpcAppearance(actorClassId);
|
||||
player:SendMessage(messageID, sender, string.format("appearance %u", actorClassId));
|
||||
end;
|
||||
|
||||
end;
|
||||
end
|
||||
end
|
|
@ -29,7 +29,7 @@ function onTrigger(player, argc, actorClassId, width, height)
|
|||
--local x, y, z = player.GetPos();
|
||||
for i = 0, w do
|
||||
for j = 0, h do
|
||||
actor = player.CurrentArea:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]);
|
||||
actor = player.CurrentArea:SpawnActor(actorClassId, "test", x + (i - (w / 2) * 3), y, z + (j - (h / 2) * 3), rot);
|
||||
actor.SetAppearance(1001149)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,7 +56,8 @@ function onTrigger(player, argc, p1, p2, p3, p4, privateArea, privateAreaType, n
|
|||
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 == "" then privateArea = nil end;
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue