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

Commit fbfeb60

Browse files
authored
Merge pull request #799 from tankfest/thf-af2
Fix climbpix spawn conditions and THF AF2 script.
2 parents 7ea54ac + 4954d5b commit fbfeb60

File tree

11 files changed

+73
-143
lines changed

11 files changed

+73
-143
lines changed

scripts/zones/Sauromugue_Champaign/IDs.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ zones[tpz.zone.SAUROMUGUE_CHAMPAIGN] =
5353
npc =
5454
{
5555
CASKET_BASE = 17269190,
56+
QM2 = 17269228,
5657
},
5758
}
5859

scripts/zones/Sauromugue_Champaign/Zone.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ end
1818
function onInitialize(zone)
1919
UpdateNMSpawnPoint(ID.mob.ROC)
2020
GetMobByID(ID.mob.ROC):setRespawnTime(math.random(900, 10800))
21+
GetNPCByID(ID.npc.QM2 + math.random(0, 5)):setLocalVar("[QM]Select", 1) -- Determine which QM is active today for THF AF2
2122
end
2223

2324
function onZoneIn( player, prevZone)
@@ -43,6 +44,13 @@ end
4344
function onRegionEnter(player, region)
4445
end
4546

47+
function onGameDay(zone)
48+
for i = ID.npc.QM2, ID.npc.QM2+5 do
49+
GetNPCByID(i):resetLocalVars()
50+
end
51+
GetNPCByID(ID.npc.QM2 + math.random(0, 5)):setLocalVar("[QM]Select", 1) -- Determine which QM is active today for THF AF2
52+
end
53+
4654
function onEventUpdate(player, csid, option)
4755
if csid == 3 then
4856
lightCutsceneUpdate(player) -- Quest: I Can Hear A Rainbow

scripts/zones/Sauromugue_Champaign/npcs/qm2.lua

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ local function isNaked(player)
1919
end
2020

2121
function onTrade(player, npc, trade)
22-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
23-
24-
if grapplingCS >= 2 and grapplingCS <= 7 and npcUtil.tradeHas(trade, 17474) then
22+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED and not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) and npcUtil.tradeHas(trade, 17474) then
2523
if isNaked(player) then
2624
player:startEvent(2) -- complete grappling part of the quest
2725
else
@@ -31,35 +29,25 @@ function onTrade(player, npc, trade)
3129
end
3230

3331
function onTrigger(player, npc)
34-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
35-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
36-
37-
if thickAsThieves == QUEST_ACCEPTED then
38-
if grapplingCS == 2 then
39-
local gob = GetMobByID(ID.mob.CLIMBPIX_HIGHRISE)
40-
41-
if not gob:isSpawned() then
32+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
33+
if not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) then
34+
if npc:getLocalVar("[QM]Select") == 1 and npcUtil.popFromQM(player, npc, ID.mob.CLIMBPIX_HIGHRISE, {radius = 1, hide = 0}) then
4235
player:messageSpecial(ID.text.THF_AF_MOB)
43-
gob:setSpawn(193, 32, 211)
44-
SpawnMob(ID.mob.CLIMBPIX_HIGHRISE):updateClaim(player)
4536
end
46-
elseif grapplingCS >= 0 or grapplingCS <= 7 then
4737
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET) -- It is impossible to climb this wall with your bare hands.
48-
elseif grapplingCS == 8 then
38+
else
4939
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 1) -- There is no longer any need to climb the tower.
5040
end
5141
else
5242
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
5343
end
54-
5544
end
5645

5746
function onEventUpdate(player, csid, option)
5847
end
5948

6049
function onEventFinish(player, csid, option)
6150
if csid == 2 then
62-
player:setCharVar("thickAsThievesGrapplingCS", 8)
6351
player:delKeyItem(tpz.ki.FIRST_FORGED_ENVELOPE)
6452
npcUtil.giveKeyItem(player, tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE)
6553
player:confirmTrade()

scripts/zones/Sauromugue_Champaign/npcs/qm3.lua

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,20 @@ require("scripts/globals/quests")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
14-
15-
if grapplingCS >= 2 and grapplingCS <= 7 and npcUtil.tradeHas(trade, 17474) then
13+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 17474) then
1614
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 3, 0, 17474) -- You cannot get a decent grip on the wall using the [Grapnel].
1715
end
1816
end
1917

2018
function onTrigger(player, npc)
21-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
22-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
23-
24-
if thickAsThieves == QUEST_ACCEPTED then
25-
if grapplingCS == 3 then
26-
local gob = GetMobByID(ID.mob.CLIMBPIX_HIGHRISE)
27-
28-
if not gob:isSpawned() then
19+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
20+
if not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) then
21+
if npc:getLocalVar("[QM]Select") == 1 and npcUtil.popFromQM(player, npc, ID.mob.CLIMBPIX_HIGHRISE, {radius = 1, hide = 0}) then
2922
player:messageSpecial(ID.text.THF_AF_MOB)
30-
gob:setSpawn(414, 16, -131)
31-
SpawnMob(ID.mob.CLIMBPIX_HIGHRISE):updateClaim(player)
3223
end
33-
elseif grapplingCS >= 0 or grapplingCS <= 7 then
34-
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET)
24+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET) -- It is impossible to climb this wall with your bare hands.
25+
else
26+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 1) -- There is no longer any need to climb the tower.
3527
end
3628
else
3729
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)

scripts/zones/Sauromugue_Champaign/npcs/qm4.lua

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,20 @@ require("scripts/globals/quests")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
14-
15-
if grapplingCS >= 2 and grapplingCS <= 7 and npcUtil.tradeHas(trade, 17474) then
13+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 17474) then
1614
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 3, 0, 17474) -- You cannot get a decent grip on the wall using the [Grapnel].
1715
end
1816
end
1917

2018
function onTrigger(player, npc)
21-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
22-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
23-
24-
if thickAsThieves == QUEST_ACCEPTED then
25-
if grapplingCS == 4 then
26-
local gob = GetMobByID(ID.mob.CLIMBPIX_HIGHRISE)
27-
28-
if not gob:isSpawned() then
19+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
20+
if not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) then
21+
if npc:getLocalVar("[QM]Select") == 1 and npcUtil.popFromQM(player, npc, ID.mob.CLIMBPIX_HIGHRISE, {radius = 1, hide = 0}) then
2922
player:messageSpecial(ID.text.THF_AF_MOB)
30-
gob:setSpawn(122, 0, -230)
31-
SpawnMob(ID.mob.CLIMBPIX_HIGHRISE):updateClaim(player)
3223
end
33-
elseif grapplingCS >= 0 or grapplingCS <= 7 then
34-
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET)
24+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET) -- It is impossible to climb this wall with your bare hands.
25+
else
26+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 1) -- There is no longer any need to climb the tower.
3527
end
3628
else
3729
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)

scripts/zones/Sauromugue_Champaign/npcs/qm5.lua

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,20 @@ require("scripts/globals/quests")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
14-
15-
if grapplingCS >= 2 and grapplingCS <= 7 and npcUtil.tradeHas(trade, 17474) then
13+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 17474) then
1614
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 3, 0, 17474) -- You cannot get a decent grip on the wall using the [Grapnel].
1715
end
1816
end
1917

2018
function onTrigger(player, npc)
21-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
22-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
23-
24-
if thickAsThieves == QUEST_ACCEPTED then
25-
if grapplingCS == 5 then
26-
local gob = GetMobByID(ID.mob.CLIMBPIX_HIGHRISE)
27-
28-
if not gob:isSpawned() then
19+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
20+
if not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) then
21+
if npc:getLocalVar("[QM]Select") == 1 and npcUtil.popFromQM(player, npc, ID.mob.CLIMBPIX_HIGHRISE, {radius = 1, hide = 0}) then
2922
player:messageSpecial(ID.text.THF_AF_MOB)
30-
gob:setSpawn(-114, 16, 51)
31-
SpawnMob(ID.mob.CLIMBPIX_HIGHRISE):updateClaim(player)
3223
end
33-
elseif grapplingCS >= 0 or grapplingCS <= 7 then
34-
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET)
24+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET) -- It is impossible to climb this wall with your bare hands.
25+
else
26+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 1) -- There is no longer any need to climb the tower.
3527
end
3628
else
3729
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)

scripts/zones/Sauromugue_Champaign/npcs/qm6.lua

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,20 @@ require("scripts/globals/quests")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
14-
15-
if grapplingCS >= 2 and grapplingCS <= 7 and npcUtil.tradeHas(trade, 17474) then
13+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 17474) then
1614
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 3, 0, 17474) -- You cannot get a decent grip on the wall using the [Grapnel].
1715
end
1816
end
1917

2018
function onTrigger(player, npc)
21-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
22-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
23-
24-
if thickAsThieves == QUEST_ACCEPTED then
25-
if grapplingCS == 6 then
26-
local gob = GetMobByID(ID.mob.CLIMBPIX_HIGHRISE)
27-
28-
if not gob:isSpawned() then
19+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
20+
if not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) then
21+
if npc:getLocalVar("[QM]Select") == 1 and npcUtil.popFromQM(player, npc, ID.mob.CLIMBPIX_HIGHRISE, {radius = 1, hide = 0}) then
2922
player:messageSpecial(ID.text.THF_AF_MOB)
30-
gob:setSpawn(371, 24, 8)
31-
SpawnMob(ID.mob.CLIMBPIX_HIGHRISE):updateClaim(player)
3223
end
33-
elseif grapplingCS >= 0 or grapplingCS <= 7 then
34-
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET)
24+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET) -- It is impossible to climb this wall with your bare hands.
25+
else
26+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 1) -- There is no longer any need to climb the tower.
3527
end
3628
else
3729
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)

scripts/zones/Sauromugue_Champaign/npcs/qm7.lua

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,20 @@ require("scripts/globals/quests")
1010
-----------------------------------
1111

1212
function onTrade(player, npc, trade)
13-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
14-
15-
if grapplingCS >= 2 and grapplingCS <= 7 and npcUtil.tradeHas(trade, 17474) then
13+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED and npcUtil.tradeHas(trade, 17474) then
1614
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 3, 0, 17474) -- You cannot get a decent grip on the wall using the [Grapnel].
1715
end
1816
end
1917

2018
function onTrigger(player, npc)
21-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
22-
local grapplingCS = player:getCharVar("thickAsThievesGrapplingCS")
23-
24-
if thickAsThieves == QUEST_ACCEPTED then
25-
if grapplingCS == 7 then
26-
local gob = GetMobByID(ID.mob.CLIMBPIX_HIGHRISE)
27-
28-
if not gob:isSpawned() then
19+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
20+
if not player:hasKeyItem(tpz.ki.FIRST_SIGNED_FORGED_ENVELOPE) then
21+
if npc:getLocalVar("[QM]Select") == 1 and npcUtil.popFromQM(player, npc, ID.mob.CLIMBPIX_HIGHRISE, {radius = 1, hide = 0}) then
2922
player:messageSpecial(ID.text.THF_AF_MOB)
30-
gob:setSpawn(-194, 15, 269)
31-
SpawnMob(ID.mob.CLIMBPIX_HIGHRISE):updateClaim(player)
3223
end
33-
elseif grapplingCS >= 0 or grapplingCS <= 7 then
34-
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET)
24+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET) -- It is impossible to climb this wall with your bare hands.
25+
else
26+
player:messageSpecial(ID.text.THF_AF_WALL_OFFSET + 1) -- There is no longer any need to climb the tower.
3527
end
3628
else
3729
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)

scripts/zones/Windurst_Woods/npcs/Bopa_Greso.lua

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
-----------------------------------
22
-- Area: Windurst Woods
3-
-- NPC: Bopa Greso
3+
-- NPC: Bopa Greso
44
-- Type: Standard NPC
55
-- !pos 59.773 -6.249 216.766 241
6-
--
7-
-- Auto-Script: Requires Verification (Verfied by Brawndo)
86
-----------------------------------
97
require("scripts/globals/quests")
108
-----------------------------------
@@ -13,21 +11,10 @@ function onTrade(player,npc,trade)
1311
end
1412

1513
function onTrigger(player,npc)
16-
local thickAsThieves = player:getQuestStatus(WINDURST,tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
17-
local thickAsThievesCS = player:getCharVar("thickAsThievesCS")
18-
19-
if thickAsThieves == QUEST_ACCEPTED then
20-
player:startEvent(506)
21-
if thickAsThievesCS == 1 then
22-
player:setCharVar("thickAsThievesCS", 2)
23-
elseif thickAsThievesCS == 3 then
24-
player:setCharVar("thickAsThievesCS", 4)
25-
local rand1 = math.random(2, 7)
26-
player:setCharVar("thickAsThievesGrapplingCS", rand1)
27-
player:setCharVar("thickAsThievesGamblingCS", 1)
28-
end
14+
if player:getQuestStatus(WINDURST,tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
15+
player:startEvent(506) -- Gambling hint
2916
else
30-
player:startEvent(77) -- standard cs
17+
player:startEvent(77) -- Standard dialogue
3118
end
3219
end
3320

scripts/zones/Windurst_Woods/npcs/Cha_Lebagta.lua

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,25 @@
33
-- NPC: Cha Lebagta
44
-- Type: Standard NPC
55
-- !pos 58.385 -6.249 216.670 241
6-
-- Involved in Quests: As Thick as Thieves, Mihgo's Amigo
6+
-- Involved in Quests: As Thick as Thieves, Mihgo's Amigo
7+
-----------------------------------
8+
require("scripts/globals/quests")
79
-----------------------------------
810

911
function onTrade(player,npc,trade)
1012
end
1113

1214
function onTrigger(player,npc)
13-
local MihgosAmigo = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.MIHGO_S_AMIGO)
14-
local thickAsThieves = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES)
15-
local thickAsThievesCS = player:getCharVar("thickAsThievesCS")
16-
17-
-- As Thick As Thieves (THF AF)
18-
if thickAsThieves == QUEST_ACCEPTED then
19-
player:startEvent(507, 0, 17474)
20-
if thickAsThievesCS == 1 then
21-
player:setCharVar("thickAsThievesCS", 3)
22-
elseif thickAsThievesCS == 2 then
23-
player:setCharVar("thickAsThievesCS", 4)
24-
local rand1 = math.random(2, 7)
25-
player:setCharVar("thickAsThievesGrapplingCS", rand1)
26-
player:setCharVar("thickAsThievesGamblingCS", 1)
27-
end
28-
29-
-- Mihgo's Amigo
30-
elseif MihgosAmigo == QUEST_ACCEPTED then
31-
player:startEvent(85,0,498) -- hint dialog
15+
local mihgosAmigo = player:getQuestStatus(WINDURST, tpz.quest.id.windurst.MIHGO_S_AMIGO)
3216

33-
-- standard dialog
34-
elseif MihgosAmigo == QUEST_COMPLETED then
35-
player:startEvent(91, 0, 498) -- new standard dialog after Mihgo's Amigo
17+
if player:getQuestStatus(WINDURST, tpz.quest.id.windurst.AS_THICK_AS_THIEVES) == QUEST_ACCEPTED then
18+
player:startEvent(507, 0, 17474) -- Grappling hint
19+
elseif mihgosAmigo == QUEST_ACCEPTED then
20+
player:startEvent(85,0,498) -- Migho's Amigo hint dialog
21+
elseif mihgosAmigo == QUEST_COMPLETED then
22+
player:startEvent(91, 0, 498) -- New standard dialog after Mihgo's Amigo completion
3623
else
37-
player:startEvent(78) -- normal dialog
24+
player:startEvent(78) -- Standard dialog
3825
end
3926
end
4027

0 commit comments

Comments
 (0)