forked from opentibiabr/canary
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
69 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 48 additions & 34 deletions
82
data-otservbr-global/scripts/quests/spike_tasks/actions_lode_stone.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,57 @@ | ||
local transformTo = { | ||
[19207] = 19216, | ||
[19216] = 19218, | ||
} | ||
|
||
local area = { --area where to teleport | ||
Position(32152, 32502, 11), | ||
Position(32365, 32725, 12), | ||
local area = { | ||
Position(32152, 32502, 11), | ||
Position(32365, 32725, 12), | ||
} | ||
|
||
local spikeTasksStone = Action() | ||
|
||
function spikeTasksStone.onUse(player, item, fromPosition, target, toPosition, isHotkey) | ||
if player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) ~= 0 then | ||
return false | ||
end | ||
|
||
if (target == nil) or not target:isItem() or (target:getId() ~= 19217) then | ||
return false | ||
end | ||
|
||
target:transform(19379) | ||
target:decay() | ||
if item:getId() == 19218 then | ||
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, 1) | ||
player:getPosition():sendMagicEffect(12) | ||
player:say("Your tinkering caused some kind of magnetic storm that caused you to get disorientated.", TALKTYPE_MONSTER_SAY) | ||
item:remove() | ||
else | ||
item:transform(transformTo[item:getId()]) | ||
if math.random(100) > 60 then | ||
player:teleportTo(Position.getFreePosition(area[1], area[2])) | ||
player:getPosition():sendMagicEffect(11) | ||
end | ||
end | ||
return toPosition:sendMagicEffect(12) | ||
local currentProgress = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) | ||
if currentProgress == 3 then | ||
return false | ||
end | ||
|
||
if (target == nil) or not target:isItem() or (target:getId() ~= 19217) then | ||
return false | ||
end | ||
|
||
if target:getId() == 19217 then | ||
target:transform(19379) | ||
target:decay() | ||
end | ||
|
||
local itemId = item:getId() | ||
|
||
if itemId == 19207 then | ||
item:transform(19216) | ||
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, 1) -- Define o progresso inicial | ||
elseif itemId == 19216 then | ||
local useCount = player:getStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main) | ||
if useCount == -1 then | ||
useCount = 0 | ||
end | ||
|
||
useCount = useCount + 1 | ||
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, useCount) | ||
|
||
if useCount == 3 then -- Corrigido para checar se o uso é 3 | ||
item:transform(19218) | ||
player:setStorageValue(Storage.Quest.U10_20.SpikeTaskQuest.Constants.Spike_Middle_Charge_Main, 3) -- Finaliza a missão | ||
return true | ||
end | ||
end | ||
|
||
if math.random(100) > 60 then | ||
player:teleportTo(Position.getFreePosition(area[1], area[2])) | ||
end | ||
|
||
return toPosition:sendMagicEffect(12) | ||
end | ||
|
||
for itemId, info in pairs(transformTo) do | ||
spikeTasksStone:id(itemId) | ||
local itemIds = {19207, 19216} | ||
|
||
for _, id in ipairs(itemIds) do | ||
spikeTasksStone:id(id) | ||
end | ||
spikeTasksStone:id(21568) | ||
|
||
spikeTasksStone:register() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters