-
-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add EventCallbacks for item movement restrictions and boss inte…
…ractions
- Loading branch information
1 parent
f34cb83
commit 398b089
Showing
3 changed files
with
59 additions
and
43 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
data-otservbr-global/scripts/quests/cults_of_tibia/event_on_item_moved.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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
local callback = EventCallback("CultsOnItemMoved") | ||
|
||
function callback.onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder) | ||
local fromPos = Position(33023, 31904, 14) | ||
local toPos = Position(33052, 31932, 15) | ||
local removeItem = false | ||
|
||
if player:getPosition():isInRange(fromPos, toPos) and item:getId() == 23729 then | ||
local tile = Tile(toPosition) | ||
if tile then | ||
local tileBoss = tile:getTopCreature() | ||
if tileBoss and tileBoss:isMonster() then | ||
local bossName = tileBoss:getName():lower() | ||
if bossName == "the remorseless corruptor" then | ||
tileBoss:addHealth(-17000) | ||
tileBoss:remove() | ||
|
||
local monster = Game.createMonster("The Corruptor of Souls", toPosition) | ||
if not monster then | ||
return false | ||
end | ||
|
||
removeItem = true | ||
monster:registerEvent("CheckTile") | ||
|
||
local storedHealth = Game.getStorageValue("healthSoul") | ||
if storedHealth > 0 then | ||
monster:addHealth(-(monster:getHealth() - storedHealth)) | ||
end | ||
|
||
Game.setStorageValue("CheckTile", os.time() + 30) | ||
elseif bossName == "the corruptor of souls" then | ||
Game.setStorageValue("CheckTile", os.time() + 30) | ||
removeItem = true | ||
end | ||
end | ||
end | ||
|
||
if removeItem then | ||
item:remove(1) | ||
end | ||
end | ||
return true | ||
end | ||
|
||
callback:register() |
13 changes: 13 additions & 0 deletions
13
data-otservbr-global/scripts/quests/the_secret_library_quest/event_on_item_moved.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
local callback = EventCallback("SecretOnItemMoved") | ||
|
||
function callback.onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder) | ||
if toPosition == Position(32460, 32928, 7) and item.itemid == 3578 then | ||
toPosition:sendMagicEffect(CONST_ME_HEARTS) | ||
player:say("You feed the turtle, now you may pass.", TALKTYPE_MONSTER_SAY) | ||
Game.setStorageValue(Storage.Quest.U11_80.TheSecretLibrary.SmallIslands.Turtle, os.time() + 10 * 60) | ||
item:remove(1) | ||
end | ||
return true | ||
end | ||
|
||
callback: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