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

Commit fd61f02

Browse files
authored
Merge pull request #1465 from Nireya/retrace-and-usables
Implements the Retrace spell and related usable items
2 parents 9ca0c84 + 8c00b61 commit fd61f02

File tree

10 files changed

+196
-65
lines changed

10 files changed

+196
-65
lines changed

scripts/globals/effects/teleport.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ function onEffectLose(target, effect)
2828
tpz.teleport.toLeader(target)
2929
elseif (destination == tpz.teleport.id.HOME_NATION) then
3030
tpz.teleport.toHomeNation(target)
31+
elseif (destination == tpz.teleport.id.RETRACE) then
32+
tpz.teleport.toAlliedNation(target)
3133
else
3234
tpz.teleport.to(target, destination)
3335
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-----------------------------------------
2+
-- ID: 18614
3+
-- Cobra Staff
4+
-- Enchantment: "Retrace" (Windurst Waters[S])
5+
-----------------------------------------
6+
require("scripts/globals/status")
7+
require("scripts/globals/teleports")
8+
-----------------------------------------
9+
10+
function onItemCheck(target)
11+
return 0
12+
end
13+
14+
function onItemUse(target)
15+
target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.WINDURST_WATERS_S, 0, 4)
16+
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-----------------------------------------
2+
-- ID: 18613
3+
-- Fourth Staff
4+
-- Enchantment: "Retrace" (Bastok Markets[S])
5+
-----------------------------------------
6+
require("scripts/globals/status")
7+
require("scripts/globals/teleports")
8+
-----------------------------------------
9+
10+
function onItemCheck(target)
11+
return 0
12+
end
13+
14+
function onItemUse(target)
15+
target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.BASTOK_MARKETS_S, 0, 4)
16+
end
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
-----------------------------------------
2+
-- ID: 18612
3+
-- Ram Staff
4+
-- Enchantment: "Retrace" (Southern San d'Oria[S])
5+
-----------------------------------------
6+
require("scripts/globals/status")
7+
require("scripts/globals/teleports")
8+
-----------------------------------------
9+
10+
function onItemCheck(target)
11+
return 0
12+
end
13+
14+
function onItemUse(target)
15+
target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.SOUTHERN_SAN_DORIA_S, 0, 4)
16+
end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-----------------------------------------
2+
-- ID: 5428
3+
-- Scroll of Instant Retrace
4+
-- Transports the user to their Allied Nation.
5+
-----------------------------------------
6+
require("scripts/globals/teleports")
7+
require("scripts/globals/status")
8+
-----------------------------------------
9+
10+
function onItemCheck(target)
11+
if not (target:getCampaignAllegiance() > 0) then
12+
return 56
13+
else
14+
return 0
15+
end
16+
end
17+
18+
function onItemUse(target)
19+
if (target:getCampaignAllegiance() > 0) then
20+
target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.RETRACE, 0, 2)
21+
end
22+
end

scripts/globals/spells/retrace.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-----------------------------------------
2+
-- Spell: Retrace
3+
-- Transports player to their Allied Nation. Can cast on allies.
4+
-----------------------------------------
5+
require("scripts/globals/teleports")
6+
require("scripts/globals/status")
7+
require("scripts/globals/msg")
8+
-----------------------------------------
9+
10+
function onMagicCastingCheck(caster, target, spell)
11+
if not (target:getCampaignAllegiance() > 0) then
12+
return 48
13+
else
14+
return 0
15+
end
16+
end
17+
18+
function onSpellCast(caster, target, spell)
19+
if (target:getCampaignAllegiance() > 0) then
20+
target:addStatusEffectEx(tpz.effect.TELEPORT, 0, tpz.teleport.id.RETRACE, 0, 4)
21+
spell:setMsg(tpz.msg.basic.MAGIC_TELEPORT)
22+
else
23+
spell:setMsg(tpz.msg.basic.NONE)
24+
end
25+
return 0
26+
end

scripts/globals/teleports.lua

Lines changed: 86 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,69 @@ tpz.teleport = tpz.teleport or {}
1212
-----------------------------------
1313
local ids =
1414
{
15-
DEM = 1,
16-
HOLLA = 2,
17-
YHOAT = 3,
18-
VAHZL = 4,
19-
MEA = 5,
20-
ALTEP = 6,
21-
WARP = 7,
22-
ESCAPE = 8,
23-
JUGNER = 9,
24-
PASHH = 10,
25-
MERIPH = 11,
26-
AZOUPH = 12,
27-
BHAFLAU = 13,
28-
ZHAYOLM = 14,
29-
DVUCCA = 15,
30-
REEF = 16,
31-
ALZADAAL = 17,
32-
CUTTER = 18,
33-
Z_REM = 19,
34-
A_REM = 20,
35-
B_REM = 21,
36-
S_REM = 22,
37-
MAAT = 23,
38-
OUTPOST = 24,
39-
LEADER = 25,
40-
EXITPROMMEA = 26,
41-
EXITPROMHOLLA = 27,
42-
EXITPROMDEM = 28,
43-
LUFAISE = 29,
44-
CHOCO_WINDURST = 30,
45-
CHOCO_SANDORIA = 31,
46-
CHOCO_BASTOK = 32,
47-
DUCALGUARD = 33,
48-
PURGONORGO = 34,
49-
AZOUPH_SP = 35,
50-
DVUCCA_SP = 36,
51-
MAMOOL_SP = 37,
52-
HALVUNG_SP = 38,
53-
ILRUSI_SP = 39,
54-
NYZUL_SP = 40,
55-
SKY = 41,
56-
CLOISTER_OF_FLAMES = 42,
57-
CLOISTER_OF_FROST = 43,
58-
CLOISTER_OF_GALES = 44,
59-
CLOISTER_OF_STORMS = 45,
60-
CLOISTER_OF_TIDES = 46,
61-
CLOISTER_OF_TREMORS = 47,
62-
GHELSBA_HUT = 48,
63-
WAJAOM_LEYPOINT = 49,
64-
VALKURM_VORTEX = 50,
65-
QUFIM_VORTEX = 51,
66-
LUFAISE_VORTEX = 52,
67-
MISAREAUX_VORTEX = 53,
68-
MINESHAFT = 54,
69-
WHITEGATE = 55,
70-
SEA = 56,
71-
HOME_NATION = 57,
72-
CHOCO_UPPER_JEUNO = 58,
73-
ZVAHL_KEEP = 59
15+
DEM = 1,
16+
HOLLA = 2,
17+
YHOAT = 3,
18+
VAHZL = 4,
19+
MEA = 5,
20+
ALTEP = 6,
21+
WARP = 7,
22+
ESCAPE = 8,
23+
JUGNER = 9,
24+
PASHH = 10,
25+
MERIPH = 11,
26+
AZOUPH = 12,
27+
BHAFLAU = 13,
28+
ZHAYOLM = 14,
29+
DVUCCA = 15,
30+
REEF = 16,
31+
ALZADAAL = 17,
32+
CUTTER = 18,
33+
Z_REM = 19,
34+
A_REM = 20,
35+
B_REM = 21,
36+
S_REM = 22,
37+
MAAT = 23,
38+
OUTPOST = 24,
39+
LEADER = 25,
40+
EXITPROMMEA = 26,
41+
EXITPROMHOLLA = 27,
42+
EXITPROMDEM = 28,
43+
LUFAISE = 29,
44+
CHOCO_WINDURST = 30,
45+
CHOCO_SANDORIA = 31,
46+
CHOCO_BASTOK = 32,
47+
DUCALGUARD = 33,
48+
PURGONORGO = 34,
49+
AZOUPH_SP = 35,
50+
DVUCCA_SP = 36,
51+
MAMOOL_SP = 37,
52+
HALVUNG_SP = 38,
53+
ILRUSI_SP = 39,
54+
NYZUL_SP = 40,
55+
SKY = 41,
56+
CLOISTER_OF_FLAMES = 42,
57+
CLOISTER_OF_FROST = 43,
58+
CLOISTER_OF_GALES = 44,
59+
CLOISTER_OF_STORMS = 45,
60+
CLOISTER_OF_TIDES = 46,
61+
CLOISTER_OF_TREMORS = 47,
62+
GHELSBA_HUT = 48,
63+
WAJAOM_LEYPOINT = 49,
64+
VALKURM_VORTEX = 50,
65+
QUFIM_VORTEX = 51,
66+
LUFAISE_VORTEX = 52,
67+
MISAREAUX_VORTEX = 53,
68+
MINESHAFT = 54,
69+
WHITEGATE = 55,
70+
SEA = 56,
71+
HOME_NATION = 57,
72+
CHOCO_UPPER_JEUNO = 58,
73+
ZVAHL_KEEP = 59,
74+
RETRACE = 60,
75+
SOUTHERN_SAN_DORIA_S = 61,
76+
BASTOK_MARKETS_S = 62,
77+
WINDURST_WATERS_S = 63
7478
}
7579
tpz.teleport.id = ids
7680

@@ -95,7 +99,7 @@ local destinations =
9599
[ids.DVUCCA] = {-252.715, -7.666, -30.640, 128, 79}, -- {R}
96100
[ids.REEF] = { 9.304, -7.376, 620.133, 0, 54}, -- {R}
97101
[ids.ALZADAAL] = { 180.000, 0.000, 20.000, 0, 72}, -- {R}
98-
[ids.CUTTER] = {-456.000, -3.000, -405.000, -405, 54},
102+
[ids.CUTTER] = {-456.000, -3.000, -405.000, -405, 54},
99103
[ids.A_REM] = {-579.000, -0.050, -100.000, 192, 72},
100104
[ids.B_REM] = { 620.000, 0.000, -260.640, 72, 72}, -- {R}
101105
[ids.S_REM] = { 580.000, 0.000, 500.000, 192, 72}, -- {R}
@@ -133,7 +137,10 @@ local destinations =
133137
[ids.MINESHAFT] = { -93.657, -120.000, -583.561, 0, 13}, -- (R)
134138
[ids.WHITEGATE] = { 27.424, -6.000, -123.792, 192, 50}, -- {R}
135139
[ids.SEA] = { -31.800, 0.000, -618.700, 190, 33}, -- {R}
136-
[ids.ZVAHL_KEEP] = {-555.996, -70.100, 59.989, 0, 162}
140+
[ids.ZVAHL_KEEP] = {-555.996, -70.100, 59.989, 0, 162},
141+
[ids.SOUTHERN_SAN_DORIA_S] = { -98.000, 1.000, -41.000, 224, 80},
142+
[ids.BASTOK_MARKETS_S] = {-291.000, -10.000, -107.000, 212, 87},
143+
[ids.WINDURST_WATERS_S] = { -31.442, -5.000, 129.202, 128, 94}
137144
}
138145

139146
tpz.teleport.type =
@@ -271,6 +278,24 @@ tpz.teleport.toHomeNation = function(player)
271278
end
272279
end
273280

281+
-----------------------------------
282+
-- TELEPORT TO ALLIED NATION
283+
-----------------------------------
284+
285+
tpz.teleport.toAlliedNation = function(player)
286+
local Allegiance = player:getCampaignAllegiance()
287+
local sandoriaPos = destinations[ids.SOUTHERN_SAN_DORIA_S]
288+
local bastokPos = destinations[ids.BASTOK_MARKETS_S]
289+
local windurstPos = destinations[ids.WINDURST_WATERS_S]
290+
if Allegiance == tpz.alliedNation.SANDORIA then
291+
player:setPos(unpack(sandoriaPos))
292+
elseif Allegiance == tpz.alliedNation.BASTOK then
293+
player:setPos(unpack(bastokPos))
294+
elseif Allegiance == tpz.alliedNation.WINDURST then
295+
player:setPos(unpack(windurstPos))
296+
end
297+
end
298+
274299
-----------------------------------
275300
-- TELEPORT TO CHAMBER OF PASSAGE
276301
-----------------------------------

scripts/globals/zone.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ tpz.nation =
8888
OTHER = 4,
8989
}
9090

91+
tpz.alliedNation =
92+
{
93+
NONE = 0,
94+
SANDORIA = 1,
95+
BASTOK = 2,
96+
WINDURST = 3,
97+
}
98+
9199
tpz.zone =
92100
{
93101
UNKNOWN = 0,

sql/item_usable.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,9 +2236,9 @@ INSERT INTO `item_usable` VALUES (18551,'twilight_scythe',1,1,0,0,1,10,600,0);
22362236
INSERT INTO `item_usable` VALUES (18581,'carbuncles_pole',1,1,0,0,30,30,600,0);
22372237
INSERT INTO `item_usable` VALUES (18586,'flexible_pole',1,3,0,0,50,30,1800,0);
22382238
INSERT INTO `item_usable` VALUES (18591,'pastoral_staff',1,3,0,0,100,30,600,0);
2239-
INSERT INTO `item_usable` VALUES (18612,'ram_staff',1,2,0,0,1,30,86400,0);
2240-
INSERT INTO `item_usable` VALUES (18613,'fourth_staff',1,2,0,0,1,30,86400,0);
2241-
INSERT INTO `item_usable` VALUES (18614,'cobra_staff',1,2,0,0,1,30,86400,0);
2239+
INSERT INTO `item_usable` VALUES (18612,'ram_staff',1,8,79,0,1,30,86400,0);
2240+
INSERT INTO `item_usable` VALUES (18613,'fourth_staff',1,8,79,0,1,30,86400,0);
2241+
INSERT INTO `item_usable` VALUES (18614,'cobra_staff',1,8,79,0,1,30,86400,0);
22422242
INSERT INTO `item_usable` VALUES (18679,'soulgauger_sgr-1',20,0,0,0,12,10,30,0);
22432243
INSERT INTO `item_usable` VALUES (18692,'mamoolbane',1,3,0,0,15,30,86400,0);
22442244
INSERT INTO `item_usable` VALUES (18693,'lamiabane',1,3,0,0,15,30,3600,0);

sql/spell_list.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ INSERT INTO `spell_list` VALUES (237,'choke',0x000000140000000000000000000000000
297297
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);
298298
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);
299299
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);
300-
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');
300+
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');
301301
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');
302302
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);
303303
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);

0 commit comments

Comments
 (0)