Skip to content

Commit

Permalink
Merge branch 'Review-Quests-V10' of https://github.com/htc16/canary i…
Browse files Browse the repository at this point in the history
…nto Review-Quests-V10
  • Loading branch information
htc16 committed Sep 14, 2024
2 parents 1eb2eac + bb37f6b commit 142a877
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 176 deletions.
Original file line number Diff line number Diff line change
@@ -1,73 +1,68 @@
local TCC_PILLARPETRIFIED = Position(31942, 32936, 10)
local ItemsCursed = {
[11466] = { usedID = 21504, finalID = 21505 },
[21504] = { usedID = 11466, finalID = 21505 },
[21505] = { usedID = 21507, finalID = 21506 },
[21507] = { usedID = 21505, finalID = 21506 },
[11466] = { usedID = 21504, finalID = 21505 },
[21504] = { usedID = 11466, finalID = 21505 },
[21505] = { usedID = 21507, finalID = 21506 },
[21507] = { usedID = 21505, finalID = 21506 },
}

local theCursedMedusa = Action()

function theCursedMedusa.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if (item.itemid == 21506) and (target.itemid == 10420) then
if player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe) == 2 then
local playerPos = player:getPosition()
if not ((math.abs(playerPos.x - TCC_PILLARPETRIFIED.x) < 5) and
(math.abs(playerPos.y - TCC_PILLARPETRIFIED.y) < 5) and
(playerPos.z == TCC_PILLARPETRIFIED.z)) then
return
end
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe, 3)
item:remove(1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You unpetrify a banshee's scream near the evil crystal, your ears protected by wax. Thus the baleful artefact is destroyed.")
local stone = Tile(TCC_PILLARPETRIFIED):getItemById(10797)
doSendMagicEffect(stone:getPosition(), CONST_ME_POFF)
stone:transform(10870)
addEvent(function()
stone:transform(10797)
end, 5000)
end
return
if (item.itemid == 21506) and (target.itemid == 10420) then
if player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe) == 2 then
local playerPos = player:getPosition()
if not ((math.abs(playerPos.x - TCC_PILLARPETRIFIED.x) < 5) and (math.abs(playerPos.y - TCC_PILLARPETRIFIED.y) < 5) and (playerPos.z == TCC_PILLARPETRIFIED.z)) then
return
end
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe, 3)
item:remove(1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You unpetrify a banshee's scream near the evil crystal, your ears protected by wax. Thus the baleful artefact is destroyed.")
local stone = Tile(TCC_PILLARPETRIFIED):getItemById(10797)
doSendMagicEffect(stone:getPosition(), CONST_ME_POFF)
stone:transform(10870)
addEvent(function()
stone:transform(10797)
end, 5000)
end
return
elseif item.itemid == 9106 then
local topCreature = Tile(toPosition):getTopCreature()
if not topCreature or not topCreature:isPlayer() then
return
end
if (player == topCreature) and (player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe) < 2) then
local playerPos = player:getPosition()
if not ((math.abs(playerPos.x - TCC_PILLARPETRIFIED.x) < 5) and (math.abs(playerPos.y - TCC_PILLARPETRIFIED.y) < 5) and (playerPos.z == TCC_PILLARPETRIFIED.z)) then
return
end
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe, 2)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You use the molten wax to plug your ears.")
doSendMagicEffect(player:getPosition(), CONST_ME_YELLOWSMOKE)
item:remove(1)
end
return
end

elseif item.itemid == 9106 then
local topCreature = Tile(toPosition):getTopCreature()
if not topCreature or not topCreature:isPlayer() then
return
end
if (player == topCreature) and (player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe) < 2) then
local playerPos = player:getPosition()
if not ((math.abs(playerPos.x - TCC_PILLARPETRIFIED.x) < 5) and
(math.abs(playerPos.y - TCC_PILLARPETRIFIED.y) < 5) and
(playerPos.z == TCC_PILLARPETRIFIED.z)) then
return
end
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe, 2)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You use the molten wax to plug your ears.")
doSendMagicEffect(player:getPosition(), CONST_ME_YELLOWSMOKE)
item:remove(1)
end
return
end
for index, value in pairs(ItemsCursed) do
if item.itemid == index and target.itemid == value.usedID then
if value.finalID == 21505 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You mixed the first ingredients to create a special ointment. But it isn't complete yet.")
elseif value.finalID == 21506 then
if player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Questline) < 2 then
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Questline, 2)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You mixed the proper ingredients to create a special ointment. With this salve you may unpetrify a petrified object.")
end

for index, value in pairs(ItemsCursed) do
if item.itemid == index and target.itemid == value.usedID then
if value.finalID == 21505 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You mixed the first ingredients to create a special ointment. But it isn't complete yet.")
elseif value.finalID == 21506 then
if player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Questline) < 2 then
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Questline, 2)
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You mixed the proper ingredients to create a special ointment. With this salve you may unpetrify a petrified object.")
end
item:remove(1)
target:remove(1)
player:addItem(value.finalID, 1)
return true
end
end

item:remove(1)
target:remove(1)
player:addItem(value.finalID, 1)
return true
end
end

player:sendTextMessage(MESSAGE_FAILURE, "Sorry, not possible.")
player:sendTextMessage(MESSAGE_FAILURE, "Sorry, not possible.")
end

theCursedMedusa:id(9106, 11466, 21504, 21505, 21507)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,99 +6,94 @@ local MAX_POS_GO = Position(31966, 32942, 9)
local MIN_POS_RETURN = Position(31960, 32935, 10)
local MAX_POS_RETURN = Position(31964, 32941, 10)

local validItems = {4809, 4810, 4811, 4812, 4813}
local validItems = { 4809, 4810, 4811, 4812, 4813 }

local function isInArea(pos, fromPos, toPos)
return pos.x >= fromPos.x and pos.x <= toPos.x and
pos.y >= fromPos.y and pos.y <= toPos.y and
pos.z == fromPos.z
return pos.x >= fromPos.x and pos.x <= toPos.x and pos.y >= fromPos.y and pos.y <= toPos.y and pos.z == fromPos.z
end

local function hasValidItem(position)
local tile = Tile(position)
if tile then
for _, itemId in ipairs(validItems) do
if tile:getItemById(itemId) then
return true
end
end
end
return false
local tile = Tile(position)
if tile then
for _, itemId in ipairs(validItems) do
if tile:getItemById(itemId) then
return true
end
end
end
return false
end

local function isVortexInArea(fromPos, toPos)
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
local tile = Tile(Position(x, y, fromPos.z))
if tile and tile:getItemById(7804) then
return true
end
end
end
return false
for x = fromPos.x, toPos.x do
for y = fromPos.y, toPos.y do
local tile = Tile(Position(x, y, fromPos.z))
if tile and tile:getItemById(7804) then
return true
end
end
end
return false
end

function cursedMiscItem.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 5902 then
if (target.itemid == 2535) or (target.itemid == 2537) or (target.itemid == 2539) or (target.itemid == 2541) then
item:remove(1)
player:addItem(9106, 1)
end

elseif item.itemid == 21554 then
local playerPos = player:getPosition()

if isInArea(playerPos, MIN_POS_GO, MAX_POS_GO) and hasValidItem(playerPos) then
if not isVortexInArea(MIN_POS_RETURN, MAX_POS_RETURN) and not isVortexInArea(MIN_POS_GO, MAX_POS_GO) then
Game.createItem(7804, 1, playerPos)
local vortex = Tile(playerPos):getItemById(7804)

if vortex then
vortex:setActionId(35001)
player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you use the small bell, an unearthly sound rings out sweetly. At the same moment, the lake's waters begin to whirl.")

addEvent(function()
local vortexItem = Tile(playerPos):getItemById(7804)
if vortexItem then
vortexItem:remove()
end
end, 10000)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A vortex already exists in this area or in the return area.")
end

elseif isInArea(playerPos, MIN_POS_RETURN, MAX_POS_RETURN) and hasValidItem(playerPos) then
if not isVortexInArea(MIN_POS_GO, MAX_POS_GO) and not isVortexInArea(MIN_POS_RETURN, MAX_POS_RETURN) then
Game.createItem(7804, 1, playerPos)
local vortex = Tile(playerPos):getItemById(7804)

if vortex then
vortex:setActionId(35001)
player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you use the small bell, an unearthly sound rings out sweetly. At the same moment, the lake's waters begin to whirl.")

addEvent(function()
local vortexItem = Tile(playerPos):getItemById(7804)
if vortexItem then
vortexItem:remove()
end
end, 10000)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A vortex already exists in this area or in the go area.")
end
end
end

return true
if item.itemid == 5902 then
if (target.itemid == 2535) or (target.itemid == 2537) or (target.itemid == 2539) or (target.itemid == 2541) then
item:remove(1)
player:addItem(9106, 1)
end
elseif item.itemid == 21554 then
local playerPos = player:getPosition()

if isInArea(playerPos, MIN_POS_GO, MAX_POS_GO) and hasValidItem(playerPos) then
if not isVortexInArea(MIN_POS_RETURN, MAX_POS_RETURN) and not isVortexInArea(MIN_POS_GO, MAX_POS_GO) then
Game.createItem(7804, 1, playerPos)
local vortex = Tile(playerPos):getItemById(7804)

if vortex then
vortex:setActionId(35001)
player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you use the small bell, an unearthly sound rings out sweetly. At the same moment, the lake's waters begin to whirl.")

addEvent(function()
local vortexItem = Tile(playerPos):getItemById(7804)
if vortexItem then
vortexItem:remove()
end
end, 10000)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A vortex already exists in this area or in the return area.")
end
elseif isInArea(playerPos, MIN_POS_RETURN, MAX_POS_RETURN) and hasValidItem(playerPos) then
if not isVortexInArea(MIN_POS_GO, MAX_POS_GO) and not isVortexInArea(MIN_POS_RETURN, MAX_POS_RETURN) then
Game.createItem(7804, 1, playerPos)
local vortex = Tile(playerPos):getItemById(7804)

if vortex then
vortex:setActionId(35001)
player:getPosition():sendMagicEffect(CONST_ME_SOUND_WHITE)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "As you use the small bell, an unearthly sound rings out sweetly. At the same moment, the lake's waters begin to whirl.")

addEvent(function()
local vortexItem = Tile(playerPos):getItemById(7804)
if vortexItem then
vortexItem:remove()
end
end, 10000)
end
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A vortex already exists in this area or in the go area.")
end
end
end

return true
end

cursedMiscItem:id(5902, 21554)
cursedMiscItem:register()


local TCC_SKELETON_PAPER_POS = Position(31974, 32907, 8)
local TCC_SKELETON_BELL_POS = Position(32031, 32914, 8)

Expand All @@ -109,7 +104,10 @@ function theCursedMiscAction.onUse(player, item, fromPosition, target, toPositio
if player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.Oneeyedjoe) < 1 and player:getStorageValue(Storage.Quest.U10_70.TheCursedCrystal.SheetOfPaper) < 1 then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found a sheet of paper.")
local paperCursedCrystal = player:addItem(2820, 1)
paperCursedCrystal:setAttribute(ITEM_ATTRIBUTE_TEXT, "I did it! I reached the crystal gardens! What beauty and splendor I have seen down there. Even more: I discovered a small subterranean lake - but Harry was there before me. And he did something strange: He ringed a small, transparent looking bell and immediately a big whirl appeared in the water. I suppose this is the mysterious way deeper into the caves we sought after for so long. But Harry, the coward, didn't dare to dive into the water. Instead he left the caverns and headed back to the surface. I must have this bell!")
paperCursedCrystal:setAttribute(
ITEM_ATTRIBUTE_TEXT,
"I did it! I reached the crystal gardens! What beauty and splendor I have seen down there. Even more: I discovered a small subterranean lake - but Harry was there before me. And he did something strange: He ringed a small, transparent looking bell and immediately a big whirl appeared in the water. I suppose this is the mysterious way deeper into the caves we sought after for so long. But Harry, the coward, didn't dare to dive into the water. Instead he left the caverns and headed back to the surface. I must have this bell!"
)
player:setStorageValue(Storage.Quest.U10_70.TheCursedCrystal.SheetOfPaper, 1)
else
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The pile of bones is empty.")
Expand All @@ -134,7 +132,6 @@ function theCursedMiscAction.onUse(player, item, fromPosition, target, toPositio
end

return true

end

theCursedMiscAction:aid(40001, 40002)
Expand Down
Loading

0 comments on commit 142a877

Please sign in to comment.