|
| 1 | +local teleport = Action() |
| 2 | + |
| 3 | +function teleport.onUse(player, item, fromPosition, target, toPosition, isHotkey) |
| 4 | + local itemId = item:getId() |
| 5 | + local itemPos = item:getPosition() |
| 6 | + |
| 7 | + if itemId == 50978 and itemPos == Position(33185, 31794, 7) then |
| 8 | + local targetPosition = Position(32520, 32514, 8) -- chapter I |
| 9 | + player:teleportTo(targetPosition) |
| 10 | + player:getPosition():sendMagicEffect(CONST_ME_OPEN_BOOKMACHINE) |
| 11 | + itemPos:sendMagicEffect(CONST_ME_OPEN_BOOKSPELL) |
| 12 | + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You are drawn into the pages of the book.") |
| 13 | + return true |
| 14 | + elseif itemId == 51528 and itemPos == Position(32522, 32512, 8) then |
| 15 | + local targetPosition = Position(33185, 31795, 7) -- front of edron book |
| 16 | + player:teleportTo(targetPosition) |
| 17 | + player:getPosition():sendMagicEffect(CONST_ME_OPEN_BOOKMACHINE) |
| 18 | + itemPos:sendMagicEffect(CONST_ME_OPEN_BOOKSPELL) |
| 19 | + return true |
| 20 | + elseif itemId == 51624 and itemPos == Position(32526, 32512, 8) then |
| 21 | + local targetPosition = Position(32526, 32513, 9) -- chapter II |
| 22 | + player:teleportTo(targetPosition) |
| 23 | + player:getPosition():sendMagicEffect(CONST_ME_OPEN_BOOKMACHINE) |
| 24 | + itemPos:sendMagicEffect(CONST_ME_OPEN_BOOKSPELL) |
| 25 | + return true |
| 26 | + elseif itemId == 51625 and itemPos == Position(32536, 32512, 8) then |
| 27 | + local targetPosition = Position(32526, 32513, 9) -- chapter III |
| 28 | + player:teleportTo(targetPosition) |
| 29 | + player:getPosition():sendMagicEffect(CONST_ME_OPEN_BOOKMACHINE) |
| 30 | + itemPos:sendMagicEffect(CONST_ME_OPEN_BOOKSPELL) |
| 31 | + return true |
| 32 | + elseif itemId == 51626 and itemPos == Position(32540, 32512, 8) then |
| 33 | + local targetPosition = Position(32585, 32558, 11) -- chapter IV |
| 34 | + player:teleportTo(targetPosition) |
| 35 | + player:getPosition():sendMagicEffect(CONST_ME_OPEN_BOOKMACHINE) |
| 36 | + itemPos:sendMagicEffect(CONST_ME_OPEN_BOOKSPELL) |
| 37 | + return true |
| 38 | + elseif itemId == 51756 then |
| 39 | + local targetPosition = Position(32520, 32514, 8) -- chapter I |
| 40 | + |
| 41 | + if itemPos == Position(32526, 32512, 9) or itemPos == Position(32552, 32594, 10) or itemPos == Position(32585, 32557, 11) then |
| 42 | + player:teleportTo(targetPosition) |
| 43 | + player:getPosition():sendMagicEffect(CONST_ME_OPEN_BOOKMACHINE) |
| 44 | + itemPos:sendMagicEffect(CONST_ME_OPEN_BOOKSPELL) |
| 45 | + return true |
| 46 | + end |
| 47 | + end |
| 48 | + |
| 49 | + return false |
| 50 | +end |
| 51 | + |
| 52 | +teleport:id(50978, 51528, 51624, 51625, 51626, 51756) |
| 53 | +teleport:register() |
0 commit comments