Skip to content

Commit

Permalink
more clean now work
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyx14 committed Aug 14, 2023
1 parent c8e4925 commit 2cc887d
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 3,611 deletions.
2,253 changes: 7 additions & 2,246 deletions data-otxserver/lib/core/storages.lua

Large diffs are not rendered by default.

54 changes: 0 additions & 54 deletions data-otxserver/scripts/actions/other/construction_kits.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,63 +59,9 @@ local constructionKits = {
[17977] = 18019
}

local jackToTheFuture_Kits = {
[2775] = {
itemId = 2374,
kitMessage = "The red cushioned chair looks quite comfy in that corner.",
jackSay = "Jack: Yeah uhm... impressive chair. Now would you please remove it? Thanks.",
storage = Storage.TibiaTales.JackFutureQuest.Furniture01
},
[2797] = {
itemId = 2979,
kitMessage = "A globe like this should be in every household.",
jackSay = "Jack: What the... what do I need a 'globe' for? Take this away.",
storage = Storage.TibiaTales.JackFutureQuest.Furniture02
},
[2799] = {
itemId = 3485,
kitMessage = "The telescope just looks like it was the one thing missing from this room.",
jackSay = "Jack: Nice, a... what is this actually?",
storage = Storage.TibiaTales.JackFutureQuest.Furniture03
},
[2800] = {
itemId = 2998,
kitMessage = "What a cute horse - and just the right thing to place into this cute room.",
jackSay = "Jack: A rocking horse? What's wrong with you.",
storage = Storage.TibiaTales.JackFutureQuest.Furniture04
},
[2805] = {
itemId = 2904,
kitMessage = "There seems to be no better place for this amphora than right here.",
jackSay = "Jack: Trying to get rid of your junk in my house? Do I look like I need such a... 'vase'?",
storage = Storage.TibiaTales.JackFutureQuest.Furniture05
}
}

local jackToTheFuture_House = {
beginPos = Position(33273, 31754, 7),
finalPos = Position(33278, 31759, 7)
}

local constructionKit = Action()

function constructionKit.onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getPosition():isInRange(jackToTheFuture_House.beginPos, jackToTheFuture_House.finalPos) then
if player:getStorageValue(Storage.TibiaTales.JackFutureQuest.QuestLine) == 3 then
local setting = jackToTheFuture_Kits[item.itemid]
if setting then
if player:getStorageValue(setting.storage) < 1 then
item:remove()
Game.createItem(setting.itemId, 1, player:getPosition())
player:say(setting.jackSay, TALKTYPE_MONSTER_SAY)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.kitMessage)
player:setStorageValue(setting.storage, 1)
return true
end
end
end
end

local kit = constructionKits[item.itemid]
if not kit then
return false
Expand Down
15 changes: 0 additions & 15 deletions data-otxserver/scripts/actions/other/destroy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,6 @@ end
local destroy = Action()

function destroy.onUse(player, item, fromPosition, target, toPosition, isHotkey)
-- Tibia tales quest, Aritos task
if (item:getId() == scimitarItemId) then
if (toPosition == Position(scimitarPos.x, scimitarPos.y, scimitarPos.z)) then
local scimitarPlaced = Tile(scimitarPos):getItemById(placedSimitarItemId)
if not scimitarPlaced then
if player:getStorageValue(Storage.TibiaTales.AritosTask) >= 0 then
item:remove()
Game.createItem(placedSimitarItemId, 1, scimitarPos)
addEvent(removeEntrance, 1 * 60 * 1000)
return true
end
end
end
end
return onDestroyItem(player, item, fromPosition, target, toPosition, isHotkey)
end

for id = 3264, 3292 do
Expand Down
17 changes: 0 additions & 17 deletions data-otxserver/scripts/actions/other/enchanting.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,6 @@ local enchantedItems = {
local enchanting = Action()

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

if table.contains({33268, 33269}, toPosition.x)
and toPosition.y == 31830 and toPosition.z == 10
and player:getStorageValue(Storage.ElementalSphere.QuestLine) > 0 then
if not table.contains(spheres[item.itemid], player:getVocation():getBaseId()) then
return false
elseif table.contains({842, 843}, target.itemid) then
player:say('Turn off the machine first.', TALKTYPE_MONSTER_SAY)
return true
else
player:setStorageValue(Storage.ElementalSphere.MachineGemCount, math.max(1, player:getStorageValue(Storage.ElementalSphere.MachineGemCount) + 1))
toPosition:sendMagicEffect(CONST_ME_PURPLEENERGY)
item:transform(item.itemid, item.type - 1)
return true
end
end

if item.itemid == 3030 and target.itemid == 3229 then
target:transform(3230)
target:decay()
Expand Down
4 changes: 0 additions & 4 deletions data-otxserver/scripts/actions/other/food.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ local foods = {

local food = Action()
function food.onUse(player, item, fromPosition, target, toPosition, isHotkey)
local bloodBrothersStorage = Storage.Quest.U8_4.BloodBrothers
local itemFood = foods[item.itemid]
local effect = itemFood[3]
if not itemFood then
Expand All @@ -136,9 +135,6 @@ function food.onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:sendTextMessage(MESSAGE_FAILURE, "You are full.")
return true
end
if item.itemid == 8194 and player:getStorageValue(bloodBrothersStorage.GarlicBread) == 0 then
player:setStorageValue(bloodBrothersStorage.GarlicBread, 1)
end
player:feed(itemFood[1] * 12)
player:say(itemFood[2], TALKTYPE_MONSTER_SAY)
item:remove(1)
Expand Down
139 changes: 3 additions & 136 deletions data-otxserver/scripts/actions/other/gems.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
local lionsRockSanctuaryPos = Position(33073, 32300, 9)
local lionsRockSanctuaryRockId = 1852
local lionsRockSanctuaryFountainId = 6389

local shrine = {
--[[
-- ice shrine
[3029] = {
targetAction = 15001,
Expand Down Expand Up @@ -30,149 +27,19 @@ local shrine = {
destination = {x = 33527, y = 32301, z = 4},
effect = CONST_ME_ENERGYHIT
}
}

local lionsRock = {
[25006] = {
itemId = 21442,
itemPos = {x = 33069, y = 32298, z = 9},
storage = Storage.LionsRock.Questline,
value = 9,
item = 3030,
fieldId = 2123,
message = "You place the ruby on the small socket. A red flame begins to burn.",
effect = CONST_ME_MAGIC_RED
},
[25007] = {
itemId = 21442,
itemPos = {x = 33069, y = 32302, z = 9},
storage = Storage.LionsRock.Questline,
value = 9,
item = 3029,
fieldId = 21463,
message = "You place the sapphire on the small socket. A blue flame begins to burn.",
effect = CONST_ME_MAGIC_BLUE
},
[25008] = {
itemId = 21440,
itemPos = {x = 33077, y = 32302, z = 9},
storage = Storage.LionsRock.Questline,
value = 9,
item = 3033,
fieldId = 7465,
message = "You place the amethyst on the small socket. A violet flame begins to burn.",
effect = CONST_ME_PURPLESMOKE
},
[25009] = {
itemId = 21437,
itemPos = {x = 33077, y = 32298, z = 9},
storage = Storage.LionsRock.Questline,
value = 9,
item = 9057,
fieldId = 21465,
message = "You place the topaz on the small socket. A yellow flame begins to burn.",
effect = CONST_ME_BLOCKHIT
}
]]
}

local gems = Action()
function gems.onUse(player, item, fromPosition, target, toPosition, isHotkey)
-- Small emerald for Kilmaresh quest
-- see data\scripts\quests\kilmaresh\1-fafnars-wrath\7-four-masks.lua
if item.itemid == 3032 and target.uid == 40032
and player:getStorageValue(Storage.Kilmaresh.Sixth.Favor) >= 1
and not testFlag(player:getStorageValue(Storage.Kilmaresh.Sixth.FourMasks), 4) then
player:addItem(31371, 1) -- Ivory mask
item:remove(1)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You hear a *click*. You can now lift the floor tile and discover a secret compartment. A mask made of ivory lies in it.")
player:setStorageValue(Storage.Kilmaresh.Sixth.Favor, player:getStorageValue(Storage.Kilmaresh.Sixth.Favor) + 1)
player:setStorageValue(Storage.Kilmaresh.Sixth.FourMasks, setFlag(player:getStorageValue(Storage.Kilmaresh.Sixth.FourMasks), 4))
return true
-- Enchanted helmet of the ancients
elseif player:getItemCount(3030) >= 1 and target.itemid == 3229 then
if player:getItemCount(3030) >= 1 and target.itemid == 3229 then
target:transform(3230)
target:decay()
item:remove(1)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
toPosition:sendMagicEffect(CONST_ME_MAGIC_RED)
return true
end

-- Gems teleport to feyrist
local ThreatenedDreams = Storage.Quest.U11_40.ThreatenedDreams
for index, value in pairs(shrine) do
if target.actionid == value.targetAction then
if player:getStorageValue(ThreatenedDreams.Mission01[1]) == 16 then
if item.itemid == index then
player:teleportTo(value.destination)
player:getPosition():sendMagicEffect(value.effect)
item:remove(1)
return true
else
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return true
end
else
player:say("When the time comes, '" ..item:getName() .. "' will be accepted at this shrine.")
return true
end
end
end

-- Use gems in the tile of lions rock quest
local setting = lionsRock[target.uid]
if not setting then
return false
end

-- Reset lion's fields
local function lionsRockFieldReset()
local gemSpot = Tile(setting.itemPos):getItemById(setting.fieldId)
if gemSpot then
Game.setStorageValue(GlobalStorage.LionsRockFields, Game.getStorageValue(GlobalStorage.LionsRockFields) - 1)
gemSpot:remove()
return true
end
end

-- Check if all lion's fields are set
local function checkLionsRockFields(storage)
if Game.getStorageValue(GlobalStorage.LionsRockFields) == 3 then
local stone = Tile(lionsRockSanctuaryPos):getItemById(lionsRockSanctuaryRockId)
if stone then
stone:transform(lionsRockSanctuaryFountainId)
lionsRockSanctuaryPos:sendMagicEffect(CONST_ME_THUNDER)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Something happens at the center of the room ...')
player:setStorageValue(storage, 10)
return true
end
end
end

-- Delay to create lion's field
local function lionsRockCreateField(itemPos, fieldId, storage)
local gemSpot = Tile(itemPos):getItemById(fieldId)
if not gemSpot then
Game.createItem(fieldId, 1, itemPos)
Game.setStorageValue(GlobalStorage.LionsRockFields, Game.getStorageValue(GlobalStorage.LionsRockFields) + 1)
checkLionsRockFields(storage)
return true
end
end

if player:getStorageValue(setting.storage) >= setting.value then
if setting.item == item.itemid then
local gemSpot = Tile(setting.itemPos):getItemById(setting.fieldId)
if not gemSpot then
toPosition:sendMagicEffect(setting.effect)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, setting.message)
item:remove(1)
addEvent(lionsRockCreateField, 2 * 1000, setting.itemPos, setting.fieldId, setting.storage)
addEvent(lionsRockFieldReset, 60 * 1000)
return true
end
end
end
return false
end

Expand Down
29 changes: 0 additions & 29 deletions data-otxserver/scripts/actions/other/music.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,6 @@ local MusicEffect = {

local music = Action()
function music.onUse(player, item, fromPosition, target, toPosition, isHotkey)

if item.itemid == 2949 then
if isInRange(player:getPosition(), Position(32695, 31717, 2), Position(32699, 31719, 2)) then
local lyreProgress = player:getStorageValue(Storage.Diapason.Lyre)
if lyreProgress < 7
and player:getStorageValue(Storage.Diapason.Edala) ~= 1
and player:getStorageValue(Storage.Diapason.LyreTimer) < os.time() then
player:setStorageValue(Storage.Diapason.Lyre, math.max(0, lyreProgress) + 1)
player:setStorageValue(Storage.Diapason.Edala, 1)
player:setStorageValue(Storage.Diapason.LyreTimer, os.time() + 86400)
end
end
elseif item.itemid == 2953 then
if isInRange(player:getPosition(), Position(33540, 32245, 7), Position(33542, 32247, 7)) then
local ThreatenedDreams = Storage.Quest.U11_40.ThreatenedDreams
local UnlikelyCouple = player:getStorageValue(ThreatenedDreams.Mission03.UnlikelyCouple)
local PanpipesTimer = player:getStorageValue(ThreatenedDreams.Mission03.PanpipesTimer)
if UnlikelyCouple >= 2 and PanpipesTimer < os.time() then
if UnlikelyCouple == 2 then
player:setStorageValue(ThreatenedDreams.Mission03.UnlikelyCouple, 3)
end
player:setStorageValue(ThreatenedDreams.Mission03.PanpipesTimer, os.time() + 20 * 3600)
player:setStorageValue(ThreatenedDreams.Mission03[1], 2)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Mysteriously some colourful music notes fall of the panpipes. - Hurry, they will fade away quickly.")
player:addItem(25782, 1)
end
end
end

player:addAchievementProgress('Rockstar', 10000)
item:getPosition():sendMagicEffect(MusicEffect[item.itemid])
return true
Expand Down
24 changes: 0 additions & 24 deletions data-otxserver/scripts/actions/tools/skinning.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,6 @@ function skinning.onUse(player, item, fromPosition, target, toPosition, isHotkey
player:addItem(33780, 1)
end
return true
-- Wrath of the emperor quest
elseif target.itemid == 11339 then
target:transform(11331)
player:say("You carve a solid bowl of the chunk of wood.", TALKTYPE_MONSTER_SAY)
return true
-- An Interest In Botany Quest
elseif target.itemid == 10735 and player:getItemCount(11699) > 0 and player:getStorageValue(Storage.TibiaTales.AnInterestInBotany) == 1 then
player:say("The plant feels cold but dry and very soft. You streak the plant gently with your knife and put a fragment in the almanach.", TALKTYPE_MONSTER_SAY)
player:setStorageValue(Storage.TibiaTales.AnInterestInBotany, 2)
return true
elseif target.itemid == 10697 and player:getItemCount(11699) > 0 and player:getStorageValue(Storage.TibiaTales.AnInterestInBotany) == 2 then
player:say("You cut a leaf from a branch and put it in the almanach. It smells strangely sweet and awfully bitter at the same time.", TALKTYPE_MONSTER_SAY)
player:setStorageValue(Storage.TibiaTales.AnInterestInBotany, 3)
return true
elseif target.itemid == 8181 and player:getStorageValue(789100) <= 1 then
player:say("You got Neutral matter.", TALKTYPE_MONSTER_SAY)
player:addItem(954, 1)
player:setStorageValue(789100, 1)
return true
elseif target.itemid == 8182 and player:getStorageValue(789100) <= 1 then
player:say("You got Neutral matter.", TALKTYPE_MONSTER_SAY)
player:addItem(954, 1)
player:setStorageValue(789100, 2)
return true
end
end

Expand Down
32 changes: 17 additions & 15 deletions data-otxserver/scripts/actions/worldboard.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
local worldBoard = Action()

local communicates = {
-- Fury Gates
[1] = {
globalStorage=65000,
communicate = "A fiery fury gate has opened near one of the major cities somewhere in Tibia."
},
-- Yasir
[2] = {
globalStorage = 65014,
communicate = "Oriental ships sighted! A trader for exotic creature products may currently be visiting Carlin, Ankrahmun or Liberty Bay."
},
-- Nightmare Isle
[3] = {
globalStorage = 65015,
communicate = "A sandstorm travels through Darama, leading to isles full of deadly creatures inside a nightmare. Avoid the river near Drefia/northernmost coast/Ankhramun tar pits!"
}
--[[
-- Fury Gates
[1] = {
globalStorage=65000,
communicate = "A fiery fury gate has opened near one of the major cities somewhere in Tibia."
},
-- Yasir
[2] = {
globalStorage = 65014,
communicate = "Oriental ships sighted! A trader for exotic creature products may currently be visiting Carlin, Ankrahmun or Liberty Bay."
},
-- Nightmare Isle
[3] = {
globalStorage = 65015,
communicate = "A sandstorm travels through Darama, leading to isles full of deadly creatures inside a nightmare. Avoid the river near Drefia/northernmost coast/Ankhramun tar pits!"
}
]]
}

function worldBoard.onUse(player, item, fromPosition, target, toPosition, isHotkey)
Expand Down
Loading

0 comments on commit 2cc887d

Please sign in to comment.