Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1465 from Nireya/retrace-and-usables
Browse files Browse the repository at this point in the history
Implements the Retrace spell and related usable items
  • Loading branch information
zach2good authored Nov 6, 2020
2 parents 9ca0c84 + 8c00b61 commit fd61f02
Show file tree
Hide file tree
Showing 10 changed files with 196 additions and 65 deletions.
2 changes: 2 additions & 0 deletions scripts/globals/effects/teleport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions scripts/globals/items/cobra_staff.lua
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions scripts/globals/items/fourth_staff.lua
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions scripts/globals/items/ram_staff.lua
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions scripts/globals/items/scroll_of_instant_retrace.lua
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions scripts/globals/spells/retrace.lua
Original file line number Diff line number Diff line change
@@ -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
147 changes: 86 additions & 61 deletions scripts/globals/teleports.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
-----------------------------------
Expand Down
8 changes: 8 additions & 0 deletions scripts/globals/zone.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ tpz.nation =
OTHER = 4,
}

tpz.alliedNation =
{
NONE = 0,
SANDORIA = 1,
BASTOK = 2,
WINDURST = 3,
}

tpz.zone =
{
UNKNOWN = 0,
Expand Down
6 changes: 3 additions & 3 deletions sql/item_usable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion sql/spell_list.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit fd61f02

Please sign in to comment.