diff --git a/data/scripts/aetheryte.lua b/data/scripts/aetheryte.lua index 031d6cf4..c14f7ae9 100644 --- a/data/scripts/aetheryte.lua +++ b/data/scripts/aetheryte.lua @@ -109,5 +109,22 @@ aetheryteChildLinks = { } aetheryteTeleportPositions = { - [1280002] = {128, 29.97, 45.83, -35.47} + [1280001] = {230, -407, 42.5, 337}, + [1280002] = {128, 29.97, 45.83, -35.47}, + [1280003] = {129, -991.88, 61.71, -1120.79}, + [1280004] = {129, -1883.47, 53.77, -1372.68}, + [1280005] = {130, 1123.29, 45.7, -928.69}, + [1280006] = {135, -278.181, 77.63, -2260.79}, + [1280007] = {128, 582.47, 54.52, -1.2}, + [1280020] = {132, 1343.5, -54.38, -870.84}, + + [1280031] = {175, -235, 185, -3.9}, + [1280033] = {171, 1250.9, 264, -544.2}, + + [1280061] = {206, -120, 16, -1332}, + [1280062] = {150, 288, 4, -543.928}, + [1280063] = {151, 1702, 20, -862}, + [1280064] = {152, -1052, 20, -1760}, + [1280065] = {153, -1566.035, -11.89, -550.51}, + [1280066] = {154, 734, -12, 1126} } \ No newline at end of file diff --git a/data/scripts/base/chara/npc/object/aetheryte/AetheryteChild.lua b/data/scripts/base/chara/npc/object/aetheryte/AetheryteChild.lua index 13ff288b..ef21bf73 100644 --- a/data/scripts/base/chara/npc/object/aetheryte/AetheryteChild.lua +++ b/data/scripts/base/chara/npc/object/aetheryte/AetheryteChild.lua @@ -21,6 +21,7 @@ eventGLJoin () - Ask to join party leader's leve require ("global") require ("aetheryte") +require ("utils") function init(npc) return false, false, 0, 0; @@ -29,12 +30,19 @@ end function onEventStarted(player, aetheryte, triggerName) aetheryteId = aetheryte:GetActorClassId(); - parentNode = aetheryteParentLinks[aetheryteId]; - menuChoice = callClientFunction(player, "eventAetheryteChildSelect", true, aetheryteChildLinks[aetheryteId], 100, 1); + parentNode = aetheryteChildLinks[aetheryteId]; + menuChoice = callClientFunction(player, "eventAetheryteChildSelect", true, parentNode, 100, 1); --Teleport if (menuChoice == 2) then + printf("%ud", parentNode); + destination = aetheryteTeleportPositions[parentNode]; + 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 --Init Levequest elseif (menuChoice == -1) then doLevequestInit(player, aetheryte); diff --git a/data/scripts/base/chara/npc/object/aetheryte/AetheryteParent.lua b/data/scripts/base/chara/npc/object/aetheryte/AetheryteParent.lua index 44feb5b7..d405ed8a 100644 --- a/data/scripts/base/chara/npc/object/aetheryte/AetheryteParent.lua +++ b/data/scripts/base/chara/npc/object/aetheryte/AetheryteParent.lua @@ -25,6 +25,7 @@ eventGLJoin () - Ask to join party leader's leve require ("global") require ("aetheryte") +require ("utils") function init(npc) return false, false, 0, 0; @@ -38,25 +39,27 @@ function onEventStarted(player, aetheryte, triggerName) local listPosition = 1; local activeChildNodes = {0, 0, 0, 0, 0}; - if (player:HasAetheryteNodeUnlocked(childNodes[1])) then - activeChildNodes[listPosition] = childNodes[1]; - listPosition = listPosition+1; - end - if (player:HasAetheryteNodeUnlocked(childNodes[2])) then - activeChildNodes[listPosition] = childNodes[2]; - listPosition = listPosition+1; - end - if (player:HasAetheryteNodeUnlocked(childNodes[3])) then - activeChildNodes[listPosition] = childNodes[3]; - listPosition = listPosition+1; - end - if (player:HasAetheryteNodeUnlocked(childNodes[4])) then - activeChildNodes[listPosition] = childNodes[4]; - listPosition = listPosition+1; - end - if (player:HasAetheryteNodeUnlocked(childNodes[5])) then - activeChildNodes[listPosition] = childNodes[5]; - listPosition = listPosition+1; + if (childNodes ~= nil) then + if (player:HasAetheryteNodeUnlocked(childNodes[1])) then + activeChildNodes[listPosition] = childNodes[1]; + listPosition = listPosition+1; + end + if (player:HasAetheryteNodeUnlocked(childNodes[2])) then + activeChildNodes[listPosition] = childNodes[2]; + listPosition = listPosition+1; + end + if (player:HasAetheryteNodeUnlocked(childNodes[3])) then + activeChildNodes[listPosition] = childNodes[3]; + listPosition = listPosition+1; + end + if (player:HasAetheryteNodeUnlocked(childNodes[4])) then + activeChildNodes[listPosition] = childNodes[4]; + listPosition = listPosition+1; + end + if (player:HasAetheryteNodeUnlocked(childNodes[5])) then + activeChildNodes[listPosition] = childNodes[5]; + listPosition = listPosition+1; + end end local showTeleportOptions = true; @@ -82,6 +85,12 @@ function onEventStarted(player, aetheryte, triggerName) player:SendGameMessage(player, aetheryte, 127, 0x20, 3, 5); --Teleport to Gate elseif (choice > 0) then + destination = aetheryteTeleportPositions[activeChildNodes[choice]]; + 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 end diff --git a/data/scripts/chocobo.lua b/data/scripts/chocobo.lua deleted file mode 100644 index 7f9c8211..00000000 --- a/data/scripts/chocobo.lua +++ /dev/null @@ -1,68 +0,0 @@ ---[[ - -Globals referenced in all of the lua scripts - ---]] - --- ACTOR STATES - -ACTORSTATE_PASSIVE = 0; -ACTORSTATE_DEAD1 = 1; -ACTORSTATE_ACTIVE = 2; -ACTORSTATE_DEAD2 = 3; -ACTORSTATE_SITTING_ONOBJ = 11; -ACTORSTATE_SITTING_ONFLOOR = 13; -ACTORSTATE_MOUNTED = 15; - - --- MESSAGE -MESSAGE_TYPE_NONE = 0; -MESSAGE_TYPE_SAY = 1; -MESSAGE_TYPE_SHOUT = 2; -MESSAGE_TYPE_TELL = 3; -MESSAGE_TYPE_PARTY = 4; -MESSAGE_TYPE_LINKSHELL1 = 5; -MESSAGE_TYPE_LINKSHELL2 = 6; -MESSAGE_TYPE_LINKSHELL3 = 7; -MESSAGE_TYPE_LINKSHELL4 = 8; -MESSAGE_TYPE_LINKSHELL5 = 9; -MESSAGE_TYPE_LINKSHELL6 = 10; -MESSAGE_TYPE_LINKSHELL7 = 11; -MESSAGE_TYPE_LINKSHELL8 = 12; - -MESSAGE_TYPE_SAY_SPAM = 22; -MESSAGE_TYPE_SHOUT_SPAM = 23; -MESSAGE_TYPE_TELL_SPAM = 24; -MESSAGE_TYPE_CUSTOM_EMOTE = 25; -MESSAGE_TYPE_EMOTE_SPAM = 26; -MESSAGE_TYPE_STANDARD_EMOTE = 27; -MESSAGE_TYPE_URGENT_MESSAGE = 28; -MESSAGE_TYPE_GENERAL_INFO = 29; -MESSAGE_TYPE_SYSTEM = 32; -MESSAGE_TYPE_SYSTEM_ERROR = 33; - --- INVENTORY -INVENTORY_NORMAL = 0x0000; --Max 0xC8 -INVENTORY_LOOT = 0x0004; --Max 0xA -INVENTORY_MELDREQUEST = 0x0005; --Max 0x04 -INVENTORY_BAZAAR = 0x0007; --Max 0x0A -INVENTORY_CURRENCY = 0x0063; --Max 0x140 -INVENTORY_KEYITEMS = 0x0064; --Max 0x500 -INVENTORY_EQUIPMENT = 0x00FE; --Max 0x23 -INVENTORY_EQUIPMENT_OTHERPLAYER = 0x00F9; --Max 0x23 - ---UTILS - -function callClientFunction(player, functionName, ...) - player:RunEventFunction(functionName, ...); - result = coroutine.yield(); - return result; -end - -function printf(s, ...) - if ... then - print(s:format(...)); - else - print(s); - end; -end; \ No newline at end of file diff --git a/data/scripts/commands/TeleportCommand.lua b/data/scripts/commands/TeleportCommand.lua index 9d31d79a..51960721 100644 --- a/data/scripts/commands/TeleportCommand.lua +++ b/data/scripts/commands/TeleportCommand.lua @@ -12,6 +12,7 @@ eventConfirm(isReturn, isInBattle, cityReturnNum, 138821, forceAskReturnOnly) require ("global") require ("aetheryte") +require ("utils") teleportMenuToAetheryte = { [1] = { @@ -74,8 +75,10 @@ function onEventStarted(player, actor, triggerName, isTeleport) player:SendGameMessage(worldMaster, 34105, 0x20); --Do teleport destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]]; - if (destination ~= nil) then - GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, destination[2], destination[3], destination[4], 0.0); + 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(); @@ -93,7 +96,7 @@ function onEventStarted(player, actor, triggerName, isTeleport) --Return to Inn if (player:GetHomePointInn() == 1) then GetWorldManager():DoZoneChange(player, 12); - elseif (player:GetHomePointInn() == 3) then + elseif (player:GetHomePointInn() == 2) then GetWorldManager():DoZoneChange(player, 13); elseif (player:GetHomePointInn() == 3) then GetWorldManager():DoZoneChange(player, 11); @@ -102,7 +105,9 @@ function onEventStarted(player, actor, triggerName, isTeleport) --Return to Homepoint destination = aetheryteTeleportPositions[player:GetHomePoint()]; if (destination ~= nil) then - GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, destination[2], destination[3], destination[4], 0.0); + 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 end diff --git a/data/scripts/utils.lua b/data/scripts/utils.lua new file mode 100644 index 00000000..136aaba8 --- /dev/null +++ b/data/scripts/utils.lua @@ -0,0 +1,18 @@ +--[[ + +Helper Utils + +--]] + +function getRandomPointInBand(originX, originY, minRadius, maxRadius) + angle = math.random() * math.pi * 2; + radius =(math.sqrt(math.random()) * (maxRadius-minRadius)) + minRadius; + x = radius * math.cos(angle); + y = radius * math.sin(angle); + return {x=x+originX,y=y+originY}; +end + +function getAngleFacing(x, y, targetX, targetY) + angle = math.atan2(targetX - x, targetY - y); + return angle; +end \ No newline at end of file diff --git a/sql/server_spawn_locations.sql b/sql/server_spawn_locations.sql index 15fd456b..12f37313 100644 --- a/sql/server_spawn_locations.sql +++ b/sql/server_spawn_locations.sql @@ -4,7 +4,7 @@ Source Host: localhost Source Database: ffxiv_server Target Host: localhost Target Database: ffxiv_server -Date: 5/1/2017 10:28:49 PM +Date: 5/2/2017 9:42:31 PM */ SET FOREIGN_KEY_CHECKS=0; @@ -145,7 +145,6 @@ INSERT INTO `server_spawn_locations` VALUES ('111', '1200044', '', '175', '', '0 INSERT INTO `server_spawn_locations` VALUES ('112', '1200194', 'task_board', '175', '', '0', '-50.24', '197.6', '58.94', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('113', '1200210', '', '175', '', '0', '-169.94', '191.8', '25.9', '0.523', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('114', '1200288', '', '175', '', '0', '-189.13', '190', '15.59', '-1.04', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('115', '1280031', 'uldah_aetheryte', '175', '', '0', '-240.45', '185.93', '-9.56', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('117', '1290004', '', '175', '', '0', '-239.02', '190', '55.67', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('118', '1500116', 'gogorano', '175', '', '0', '-77.82', '192.1', '4.29', '0.23', '0', '1040', null); INSERT INTO `server_spawn_locations` VALUES ('119', '1500129', 'yayatoki', '175', '', '0', '-27.31', '196', '87.25', '1.91', '0', '1040', null); @@ -754,13 +753,13 @@ INSERT INTO `server_spawn_locations` VALUES ('724', '1000951', 'lonsygg', '155', INSERT INTO `server_spawn_locations` VALUES ('728', '1200052', 'test_mining_point', '141', '', '0', '-8.48', '45.36', '139.5', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('729', '5900013', 'ship_route_1', '200', '', '0', '0', '10', '-128', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('730', '5900014', 'ship_route_2', '200', '', '0', '0', '10', '128', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('731', '1280001', 'limsa_aetheryte', '230', '', '0', '-400', '43', '338', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('731', '1280001', 'limsa_aetheryte', '230', '', '0', '-395.1', '42.5', '337.12', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('732', '1280002', 'camp_beardedrock_aetheryte', '128', '', '0', '29.97', '45.83', '-35.47', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('733', '1280003', 'camp_skullvalley_aetheryte', '129', '', '0', '-992', '62', '-1121', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('734', '1280004', 'camp_baldknoll_aetheryte', '129', '', '0', '-1889', '54', '-1379', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('735', '1280005', 'camp_bloodshore_aetheryte', '130', '', '0', '1128', '46', '-926', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('736', '1280006', 'camp_ironlake_aetheryte', '135', '', '0', '-284', '79', '-2276', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('737', '1280007', 'cedarwood_aetherytegate', '128', '', '0', '588', '55', '-1', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('733', '1280003', 'camp_skullvalley_aetheryte', '129', '', '0', '-991.88', '61.71', '-1120.79', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('734', '1280004', 'camp_baldknoll_aetheryte', '129', '', '0', '-1883.47', '53.77', '-1372.68', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('735', '1280005', 'camp_bloodshore_aetheryte', '130', '', '0', '1123.29', '45.7', '-928.69', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('736', '1280006', 'camp_ironlake_aetheryte', '135', '', '0', '-278.181', '77.63', '-2260.79', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('737', '1280007', 'cedarwood_aetherytegate', '128', '', '0', '582.47', '54.52', '-1.2', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('738', '1280008', 'widowcliffs_aetherytegate', '128', '', '0', '966', '50', '833', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('739', '1280009', 'morabybay_aetherytegate', '128', '', '0', '318', '25', '581', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('740', '1280010', 'woadwhisper_aetherytegate', '129', '', '0', '-636', '50', '-1287', '0', '0', '0', null); @@ -773,9 +772,9 @@ INSERT INTO `server_spawn_locations` VALUES ('746', '1280016', 'bronzelake_aethe INSERT INTO `server_spawn_locations` VALUES ('747', '1280017', 'oakwood_aetherytegate', '135', '', '0', '-894', '42', '-2188', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('748', '1280018', 'mistbeardcove_aetherytegate', '131', '', '0', '-1694.5', '-19', '-1534', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('749', '1280020', 'cassiopeia_aetherytegate', '132', '', '0', '1343.5', '-54.38', '-870.84', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('750', '1280031', 'uldah_aetheryte', '175', '', '0', '240.45', '185.93', '-9.56', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('750', '1280031', 'uldah_aetheryte', '175', '', '0', '-240.45', '185.93', '-9.56', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('751', '1280032', 'camp_blackbrush_aetheryte', '170', '', '0', '33', '201', '-482', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('752', '1280033', 'camp_drybone_aetheryte', '171', '', '0', '1251', '265', '-545', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('752', '1280033', 'camp_drybone_aetheryte', '171', '', '0', '1250.9', '264', '-544.2', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('753', '1280034', 'camp_horizon_aetheryte', '172', '', '0', '-1315', '57', '-147', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('754', '1280035', 'camp_bluefog_aetheryte', '173', '', '0', '-165', '281', '-1699', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('755', '1280036', 'camp_brokenwater_aetheryte', '174', '', '0', '1686', '297', '995', '0', '0', '0', null); @@ -799,12 +798,12 @@ INSERT INTO `server_spawn_locations` VALUES ('772', '1280057', '', '0', '', '0', INSERT INTO `server_spawn_locations` VALUES ('773', '1280058', '', '0', '', '0', '-1315', '57', '-147', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('774', '1280059', '', '0', '', '0', '-165', '281', '-1699', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('775', '1280061', 'gridania_aetheryte', '206', '', '0', '-130.63', '16.08', '-1323.99', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('776', '1280062', 'camp_bentbranch_aetheryte', '150', '', '0', '287', '5', '-542', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('777', '1280063', 'camp_nineivies_aetheryte', '151', '', '0', '1698', '21', '-865', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('778', '1280064', 'camp_emeraldmoss_aetheryte', '152', '', '0', '-1054', '21', '-1761', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('779', '1280065', 'camp_crimsonbark_aetheryte', '153', '', '0', '-1568', '-11', '-552', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('780', '1280066', 'camp_tranquil_aetheryte', '154', '', '0', '734', '-10', '1127', '0', '0', '0', null); -INSERT INTO `server_spawn_locations` VALUES ('781', '1280067', 'humblehearth_aetherytegate', '150', '', '0', '-93', '5', '-546', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('776', '1280062', 'camp_bentbranch_aetheryte', '150', '', '0', '288', '4', '-543.928', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('777', '1280063', 'camp_nineivies_aetheryte', '151', '', '0', '1702', '20', '-862', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('778', '1280064', 'camp_emeraldmoss_aetheryte', '152', '', '0', '-1052', '20', '-1760', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('779', '1280065', 'camp_crimsonbark_aetheryte', '153', '', '0', '-1566.04', '-11.89', '-550.51', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('780', '1280066', 'camp_tranquil_aetheryte', '154', '', '0', '734', '-12', '1126', '0', '0', '0', null); +INSERT INTO `server_spawn_locations` VALUES ('781', '1280067', 'humblehearth_aetherytegate', '150', '', '0', '-94.07', '4', '-543.16', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('782', '1280068', 'sorrelhaven_aetherytegate', '150', '', '0', '-285', '-21', '-46', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('783', '1280069', 'fivehangs_aetherytegate', '150', '', '0', '636', '17', '-324', '0', '0', '0', null); INSERT INTO `server_spawn_locations` VALUES ('784', '1280070', 'verdantdrop_aetherytegate', '151', '', '0', '1529', '27', '-1147', '0', '0', '0', null);