From 8c00b6159165817fff6f91230be7b83cf363ca74 Mon Sep 17 00:00:00 2001 From: Nireya Date: Sun, 1 Nov 2020 19:58:47 -0500 Subject: [PATCH] Retrace spell and related usable items --- scripts/globals/effects/teleport.lua | 2 + scripts/globals/items/cobra_staff.lua | 16 ++ scripts/globals/items/fourth_staff.lua | 16 ++ scripts/globals/items/ram_staff.lua | 16 ++ .../items/scroll_of_instant_retrace.lua | 22 +++ scripts/globals/spells/retrace.lua | 26 ++++ scripts/globals/teleports.lua | 147 ++++++++++-------- scripts/globals/zone.lua | 8 + sql/item_usable.sql | 6 +- sql/spell_list.sql | 2 +- 10 files changed, 196 insertions(+), 65 deletions(-) create mode 100644 scripts/globals/items/cobra_staff.lua create mode 100644 scripts/globals/items/fourth_staff.lua create mode 100644 scripts/globals/items/ram_staff.lua create mode 100644 scripts/globals/items/scroll_of_instant_retrace.lua create mode 100644 scripts/globals/spells/retrace.lua diff --git a/scripts/globals/effects/teleport.lua b/scripts/globals/effects/teleport.lua index 303c66c09e7..1493950446a 100644 --- a/scripts/globals/effects/teleport.lua +++ b/scripts/globals/effects/teleport.lua @@ -28,6 +28,8 @@ function onEffectLose(target, effect) tpz.teleport.toLeader(target) elseif (destination == tpz.teleport.id.HOME_NATION) then tpz.teleport.toHomeNation(target) + elseif (destination == tpz.teleport.id.RETRACE) then + tpz.teleport.toAlliedNation(target) else tpz.teleport.to(target, destination) end diff --git a/scripts/globals/items/cobra_staff.lua b/scripts/globals/items/cobra_staff.lua new file mode 100644 index 00000000000..2c993fca5d0 --- /dev/null +++ b/scripts/globals/items/cobra_staff.lua @@ -0,0 +1,16 @@ +----------------------------------------- +-- ID: 18614 +-- Cobra Staff +-- Enchantment: "Retrace" (Windurst Waters[S]) +----------------------------------------- +require("scripts/globals/status") +require("scripts/globals/teleports") +----------------------------------------- + +function onItemCheck(target) + return 0 +end + +function onItemUse(target) + target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.WINDURST_WATERS_S, 0, 4) +end diff --git a/scripts/globals/items/fourth_staff.lua b/scripts/globals/items/fourth_staff.lua new file mode 100644 index 00000000000..c0866b04d84 --- /dev/null +++ b/scripts/globals/items/fourth_staff.lua @@ -0,0 +1,16 @@ +----------------------------------------- +-- ID: 18613 +-- Fourth Staff +-- Enchantment: "Retrace" (Bastok Markets[S]) +----------------------------------------- +require("scripts/globals/status") +require("scripts/globals/teleports") +----------------------------------------- + +function onItemCheck(target) + return 0 +end + +function onItemUse(target) + target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.BASTOK_MARKETS_S, 0, 4) +end diff --git a/scripts/globals/items/ram_staff.lua b/scripts/globals/items/ram_staff.lua new file mode 100644 index 00000000000..990b6827b0a --- /dev/null +++ b/scripts/globals/items/ram_staff.lua @@ -0,0 +1,16 @@ +----------------------------------------- +-- ID: 18612 +-- Ram Staff +-- Enchantment: "Retrace" (Southern San d'Oria[S]) +----------------------------------------- +require("scripts/globals/status") +require("scripts/globals/teleports") +----------------------------------------- + +function onItemCheck(target) + return 0 +end + +function onItemUse(target) + target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.SOUTHERN_SAN_DORIA_S, 0, 4) +end diff --git a/scripts/globals/items/scroll_of_instant_retrace.lua b/scripts/globals/items/scroll_of_instant_retrace.lua new file mode 100644 index 00000000000..76eb0ba4756 --- /dev/null +++ b/scripts/globals/items/scroll_of_instant_retrace.lua @@ -0,0 +1,22 @@ +----------------------------------------- +-- ID: 5428 +-- Scroll of Instant Retrace +-- Transports the user to their Allied Nation. +----------------------------------------- +require("scripts/globals/teleports") +require("scripts/globals/status") +----------------------------------------- + +function onItemCheck(target) + if not (target:getCampaignAllegiance() > 0) then + return 56 + else + return 0 + end +end + +function onItemUse(target) + if (target:getCampaignAllegiance() > 0) then + target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.RETRACE, 0, 2) + end +end diff --git a/scripts/globals/spells/retrace.lua b/scripts/globals/spells/retrace.lua new file mode 100644 index 00000000000..54c4e7612fe --- /dev/null +++ b/scripts/globals/spells/retrace.lua @@ -0,0 +1,26 @@ +----------------------------------------- +-- Spell: Retrace +-- Transports player to their Allied Nation. Can cast on allies. +----------------------------------------- +require("scripts/globals/teleports") +require("scripts/globals/status") +require("scripts/globals/msg") +----------------------------------------- + +function onMagicCastingCheck(caster, target, spell) + if not (target:getCampaignAllegiance() > 0) then + return 48 + else + return 0 + end +end + +function onSpellCast(caster, target, spell) + if (target:getCampaignAllegiance() > 0) then + target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.RETRACE, 0, 4) + spell:setMsg(tpz.msg.basic.MAGIC_TELEPORT) + else + spell:setMsg(tpz.msg.basic.NONE) + end + return 0 +end diff --git a/scripts/globals/teleports.lua b/scripts/globals/teleports.lua index 35a9ab37009..ac569756c7b 100644 --- a/scripts/globals/teleports.lua +++ b/scripts/globals/teleports.lua @@ -12,65 +12,69 @@ tpz.teleport = tpz.teleport or {} ----------------------------------- local ids = { - DEM = 1, - HOLLA = 2, - YHOAT = 3, - VAHZL = 4, - MEA = 5, - ALTEP = 6, - WARP = 7, - ESCAPE = 8, - JUGNER = 9, - PASHH = 10, - MERIPH = 11, - AZOUPH = 12, - BHAFLAU = 13, - ZHAYOLM = 14, - DVUCCA = 15, - REEF = 16, - ALZADAAL = 17, - CUTTER = 18, - Z_REM = 19, - A_REM = 20, - B_REM = 21, - S_REM = 22, - MAAT = 23, - OUTPOST = 24, - LEADER = 25, - EXITPROMMEA = 26, - EXITPROMHOLLA = 27, - EXITPROMDEM = 28, - LUFAISE = 29, - CHOCO_WINDURST = 30, - CHOCO_SANDORIA = 31, - CHOCO_BASTOK = 32, - DUCALGUARD = 33, - PURGONORGO = 34, - AZOUPH_SP = 35, - DVUCCA_SP = 36, - MAMOOL_SP = 37, - HALVUNG_SP = 38, - ILRUSI_SP = 39, - NYZUL_SP = 40, - SKY = 41, - CLOISTER_OF_FLAMES = 42, - CLOISTER_OF_FROST = 43, - CLOISTER_OF_GALES = 44, - CLOISTER_OF_STORMS = 45, - CLOISTER_OF_TIDES = 46, - CLOISTER_OF_TREMORS = 47, - GHELSBA_HUT = 48, - WAJAOM_LEYPOINT = 49, - VALKURM_VORTEX = 50, - QUFIM_VORTEX = 51, - LUFAISE_VORTEX = 52, - MISAREAUX_VORTEX = 53, - MINESHAFT = 54, - WHITEGATE = 55, - SEA = 56, - HOME_NATION = 57, - CHOCO_UPPER_JEUNO = 58, - ZVAHL_KEEP = 59 + DEM = 1, + HOLLA = 2, + YHOAT = 3, + VAHZL = 4, + MEA = 5, + ALTEP = 6, + WARP = 7, + ESCAPE = 8, + JUGNER = 9, + PASHH = 10, + MERIPH = 11, + AZOUPH = 12, + BHAFLAU = 13, + ZHAYOLM = 14, + DVUCCA = 15, + REEF = 16, + ALZADAAL = 17, + CUTTER = 18, + Z_REM = 19, + A_REM = 20, + B_REM = 21, + S_REM = 22, + MAAT = 23, + OUTPOST = 24, + LEADER = 25, + EXITPROMMEA = 26, + EXITPROMHOLLA = 27, + EXITPROMDEM = 28, + LUFAISE = 29, + CHOCO_WINDURST = 30, + CHOCO_SANDORIA = 31, + CHOCO_BASTOK = 32, + DUCALGUARD = 33, + PURGONORGO = 34, + AZOUPH_SP = 35, + DVUCCA_SP = 36, + MAMOOL_SP = 37, + HALVUNG_SP = 38, + ILRUSI_SP = 39, + NYZUL_SP = 40, + SKY = 41, + CLOISTER_OF_FLAMES = 42, + CLOISTER_OF_FROST = 43, + CLOISTER_OF_GALES = 44, + CLOISTER_OF_STORMS = 45, + CLOISTER_OF_TIDES = 46, + CLOISTER_OF_TREMORS = 47, + GHELSBA_HUT = 48, + WAJAOM_LEYPOINT = 49, + VALKURM_VORTEX = 50, + QUFIM_VORTEX = 51, + LUFAISE_VORTEX = 52, + MISAREAUX_VORTEX = 53, + MINESHAFT = 54, + WHITEGATE = 55, + SEA = 56, + HOME_NATION = 57, + CHOCO_UPPER_JEUNO = 58, + ZVAHL_KEEP = 59, + RETRACE = 60, + SOUTHERN_SAN_DORIA_S = 61, + BASTOK_MARKETS_S = 62, + WINDURST_WATERS_S = 63 } tpz.teleport.id = ids @@ -95,7 +99,7 @@ local destinations = [ids.DVUCCA] = {-252.715, -7.666, -30.640, 128, 79}, -- {R} [ids.REEF] = { 9.304, -7.376, 620.133, 0, 54}, -- {R} [ids.ALZADAAL] = { 180.000, 0.000, 20.000, 0, 72}, -- {R} - [ids.CUTTER] = {-456.000, -3.000, -405.000, -405, 54}, + [ids.CUTTER] = {-456.000, -3.000, -405.000, -405, 54}, [ids.A_REM] = {-579.000, -0.050, -100.000, 192, 72}, [ids.B_REM] = { 620.000, 0.000, -260.640, 72, 72}, -- {R} [ids.S_REM] = { 580.000, 0.000, 500.000, 192, 72}, -- {R} @@ -133,7 +137,10 @@ local destinations = [ids.MINESHAFT] = { -93.657, -120.000, -583.561, 0, 13}, -- (R) [ids.WHITEGATE] = { 27.424, -6.000, -123.792, 192, 50}, -- {R} [ids.SEA] = { -31.800, 0.000, -618.700, 190, 33}, -- {R} - [ids.ZVAHL_KEEP] = {-555.996, -70.100, 59.989, 0, 162} + [ids.ZVAHL_KEEP] = {-555.996, -70.100, 59.989, 0, 162}, + [ids.SOUTHERN_SAN_DORIA_S] = { -98.000, 1.000, -41.000, 224, 80}, + [ids.BASTOK_MARKETS_S] = {-291.000, -10.000, -107.000, 212, 87}, + [ids.WINDURST_WATERS_S] = { -31.442, -5.000, 129.202, 128, 94} } tpz.teleport.type = @@ -271,6 +278,24 @@ tpz.teleport.toHomeNation = function(player) end end +----------------------------------- +-- TELEPORT TO ALLIED NATION +----------------------------------- + +tpz.teleport.toAlliedNation = function(player) + local Allegiance = player:getCampaignAllegiance() + local sandoriaPos = destinations[ids.SOUTHERN_SAN_DORIA_S] + local bastokPos = destinations[ids.BASTOK_MARKETS_S] + local windurstPos = destinations[ids.WINDURST_WATERS_S] + if Allegiance == tpz.alliedNation.SANDORIA then + player:setPos(unpack(sandoriaPos)) + elseif Allegiance == tpz.alliedNation.BASTOK then + player:setPos(unpack(bastokPos)) + elseif Allegiance == tpz.alliedNation.WINDURST then + player:setPos(unpack(windurstPos)) + end +end + ----------------------------------- -- TELEPORT TO CHAMBER OF PASSAGE ----------------------------------- diff --git a/scripts/globals/zone.lua b/scripts/globals/zone.lua index e5d5038f878..b0e4ea01968 100644 --- a/scripts/globals/zone.lua +++ b/scripts/globals/zone.lua @@ -88,6 +88,14 @@ tpz.nation = OTHER = 4, } +tpz.alliedNation = +{ + NONE = 0, + SANDORIA = 1, + BASTOK = 2, + WINDURST = 3, +} + tpz.zone = { UNKNOWN = 0, diff --git a/sql/item_usable.sql b/sql/item_usable.sql index 45a6c2d2430..6c03fc17ecb 100644 --- a/sql/item_usable.sql +++ b/sql/item_usable.sql @@ -2236,9 +2236,9 @@ INSERT INTO `item_usable` VALUES (18551,'twilight_scythe',1,1,0,0,1,10,600,0); INSERT INTO `item_usable` VALUES (18581,'carbuncles_pole',1,1,0,0,30,30,600,0); INSERT INTO `item_usable` VALUES (18586,'flexible_pole',1,3,0,0,50,30,1800,0); INSERT INTO `item_usable` VALUES (18591,'pastoral_staff',1,3,0,0,100,30,600,0); -INSERT INTO `item_usable` VALUES (18612,'ram_staff',1,2,0,0,1,30,86400,0); -INSERT INTO `item_usable` VALUES (18613,'fourth_staff',1,2,0,0,1,30,86400,0); -INSERT INTO `item_usable` VALUES (18614,'cobra_staff',1,2,0,0,1,30,86400,0); +INSERT INTO `item_usable` VALUES (18612,'ram_staff',1,8,79,0,1,30,86400,0); +INSERT INTO `item_usable` VALUES (18613,'fourth_staff',1,8,79,0,1,30,86400,0); +INSERT INTO `item_usable` VALUES (18614,'cobra_staff',1,8,79,0,1,30,86400,0); INSERT INTO `item_usable` VALUES (18679,'soulgauger_sgr-1',20,0,0,0,12,10,30,0); INSERT INTO `item_usable` VALUES (18692,'mamoolbane',1,3,0,0,15,30,86400,0); INSERT INTO `item_usable` VALUES (18693,'lamiabane',1,3,0,0,15,30,3600,0); diff --git a/sql/spell_list.sql b/sql/spell_list.sql index 58d0597eaf1..326a527be00 100644 --- a/sql/spell_list.sql +++ b/sql/spell_list.sql @@ -297,7 +297,7 @@ INSERT INTO `spell_list` VALUES (237,'choke',0x000000140000000000000000000000000 INSERT INTO `spell_list` VALUES (238,'rasp',0x00000012000000000000000000000000000000000000,2,65,2,0,4,36,25,2500,10000,2,252,238,2000,0,0,1.00,1,165,0,204,NULL); INSERT INTO `spell_list` VALUES (239,'shock',0x00000010000000000000000000000000000000000000,2,65,6,0,4,36,25,2500,10000,2,252,239,2000,0,0,1.00,1,165,0,204,NULL); INSERT INTO `spell_list` VALUES (240,'drown',0x0000001B000000000000000000000000000000000000,2,65,3,0,4,36,25,2500,10000,2,252,240,2000,0,0,1.00,1,165,0,204,NULL); -INSERT INTO `spell_list` VALUES (241,'retrace',0x00000037000000000000000000000000000000000000,2,0,8,0,3,34,150,8000,10000,0,0,284,2000,0,0,1.00,1,165,0,204,'WOTG'); +INSERT INTO `spell_list` VALUES (241,'retrace',0x00000037000000000000000000000000000000000000,2,73,8,0,3,34,150,5000,10000,0,0,284,2000,0,0,1.00,1,165,0,204,'WOTG'); INSERT INTO `spell_list` VALUES (242,'absorb-acc',0x000000000000003D0000000000000000000000000000,2,66,8,0,4,37,33,2000,60000,0,0,285,2000,3,0,1.00,1,640,0,204,'WOTG'); INSERT INTO `spell_list` VALUES (244,'meteor_ii',0x00000000000000000000000000000000000000000000,2,61,8,0,4,37,666,5000,10000,0,0,280,2000,0,0,1.00,0,0,0,204,NULL); INSERT INTO `spell_list` VALUES (245,'drain',0x0000000C0000000A0000000000000000000000150000,2,67,8,0,4,37,21,3000,60000,227,274,245,2000,3,0,1.00,0,0,0,204,NULL);