Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix The Hidden City of Beregar #309

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,15 @@
<!-- The Hidden City of Beregar -->
<action actionid="12606" script="quests/the hidden city of beregar/bargateLever.lua" />
<action actionid="50128" script="quests/the hidden city of beregar/deeperMineWagon.lua" />
<action fromaid="50098" toaid="50108" script="quests/the hidden city of beregar/oreWagon.lua" />
<action fromaid="50098" toaid="50109" script="quests/the hidden city of beregar/oreWagon.lua" />
<action actionid="50112" script="quests/the hidden city of beregar/gapWagon.lua" />
<action actionid="50115" script="quests/the hidden city of beregar/tunnelWagon.lua" />
<action actionid="50117" script="quests/the hidden city of beregar/coalWagon.lua" />
<action fromuid="50108" touid="50111" script="quests/the hidden city of beregar/coalLevers.lua" />
<action fromaid="50122" toaid="50125" script="quests/the hidden city of beregar/coalExitWagons.lua" />
<action fromuid="50113" touid="50123" script="quests/the hidden city of beregar/wagonMazeLevers.lua" />
<action uniqueid="50124" script="quests/the hidden city of beregar/wagonMazeExit.lua" />
<action itemid="10035" script="quests/the hidden city of beregar/ladder.lua" />

<!-- Thieves Guild Quest -->
<action itemid="8693" script="quests/the thieves guild/dwarfDisguiseKit.lua" />
Expand Down
2 changes: 1 addition & 1 deletion data/actions/lib/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
player:addItem(21250, 1)
player:setStorageValue(Storage.GravediggerOfDrefia.Mission68, 1)

-- ???
-- The Hidden City of Beregar Quest
elseif targetActionId == 50118 then
local wagonItem = Tile(Position(32717, 31492, 11)):getItemById(7131)
if wagonItem then
Expand Down
25 changes: 16 additions & 9 deletions data/actions/scripts/other/firebug.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
--Dreamer Challenge Quest
-- Dreamer Challenge Quest
if target.uid == 2243 then
target:transform(1387)
toPosition:sendMagicEffect(CONST_ME_FIREAREA)
item:remove()
return true
end

-- The Hidden City of Beregar
if target.itemid == 8642 and target.actionid == 50119 then
target:transform(8641)
return true
end

local random = math.random(10)
if random >= 4 then --success 6% chance
if target.itemid == 7538 then --Destroy spider webs/North - South
if random >= 4 then -- success 6% chance
if target.itemid == 7538 then -- Destroy spider webs/North - South
toPosition:sendMagicEffect(CONST_ME_HITBYFIRE)
target:transform(7544)
target:decay()
elseif target.itemid == 7539 then --Destroy spider webs/EAST- West
elseif target.itemid == 7539 then -- Destroy spider webs/EAST- West
toPosition:sendMagicEffect(CONST_ME_HITBYFIRE)
target:transform(7545)
target:decay()
elseif target.itemid == 5466 then --Burn Sugar Cane
elseif target.itemid == 5466 then -- Burn Sugar Cane
toPosition:sendMagicEffect(CONST_ME_FIREAREA)
target:transform(5465)
target:decay()
elseif target.itemid == 1485 then --Light Up empty coal basins
elseif target.itemid == 1485 then -- Light Up empty coal basins
toPosition:sendMagicEffect(CONST_ME_HITBYFIRE)
target:transform(1484)
elseif target.actionid == 12550 or target.actionid == 12551 then -- Secret Service Quest
Expand All @@ -30,15 +36,16 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:setStorageValue(Storage.secretService.TBIMission01, 2)
end
end
elseif random == 2 then --it remove the fire bug 2% chance
elseif random == 2 then -- it remove the fire bug 2% chance
item:remove(1)
toPosition:sendMagicEffect(CONST_ME_POFF)
elseif random == 1 then --it explode on the user 1% chance
elseif random == 1 then -- it explode on the user 1% chance
doTargetCombatHealth(0, player, COMBAT_FIREDAMAGE, -5, -5, CONST_ME_HITBYFIRE)
player:say('OUCH!', TALKTYPE_MONSTER_SAY)
item:remove(1)
else
toPosition:sendMagicEffect(CONST_ME_POFF) --it fails, but dont get removed 3% chance
toPosition:sendMagicEffect(CONST_ME_POFF) -- it fails, but dont get removed 3% chance
end

return true
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
return true
end

local crucible = Tile(Position(32699, 31494, 11)):getItemById(8641)
if crucible.actionid == 50121 then
local machine = Tile(Position(32699, 31494, 11)):getItemById(8641)
if not machine then
return false
end

if machine.actionid == 50121 then
local wagon = Game.createItem(7132, 1, useItem.wagonPos)
if wagon then
wagon:setActionId(useItem.actionId)
end

crucible:transform(8642)
machine:transform(8642)
end

item:transform(item.itemid == 10044 and 10045 or 10044)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
local config = {
{wagon = 7131, stopPos = Position(32717, 31492, 11)},
{wagon = 8749, stopPos = Position(32699, 31492, 11)}
local wagons = {
[7131] = Position(32717, 31492, 11),
[8749] = Position(32699, 31492, 11)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
for i = 1, #config do
local table = config[i]
local wagonPos = table.wagon:getPosition()
if table.wagon == 7131 and wagonPos ~= table.stopPos then
Tile(wagonPos):getTopTopItem():moveTo(wagonPos, x + 2)
elseif table.wagon == 8749 and wagonPos ~= table.stopPos then
Tile(wagonPos):getTopTopItem():moveTo(wagonPos, x - 2)
end
player:say("SQUEEEEAK", TALKTYPE_MONSTER_SAY, false, 0, wagonPos)
local lastPosition = wagons[item.itemid]
if not lastPosition then
return false
end

local wagonPosition = item:getPosition()
if wagonPosition == lastPosition then
return false
end

local tile = Tile(wagonPosition)
if item.itemid == 7131 then
wagonPosition.x = wagonPosition.x + 2
tile:getTopTopItem():moveTo(wagonPosition)
elseif item.itemid == 8749 and item.actionid == 50117 then
wagonPosition.x = wagonPosition.x - 2
tile:getItemById(7131):moveTo(wagonPosition)
tile:getItemById(8749):moveTo(wagonPosition)
end

player:say("SQUEEEEAK", TALKTYPE_MONSTER_SAY, false, 0, wagonPosition)

return true
end
33 changes: 15 additions & 18 deletions data/actions/scripts/quests/the hidden city of beregar/gapWagon.lua
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local tile = Tile(Position(32571, 31508, 9))
if not tile:getItemById(7122) then
player:teleportTo(Position(32580, 31487, 9))
if tile and tile:getItemById(7122) and player:getStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue) == 1 then
player:setStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue, 2)
player:teleportTo(Position(32578, 31507, 9))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:say("You need to build a bridge to pass the gap.", TALKTYPE_MONSTER_SAY)
return true
end

if player:getStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue) ~= 1 then
return false
end
player:say("You safely passed the gap but your bridge collapsed behind you.", TALKTYPE_MONSTER_SAY, false, 0, player:getPosition())

player:setStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue, 2)
player:teleportTo(Position(32578, 31507, 9))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:say("You safely passed the gap but your bridge collapsed behind you.", TALKTYPE_MONSTER_SAY)
local thing = tile:getItemById(7122)
if thing then
thing:remove()
end

local items = tile:getItems()
for i = 1, tile:getItemCount() do
local tmpItem = items[i]
if isInArray({7122, 5770}, tmpItem:getId()) then
tmpItem:remove()
local secondThing = tile:getItemById(5779)
if secondThing then
secondThing:remove()
end
else
player:teleportTo(Position(32580, 31487, 9))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:say("You need to build a bridge to pass the gap.", TALKTYPE_MONSTER_SAY, false, 0, player:getPosition())
end

return true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:teleportTo(Position(32680, 31508, 10))

return true
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ local config = {
[50105] = Position(32687, 31470, 13),
[50106] = Position(32687, 31470, 13),
[50107] = Position(32580, 31487, 9),
[50108] = Position(32687, 31470, 13)
[50108] = Position(32687, 31470, 13),
[50109] = Position(32617, 31514, 9)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
Expand All @@ -18,12 +19,13 @@ function onUse(player, item, fromPosition, target, toPosition, isHotkey)
return true
end


if player:getStorageValue(Storage.hiddenCityOfBeregar.OreWagon) == 1 then
player:teleportTo(targetPosition)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't know how to use this yet.")
return true
end
return true

player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You don't know how to use this yet.")

return false
end
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local rubblePosition = Position(32619, 31514, 9)
if Tile(rubblePosition):getItemById(5709) then
if Tile(Position(32619, 31514, 9)):getItemById(5709) then
player:teleportTo(Position(32580, 31487, 9))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:say("You need to build a bridge to pass the gap.", TALKTYPE_MONSTER_SAY)
return true
end

if player:getStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue) ~= 2 then
player:say("You need to build a bridge to pass the gap.", TALKTYPE_MONSTER_SAY, false, 0, player:getPosition())
return false
end

player:setStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue, 3)
player:teleportTo(Position(32625, 31514, 9))
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
player:say("You safely passed the tunnel.", TALKTYPE_MONSTER_SAY)
Game.createItem(5709, 1, rubblePosition)
player:say("You safely passed the tunnel.", TALKTYPE_MONSTER_SAY, false, 0, player:getPosition())
Game.createItem(5709, 1, Position(32619, 31514, 9))

local wallItem = Tile(Position(32617, 31513, 9)):getItemById(1027)
if wallItem then
wallItem:remove()
local tile = Tile(Position(32617, 31513, 9))
if tile then
local thing = tile:getItemById(1027)
if thing then
thing:remove()
end
end

local archwayItem = Tile(Position(32617, 31514, 9)):getItemById(1205)
if archwayItem then
archwayItem:remove()
local secondTile = Tile(Position(32617, 31513, 9))
if secondTile then
local thing = tile:getItemById(1205)
if thing then
thing:remove()
end
end

return true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local destinations = {
{teleportPos = Position(32692, 31501, 11), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7122)}, --Coal Room
{teleportPos = Position(32549, 31407, 11), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7125) and Tile(Position(32684, 31464, 13)):getItemById(7123)}, --Infested Tavern
{teleportPos = Position(32579, 31487, 9), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7125) and Tile(Position(32684, 31464, 13)):getItemById(7122) and Tile(Position(32682, 31455, 13)):getItemById(7124)}, --Beregar
{teleportPos = Position(32701, 31448, 15), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7125) and Tile(Position(32684, 31464, 13)):getItemById(7122) and Tile(Position(32682, 31455, 13)):getItemById(7121) and Tile(Position(32687, 31452, 13)):getItemById(7125) and Tile(Position(32692, 31453, 13)):getItemById(7126)}, --NPC Tehlim
{teleportPos = Position(32721, 31487, 15), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7121) and Tile(Position(32692, 31459, 13)):getItemById(7123) and Tile(Position(32696, 31453, 13)):getItemById(7123)}, --Troll tribe's hideout
{teleportPos = Position(32600, 31504, 13), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7123) and Tile(Position(32695, 31464, 13)):getItemById(7123)} --City's Entrance
}
local destinations = {
{teleportPos = Position(32692, 31501, 11), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7122)}, -- Coal Room
{teleportPos = Position(32549, 31407, 11), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7125) and Tile(Position(32684, 31464, 13)):getItemById(7123)}, -- Infested Tavern
{teleportPos = Position(32579, 31487, 9), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7125) and Tile(Position(32684, 31464, 13)):getItemById(7122) and Tile(Position(32682, 31455, 13)):getItemById(7124)}, -- Beregar
{teleportPos = Position(32701, 31448, 15), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7124) and Tile(Position(32690, 31465, 13)):getItemById(7125) and Tile(Position(32684, 31464, 13)):getItemById(7122) and Tile(Position(32682, 31455, 13)):getItemById(7121) and Tile(Position(32687, 31452, 13)):getItemById(7125) and Tile(Position(32692, 31453, 13)):getItemById(7126)}, -- NPC Tehlim
{teleportPos = Position(32721, 31487, 15), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7121) and Tile(Position(32692, 31459, 13)):getItemById(7123) and Tile(Position(32696, 31453, 13)):getItemById(7123)}, -- Troll tribe's hideout
{teleportPos = Position(32600, 31504, 13), railCheck = Tile(Position(32688, 31469, 13)):getItemById(7123) and Tile(Position(32695, 31464, 13)):getItemById(7123)} -- City's Entrance
}

for i = 1, #config do
local table = config[i]
if table.railCheck then
player:teleportTo(table.teleportPos)
for i = 1, #destinations do
local destination = destinations[i]
if destination.railCheck then
player:teleportTo(destination.teleportPos)
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return true
end
end
return true

return false
end
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
local levers = {
{uniqueId = 50113, railPos = Position(32696, 31453, 13)},
{uniqueId = 50114, railPos = Position(32692, 31453, 13)},
{uniqueId = 50115, railPos = Position(32687, 31452, 13)},
{uniqueId = 50116, railPos = Position(32682, 31455, 13)},
{uniqueId = 50117, railPos = Position(32688, 31456, 13)},
{uniqueId = 50118, railPos = Position(32692, 31459, 13)},
{uniqueId = 50119, railPos = Position(32696, 31461, 13)},
{uniqueId = 50120, railPos = Position(32695, 31464, 13)},
{uniqueId = 50121, railPos = Position(32690, 31465, 13)},
{uniqueId = 50122, railPos = Position(32684, 31464, 13)},
{uniqueId = 50123, railPos = Position(32688, 31469, 13)}
[50113] = Position(32696, 31453, 13),
[50114] = Position(32692, 31453, 13),
[50115] = Position(32687, 31452, 13),
[50116] = Position(32682, 31455, 13),
[50117] = Position(32688, 31456, 13),
[50118] = Position(32692, 31459, 13),
[50119] = Position(32696, 31461, 13),
[50120] = Position(32695, 31464, 13),
[50121] = Position(32690, 31465, 13),
[50122] = Position(32684, 31464, 13),
[50123] = Position(32688, 31469, 13)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)

for i = 1, #config do
local table = config[i]
if item.uid == table.uniqueId then
local tile = Tile(railPos)
if tile:getItemById(7130) then
tile:getItemById(7130):transform(7121)
else
tile:getItemById():transform(item.itemid + 1)
end
local lever = levers[item.uid]
if lever then
local tile = Tile(lever)
if tile:getItemById(7130) then
tile:getItemById(7130):transform(7121)
else
local targetItem = tile:getItems()[1]
targetItem:transform(targetItem:getId() + 1)
end
end

item:transform(item.itemid == 10044 and 10045 or 10044)

return true
end
1 change: 1 addition & 0 deletions data/movements/movements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
<movevent event="StepIn" uniqueid="50107" script="quests/the hidden city of beregar/bellow.lua" />
<movevent event="StepIn" uniqueid="50127" script="quests/the hidden city of beregar/pythiusTeleport.lua" />
<movevent event="StepIn" fromaid="50125" toaid="50126" script="quests/the hidden city of beregar/pythiusBossTeleport.lua" />
<movevent event="StepIn" actionid="50199" script="quests/the hidden city of beregar/bridgeTeleport.lua"/>

<!-- Secret Service Quest -->
<movevent event="StepIn" actionid="12571" script="quests/secret service/pirates.lua" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
local cruciblePosition = Position(32699, 31494, 11)

function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if not player then
if not creature:isPlayer() then
return true
end

local crucibleItem = Tile(cruciblePosition):getItemById(8641)
local crucibleItem = Tile(Position(32699, 31495, 11)):getItemById(10040)
if not crucibleItem then
return true
end
Expand All @@ -18,8 +15,9 @@ function onStepIn(creature, item, position, fromPosition)
crucibleItem:setActionId(50121)
Position(32695, 31494, 10):sendMagicEffect(CONST_ME_POFF)
elseif crucibleItem.actionid == 50121 then
player:say('TSSSSHHHHH', TALKTYPE_MONSTER_SAY, false, 0, Position(32695, 31494, 11))
player:say('CHOOOOOOOHHHHH', TALKTYPE_MONSTER_SAY, false, 0, Position(32698, 31492, 11))
Tile(Position(32699, 31494, 11)):getItemById(8641):setActionId(50121)
creature:say('TSSSSHHHHH', TALKTYPE_MONSTER_SAY, false, 0, Position(32695, 31494, 11))
creature:say('CHOOOOOOOHHHHH', TALKTYPE_MONSTER_SAY, false, 0, Position(32698, 31492, 11))
end
return true
end
Loading