| @@ -0,0 +1,4 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | Game.createItem(2111, 1, item:getPosition()) | |
| 3 | + | return true | |
| 4 | + | end |
| @@ -0,0 +1,27 @@ | |||
| 1 | + | local presents = { | |
| 2 | + | [6570] = { -- blue present | |
| 3 | + | {2687, 10}, {6394, 3}, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114 | |
| 4 | + | }, | |
| 5 | + | [6571] = { -- red present | |
| 6 | + | {2152, 10}, {2152, 10}, {2152, 10}, 2153, 5944, 2112, 6568, 6566, 2492, 2520, 2195, 2114, 2114, 2114, 6394, 6394, 6576, 6576, 6578, 6578, 6574, 6574 | |
| 7 | + | } | |
| 8 | + | } | |
| 9 | + | ||
| 10 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 11 | + | local count = 1 | |
| 12 | + | local targetItem = presents[item.itemid] | |
| 13 | + | if not targetItem then | |
| 14 | + | return true | |
| 15 | + | end | |
| 16 | + | ||
| 17 | + | local gift = targetItem[math.random(#targetItem)] | |
| 18 | + | if type(gift) == "table" then | |
| 19 | + | gift = gift[1] | |
| 20 | + | count = gift[2] | |
| 21 | + | end | |
| 22 | + | ||
| 23 | + | player:addItem(gift, count) | |
| 24 | + | item:remove(1) | |
| 25 | + | fromPosition:sendMagicEffect(CONST_ME_GIFT_WRAPS) | |
| 26 | + | return true | |
| 27 | + | end |
| @@ -0,0 +1,21 @@ | |||
| 1 | + | local upFloorIds = {1386, 3678, 5543, 22845, 22846} | |
| 2 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 3 | + | if table.contains(upFloorIds, item.itemid) then | |
| 4 | + | fromPosition:moveUpstairs() | |
| 5 | + | else | |
| 6 | + | fromPosition.z = fromPosition.z + 1 | |
| 7 | + | end | |
| 8 | + | ||
| 9 | + | if player:isPzLocked() and Tile(fromPosition):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 10 | + | player:sendCancelMessage(RETURNVALUE_PLAYERISPZLOCKED) | |
| 11 | + | return true | |
| 12 | + | end | |
| 13 | + | if item.itemid == 1369 then | |
| 14 | + | if item.actionid < 01 then | |
| 15 | + | return true | |
| 16 | + | end | |
| 17 | + | end | |
| 18 | + | ||
| 19 | + | player:teleportTo(fromPosition, false) | |
| 20 | + | return true | |
| 21 | + | end |
| @@ -0,0 +1,13 @@ | |||
| 1 | + | local transformItems = { | |
| 2 | + | [3743] = 4404, [4404] = 3743 | |
| 3 | + | } | |
| 4 | + | ||
| 5 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 6 | + | local transformIds = transformItems[item:getId()] | |
| 7 | + | if not transformIds then | |
| 8 | + | return false | |
| 9 | + | end | |
| 10 | + | ||
| 11 | + | item:transform(transformIds) | |
| 12 | + | return true | |
| 13 | + | end |
| @@ -0,0 +1,5 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | item:transform(item:getId() - 1) | |
| 3 | + | fromPosition:sendMagicEffect(CONST_ME_POFF) | |
| 4 | + | return true | |
| 5 | + | end |
| @@ -0,0 +1,24 @@ | |||
| 1 | + | local messages = { | |
| 2 | + | "You could win a beauty contest today!", | |
| 3 | + | "You rarely looked better.", | |
| 4 | + | "Well, you can't look good every day.", | |
| 5 | + | "You should think about a makeover.", | |
| 6 | + | "Is that the indication of a potbelly looming under your clothes?", | |
| 7 | + | "You look irresistible.", | |
| 8 | + | "You look tired.", | |
| 9 | + | "You look awesome!", | |
| 10 | + | "You nearly don't recognize yourself.", | |
| 11 | + | "You look fabulous.", | |
| 12 | + | "Surprise, surprise, you don't see yourself." | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 16 | + | if player:getStorageValue(PlayerStorageKeys.delayWallMirror) <= os.time() then | |
| 17 | + | player:say(messages[math.random(1, #messages)], TALKTYPE_MONSTER_SAY) | |
| 18 | + | player:setStorageValue(PlayerStorageKeys.delayWallMirror, os.time() + 20 * 60 * 60) | |
| 19 | + | player:addAchievementProgress("Vanity", 300) | |
| 20 | + | else | |
| 21 | + | player:say("Don't be so vain about your appearance.", TALKTYPE_MONSTER_SAY) | |
| 22 | + | end | |
| 23 | + | return true | |
| 24 | + | end |
| @@ -0,0 +1,4 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | player:sendTextMessage(MESSAGE_INFO_DESCR, "The time is " .. getFormattedWorldTime() .. ".") | |
| 3 | + | return true | |
| 4 | + | end |
| @@ -0,0 +1,8 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if math.random(3) == 1 then | |
| 3 | + | item:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 4 | + | else | |
| 5 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 6 | + | end | |
| 7 | + | return true | |
| 8 | + | end |
| @@ -0,0 +1,52 @@ | |||
| 1 | + | local windows = { | |
| 2 | + | [5303] = 6448, [5304] = 6449, [6438] = 6436, [6436] = 6438, | |
| 3 | + | [6439] = 6437, [6437] = 6439, [6442] = 6440, [6440] = 6442, | |
| 4 | + | [6443] = 6441, [6441] = 6443, [6446] = 6444, [6444] = 6446, | |
| 5 | + | [6447] = 6445, [6445] = 6447, [6448] = 5303, [6449] = 5304, | |
| 6 | + | [6452] = 6450, [6450] = 6452, [6453] = 6451, [6451] = 6453, | |
| 7 | + | [6456] = 6454, [6454] = 6456, [6457] = 6455, [6455] = 6457, | |
| 8 | + | [6460] = 6458, [6458] = 6460, [6461] = 6459, [6459] = 6461, | |
| 9 | + | [6464] = 6462, [6462] = 6464, [6465] = 6463, [6463] = 6465, | |
| 10 | + | [6468] = 6466, [6466] = 6468, [6469] = 6467, [6467] = 6469, | |
| 11 | + | [6472] = 6470, [6470] = 6472, [6473] = 6471, [6471] = 6473, | |
| 12 | + | [6790] = 6788, [6788] = 6790, [6791] = 6789, [6789] = 6791, | |
| 13 | + | [7027] = 7025, [7025] = 7027, [7028] = 7026, [7026] = 7028, | |
| 14 | + | [7031] = 7029, [7029] = 7031, [7032] = 7030, [7030] = 7032, | |
| 15 | + | [10264] = 10266, [10266] = 10264, [10265] = 10267, [10267] = 10265, | |
| 16 | + | [10488] = 10490, [10490] = 10488, [10489] = 10491, [10491] = 10489, | |
| 17 | + | [19427] = 19447, [19428] = 19448, [19441] = 19450, [19440] = 19449, | |
| 18 | + | [19443] = 20180, [19444] = 20181, [19445] = 20183, [19446] = 20184, | |
| 19 | + | [19447] = 19427, [19448] = 19428, [19449] = 19440, [19450] = 19441, | |
| 20 | + | [19974] = 20182, [19975] = 20185, [20180] = 19443, [20181] = 19444, | |
| 21 | + | [20182] = 19974, [20183] = 19445, [20184] = 19446, [20185] = 19975 | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 25 | + | local window = windows[item:getId()] | |
| 26 | + | if not window then | |
| 27 | + | return false | |
| 28 | + | end | |
| 29 | + | ||
| 30 | + | local tile = Tile(fromPosition) | |
| 31 | + | local house = tile and tile:getHouse() | |
| 32 | + | if not house then | |
| 33 | + | fromPosition.y = fromPosition.y - 1 | |
| 34 | + | tile = Tile(fromPosition) | |
| 35 | + | house = tile and tile:getHouse() | |
| 36 | + | if not house then | |
| 37 | + | fromPosition.y = fromPosition.y + 1 | |
| 38 | + | fromPosition.x = fromPosition.x - 1 | |
| 39 | + | tile = Tile(fromPosition) | |
| 40 | + | house = tile and tile:getHouse() | |
| 41 | + | end | |
| 42 | + | end | |
| 43 | + | ||
| 44 | + | if house and player:getTile():getHouse() ~= house and player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then | |
| 45 | + | return false | |
| 46 | + | end | |
| 47 | + | ||
| 48 | + | player:addAchievementProgress("Do Not Disturb", 100) | |
| 49 | + | player:addAchievementProgress("Let the Sunshine In", 100) | |
| 50 | + | item:transform(window) | |
| 51 | + | return true | |
| 52 | + | end |
| @@ -0,0 +1,82 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if item.actionid == 10155 then | |
| 3 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) < 01 then | |
| 4 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 5 | + | player:setStorageValue(_QUESTLOG[42].Value[01], 01) | |
| 6 | + | player:setStorageValue(_QUESTLOG[42].UID_01, 02) | |
| 7 | + | player:getPosition():sendMagicEffect(14) | |
| 8 | + | else | |
| 9 | + | player:getPosition():sendMagicEffect(03) | |
| 10 | + | end | |
| 11 | + | elseif item.actionid == 10156 then | |
| 12 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) == 01 then | |
| 13 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.") | |
| 14 | + | player:setStorageValue(_QUESTLOG[42].Value[01], 02) | |
| 15 | + | player:getPosition():sendMagicEffect(14) | |
| 16 | + | else | |
| 17 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then | |
| 18 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.") | |
| 19 | + | player:getPosition():sendMagicEffect(03) | |
| 20 | + | else | |
| 21 | + | player:getPosition():sendMagicEffect(03) | |
| 22 | + | end | |
| 23 | + | end | |
| 24 | + | elseif item.actionid == 10157 then | |
| 25 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) == 02 then | |
| 26 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.") | |
| 27 | + | player:setStorageValue(_QUESTLOG[42].Value[01], 03) | |
| 28 | + | player:getPosition():sendMagicEffect(14) | |
| 29 | + | else | |
| 30 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then | |
| 31 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.") | |
| 32 | + | player:getPosition():sendMagicEffect(03) | |
| 33 | + | else | |
| 34 | + | player:getPosition():sendMagicEffect(03) | |
| 35 | + | end | |
| 36 | + | end | |
| 37 | + | elseif item.actionid == 10158 then | |
| 38 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) == 03 then | |
| 39 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.") | |
| 40 | + | player:setStorageValue(_QUESTLOG[42].Value[01], 04) | |
| 41 | + | player:getPosition():sendMagicEffect(14) | |
| 42 | + | else | |
| 43 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then | |
| 44 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.") | |
| 45 | + | player:getPosition():sendMagicEffect(03) | |
| 46 | + | else | |
| 47 | + | player:getPosition():sendMagicEffect(03) | |
| 48 | + | end | |
| 49 | + | end | |
| 50 | + | elseif item.actionid == 10159 then | |
| 51 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) == 04 then | |
| 52 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.") | |
| 53 | + | player:setStorageValue(_QUESTLOG[42].Value[01], 05) | |
| 54 | + | player:getPosition():sendMagicEffect(14) | |
| 55 | + | else | |
| 56 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then | |
| 57 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.") | |
| 58 | + | player:getPosition():sendMagicEffect(03) | |
| 59 | + | else | |
| 60 | + | player:getPosition():sendMagicEffect(03) | |
| 61 | + | end | |
| 62 | + | end | |
| 63 | + | elseif item.actionid == 10160 then | |
| 64 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) == 05 then | |
| 65 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado.\nAcesso ao portal liberado.") | |
| 66 | + | player:setStorageValue(_QUESTLOG[42].Value[01], 06) | |
| 67 | + | player:setStorageValue(_QUESTLOG[42].UID_01, 03) | |
| 68 | + | player:getPosition():sendMagicEffect(14) | |
| 69 | + | ||
| 70 | + | doBackpack(player, 12) | |
| 71 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 72 | + | else | |
| 73 | + | if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then | |
| 74 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.") | |
| 75 | + | player:getPosition():sendMagicEffect(03) | |
| 76 | + | else | |
| 77 | + | player:getPosition():sendMagicEffect(03) | |
| 78 | + | end | |
| 79 | + | end | |
| 80 | + | end | |
| 81 | + | return true | |
| 82 | + | end |
| @@ -0,0 +1,199 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | ||
| 3 | + | local LEVEL_NEED = 100 | |
| 4 | + | local GLOBAL_RANK = 00 | |
| 5 | + | local PLAYER_RANK = player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) | |
| 6 | + | if player:getLevel() >= LEVEL_NEED then | |
| 7 | + | if item.actionid >= 3001 and item.actionid <= 3020 then | |
| 8 | + | GLOBAL_RANK = 01 | |
| 9 | + | elseif item.actionid >= 3021 and item.actionid <= 3040 then | |
| 10 | + | if PLAYER_RANK >= 02 then | |
| 11 | + | GLOBAL_RANK = 02 | |
| 12 | + | end | |
| 13 | + | elseif item.actionid >= 3041 and item.actionid <= 3060 then | |
| 14 | + | if PLAYER_RANK >= 03 then | |
| 15 | + | GLOBAL_RANK = 03 | |
| 16 | + | end | |
| 17 | + | elseif item.actionid >= 3061 and item.actionid <= 3080 then | |
| 18 | + | if PLAYER_RANK >= 04 then | |
| 19 | + | GLOBAL_RANK = 04 | |
| 20 | + | end | |
| 21 | + | elseif item.actionid >= 3081 and item.actionid <= 3099 then | |
| 22 | + | if PLAYER_RANK >= 05 then | |
| 23 | + | GLOBAL_RANK = 05 | |
| 24 | + | end | |
| 25 | + | end | |
| 26 | + | else | |
| 27 | + | player:getPosition():sendMagicEffect(03) | |
| 28 | + | return false | |
| 29 | + | end | |
| 30 | + | ||
| 31 | + | if GLOBAL_RANK > 00 then | |
| 32 | + | local CHEST_ID = (item.actionid - 3000) | |
| 33 | + | local GLOBAL_POSITION = 00 | |
| 34 | + | ||
| 35 | + | if GLOBAL_RANK == 02 then | |
| 36 | + | CHEST_ID = (item.actionid - 3020) | |
| 37 | + | elseif GLOBAL_RANK == 03 then | |
| 38 | + | CHEST_ID = (item.actionid - 3040) | |
| 39 | + | elseif GLOBAL_RANK == 04 then | |
| 40 | + | CHEST_ID = (item.actionid - 3060) | |
| 41 | + | elseif GLOBAL_RANK == 05 then | |
| 42 | + | CHEST_ID = (item.actionid - 3080) | |
| 43 | + | end | |
| 44 | + | ||
| 45 | + | if CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][01]) then | |
| 46 | + | GLOBAL_POSITION = 01 | |
| 47 | + | elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][02]) then | |
| 48 | + | GLOBAL_POSITION = 02 | |
| 49 | + | elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][03]) then | |
| 50 | + | GLOBAL_POSITION = 03 | |
| 51 | + | elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][04]) then | |
| 52 | + | GLOBAL_POSITION = 04 | |
| 53 | + | elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][05]) then | |
| 54 | + | GLOBAL_POSITION = 05 | |
| 55 | + | end | |
| 56 | + | ||
| 57 | + | if GLOBAL_POSITION > 00 then | |
| 58 | + | local CHEST_ID = Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][GLOBAL_POSITION]) | |
| 59 | + | if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][02][GLOBAL_RANK][GLOBAL_POSITION]) ~= CHEST_ID then | |
| 60 | + | local X = _GLOBAL_RANDOM.SAQUEADORES[GLOBAL_RANK][CHEST_ID] | |
| 61 | + | if X.REC[01][01] == 0002 then | |
| 62 | + | player:sendCancelMessage("@PassChest 01 " ..X.REC[01][02].. " " ..GLOBAL_POSITION.. " " ..CHEST_ID) | |
| 63 | + | return false | |
| 64 | + | end | |
| 65 | + | for REWARD = 01, #X.REC do | |
| 66 | + | if X.REC[REWARD][01] == 0000 then -- EXP | |
| 67 | + | player:addExperience(X.REC[REWARD][02], true, true) | |
| 68 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - EXP: " ..X.REC[REWARD][02]) | |
| 69 | + | if _DEBUG_MODE then | |
| 70 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: EXP [ " ..X.REC[REWARD][02].. " ]") | |
| 71 | + | end | |
| 72 | + | elseif X.REC[REWARD][01] == 0001 then -- GOLD | |
| 73 | + | PlayerGoldCoins(player, 02, X.REC[REWARD][02]) | |
| 74 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Gold Coin: " ..X.REC[REWARD][02]) | |
| 75 | + | if _DEBUG_MODE then | |
| 76 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Gold [ " ..X.REC[REWARD][02].. " ]") | |
| 77 | + | end | |
| 78 | + | elseif X.REC[REWARD][01] == 0003 then -- TASK POINTS (BRANCOS) | |
| 79 | + | PlayerTokenCoins(player, 01, X.REC[REWARD][02], 01) | |
| 80 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Pontos Brancos: " ..X.REC[REWARD][02]) | |
| 81 | + | if _DEBUG_MODE then | |
| 82 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: White Task [ " ..X.REC[REWARD][02].. " ]") | |
| 83 | + | end | |
| 84 | + | elseif X.REC[REWARD][01] == 0004 then -- TASK POINTS (AMARELOS) | |
| 85 | + | PlayerTokenCoins(player, 02, X.REC[REWARD][02], 01) | |
| 86 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Pontos Amarelos: " ..X.REC[REWARD][02]) | |
| 87 | + | if _DEBUG_MODE then | |
| 88 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Yellow Task [ " ..X.REC[REWARD][02].. " ]") | |
| 89 | + | end | |
| 90 | + | elseif X.REC[REWARD][01] == 0005 then -- TASK POINTS (AZUIS) | |
| 91 | + | PlayerTokenCoins(player, 03, X.REC[REWARD][02], 01) | |
| 92 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Pontos Azuis: " ..X.REC[REWARD][02]) | |
| 93 | + | if _DEBUG_MODE then | |
| 94 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Blue Task [ " ..X.REC[REWARD][02].. " ]") | |
| 95 | + | end | |
| 96 | + | elseif X.REC[REWARD][01] == 0006 then -- CRIPTOMOEDAS | |
| 97 | + | if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then | |
| 98 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (X.REC[REWARD][02] + 01)) | |
| 99 | + | else | |
| 100 | + | player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + X.REC[REWARD][02])) | |
| 101 | + | end | |
| 102 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Criptomoedas: " ..X.REC[REWARD][02]) | |
| 103 | + | if _DEBUG_MODE then | |
| 104 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Criptomoedas [ " ..X.REC[REWARD][02].. " ]") | |
| 105 | + | end | |
| 106 | + | else -- ITEMS | |
| 107 | + | if doBackpack(player, 00, 03, 00, 01) then | |
| 108 | + | local itemid = X.REC[REWARD][01] | |
| 109 | + | local slot = 03 | |
| 110 | + | local ext = 00 | |
| 111 | + | local rare = _ITEMS[itemid].RARE | |
| 112 | + | local star = _ITEMS[itemid].STAR | |
| 113 | + | local qnt = X.REC[REWARD][02] | |
| 114 | + | doBackpack(player, 03, slot, ext, 01, itemid) -- Procurar | |
| 115 | + | if doBackpack(player, 01, slot, ext, 00, itemid, rare, star, qnt) then | |
| 116 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - " .._ITEMS[itemid].NAME.. ", x" ..X.REC[REWARD][02]) | |
| 117 | + | if _DEBUG_MODE then | |
| 118 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Item [ " .._ITEMS[itemid].NAME.. ", x" ..X.REC[REWARD][02].. " ]") | |
| 119 | + | end | |
| 120 | + | player:getPosition():sendMagicEffect(14) | |
| 121 | + | end | |
| 122 | + | else | |
| 123 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sua Backpack esta cheia.\nObtenha espaco para finalizar a Quest.") | |
| 124 | + | player:getPosition():sendMagicEffect(03) | |
| 125 | + | return false | |
| 126 | + | end | |
| 127 | + | end | |
| 128 | + | ||
| 129 | + | local PLAYER_VALUE = player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) | |
| 130 | + | if PLAYER_RANK < 01 then PLAYER_RANK = 01 end | |
| 131 | + | if PLAYER_VALUE < 00 then PLAYER_VALUE = 00 end | |
| 132 | + | ||
| 133 | + | if PLAYER_RANK == GLOBAL_RANK then | |
| 134 | + | if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) < 00 then | |
| 135 | + | player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02], 01) | |
| 136 | + | else | |
| 137 | + | player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02], (player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) + 01)) | |
| 138 | + | local MAX_RANK = _GLOBAL_RANDOM.SAQUEADORES[00][00][PLAYER_RANK] | |
| 139 | + | if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) < 05 then | |
| 140 | + | if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) == MAX_RANK then | |
| 141 | + | if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) < 01 then | |
| 142 | + | player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01], 02) | |
| 143 | + | else | |
| 144 | + | player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01], (player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) + 01)) | |
| 145 | + | end | |
| 146 | + | ||
| 147 | + | if _DEBUG_MODE then | |
| 148 | + | print("[ACTION - SAQUEADORES] " ..player:getName().. " - Avan�ou de Rank") | |
| 149 | + | end | |
| 150 | + | player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[SAQUEADOR] Voc� avan�ou de RANK.") | |
| 151 | + | end | |
| 152 | + | end | |
| 153 | + | end | |
| 154 | + | end | |
| 155 | + | ||
| 156 | + | -- DESAFIO | |
| 157 | + | if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then | |
| 158 | + | onPlayerDesafios(player, 75, 01) | |
| 159 | + | end | |
| 160 | + | if player:getStorageValue(_QUESTLOG[178].UID_01) == 01 then | |
| 161 | + | if player:getStorageValue(11009) == 04 then | |
| 162 | + | player:setStorageValue(_QUESTLOG[178].UID_01, 100) | |
| 163 | + | player:setStorageValue(11009, nil) | |
| 164 | + | ||
| 165 | + | doBackpack(player, 12) | |
| 166 | + | player:sendCancelMessage("@LoadQuestWindows") | |
| 167 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 168 | + | else | |
| 169 | + | player:setStorageValue(11009, (player:getStorageValue(11009) + 01)) | |
| 170 | + | doBackpack(player, 12) | |
| 171 | + | end | |
| 172 | + | end | |
| 173 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 174 | + | player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][02][GLOBAL_RANK][GLOBAL_POSITION], CHEST_ID) | |
| 175 | + | player:getPosition():sendMagicEffect(14) | |
| 176 | + | return false | |
| 177 | + | end | |
| 178 | + | else | |
| 179 | + | player:getPosition():sendMagicEffect(03) | |
| 180 | + | end | |
| 181 | + | else | |
| 182 | + | player:getPosition():sendMagicEffect(03) | |
| 183 | + | end | |
| 184 | + | else | |
| 185 | + | player:getPosition():sendMagicEffect(03) | |
| 186 | + | end | |
| 187 | + | return true | |
| 188 | + | end | |
| 189 | + | ||
| 190 | + | ||
| 191 | + | ||
| 192 | + | ||
| 193 | + | ||
| 194 | + | ||
| 195 | + | ||
| 196 | + | ||
| 197 | + | ||
| 198 | + | ||
| 199 | + |
| @@ -0,0 +1,11 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if item.itemid == 1453 then | |
| 3 | + | item:transform(1454) | |
| 4 | + | elseif item.itemid == 1454 then | |
| 5 | + | item:transform(1452) | |
| 6 | + | elseif item.itemid == 1452 then | |
| 7 | + | item:transform(1455) | |
| 8 | + | elseif item.itemid == 1455 then | |
| 9 | + | item:transform(1453) | |
| 10 | + | end | |
| 11 | + | end |
| @@ -0,0 +1,146 @@ | |||
| 1 | + | local Timer_01 = 00 | |
| 2 | + | local Timer_02 = 00 | |
| 3 | + | local Timer_03 = 00 | |
| 4 | + | local Timer_04 = 00 | |
| 5 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 6 | + | local Player_01 = Tile(3617, 1264, 8) | |
| 7 | + | local Player_02 = Tile(3620, 1267, 8) | |
| 8 | + | local Player_03 = Tile(3617, 1270, 8) | |
| 9 | + | local Player_04 = Tile(3614, 1267, 8) | |
| 10 | + | ||
| 11 | + | local Player_One = Player_01:getTopCreature() | |
| 12 | + | local Player_Two = Player_02:getTopCreature() | |
| 13 | + | local Player_Tre = Player_03:getTopCreature() | |
| 14 | + | local Player_Fou = Player_04:getTopCreature() | |
| 15 | + | ||
| 16 | + | if item.itemid == 1946 then | |
| 17 | + | item:transform(1945) | |
| 18 | + | return true | |
| 19 | + | end | |
| 20 | + | if Player_One and Player_One:isPlayer() and Player_Two and Player_Two:isPlayer() and Player_Tre and Player_Tre:isPlayer() and Player_Fou and Player_Fou:isPlayer() then | |
| 21 | + | item:transform(1946) | |
| 22 | + | Player_One:teleportTo({x=3619, y=1296, z=08}) | |
| 23 | + | Player_One:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 24 | + | Timer_01 = 59 | |
| 25 | + | addEvent(onTesouroUm, 1000) | |
| 26 | + | ||
| 27 | + | Player_Two:teleportTo({x=3619, y=1310, z=08}) | |
| 28 | + | Player_Two:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 29 | + | Timer_02 = 59 | |
| 30 | + | addEvent(onTesouroDois, 1000) | |
| 31 | + | ||
| 32 | + | Player_Tre:teleportTo({x=3619, y=1324, z=08}) | |
| 33 | + | Player_Tre:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 34 | + | Timer_03 = 59 | |
| 35 | + | addEvent(onTesouroTres, 1000) | |
| 36 | + | ||
| 37 | + | Player_Fou:teleportTo({x=3619, y=1338, z=08}) | |
| 38 | + | Player_Fou:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 39 | + | Timer_04 = 59 | |
| 40 | + | addEvent(onTesouroQuatro, 1000) | |
| 41 | + | else | |
| 42 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Todos precisam ficar em suas posi�es.") | |
| 43 | + | player:getPosition():sendMagicEffect(03) | |
| 44 | + | end | |
| 45 | + | return true | |
| 46 | + | end | |
| 47 | + | function onTesouroUm() | |
| 48 | + | local from = {x=3616, y=1293, z=08} | |
| 49 | + | local to = {x=3622, y=1299, z=08} | |
| 50 | + | for A = from.x, to.x do | |
| 51 | + | for B = from.y, to.y do | |
| 52 | + | for C = from.z, to.z do | |
| 53 | + | local tile = Tile(A, B, C) | |
| 54 | + | if tile ~= nil then | |
| 55 | + | local creature = tile:getTopCreature() | |
| 56 | + | if creature and creature:isPlayer() then | |
| 57 | + | if Timer_01 == 00 then | |
| 58 | + | creature:teleportTo({x=3602, y=1261, z=08}) | |
| 59 | + | creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 60 | + | break | |
| 61 | + | else | |
| 62 | + | Timer_01 = Timer_01 - 01 | |
| 63 | + | addEvent(onTesouroUm, 1000) | |
| 64 | + | break | |
| 65 | + | end | |
| 66 | + | end | |
| 67 | + | end | |
| 68 | + | end | |
| 69 | + | end | |
| 70 | + | end | |
| 71 | + | end | |
| 72 | + | function onTesouroDois() | |
| 73 | + | local from = {x=3616, y=1307, z=08} | |
| 74 | + | local to = {x=3622, y=1313, z=08} | |
| 75 | + | for A = from.x, to.x do | |
| 76 | + | for B = from.y, to.y do | |
| 77 | + | for C = from.z, to.z do | |
| 78 | + | local tile = Tile(A, B, C) | |
| 79 | + | if tile ~= nil then | |
| 80 | + | local creature = tile:getTopCreature() | |
| 81 | + | if creature and creature:isPlayer() then | |
| 82 | + | if Timer_02 == 00 then | |
| 83 | + | creature:teleportTo({x=3602, y=1261, z=08}) | |
| 84 | + | creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 85 | + | break | |
| 86 | + | else | |
| 87 | + | Timer_02 = Timer_02 - 01 | |
| 88 | + | addEvent(onTesouroDois, 1000) | |
| 89 | + | break | |
| 90 | + | end | |
| 91 | + | end | |
| 92 | + | end | |
| 93 | + | end | |
| 94 | + | end | |
| 95 | + | end | |
| 96 | + | end | |
| 97 | + | function onTesouroTres() | |
| 98 | + | local from = {x=3616, y=1321, z=08} | |
| 99 | + | local to = {x=3622, y=1327, z=08} | |
| 100 | + | for A = from.x, to.x do | |
| 101 | + | for B = from.y, to.y do | |
| 102 | + | for C = from.z, to.z do | |
| 103 | + | local tile = Tile(A, B, C) | |
| 104 | + | if tile ~= nil then | |
| 105 | + | local creature = tile:getTopCreature() | |
| 106 | + | if creature and creature:isPlayer() then | |
| 107 | + | if Timer_03 == 00 then | |
| 108 | + | creature:teleportTo({x=3602, y=1261, z=08}) | |
| 109 | + | creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 110 | + | break | |
| 111 | + | else | |
| 112 | + | Timer_03 = Timer_03 - 01 | |
| 113 | + | addEvent(onTesouroTres, 1000) | |
| 114 | + | break | |
| 115 | + | end | |
| 116 | + | end | |
| 117 | + | end | |
| 118 | + | end | |
| 119 | + | end | |
| 120 | + | end | |
| 121 | + | end | |
| 122 | + | function onTesouroQuatro() | |
| 123 | + | local from = {x=3616, y=1335, z=08} | |
| 124 | + | local to = {x=3622, y=1341, z=08} | |
| 125 | + | for A = from.x, to.x do | |
| 126 | + | for B = from.y, to.y do | |
| 127 | + | for C = from.z, to.z do | |
| 128 | + | local tile = Tile(A, B, C) | |
| 129 | + | if tile ~= nil then | |
| 130 | + | local creature = tile:getTopCreature() | |
| 131 | + | if creature and creature:isPlayer() then | |
| 132 | + | if Timer_04 == 00 then | |
| 133 | + | creature:teleportTo({x=3602, y=1261, z=08}) | |
| 134 | + | creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 135 | + | break | |
| 136 | + | else | |
| 137 | + | Timer_04 = Timer_04 - 01 | |
| 138 | + | addEvent(onTesouroQuatro, 1000) | |
| 139 | + | break | |
| 140 | + | end | |
| 141 | + | end | |
| 142 | + | end | |
| 143 | + | end | |
| 144 | + | end | |
| 145 | + | end | |
| 146 | + | end |
| @@ -0,0 +1,167 @@ | |||
| 1 | + | local M = 0 | |
| 2 | + | local S = 0 | |
| 3 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 4 | + | local id = { | |
| 5 | + | [1] = { 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, | |
| 6 | + | 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, | |
| 7 | + | 1020, 1021, 1022, 1023, 1024, 1025, 1026 }, | |
| 8 | + | ||
| 9 | + | [2] = { 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | |
| 10 | + | 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, | |
| 11 | + | 2020, 2021, 2022, 2023, 2024 }, | |
| 12 | + | ||
| 13 | + | [3] = { 10500, 10501, 10502, 10503, 10504, 10505, 10506, 10507, 10508, | |
| 14 | + | 10509, 10510, 10511, 10512, 10513, 10514, 10515, 10516, 10517, | |
| 15 | + | 10518, 10519, 10520, 10521, 10522, 10523, 10524, 10525, 10526 }, | |
| 16 | + | --[[[3] = { 11001, 11002, 11003, 11004, 11005, 11006, 11007, 11008, 11009, | |
| 17 | + | 11010, 11011, 11012, 11013, 11014, 11015, 11016, 11017, 11018, | |
| 18 | + | 11019, 11020, 11021, 11022, 11023, 11024, 11025, 11026, 11027 },]] | |
| 19 | + | ||
| 20 | + | [4] = { 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009, | |
| 21 | + | 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019, | |
| 22 | + | 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029, | |
| 23 | + | 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039, | |
| 24 | + | 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049 }, | |
| 25 | + | ||
| 26 | + | [5] = { 5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009, | |
| 27 | + | 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019, | |
| 28 | + | 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029, | |
| 29 | + | 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038, 5039, | |
| 30 | + | 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048 }, | |
| 31 | + | ||
| 32 | + | [6] = { 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, | |
| 33 | + | 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019, | |
| 34 | + | 6020, 6021, 6022, 6023 }, | |
| 35 | + | ||
| 36 | + | [7] = { 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010 }, | |
| 37 | + | ||
| 38 | + | [8] = { 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, | |
| 39 | + | 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019, | |
| 40 | + | 8020, 8021, 8022, 8023, 8024 }, | |
| 41 | + | ||
| 42 | + | [9] = { 9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, | |
| 43 | + | 9010, 9011, 9012, 9013, 9014, 9015, 9016, 9017, 9018, 9019, | |
| 44 | + | 9020 }, | |
| 45 | + | } | |
| 46 | + | ||
| 47 | + | local type = 0 | |
| 48 | + | local slot = math.random(1, 1) | |
| 49 | + | local itemid = 1002 --id[slot][math.random(01, #id[slot])] | |
| 50 | + | local rare = 02 --math.random(00, 04) | |
| 51 | + | local star = 01 --math.random(00, 02) | |
| 52 | + | local qnt = 01 --math.random(01, 05) | |
| 53 | + | local ext = 0 | |
| 54 | + | ||
| 55 | + | if type == 0 then | |
| 56 | + | if _ITEMS[itemid] then | |
| 57 | + | if doBackpack(player, 00, slot, ext, 01) then | |
| 58 | + | if slot == 3 then | |
| 59 | + | doBackpack(player, 03, slot, ext, 01, itemid) -- Procurar | |
| 60 | + | if doBackpack(player, 01, slot, ext, 0, itemid, rare, star, qnt) then | |
| 61 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o item [ " .._ITEMS[itemid].NAME.. ", x" ..qnt.." ].") | |
| 62 | + | player:getPosition():sendMagicEffect(14) | |
| 63 | + | end | |
| 64 | + | else | |
| 65 | + | if doBackpack(player, 01, slot, ext, 0, itemid, rare, star) then | |
| 66 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o item [ " .._ITEMS[itemid].NAME.. " ].") | |
| 67 | + | player:getPosition():sendMagicEffect(14) | |
| 68 | + | end | |
| 69 | + | end | |
| 70 | + | else | |
| 71 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sua Backpack esta cheia.") | |
| 72 | + | player:getPosition():sendMagicEffect(03) | |
| 73 | + | end | |
| 74 | + | else | |
| 75 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Tente novamente.") | |
| 76 | + | player:getPosition():sendMagicEffect(03) | |
| 77 | + | end | |
| 78 | + | elseif type == 1 then | |
| 79 | + | local sumid = math.random(1000, 1156) | |
| 80 | + | local star = _SUMMON[sumid].STAR | |
| 81 | + | if doSummon(player, 02, star, sumid) == 0 then | |
| 82 | + | doSummon(player, 00, star) | |
| 83 | + | doSummon(player, 01, star, sumid) | |
| 84 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o summon \n[ " .._SUMMON[sumid].NAME.. " ]\nEstrelas [ " ..star.. " ].") | |
| 85 | + | player:getPosition():sendMagicEffect(14) | |
| 86 | + | doSummon(player, 00, 00) | |
| 87 | + | else | |
| 88 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Você já possui o summon [ " .._SUMMON[sumid].NAME.. " ].\nTente novamente") | |
| 89 | + | player:getPosition():sendMagicEffect(03) | |
| 90 | + | end | |
| 91 | + | elseif type == 2 then | |
| 92 | + | M = 00 | |
| 93 | + | S = 15 | |
| 94 | + | local party = player:getParty() | |
| 95 | + | if not party then | |
| 96 | + | player:sendCancelMessage("@DGTime 01") | |
| 97 | + | else | |
| 98 | + | local members = party:getMembers() | |
| 99 | + | members[#members + 1] = party:getLeader() | |
| 100 | + | for _, member in ipairs(members) do | |
| 101 | + | member:sendCancelMessage("@DGTime 01") | |
| 102 | + | end | |
| 103 | + | end | |
| 104 | + | ||
| 105 | + | addEvent(onCountTimer, 1000, player.uid) | |
| 106 | + | else | |
| 107 | + | player:sendCancelMessage("@TaskMSG") | |
| 108 | + | end | |
| 109 | + | end | |
| 110 | + | ||
| 111 | + | function onCountTimer(cid) | |
| 112 | + | local player = Player(cid) | |
| 113 | + | if player then | |
| 114 | + | if M == 0 and S == 0 then | |
| 115 | + | local party = player:getParty() | |
| 116 | + | if not party then | |
| 117 | + | player:sendCancelMessage("@DGTime 00") | |
| 118 | + | else | |
| 119 | + | local members = party:getMembers() | |
| 120 | + | members[#members + 1] = party:getLeader() | |
| 121 | + | for _, member in ipairs(members) do | |
| 122 | + | member:sendCancelMessage("@DGTime 00") | |
| 123 | + | end | |
| 124 | + | end | |
| 125 | + | else | |
| 126 | + | local M1 = 0 local S1 = 0 | |
| 127 | + | local M2 = 0 local S2 = 0 | |
| 128 | + | ||
| 129 | + | if M > 0 and S > 0 then | |
| 130 | + | S = S - 1 | |
| 131 | + | elseif M > 0 and S == 0 then | |
| 132 | + | S = 59 | |
| 133 | + | M = M - 1 | |
| 134 | + | elseif M == 0 and S > 0 then | |
| 135 | + | S = S - 1 | |
| 136 | + | end | |
| 137 | + | ||
| 138 | + | if string.len(M) == 2 then | |
| 139 | + | M1 = string.sub(M, 1, 1) | |
| 140 | + | M2 = string.sub(M, 2, 2) | |
| 141 | + | else | |
| 142 | + | M1 = 0 | |
| 143 | + | M2 = string.sub(M, 1, 1) | |
| 144 | + | end | |
| 145 | + | if string.len(S) == 2 then | |
| 146 | + | S1 = string.sub(S, 1, 1) | |
| 147 | + | S2 = string.sub(S, 2, 2) | |
| 148 | + | else | |
| 149 | + | S1 = 0 | |
| 150 | + | S2 = string.sub(S, 1, 1) | |
| 151 | + | end | |
| 152 | + | ||
| 153 | + | local party = player:getParty() | |
| 154 | + | if not party then | |
| 155 | + | player:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2) | |
| 156 | + | else | |
| 157 | + | local members = party:getMembers() | |
| 158 | + | members[#members + 1] = party:getLeader() | |
| 159 | + | for _, member in ipairs(members) do | |
| 160 | + | member:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2) | |
| 161 | + | end | |
| 162 | + | end | |
| 163 | + | ||
| 164 | + | addEvent(onCountTimer, 1000, player.uid) | |
| 165 | + | end | |
| 166 | + | end | |
| 167 | + | end |
| @@ -0,0 +1,87 @@ | |||
| 1 | + | local exhaust = {} | |
| 2 | + | local timeExhaust = 05 * 1000 | |
| 3 | + | ||
| 4 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 5 | + | ||
| 6 | + | if player:getLevel() < _GLOBAL_RANDOM.WARZONE.LEVEL then | |
| 7 | + | player:sendCancelMessage("Somente jogadores de Nv. " .._GLOBAL_RANDOM.WARZONE.LEVEL.. " ou superior podem batalhar.") | |
| 8 | + | player:getPosition():sendMagicEffect(03) | |
| 9 | + | return false | |
| 10 | + | end | |
| 11 | + | if player:getVocation():getBase():getId() < 01 then | |
| 12 | + | player:sendCancelMessage("Jogadores sem Vocation n�o pode entrar.") | |
| 13 | + | player:getPosition():sendMagicEffect(03) | |
| 14 | + | return false | |
| 15 | + | end | |
| 16 | + | ||
| 17 | + | if player:getStorageValue(_SYSTEM.PLAYER_EXHAUST) < 01 then | |
| 18 | + | if item.actionid == 2053 then | |
| 19 | + | local QntPlayers = 0 | |
| 20 | + | local from = {x=3893, y=1122, z=07} | |
| 21 | + | local to = {x=4047, y=1258, z=07} | |
| 22 | + | for A = from.x, to.x do | |
| 23 | + | for B = from.y, to.y do | |
| 24 | + | for C = from.z, to.z do | |
| 25 | + | local tile = Tile(A, B, C) | |
| 26 | + | if tile then | |
| 27 | + | local creature = tile:getTopCreature() | |
| 28 | + | if creature and creature:isPlayer() then | |
| 29 | + | QntPlayers = QntPlayers + 01 | |
| 30 | + | end | |
| 31 | + | end | |
| 32 | + | end | |
| 33 | + | end | |
| 34 | + | end | |
| 35 | + | ||
| 36 | + | local title = "Entrada para a Warzone" | |
| 37 | + | local message = "Atualmente h� " ..QntPlayers.. " jogador(es) na Warzone.\nDeseja entrar e batalhar?" | |
| 38 | + | local startOracle = ModalWindow(1000, title, message) | |
| 39 | + | startOracle:addButton(100, "Yes") | |
| 40 | + | startOracle:addButton(101, "No") | |
| 41 | + | startOracle:setDefaultEnterButton(100) | |
| 42 | + | startOracle:setDefaultEscapeButton(101) | |
| 43 | + | startOracle:sendToPlayer(player) | |
| 44 | + | ||
| 45 | + | player:setStorageValue(_SYSTEM.PLAYER_EXHAUST, 01) | |
| 46 | + | local cid = player:getId() | |
| 47 | + | if not exhaust[cid] then | |
| 48 | + | exhaust[cid] = addEvent(onPlayerExhaust, timeExhaust, cid) | |
| 49 | + | end | |
| 50 | + | ||
| 51 | + | elseif item.actionid == 2054 then | |
| 52 | + | local title = "Saida da Warzone" | |
| 53 | + | local message = "Deseja sair da Warzone?" | |
| 54 | + | local startOracle = ModalWindow(1001, title, message) | |
| 55 | + | startOracle:addButton(100, "Yes") | |
| 56 | + | startOracle:addButton(101, "No") | |
| 57 | + | startOracle:setDefaultEnterButton(100) | |
| 58 | + | startOracle:setDefaultEscapeButton(101) | |
| 59 | + | startOracle:sendToPlayer(player) | |
| 60 | + | ||
| 61 | + | elseif item.actionid == 2055 then | |
| 62 | + | local title = "Arme-se para batalhar" | |
| 63 | + | local message = "Qual categoria de arma deseja usar?\nA arma ser� escolhida aleat�riamente.\n\n" | |
| 64 | + | local startOracle = ModalWindow(1002, title, message) | |
| 65 | + | startOracle:addChoice(1, "Pistola") | |
| 66 | + | startOracle:addChoice(2, "Rifle") | |
| 67 | + | startOracle:addChoice(3, "Metralhadora") | |
| 68 | + | startOracle:addChoice(4, "Espingarda") | |
| 69 | + | ||
| 70 | + | startOracle:addButton(100, "Escolher") | |
| 71 | + | startOracle:addButton(101, "Cancelar") | |
| 72 | + | startOracle:setDefaultEnterButton(100) | |
| 73 | + | startOracle:setDefaultEscapeButton(101) | |
| 74 | + | startOracle:sendToPlayer(player) | |
| 75 | + | end | |
| 76 | + | else | |
| 77 | + | player:sendCancelMessage("Aguarde alguns segundos para usar novamente.") | |
| 78 | + | player:getPosition():sendMagicEffect(03) | |
| 79 | + | end | |
| 80 | + | ||
| 81 | + | return true | |
| 82 | + | end | |
| 83 | + | function onPlayerExhaust(cid) | |
| 84 | + | local player = Player(cid) | |
| 85 | + | player:setStorageValue(_SYSTEM.PLAYER_EXHAUST, nil) | |
| 86 | + | exhaust[cid] = nil | |
| 87 | + | end |
| @@ -0,0 +1,7 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <channels> | |
| 3 | + | <channel id="2" name="Tutor" script="tutor.lua" /> | |
| 4 | + | <channel id="3" name="Global Chat" public="1" script="worldchat.lua" /> | |
| 5 | + | <channel id="4" name="Help" public="1" script="help.lua" /> | |
| 6 | + | <channel id="7" name="Lua_advanced" public="1" script="execute.lua" /> | |
| 7 | + | </channels> |
| @@ -0,0 +1,56 @@ | |||
| 1 | + | function canJoin(player) | |
| 2 | + | if player:getGroup():getAccess() then | |
| 3 | + | return true | |
| 4 | + | end | |
| 5 | + | ||
| 6 | + | return false | |
| 7 | + | end | |
| 8 | + | ||
| 9 | + | local function cleanGlobalVariables() | |
| 10 | + | _G["cid"] = nil | |
| 11 | + | _G["player"] = nil | |
| 12 | + | _G["creature"] = nil | |
| 13 | + | _G["pos"] = nil | |
| 14 | + | _G["tile"] = nil | |
| 15 | + | _G["container"] = nil | |
| 16 | + | _G["group"] = nil | |
| 17 | + | _G["vocation"] = nil | |
| 18 | + | _G["town"] = nil | |
| 19 | + | _G["house"] = nil | |
| 20 | + | _G["party"] = nil | |
| 21 | + | end | |
| 22 | + | ||
| 23 | + | function onSpeak(player, type, message) | |
| 24 | + | local pos = Position(player:getPosition()) | |
| 25 | + | local tile = Tile(pos) | |
| 26 | + | ||
| 27 | + | _G["cid"] = player:getId() | |
| 28 | + | _G["player"] = player | |
| 29 | + | _G["creature"] = Creature(player:getId()) | |
| 30 | + | _G["pos"] = pos | |
| 31 | + | _G["tile"] = tile | |
| 32 | + | _G["container"] = player:getSlotItem(CONST_SLOT_BACKPACK) | |
| 33 | + | _G["group"] = player:getGroup() | |
| 34 | + | _G["vocation"] = player:getVocation() | |
| 35 | + | _G["town"] = player:getTown() | |
| 36 | + | _G["house"] = tile:getHouse() | |
| 37 | + | _G["party"] = player:getParty() | |
| 38 | + | ||
| 39 | + | local res, err = loadstring(message) | |
| 40 | + | if res then | |
| 41 | + | local ret, err = pcall(res) | |
| 42 | + | if not ret then | |
| 43 | + | player:sendChannelMessage(player:getName(), "Lua Script Error: " .. err .. ".", TALKTYPE_CHANNEL_O, 7) | |
| 44 | + | cleanGlobalVariables() | |
| 45 | + | return false | |
| 46 | + | end | |
| 47 | + | else | |
| 48 | + | player:sendChannelMessage(player:getName(), "Lua Script Error: " .. err .. ".", TALKTYPE_CHANNEL_O, 7) | |
| 49 | + | cleanGlobalVariables() | |
| 50 | + | return false | |
| 51 | + | end | |
| 52 | + | ||
| 53 | + | player:sendChannelMessage("", player:getName() .. ">> " .. message, TALKTYPE_CHANNEL_Y, 7) | |
| 54 | + | cleanGlobalVariables() | |
| 55 | + | return false | |
| 56 | + | end |
| @@ -0,0 +1,77 @@ | |||
| 1 | + | local CHANNEL_HELP = 7 | |
| 2 | + | ||
| 3 | + | local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT) | |
| 4 | + | muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP) | |
| 5 | + | muted:setParameter(CONDITION_PARAM_TICKS, 3600000) | |
| 6 | + | ||
| 7 | + | function onSpeak(player, type, message) | |
| 8 | + | local playerAccountType = player:getAccountType() | |
| 9 | + | if player:getLevel() == 1 and playerAccountType == ACCOUNT_TYPE_NORMAL then | |
| 10 | + | player:sendCancelMessage("Voc� n�o pode falar em canais enquanto estiver no n�vel 1.") | |
| 11 | + | return false | |
| 12 | + | end | |
| 13 | + | ||
| 14 | + | if player:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then | |
| 15 | + | player:sendCancelMessage("Voc� foi silenciado no canal de Ajuda por us�-lo de forma inadequada.") | |
| 16 | + | return false | |
| 17 | + | end | |
| 18 | + | ||
| 19 | + | if playerAccountType >= ACCOUNT_TYPE_TUTOR then | |
| 20 | + | if string.sub(message, 1, 6) == "!mute " then | |
| 21 | + | local targetName = string.sub(message, 7) | |
| 22 | + | local target = Player(targetName) | |
| 23 | + | if target then | |
| 24 | + | if playerAccountType > target:getAccountType() then | |
| 25 | + | if not target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then | |
| 26 | + | target:addCondition(muted) | |
| 27 | + | sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " foi silenciado por " .. player:getName() .. " por usar o Canal de Ajuda de forma inadequada.") | |
| 28 | + | else | |
| 29 | + | player:sendCancelMessage("Esse jogador j� est� silenciado.") | |
| 30 | + | end | |
| 31 | + | else | |
| 32 | + | player:sendCancelMessage("Voc� n�o est� autorizado a silenciar esse jogador.") | |
| 33 | + | end | |
| 34 | + | else | |
| 35 | + | player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE) | |
| 36 | + | end | |
| 37 | + | return false | |
| 38 | + | elseif string.sub(message, 1, 8) == "!unmute " then | |
| 39 | + | local targetName = string.sub(message, 9) | |
| 40 | + | local target = Player(targetName) | |
| 41 | + | if target then | |
| 42 | + | if playerAccountType > target:getAccountType() then | |
| 43 | + | if target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then | |
| 44 | + | target:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) | |
| 45 | + | sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been unmuted by " .. player:getName() .. ".") | |
| 46 | + | else | |
| 47 | + | player:sendCancelMessage("Esse jogador n�o est� mudo.") | |
| 48 | + | end | |
| 49 | + | else | |
| 50 | + | player:sendCancelMessage("Voc� n�o est� autorizado a ativar o som desse player.") | |
| 51 | + | end | |
| 52 | + | else | |
| 53 | + | player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE) | |
| 54 | + | end | |
| 55 | + | return false | |
| 56 | + | end | |
| 57 | + | end | |
| 58 | + | ||
| 59 | + | if type == TALKTYPE_CHANNEL_Y then | |
| 60 | + | if playerAccountType >= ACCOUNT_TYPE_TUTOR or player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then | |
| 61 | + | type = TALKTYPE_CHANNEL_O | |
| 62 | + | end | |
| 63 | + | elseif type == TALKTYPE_CHANNEL_O then | |
| 64 | + | if playerAccountType < ACCOUNT_TYPE_TUTOR and not player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then | |
| 65 | + | type = TALKTYPE_CHANNEL_Y | |
| 66 | + | end | |
| 67 | + | elseif type == TALKTYPE_CHANNEL_R1 then | |
| 68 | + | if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then | |
| 69 | + | if playerAccountType >= ACCOUNT_TYPE_TUTOR or player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then | |
| 70 | + | type = TALKTYPE_CHANNEL_O | |
| 71 | + | else | |
| 72 | + | type = TALKTYPE_CHANNEL_Y | |
| 73 | + | end | |
| 74 | + | end | |
| 75 | + | end | |
| 76 | + | return type | |
| 77 | + | end |
| @@ -0,0 +1,21 @@ | |||
| 1 | + | function canJoin(player) | |
| 2 | + | return player:getAccountType() >= ACCOUNT_TYPE_TUTOR | |
| 3 | + | end | |
| 4 | + | ||
| 5 | + | function onSpeak(player, type, message) | |
| 6 | + | local playerAccountType = player:getAccountType() | |
| 7 | + | if type == TALKTYPE_CHANNEL_Y then | |
| 8 | + | if playerAccountType >= ACCOUNT_TYPE_SENIORTUTOR then | |
| 9 | + | type = TALKTYPE_CHANNEL_O | |
| 10 | + | end | |
| 11 | + | elseif type == TALKTYPE_CHANNEL_O then | |
| 12 | + | if playerAccountType < ACCOUNT_TYPE_SENIORTUTOR then | |
| 13 | + | type = TALKTYPE_CHANNEL_Y | |
| 14 | + | end | |
| 15 | + | elseif type == TALKTYPE_CHANNEL_R1 then | |
| 16 | + | if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then | |
| 17 | + | type = TALKTYPE_CHANNEL_Y | |
| 18 | + | end | |
| 19 | + | end | |
| 20 | + | return type | |
| 21 | + | end |
| @@ -0,0 +1,22 @@ | |||
| 1 | + | function onSpeak(player, type, message) | |
| 2 | + | local playerAccountType = player:getAccountType() | |
| 3 | + | if player:getLevel() == 1 and playerAccountType < ACCOUNT_TYPE_GAMEMASTER then | |
| 4 | + | player:sendCancelMessage("You may not speak into channels as long as you are on level 1.") | |
| 5 | + | return false | |
| 6 | + | end | |
| 7 | + | ||
| 8 | + | if type == TALKTYPE_CHANNEL_Y then | |
| 9 | + | if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then | |
| 10 | + | type = TALKTYPE_CHANNEL_O | |
| 11 | + | end | |
| 12 | + | elseif type == TALKTYPE_CHANNEL_O then | |
| 13 | + | if playerAccountType < ACCOUNT_TYPE_GAMEMASTER then | |
| 14 | + | type = TALKTYPE_CHANNEL_Y | |
| 15 | + | end | |
| 16 | + | elseif type == TALKTYPE_CHANNEL_R1 then | |
| 17 | + | if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then | |
| 18 | + | type = TALKTYPE_CHANNEL_Y | |
| 19 | + | end | |
| 20 | + | end | |
| 21 | + | return type | |
| 22 | + | end |
| @@ -0,0 +1,20 @@ | |||
| 1 | + | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | + | <creaturescripts> | |
| 3 | + | <event type="healthchange" name="Defense" script="defense.lua" /> | |
| 4 | + | <event type="kill" name="onDGKill" script="dg_kill.lua"/> | |
| 5 | + | <!--<event type="death" name="DropLoot" script="droploot.lua" /> --> | |
| 6 | + | <event type="modalwindow" name="DungeonSystem_Modal" script="dungeon_mod.lua"/> | |
| 7 | + | <event type="modalwindow" name="DungeonSystemType_Modal" script="dungeon_mod2.lua"/> | |
| 8 | + | <event type="modalwindow" name="DungeonSystemDetails_Modal" script="dungeon_mod2.lua"/> | |
| 9 | + | <event type="extendedopcode" name="ExtendedOpcode" script="extendedopcode.lua" /> | |
| 10 | + | <event type="login" name="PlayerLogin" script="login.lua" /> | |
| 11 | + | <event type="logout" name="PlayerLogout" script="logout.lua" /> | |
| 12 | + | <event type="ModalWindow" name="ModalWindow_TGun" script="modalWindow.lua"/> | |
| 13 | + | <event type="kill" name="onLoot" script="monster_loot.lua"/> | |
| 14 | + | <!--<event type="death" name="PlayerDeath" script="playerdeath.lua" /> --> | |
| 15 | + | <event type="preparedeath" name="PVPZoneDeath" script="preparedeath.lua" /> | |
| 16 | + | <event type="advance" name="QuestLevel" script="quest_level.lua"/> | |
| 17 | + | <event type="death" name="Sentinelas" script="sentinel.lua" /> | |
| 18 | + | <event type="think" name="Think" script="think.lua" /> | |
| 19 | + | <event type="think" name="partyUpdate" interval="3000" script="partyUpdate.lua" /> | |
| 20 | + | </creaturescripts> |
| @@ -0,0 +1,1 @@ | |||
| 1 | + | -- empty file -- |
| @@ -0,0 +1,806 @@ | |||
| 1 | + | local PASSIVE_LEVEL = 00 | |
| 2 | + | local COMBAT_TYPES = { | |
| 3 | + | [COMBAT_ENERGYDAMAGE] = COMBAT_ENERGYDAMAGE, | |
| 4 | + | [COMBAT_EARTHDAMAGE] = COMBAT_EARTHDAMAGE, | |
| 5 | + | [COMBAT_FIREDAMAGE] = COMBAT_FIREDAMAGE, | |
| 6 | + | [COMBAT_ICEDAMAGE] = COMBAT_ICEDAMAGE, | |
| 7 | + | [COMBAT_HOLYDAMAGE] = COMBAT_HOLYDAMAGE, | |
| 8 | + | [COMBAT_DEATHDAMAGE] = COMBAT_DEATHDAMAGE | |
| 9 | + | } | |
| 10 | + | local function isWalkable(item) | |
| 11 | + | if item then | |
| 12 | + | if item.uid > 0 and item.uid <= 65535 then | |
| 13 | + | return false | |
| 14 | + | end | |
| 15 | + | end | |
| 16 | + | return true | |
| 17 | + | end | |
| 18 | + | local function onGetPassivas(player, id) | |
| 19 | + | if player:getStorageValue(_SYSTEM.POINTS_ATR[01]) == id then | |
| 20 | + | PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[08]) | |
| 21 | + | return true | |
| 22 | + | elseif player:getStorageValue(_SYSTEM.POINTS_ATR[02]) == id then | |
| 23 | + | PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[09]) | |
| 24 | + | return true | |
| 25 | + | elseif player:getStorageValue(_SYSTEM.POINTS_ATR[03]) == id then | |
| 26 | + | PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[10]) | |
| 27 | + | return true | |
| 28 | + | elseif player:getStorageValue(_SYSTEM.POINTS_ATR[04]) == id then | |
| 29 | + | PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[11]) | |
| 30 | + | return true | |
| 31 | + | elseif player:getStorageValue(_SYSTEM.POINTS_ATR[05]) == id then | |
| 32 | + | PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[12]) | |
| 33 | + | return true | |
| 34 | + | elseif player:getStorageValue(_SYSTEM.POINTS_ATR[06]) == id then | |
| 35 | + | PASSIVE_LEVEL = player:getStorageValue(_SYSTEM.POINTS_ATR[13]) | |
| 36 | + | return true | |
| 37 | + | else | |
| 38 | + | PASSIVE_LEVEL = 00 | |
| 39 | + | return false | |
| 40 | + | end | |
| 41 | + | end | |
| 42 | + | function BombAround(cid, attacker, effect, combat) | |
| 43 | + | local creature = Player(cid) | |
| 44 | + | local min = creature:getLevel() / 3 | |
| 45 | + | local max = creature:getLevel() / 2 | |
| 46 | + | ||
| 47 | + | creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) | |
| 48 | + | local POS = creature:getPosition() | |
| 49 | + | local POS1 = Position(POS.x, POS.y + 1, POS.z) | |
| 50 | + | POS1:sendMagicEffect(effect) | |
| 51 | + | local tile_1 = Tile(POS.x, POS.y + 1, POS.z) | |
| 52 | + | if tile_1 then | |
| 53 | + | if isWalkable(tile_1.uid) then | |
| 54 | + | local Target_1 = tile_1:getTopCreature() | |
| 55 | + | if Target_1 then | |
| 56 | + | if Target_1:isPlayer() then | |
| 57 | + | if creature:hasSecureMode() == true or Tile(Target_1:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 58 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_1:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 59 | + | ||
| 60 | + | else | |
| 61 | + | doTargetCombat(creature, Target_1, combat, -min, -max, effect) | |
| 62 | + | end | |
| 63 | + | else | |
| 64 | + | doTargetCombat(creature, Target_1, combat, -min, -max, effect) | |
| 65 | + | end | |
| 66 | + | end | |
| 67 | + | end | |
| 68 | + | end | |
| 69 | + | ||
| 70 | + | local POS2 = Position(POS.x - 1, POS.y + 1, POS.z) | |
| 71 | + | POS2:sendMagicEffect(effect) | |
| 72 | + | local tile_2 = Tile(POS.x - 1, POS.y + 1, POS.z) | |
| 73 | + | if tile_2 then | |
| 74 | + | if isWalkable(tile_2.uid) then | |
| 75 | + | local Target_2 = tile_2:getTopCreature() | |
| 76 | + | if Target_2 then | |
| 77 | + | if Target_2:isPlayer() then | |
| 78 | + | if creature:hasSecureMode() == true or Tile(Target_2:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 79 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_2:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 80 | + | ||
| 81 | + | else | |
| 82 | + | doTargetCombat(creature, Target_2, combat, -min, -max, effect) | |
| 83 | + | end | |
| 84 | + | else | |
| 85 | + | doTargetCombat(creature, Target_2, combat, -min, -max, effect) | |
| 86 | + | end | |
| 87 | + | end | |
| 88 | + | end | |
| 89 | + | end | |
| 90 | + | ||
| 91 | + | local POS3 = Position(POS.x - 1, POS.y, POS.z) | |
| 92 | + | POS3:sendMagicEffect(effect) | |
| 93 | + | local tile_3 = Tile(POS.x - 1, POS.y, POS.z) | |
| 94 | + | if tile_3 then | |
| 95 | + | if isWalkable(tile_3.uid) then | |
| 96 | + | local Target_3 = tile_3:getTopCreature() | |
| 97 | + | if Target_3 then | |
| 98 | + | if Target_3:isPlayer() then | |
| 99 | + | if creature:hasSecureMode() == true or Tile(Target_3:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 100 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_3:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 101 | + | ||
| 102 | + | else | |
| 103 | + | doTargetCombat(creature, Target_3, combat, -min, -max, effect) | |
| 104 | + | end | |
| 105 | + | else | |
| 106 | + | doTargetCombat(creature, Target_3, combat, -min, -max, effect) | |
| 107 | + | end | |
| 108 | + | end | |
| 109 | + | end | |
| 110 | + | end | |
| 111 | + | ||
| 112 | + | local POS4 = Position(POS.x - 1, POS.y - 1, POS.z) | |
| 113 | + | POS4:sendMagicEffect(effect) | |
| 114 | + | local tile_4 = Tile(POS.x - 1, POS.y - 1, POS.z) | |
| 115 | + | if tile_4 then | |
| 116 | + | if isWalkable(tile_4.uid) then | |
| 117 | + | local Target_4 = tile_4:getTopCreature() | |
| 118 | + | if Target_4 then | |
| 119 | + | if Target_4:isPlayer() then | |
| 120 | + | if creature:hasSecureMode() == true or Tile(Target_4:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 121 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_4:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 122 | + | ||
| 123 | + | else | |
| 124 | + | doTargetCombat(creature, Target_4, combat, -min, -max, effect) | |
| 125 | + | end | |
| 126 | + | else | |
| 127 | + | doTargetCombat(creature, Target_4, combat, -min, -max, effect) | |
| 128 | + | end | |
| 129 | + | end | |
| 130 | + | end | |
| 131 | + | end | |
| 132 | + | ||
| 133 | + | local POS5 = Position(POS.x, POS.y - 1, POS.z) | |
| 134 | + | POS5:sendMagicEffect(effect) | |
| 135 | + | local tile_5 = Tile(POS.x, POS.y - 1, POS.z) | |
| 136 | + | if tile_5 then | |
| 137 | + | if isWalkable(tile_5.uid) then | |
| 138 | + | local Target_5 = tile_5:getTopCreature() | |
| 139 | + | if Target_5 then | |
| 140 | + | if Target_5:isPlayer() then | |
| 141 | + | if creature:hasSecureMode() == true or Tile(Target_5:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 142 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_5:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 143 | + | ||
| 144 | + | else | |
| 145 | + | doTargetCombat(creature, Target_5, combat, -min, -max, effect) | |
| 146 | + | end | |
| 147 | + | else | |
| 148 | + | doTargetCombat(creature, Target_5, combat, -min, -max, effect) | |
| 149 | + | end | |
| 150 | + | end | |
| 151 | + | end | |
| 152 | + | end | |
| 153 | + | ||
| 154 | + | local POS6 = Position(POS.x + 1, POS.y - 1, POS.z) | |
| 155 | + | POS6:sendMagicEffect(effect) | |
| 156 | + | local tile_6 = Tile(POS.x + 1, POS.y - 1, POS.z) | |
| 157 | + | if tile_6 then | |
| 158 | + | if isWalkable(tile_6.uid) then | |
| 159 | + | local Target_6 = tile_6:getTopCreature() | |
| 160 | + | if Target_6 then | |
| 161 | + | if Target_6:isPlayer() then | |
| 162 | + | if creature:hasSecureMode() == true or Tile(Target_6:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 163 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_6:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 164 | + | ||
| 165 | + | else | |
| 166 | + | doTargetCombat(creature, Target_6, combat, -min, -max, effect) | |
| 167 | + | end | |
| 168 | + | else | |
| 169 | + | doTargetCombat(creature, Target_6, combat, -min, -max, effect) | |
| 170 | + | end | |
| 171 | + | end | |
| 172 | + | end | |
| 173 | + | end | |
| 174 | + | ||
| 175 | + | local POS7 = Position(POS.x + 1, POS.y, POS.z) | |
| 176 | + | POS7:sendMagicEffect(effect) | |
| 177 | + | local tile_7 = Tile(POS.x + 1, POS.y, POS.z) | |
| 178 | + | if tile_7 then | |
| 179 | + | if isWalkable(tile_7.uid) then | |
| 180 | + | local Target_7 = tile_7:getTopCreature() | |
| 181 | + | if Target_7 then | |
| 182 | + | if Target_7:isPlayer() then | |
| 183 | + | if creature:hasSecureMode() == true or Tile(Target_7:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 184 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_7:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 185 | + | ||
| 186 | + | else | |
| 187 | + | doTargetCombat(creature, Target_7, combat, -min, -max, effect) | |
| 188 | + | end | |
| 189 | + | else | |
| 190 | + | doTargetCombat(creature, Target_7, combat, -min, -max, effect) | |
| 191 | + | end | |
| 192 | + | end | |
| 193 | + | end | |
| 194 | + | end | |
| 195 | + | ||
| 196 | + | local POS8 = Position(POS.x + 1, POS.y + 1, POS.z) | |
| 197 | + | POS8:sendMagicEffect(effect) | |
| 198 | + | local tile_8 = Tile(POS.x + 1, POS.y + 1, POS.z) | |
| 199 | + | if tile_8 then | |
| 200 | + | if isWalkable(tile_8.uid) then | |
| 201 | + | local Target_8 = tile_8:getTopCreature() | |
| 202 | + | if Target_8 then | |
| 203 | + | if Target_8:isPlayer() then | |
| 204 | + | if creature:hasSecureMode() == true or Tile(Target_8:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) | |
| 205 | + | or creature:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 and creature:getStorageValue(_PVP_ROOM[00].TIME_ID) == Target_8:getStorageValue(_PVP_ROOM[00].TIME_ID) then | |
| 206 | + | ||
| 207 | + | else | |
| 208 | + | doTargetCombat(creature, Target_8, combat, -min, -max, effect) | |
| 209 | + | end | |
| 210 | + | else | |
| 211 | + | doTargetCombat(creature, Target_8, combat, -min, -max, effect) | |
| 212 | + | end | |
| 213 | + | end | |
| 214 | + | end | |
| 215 | + | end | |
| 216 | + | end | |
| 217 | + | function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin) | |
| 218 | + | if _CHEATS.IMORTAL_MODE then | |
| 219 | + | creature:getPosition():sendMagicEffect(03) | |
| 220 | + | return false | |
| 221 | + | end | |
| 222 | + | if creature:getStorageValue(_SYSTEM.MAESTRIA[01]) == 02 then | |
| 223 | + | if creature:getStorageValue(_SYSTEM.MAESTRIA[04]) > 0 then | |
| 224 | + | if primaryType ~= 128 then | |
| 225 | + | if creature:isPlayer() then | |
| 226 | + | --local position = Position(creature:getPosition().x + 1, creature:getPosition().y + 1, creature:getPosition().z) | |
| 227 | + | creature:getPosition():sendMagicEffect(195) | |
| 228 | + | return false | |
| 229 | + | end | |
| 230 | + | end | |
| 231 | + | end | |
| 232 | + | end | |
| 233 | + | if creature:isPlayer() then | |
| 234 | + | if primaryType ~= 128 then -- Ignore health potions | |
| 235 | + | local DEF = creature:getStorageValue(_PLAYER_INFO.DEF) or 0 | |
| 236 | + | local ESQ = creature:getStorageValue(_PLAYER_INFO.ESQ) or 0 | |
| 237 | + | local FIRE = creature:getStorageValue(_PLAYER_INFO.FIRE) or 0 | |
| 238 | + | local ICE = creature:getStorageValue(_PLAYER_INFO.ICE) or 0 | |
| 239 | + | local ENERGY = creature:getStorageValue(_PLAYER_INFO.ENERGY) or 0 | |
| 240 | + | local EARTH = creature:getStorageValue(_PLAYER_INFO.EARTH) or 0 | |
| 241 | + | local DEATH = creature:getStorageValue(_PLAYER_INFO.DEATH) or 0 | |
| 242 | + | local ResPlayer = creature:getStorageValue(_PLAYER_INFO.RES_PLAYER) or 0 | |
| 243 | + | local ExtraDef = creature:getStorageValue(_PLAYER_INFO.EXTRA_DEF) or 0 | |
| 244 | + | local ExtraESQ = creature:getStorageValue(_PLAYER_INFO.EXTRA_ESQ) or 0 | |
| 245 | + | local ExtraMAG = creature:getStorageValue(_PLAYER_INFO.EXTRA_MAG) or 0 | |
| 246 | + | local CuraESQ = creature:getStorageValue(_PLAYER_INFO.CURA_ESQ) or 0 | |
| 247 | + | local FearPara = creature:getStorageValue(_PLAYER_INFO.FEAR_PARA) or 0 | |
| 248 | + | local BombFire = creature:getStorageValue(_PLAYER_INFO.BOMB_FIRE) or 0 | |
| 249 | + | local BombEnergy = creature:getStorageValue(_PLAYER_INFO.BOMB_ENERGY) or 0 | |
| 250 | + | local BombIce = creature:getStorageValue(_PLAYER_INFO.BOMB_ICE) or 0 | |
| 251 | + | local BombEarth = creature:getStorageValue(_PLAYER_INFO.BOMB_EARTH) or 0 | |
| 252 | + | local BombDeath = creature:getStorageValue(_PLAYER_INFO.BOMB_DEATH) or 0 | |
| 253 | + | local BombHoly = creature:getStorageValue(_PLAYER_INFO.BOMB_HOLY) or 0 | |
| 254 | + | local BombPhysical = creature:getStorageValue(_PLAYER_INFO.BOMB_PHYSICAL) or 0 | |
| 255 | + | local CancelInv = creature:getStorageValue(_PLAYER_INFO.CANCEL_INV) or 0 | |
| 256 | + | local CanPara = creature:getStorageValue(_PLAYER_INFO.CAN_PARA) or 0 | |
| 257 | + | local DmgHalf = creature:getStorageValue(_PLAYER_INFO.DMG_HALF) or 0 | |
| 258 | + | local ProtectPercent = 0 | |
| 259 | + | ||
| 260 | + | if onGetPassivas(creature, 62) then | |
| 261 | + | local HP_HIGH = 70 * (creature:getBaseMaxHealth() / 100) | |
| 262 | + | if creature:getHealth() > HP_HIGH then | |
| 263 | + | local Percent = _PASSIVES[62].POWER_BASE + (_PASSIVES[62].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 264 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 265 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[62].CATEGORY then | |
| 266 | + | Percent = Percent + _PASSIVES[62].BOOST | |
| 267 | + | end | |
| 268 | + | end | |
| 269 | + | DEF = DEF + Percent | |
| 270 | + | end | |
| 271 | + | end | |
| 272 | + | if onGetPassivas(creature, 50) then | |
| 273 | + | local HP_HIGH = 70 * (creature:getBaseMaxHealth() / 100) | |
| 274 | + | if creature:getHealth() > HP_HIGH then | |
| 275 | + | local Percent = _PASSIVES[50].POWER_BASE + (_PASSIVES[50].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 276 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 277 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[50].CATEGORY then | |
| 278 | + | Percent = Percent + _PASSIVES[50].BOOST | |
| 279 | + | end | |
| 280 | + | end | |
| 281 | + | ESQ = ESQ + Percent | |
| 282 | + | end | |
| 283 | + | end | |
| 284 | + | if creature:getStorageValue(_SYSTEM.PASSIVA[01]) > 00 then | |
| 285 | + | if onGetPassivas(creature, 09) then | |
| 286 | + | local Percent = _PASSIVES[09].POWER_BASE + (_PASSIVES[09].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 287 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 288 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[09].CATEGORY then | |
| 289 | + | Percent = Percent + _PASSIVES[09].BOOST | |
| 290 | + | end | |
| 291 | + | end | |
| 292 | + | ESQ = ESQ + Percent | |
| 293 | + | end | |
| 294 | + | end | |
| 295 | + | if creature:getStorageValue(_SYSTEM.PASSIVA[02]) > 00 then | |
| 296 | + | if onGetPassivas(creature, 19) then | |
| 297 | + | local Percent = _PASSIVES[19].POWER_BASE + (_PASSIVES[19].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 298 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 299 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[19].CATEGORY then | |
| 300 | + | Percent = Percent + _PASSIVES[19].BOOST | |
| 301 | + | end | |
| 302 | + | end | |
| 303 | + | DEF = DEF + Percent | |
| 304 | + | end | |
| 305 | + | end | |
| 306 | + | if creature:getStorageValue(_PLAYER_INFO.DELAY) <= 0 then | |
| 307 | + | if BombFire > 0 then | |
| 308 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 309 | + | if attacker then | |
| 310 | + | if math.random(00, 150) <= BombFire then | |
| 311 | + | BombAround(creature, attacker, 16, COMBAT_FIREDAMAGE) | |
| 312 | + | end | |
| 313 | + | end | |
| 314 | + | end | |
| 315 | + | end | |
| 316 | + | if BombEnergy > 0 then | |
| 317 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 318 | + | if attacker then | |
| 319 | + | if math.random(00, 150) <= BombEnergy then | |
| 320 | + | BombAround(creature, attacker, 12, COMBAT_ENERGYDAMAGE) | |
| 321 | + | end | |
| 322 | + | end | |
| 323 | + | end | |
| 324 | + | end | |
| 325 | + | if BombIce > 0 then | |
| 326 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 327 | + | if attacker then | |
| 328 | + | if math.random(00, 150) <= BombIce then | |
| 329 | + | BombAround(creature, attacker, 43, COMBAT_ICEDAMAGE) | |
| 330 | + | end | |
| 331 | + | end | |
| 332 | + | end | |
| 333 | + | end | |
| 334 | + | if BombDeath > 0 then | |
| 335 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 336 | + | if attacker then | |
| 337 | + | if math.random(00, 150) <= BombDeath then | |
| 338 | + | BombAround(creature, attacker, 18, COMBAT_DEATHDAMAGE) | |
| 339 | + | end | |
| 340 | + | end | |
| 341 | + | end | |
| 342 | + | end | |
| 343 | + | if BombEarth > 0 then | |
| 344 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 345 | + | if attacker then | |
| 346 | + | if math.random(00, 150) <= BombEarth then | |
| 347 | + | BombAround(creature, attacker, 46, COMBAT_EARTHDAMAGE) | |
| 348 | + | end | |
| 349 | + | end | |
| 350 | + | end | |
| 351 | + | end | |
| 352 | + | if BombHoly > 0 then | |
| 353 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 354 | + | if attacker then | |
| 355 | + | if math.random(00, 150) <= BombHoly then | |
| 356 | + | BombAround(creature, attacker, 40, COMBAT_HOLYDAMAGE) | |
| 357 | + | end | |
| 358 | + | end | |
| 359 | + | end | |
| 360 | + | end | |
| 361 | + | if BombPhysical > 0 then | |
| 362 | + | if not Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then | |
| 363 | + | if attacker then | |
| 364 | + | if math.random(00, 150) <= BombPhysical then | |
| 365 | + | BombAround(creature, attacker, 10, COMBAT_PHYSICALDAMAGE) | |
| 366 | + | end | |
| 367 | + | end | |
| 368 | + | end | |
| 369 | + | end | |
| 370 | + | if CanPara > 0 then | |
| 371 | + | if creature:getCondition(CONDITION_PARALYZE) then | |
| 372 | + | creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) | |
| 373 | + | creature:removeCondition(CONDITION_PARALYZE) | |
| 374 | + | end | |
| 375 | + | end | |
| 376 | + | if CancelInv > 0 then | |
| 377 | + | if attacker then | |
| 378 | + | if attacker:getCondition(CONDITION_INVISIBLE) then | |
| 379 | + | creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) | |
| 380 | + | attacker:removeCondition(CONDITION_INVISIBLE) | |
| 381 | + | end | |
| 382 | + | end | |
| 383 | + | end | |
| 384 | + | end | |
| 385 | + | ||
| 386 | + | local cid = creature:getId() | |
| 387 | + | if _BONUS_EXTRA_TABLE[cid] then | |
| 388 | + | local ID_BONUS = 32 | |
| 389 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 390 | + | DEF = DEF + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 391 | + | end | |
| 392 | + | ID_BONUS = 34 | |
| 393 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 394 | + | FIRE = FIRE + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 395 | + | end | |
| 396 | + | ID_BONUS = 35 | |
| 397 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 398 | + | ICE = ICE + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 399 | + | end | |
| 400 | + | ID_BONUS = 36 | |
| 401 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 402 | + | EARTH = EARTH + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 403 | + | end | |
| 404 | + | ID_BONUS = 37 | |
| 405 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 406 | + | ENERGY = ENERGY + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 407 | + | end | |
| 408 | + | ID_BONUS = 38 | |
| 409 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 410 | + | DEATH = DEATH + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 411 | + | end | |
| 412 | + | ID_BONUS = 44 | |
| 413 | + | if _BONUS_EXTRA_TABLE[cid][ID_BONUS] > 00 then | |
| 414 | + | ESQ = ESQ + _BONUS_EXTRA_TABLE[cid][ID_BONUS] | |
| 415 | + | end | |
| 416 | + | end | |
| 417 | + | ||
| 418 | + | -- POWER MONSTER DG | |
| 419 | + | if attacker then | |
| 420 | + | if attacker:isMonster() then | |
| 421 | + | if attacker:getStorageValue(29937) > 00 then | |
| 422 | + | primaryDamage = primaryDamage * attacker:getStorageValue(29937) | |
| 423 | + | end | |
| 424 | + | end | |
| 425 | + | end | |
| 426 | + | -- POWER PLAYER VS PLAYER | |
| 427 | + | if attacker then | |
| 428 | + | if attacker:isPlayer() then | |
| 429 | + | DEF = 00 | |
| 430 | + | ESQ = ESQ / 02 | |
| 431 | + | end | |
| 432 | + | end | |
| 433 | + | -- CALCULANDO ESQUIVA | |
| 434 | + | local chanceESQ = math.random(1, 1000) | |
| 435 | + | if chanceESQ <= ESQ and primaryDamage > 0 and primaryType == 1 and creature:getStorageValue(_PLAYER_INFO.DELAY) <= 0 then | |
| 436 | + | if attacker then | |
| 437 | + | creature:getPosition():sendMagicEffect(4) | |
| 438 | + | creature:say("MISS", TALKTYPE_MONSTER_SAY) | |
| 439 | + | creature:setStorageValue(_SYSTEM.ATR_VALUES[01], 01) | |
| 440 | + | creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) | |
| 441 | + | ||
| 442 | + | if CuraESQ > 0 then | |
| 443 | + | local HPCrit = math.floor(CuraESQ * (creature:getBaseMaxHealth() / 100)) | |
| 444 | + | doTargetCombat(0, creature, COMBAT_HEALING, HPCrit, HPCrit) | |
| 445 | + | end | |
| 446 | + | return false | |
| 447 | + | end | |
| 448 | + | else | |
| 449 | + | if attacker then | |
| 450 | + | if attacker:isMonster() then | |
| 451 | + | local master = attacker:getMaster() | |
| 452 | + | if master and master:isPlayer() then | |
| 453 | + | return false | |
| 454 | + | end | |
| 455 | + | end | |
| 456 | + | end | |
| 457 | + | -- ABSORVENDO DANO PHYSICAL | |
| 458 | + | if primaryType == 1 then | |
| 459 | + | if attacker then | |
| 460 | + | if attacker:isPlayer() then | |
| 461 | + | if creature:getStorageValue(_SYSTEM.POINTS_ATR[04]) > 0 then | |
| 462 | + | ResPlayer = ResPlayer + math.floor(creature:getStorageValue(_SYSTEM.POINTS_ATR[04]) / 5) | |
| 463 | + | end | |
| 464 | + | if primaryDamage <= ResPlayer then | |
| 465 | + | primaryDamage = 0 | |
| 466 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 467 | + | else | |
| 468 | + | primaryDamage = primaryDamage - ResPlayer | |
| 469 | + | end | |
| 470 | + | end | |
| 471 | + | end | |
| 472 | + | if primaryDamage <= DEF then | |
| 473 | + | primaryDamage = 0 | |
| 474 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 475 | + | else | |
| 476 | + | -- Passiva Menor Dano [Monster Classe] & Refletir | |
| 477 | + | if attacker then | |
| 478 | + | if attacker:isMonster() then | |
| 479 | + | if onGetPassivas(creature, 03) then | |
| 480 | + | local Percent = _PASSIVES[03].POWER_BASE + (_PASSIVES[03].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 481 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 482 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[03].CATEGORY then | |
| 483 | + | Percent = Percent + _PASSIVES[03].BOOST | |
| 484 | + | end | |
| 485 | + | end | |
| 486 | + | local Reflect = math.floor(Percent * (primaryDamage / 100)) | |
| 487 | + | if Reflect < 01 then Reflect = 01 end | |
| 488 | + | doTargetCombat(creature, attacker, 01, -Reflect, -Reflect, 01) | |
| 489 | + | end | |
| 490 | + | if _MONSTER_LOOT[attacker:getName()] then | |
| 491 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Constructos" then | |
| 492 | + | local PID = 18 | |
| 493 | + | if onGetPassivas(creature, PID) then | |
| 494 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 495 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 496 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 497 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 498 | + | end | |
| 499 | + | end | |
| 500 | + | ProtectPercent = ProtectPercent + Percent | |
| 501 | + | end | |
| 502 | + | end | |
| 503 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Dimensionais" then | |
| 504 | + | local PID = 47 | |
| 505 | + | if onGetPassivas(creature, PID) then | |
| 506 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 507 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 508 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 509 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 510 | + | end | |
| 511 | + | end | |
| 512 | + | ProtectPercent = ProtectPercent + Percent | |
| 513 | + | end | |
| 514 | + | end | |
| 515 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Gigantes" then | |
| 516 | + | local PID = 33 | |
| 517 | + | if onGetPassivas(creature, PID) then | |
| 518 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 519 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 520 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 521 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 522 | + | end | |
| 523 | + | end | |
| 524 | + | ProtectPercent = ProtectPercent + Percent | |
| 525 | + | end | |
| 526 | + | end | |
| 527 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Dragon" then | |
| 528 | + | local PID = 34 | |
| 529 | + | if onGetPassivas(creature, PID) then | |
| 530 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 531 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 532 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 533 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 534 | + | end | |
| 535 | + | end | |
| 536 | + | ProtectPercent = ProtectPercent + Percent | |
| 537 | + | end | |
| 538 | + | end | |
| 539 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Demon" then | |
| 540 | + | local PID = 15 | |
| 541 | + | if onGetPassivas(creature, PID) then | |
| 542 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 543 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 544 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 545 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 546 | + | end | |
| 547 | + | end | |
| 548 | + | ProtectPercent = ProtectPercent + Percent | |
| 549 | + | end | |
| 550 | + | end | |
| 551 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Humanoide" then | |
| 552 | + | local PID = 06 | |
| 553 | + | if onGetPassivas(creature, PID) then | |
| 554 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 555 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 556 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 557 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 558 | + | end | |
| 559 | + | end | |
| 560 | + | ProtectPercent = ProtectPercent + Percent | |
| 561 | + | end | |
| 562 | + | end | |
| 563 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Magica" then | |
| 564 | + | local PID = 27 | |
| 565 | + | if onGetPassivas(creature, PID) then | |
| 566 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 567 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 568 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 569 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 570 | + | end | |
| 571 | + | end | |
| 572 | + | ProtectPercent = ProtectPercent + Percent | |
| 573 | + | end | |
| 574 | + | end | |
| 575 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Repteis" then | |
| 576 | + | local PID = 36 | |
| 577 | + | if onGetPassivas(creature, PID) then | |
| 578 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 579 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 580 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 581 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 582 | + | end | |
| 583 | + | end | |
| 584 | + | ProtectPercent = ProtectPercent + Percent | |
| 585 | + | end | |
| 586 | + | end | |
| 587 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Vermes" then | |
| 588 | + | local PID = 21 | |
| 589 | + | if onGetPassivas(creature, PID) then | |
| 590 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 591 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 592 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 593 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 594 | + | end | |
| 595 | + | end | |
| 596 | + | ProtectPercent = ProtectPercent + Percent | |
| 597 | + | end | |
| 598 | + | end | |
| 599 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Boss" then | |
| 600 | + | local PID = 43 | |
| 601 | + | if onGetPassivas(creature, PID) then | |
| 602 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 603 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 604 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 605 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 606 | + | end | |
| 607 | + | end | |
| 608 | + | ProtectPercent = ProtectPercent + Percent | |
| 609 | + | end | |
| 610 | + | end | |
| 611 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Aquaticos" then | |
| 612 | + | local PID = 14 | |
| 613 | + | if onGetPassivas(creature, PID) then | |
| 614 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 615 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 616 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 617 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 618 | + | end | |
| 619 | + | end | |
| 620 | + | ProtectPercent = ProtectPercent + Percent | |
| 621 | + | end | |
| 622 | + | end | |
| 623 | + | if _MONSTER_LOOT[attacker:getName()][00].Type == "Morto-Vivo" then | |
| 624 | + | local PID = 28 | |
| 625 | + | if onGetPassivas(creature, PID) then | |
| 626 | + | local Percent = _PASSIVES[PID].POWER_BASE + (_PASSIVES[PID].POWER_FOR_LEVEL * (PASSIVE_LEVEL - 01)) | |
| 627 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 02 then -- PASSIVA DAS CORES | |
| 628 | + | if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.PASSIVE) == _PASSIVES[PID].CATEGORY then | |
| 629 | + | Percent = Percent + _PASSIVES[PID].BOOST | |
| 630 | + | end | |
| 631 | + | end | |
| 632 | + | ProtectPercent = ProtectPercent + Percent | |
| 633 | + | end | |
| 634 | + | end | |
| 635 | + | end | |
| 636 | + | end | |
| 637 | + | end | |
| 638 | + | -- ATR: Paralizia do Medo (12) | |
| 639 | + | if FearPara > 0 then | |
| 640 | + | if attacker then | |
| 641 | + | local CriticalHealth = 80 * (creature:getBaseMaxHealth() / 100) | |
| 642 | + | if creature:getHealth() <= CriticalHealth then | |
| 643 | + | local ChanceParalyze = math.random(00, 100) | |
| 644 | + | if ChanceParalyze <= FearPara then | |
| 645 | + | local condition = Condition(CONDITION_PARALYZE) | |
| 646 | + | condition:setParameter(CONDITION_PARAM_TICKS, 10000) | |
| 647 | + | condition:setFormula(-5, 100, -5, 150) | |
| 648 | + | attacker:addCondition(condition) | |
| 649 | + | attacker:getPosition():sendMagicEffect(11) | |
| 650 | + | end | |
| 651 | + | end | |
| 652 | + | end | |
| 653 | + | end | |
| 654 | + | -- Amuletos | |
| 655 | + | if creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_01) > 0 and creature:getStorageValue(_PLAYER_INFO.DELAY) <= 0 then | |
| 656 | + | if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][01]) < 1 then | |
| 657 | + | local AmuletID = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_01) | |
| 658 | + | local Effect = _SYSTEM.AMULET_VALUES[AmuletID] | |
| 659 | + | local RareAmulet = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_02) | |
| 660 | + | local StarAmulet = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_03) | |
| 661 | + | local LevelAmulet = creature:getStorageValue(_SYSTEM.INVENTARIO[01].UID_05) | |
| 662 | + | local BUFF_TIME = 0 | |
| 663 | + | local ChanceRandom = math.random(200) | |
| 664 | + | if RareAmulet < 0 then RareAmulet = 0 end | |
| 665 | + | if StarAmulet < 0 then StarAmulet = 0 end | |
| 666 | + | if LevelAmulet < 0 then LevelAmulet = 0 end | |
| 667 | + | ||
| 668 | + | if creature:getStorageValue(_SYSTEM.MAESTRIA[01]) == 05 then | |
| 669 | + | if creature:getStorageValue(_SYSTEM.MAESTRIA[04]) > 0 then | |
| 670 | + | ChanceRandom = 00 | |
| 671 | + | end | |
| 672 | + | end | |
| 673 | + | if ChanceRandom <= _AMULET_CHANCE_MODE[RareAmulet] then | |
| 674 | + | local Timer_Left = (LevelAmulet + (StarAmulet * 10) + 5) | |
| 675 | + | if Effect ~= 10 then | |
| 676 | + | if Effect == 01 then | |
| 677 | + | local CritValue = creature:getStorageValue(_SYSTEM.CRITICAL_VALUES[02]) | |
| 678 | + | if CritValue < 0 then CritValue = 0 end | |
| 679 | + | creature:setStorageValue(_SYSTEM.CRITICAL_VALUES[02], (CritValue + 05)) | |
| 680 | + | elseif Effect == 04 then | |
| 681 | + | local CritValue = creature:getStorageValue(_SYSTEM.CRITICAL_VALUES[01]) | |
| 682 | + | if CritValue < 0 then CritValue = 0 end | |
| 683 | + | creature:setStorageValue(_SYSTEM.CRITICAL_VALUES[01], (CritValue + 50)) | |
| 684 | + | elseif Effect == 05 or Effect == 06 or Effect == 08 then | |
| 685 | + | creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 25) | |
| 686 | + | elseif Effect == 07 then | |
| 687 | + | creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 15) | |
| 688 | + | elseif Effect == 09 then | |
| 689 | + | local condition = Condition(CONDITION_INVISIBLE) | |
| 690 | + | condition:setParameter(CONDITION_PARAM_TICKS, (Timer_Left + StarAmulet) * 1000) | |
| 691 | + | creature:addCondition(condition) | |
| 692 | + | elseif Effect == 17 then | |
| 693 | + | creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 30) | |
| 694 | + | elseif Effect == 18 or Effect == 19 or Effect == 20 or Effect == 21 or Effect == 22 then | |
| 695 | + | creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 20) | |
| 696 | + | end | |
| 697 | + | ||
| 698 | + | -- DESAFIO | |
| 699 | + | if creature:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then | |
| 700 | + | onPlayerDesafios(creature, 20, 01) | |
| 701 | + | end | |
| 702 | + | creature:getPosition():sendMagicEffect(13) | |
| 703 | + | creature:setStorageValue(_PLAYER_INFO.DELAY, _PLAYER_INFO.SECONDS_DELAY) | |
| 704 | + | creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][02], Effect) | |
| 705 | + | creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][01], Timer_Left) | |
| 706 | + | if creature:getStorageValue(_QUESTLOG[101].UID_01) == 01 then | |
| 707 | + | if creature:getStorageValue(10919) == 04 then | |
| 708 | + | creature:setStorageValue(_QUESTLOG[101].UID_01, 100) | |
| 709 | + | creature:setStorageValue(10919, nil) | |
| 710 | + | creature:sendCancelMessage("@LoadQuestWindows") | |
| 711 | + | ||
| 712 | + | creature:addExperience(20000, true, true) | |
| 713 | + | creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 714 | + | else | |
| 715 | + | if creature:getStorageValue(10919) < 00 then | |
| 716 | + | creature:setStorageValue(10919, 01) | |
| 717 | + | else | |
| 718 | + | creature:setStorageValue(10919, (creature:getStorageValue(10919) + 01)) | |
| 719 | + | end | |
| 720 | + | doBackpack(creature, 12) | |
| 721 | + | end | |
| 722 | + | end | |
| 723 | + | end | |
| 724 | + | end | |
| 725 | + | end | |
| 726 | + | end | |
| 727 | + | ||
| 728 | + | if ProtectPercent > 00 then | |
| 729 | + | local NewDmgProtect = math.floor(ProtectPercent * (primaryDamage / 100)) | |
| 730 | + | primaryDamage = primaryDamage - NewDmgProtect | |
| 731 | + | end | |
| 732 | + | primaryDamage = primaryDamage - DEF | |
| 733 | + | -- ATR: Resistencia a Combate (14) | |
| 734 | + | if DmgHalf > 0 then | |
| 735 | + | if attacker then | |
| 736 | + | if primaryDamage <= _ATRIBUTOS[14].PERCENT then | |
| 737 | + | doTargetCombat(attacker, attacker, primaryType, -primaryDamage, -primaryDamage, 01) | |
| 738 | + | end | |
| 739 | + | end | |
| 740 | + | end | |
| 741 | + | end | |
| 742 | + | end | |
| 743 | + | if COMBAT_TYPES[primaryType] then | |
| 744 | + | if COMBAT_TYPES[primaryType] == 08 then | |
| 745 | + | local PercentFire = math.floor(FIRE * (primaryDamage / 100)) | |
| 746 | + | if FIRE >= primaryDamage then | |
| 747 | + | primaryDamage = 0 | |
| 748 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 749 | + | elseif primaryDamage <= PercentFire then | |
| 750 | + | primaryDamage = 0 | |
| 751 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 752 | + | else | |
| 753 | + | primaryDamage = primaryDamage - PercentFire | |
| 754 | + | end | |
| 755 | + | elseif COMBAT_TYPES[primaryType] == 512 then | |
| 756 | + | local PercentIce = math.floor(ICE * (primaryDamage / 100)) | |
| 757 | + | if ICE >= primaryDamage then | |
| 758 | + | primaryDamage = 0 | |
| 759 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 760 | + | elseif primaryDamage <= PercentIce then | |
| 761 | + | primaryDamage = 0 | |
| 762 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 763 | + | else | |
| 764 | + | primaryDamage = primaryDamage - PercentIce | |
| 765 | + | end | |
| 766 | + | elseif COMBAT_TYPES[primaryType] == 02 then | |
| 767 | + | local PercentEnergy = math.floor(ENERGY * (primaryDamage / 100)) | |
| 768 | + | if ENERGY >= primaryDamage then | |
| 769 | + | primaryDamage = 0 | |
| 770 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 771 | + | elseif primaryDamage <= PercentEnergy then | |
| 772 | + | primaryDamage = 0 | |
| 773 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 774 | + | else | |
| 775 | + | primaryDamage = primaryDamage - PercentEnergy | |
| 776 | + | end | |
| 777 | + | elseif COMBAT_TYPES[primaryType] == 04 then | |
| 778 | + | local PercentEarth = math.floor(EARTH * (primaryDamage / 100)) | |
| 779 | + | if EARTH >= primaryDamage then | |
| 780 | + | primaryDamage = 0 | |
| 781 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 782 | + | elseif primaryDamage <= PercentEarth then | |
| 783 | + | primaryDamage = 0 | |
| 784 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 785 | + | else | |
| 786 | + | primaryDamage = primaryDamage - PercentEarth | |
| 787 | + | end | |
| 788 | + | elseif COMBAT_TYPES[primaryType] == 2048 then | |
| 789 | + | local PercentDeath = math.floor(DEATH * (primaryDamage / 100)) | |
| 790 | + | if DEATH >= primaryDamage then | |
| 791 | + | primaryDamage = 0 | |
| 792 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 793 | + | elseif primaryDamage <= PercentDeath then | |
| 794 | + | primaryDamage = 0 | |
| 795 | + | creature:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 796 | + | else | |
| 797 | + | primaryDamage = primaryDamage - PercentDeath | |
| 798 | + | end | |
| 799 | + | end | |
| 800 | + | end | |
| 801 | + | end | |
| 802 | + | end | |
| 803 | + | end | |
| 804 | + | ||
| 805 | + | return primaryDamage, primaryType, secondaryDamage, secondaryType, origin | |
| 806 | + | end |
| @@ -0,0 +1,57 @@ | |||
| 1 | + | function onKill(player, target) | |
| 2 | + | local DG_MONSTER = { | |
| 3 | + | ["Massive Fire Elemental+"] = 01; | |
| 4 | + | ["Shaburak Prince+"] = 01; | |
| 5 | + | ["Yielothax+"] = 01; | |
| 6 | + | ["Nightmare+"] = 01; | |
| 7 | + | ["Eternal Guardian+"] = 01; | |
| 8 | + | } | |
| 9 | + | if not target:isMonster() then | |
| 10 | + | return true | |
| 11 | + | end | |
| 12 | + | ||
| 13 | + | local Name = target:getName() | |
| 14 | + | if DG_MONSTER[Name] then | |
| 15 | + | doRemoveCreature(target:getId()) | |
| 16 | + | local killer = Creature(player) | |
| 17 | + | if killer and killer:isPlayer() and target:isMonster() then | |
| 18 | + | local party = player:getParty() | |
| 19 | + | local STORAGE_BONE_DOIS = _SYSTEM.DANGEROUS[08][01].STORAGE | |
| 20 | + | if not party then | |
| 21 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monstros Skull [ 0" ..player:getStorageValue(STORAGE_BONE_DOIS).. "/05 ].") | |
| 22 | + | if player:getStorageValue(STORAGE_BONE_DOIS) < 00 then | |
| 23 | + | player:setStorageValue(STORAGE_BONE_DOIS, (player:getStorageValue(STORAGE_BONE_DOIS) + 2)) | |
| 24 | + | player:getPosition():sendMagicEffect(13) | |
| 25 | + | else | |
| 26 | + | player:setStorageValue(STORAGE_BONE_DOIS, (player:getStorageValue(STORAGE_BONE_DOIS) + 1)) | |
| 27 | + | player:getPosition():sendMagicEffect(13) | |
| 28 | + | end | |
| 29 | + | ||
| 30 | + | if player:getStorageValue(STORAGE_BONE_DOIS) == 06 then | |
| 31 | + | player:setStorageValue(_SYSTEM.DANGEROUS[08][01].RECOMPENSA[01], _SYSTEM.DANGEROUS[08][01].RECOMPENSA[02]) | |
| 32 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Todos os Monstros Skull foram eliminados.") | |
| 33 | + | end | |
| 34 | + | else | |
| 35 | + | local members = party:getMembers() | |
| 36 | + | members[#members + 1] = party:getLeader() | |
| 37 | + | for _, member in ipairs(members) do | |
| 38 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monstros Skull [ 0" ..member:getStorageValue(STORAGE_BONE_DOIS).. "/05 ].") | |
| 39 | + | if member:getStorageValue(STORAGE_BONE_DOIS) < 00 then | |
| 40 | + | member:setStorageValue(STORAGE_BONE_DOIS, (member:getStorageValue(STORAGE_BONE_DOIS) + 2)) | |
| 41 | + | member:getPosition():sendMagicEffect(13) | |
| 42 | + | else | |
| 43 | + | member:setStorageValue(STORAGE_BONE_DOIS, (member:getStorageValue(STORAGE_BONE_DOIS) + 1)) | |
| 44 | + | member:getPosition():sendMagicEffect(13) | |
| 45 | + | end | |
| 46 | + | ||
| 47 | + | if member:getStorageValue(STORAGE_BONE_DOIS) == 06 then | |
| 48 | + | member:setStorageValue(_SYSTEM.DANGEROUS[08][01].RECOMPENSA[01], _SYSTEM.DANGEROUS[08][01].RECOMPENSA[02]) | |
| 49 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Todos os Monstros Skull foram eliminados.") | |
| 50 | + | end | |
| 51 | + | end | |
| 52 | + | end | |
| 53 | + | end | |
| 54 | + | end | |
| 55 | + | ||
| 56 | + | return true | |
| 57 | + | end |
| @@ -0,0 +1,291 @@ | |||
| 1 | + | function onModalWindow(player, modalWindowId, buttonId, choiceId) | |
| 2 | + | ||
| 3 | + | player:unregisterEvent("DungeonSystem_Modal") | |
| 4 | + | ||
| 5 | + | local dg = DUNGEON_SYSTEM.Dungeons | |
| 6 | + | local msg = DUNGEON_SYSTEM.Messages | |
| 7 | + | local modal = DUNGEON_SYSTEM.Modal | |
| 8 | + | local sto = DUNGEON_SYSTEM.Storages | |
| 9 | + | ||
| 10 | + | if (modalWindowId == DUNGEON_SYSTEM.Modal.ID) then | |
| 11 | + | ||
| 12 | + | if buttonId == 200 then | |
| 13 | + | ||
| 14 | + | local players = {} | |
| 15 | + | for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do | |
| 16 | + | for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do | |
| 17 | + | for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do | |
| 18 | + | local tile = Tile(x, y, z) | |
| 19 | + | local creature = tile:getTopCreature() | |
| 20 | + | if creature and creature:isPlayer() then | |
| 21 | + | players[#players+1] = creature | |
| 22 | + | end | |
| 23 | + | end | |
| 24 | + | end | |
| 25 | + | end | |
| 26 | + | ||
| 27 | + | if #players > 0 then | |
| 28 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 29 | + | return player:sendTextMessage(MESSAGE_STATUS_SMALL, msg.PlayerInside) | |
| 30 | + | end | |
| 31 | + | ||
| 32 | + | if (dg[choiceId].NeedLevel) then | |
| 33 | + | if (player:getLevel() < dg[choiceId].Level) then | |
| 34 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedLevel, dg[choiceId].Level)) | |
| 35 | + | return false | |
| 36 | + | end | |
| 37 | + | end | |
| 38 | + | ||
| 39 | + | local pt = player:getParty() | |
| 40 | + | local partyMembers | |
| 41 | + | ||
| 42 | + | local party = {} | |
| 43 | + | party = partyMembers | |
| 44 | + | ||
| 45 | + | local fromPosPlayer = player:getPosition() | |
| 46 | + | ||
| 47 | + | if (dg[choiceId].NeedParty) then | |
| 48 | + | ||
| 49 | + | if not pt then | |
| 50 | + | ||
| 51 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgUniqueNeedParty) | |
| 52 | + | return false | |
| 53 | + | ||
| 54 | + | else | |
| 55 | + | ||
| 56 | + | partyMembers = pt:getMembers() | |
| 57 | + | local party = player:getParty():getMemberCount() | |
| 58 | + | ||
| 59 | + | if not (pt:getLeader():getName() == player:getName()) then | |
| 60 | + | ||
| 61 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgLeaderParty) | |
| 62 | + | return false | |
| 63 | + | ||
| 64 | + | else | |
| 65 | + | ||
| 66 | + | local partyMaisUm = party+1 | |
| 67 | + | ||
| 68 | + | if not (partyMaisUm == dg[choiceId].AmountParty) then | |
| 69 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedParty, dg[choiceId].AmountParty)) | |
| 70 | + | return false | |
| 71 | + | end | |
| 72 | + | ||
| 73 | + | local names = {} | |
| 74 | + | local posOfPlayer = {} | |
| 75 | + | ||
| 76 | + | for i = 1, party do | |
| 77 | + | ||
| 78 | + | local ppt = partyMembers[i] | |
| 79 | + | local fromPosPpt = ppt:getPosition() | |
| 80 | + | ||
| 81 | + | if DUNGEON_SYSTEM.PzToEntry then | |
| 82 | + | if not getTileInfo(fromPosPpt).protection then | |
| 83 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 84 | + | return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzMsg) | |
| 85 | + | elseif not getTileInfo(fromPosPlayer).protection then | |
| 86 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 87 | + | return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg) | |
| 88 | + | end | |
| 89 | + | end | |
| 90 | + | ||
| 91 | + | -- SE TEM COOLDOWN | |
| 92 | + | if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 or ppt:getStorageValue(sto.TimerCooldown) - os.time() > 0 then | |
| 93 | + | if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then | |
| 94 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.format(player:getStorageValue(sto.TimerCooldown)-os.time()))) | |
| 95 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 96 | + | ppt:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 97 | + | else | |
| 98 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.WaitFriendsCooldown, string.format(ppt:getStorageValue(sto.TimerCooldown)-os.time()))) | |
| 99 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 100 | + | ppt:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 101 | + | end | |
| 102 | + | return false | |
| 103 | + | end | |
| 104 | + | ||
| 105 | + | names[i] = ppt:getName() | |
| 106 | + | ||
| 107 | + | end | |
| 108 | + | ||
| 109 | + | local positionPlayer = player:getPosition() | |
| 110 | + | local distance = DUNGEON_SYSTEM.SQMsDistanceOfLeader | |
| 111 | + | ||
| 112 | + | for x = positionPlayer.x - distance, positionPlayer.x + distance do | |
| 113 | + | for y = positionPlayer.y - distance, positionPlayer.y + distance do | |
| 114 | + | for z = positionPlayer.z, positionPlayer.z do | |
| 115 | + | local tileP = Tile(x, y, z) | |
| 116 | + | local creatureP = tileP:getTopCreature() | |
| 117 | + | if creatureP and creatureP:isPlayer() then | |
| 118 | + | for xx = 1, #names do | |
| 119 | + | if creatureP:getName() == names[xx] then | |
| 120 | + | posOfPlayer[#posOfPlayer+1] = creatureP | |
| 121 | + | end | |
| 122 | + | end | |
| 123 | + | end | |
| 124 | + | end | |
| 125 | + | end | |
| 126 | + | end | |
| 127 | + | ||
| 128 | + | if #posOfPlayer+1 ~= dg[choiceId].AmountParty then | |
| 129 | + | return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgDistanceLeader) | |
| 130 | + | end | |
| 131 | + | ||
| 132 | + | if dg[choiceId].SpawnMonsters then | |
| 133 | + | for m, l in pairs(dg[choiceId].Monsters) do | |
| 134 | + | Game.createMonster(m, l) | |
| 135 | + | end | |
| 136 | + | end | |
| 137 | + | ||
| 138 | + | player:teleportTo(dg[choiceId].DungeonPos) | |
| 139 | + | player:getPosition():sendMagicEffect(40) | |
| 140 | + | player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY) | |
| 141 | + | ||
| 142 | + | addEvent(function() | |
| 143 | + | player:teleportTo(fromPosPlayer) | |
| 144 | + | player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime) | |
| 145 | + | player:getPosition():sendMagicEffect(40) | |
| 146 | + | player:popupFYI(msg.ToFail) | |
| 147 | + | ||
| 148 | + | -- Remove All monsters | |
| 149 | + | local monsterPos = {} | |
| 150 | + | for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do | |
| 151 | + | for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do | |
| 152 | + | for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do | |
| 153 | + | local tile = Tile(x, y, z) | |
| 154 | + | local monster = tile:getTopCreature() | |
| 155 | + | if monster and monster:isMonster() then | |
| 156 | + | monster:remove() | |
| 157 | + | end | |
| 158 | + | end | |
| 159 | + | end | |
| 160 | + | end | |
| 161 | + | ||
| 162 | + | end, dg[choiceId].DungeonTime*1000) | |
| 163 | + | ||
| 164 | + | for mx = 1, party do | |
| 165 | + | ||
| 166 | + | local ppt = partyMembers[mx] | |
| 167 | + | local fromPosPpt = ppt:getPosition() | |
| 168 | + | ||
| 169 | + | ppt:teleportTo(dg[choiceId].DungeonPos) | |
| 170 | + | ppt:getPosition():sendMagicEffect(40) | |
| 171 | + | ||
| 172 | + | addEvent(function() | |
| 173 | + | ppt:teleportTo(fromPosPpt) | |
| 174 | + | ppt:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime) | |
| 175 | + | ppt:getPosition():sendMagicEffect(40) | |
| 176 | + | ppt:popupFYI(msg.ToFail) | |
| 177 | + | end, dg[choiceId].DungeonTime*1000) | |
| 178 | + | ||
| 179 | + | end | |
| 180 | + | ||
| 181 | + | end | |
| 182 | + | ||
| 183 | + | end | |
| 184 | + | ||
| 185 | + | else | |
| 186 | + | ||
| 187 | + | if DUNGEON_SYSTEM.PzToEntry then | |
| 188 | + | if not getTileInfo(fromPosPlayer).protection then | |
| 189 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 190 | + | return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg) | |
| 191 | + | end | |
| 192 | + | end | |
| 193 | + | ||
| 194 | + | if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then | |
| 195 | + | player:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 196 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.format(player:getStorageValue(sto.TimerCooldown)-os.time()))) | |
| 197 | + | return false | |
| 198 | + | end | |
| 199 | + | ||
| 200 | + | if dg[choiceId].SpawnMonsters then | |
| 201 | + | for m, l in pairs(dg[choiceId].Monsters) do | |
| 202 | + | Game.createMonster(m, l) | |
| 203 | + | end | |
| 204 | + | end | |
| 205 | + | ||
| 206 | + | -- To Dungeon | |
| 207 | + | player:teleportTo(dg[choiceId].DungeonPos) | |
| 208 | + | player:getPosition():sendMagicEffect(40) | |
| 209 | + | player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY) | |
| 210 | + | player:setStorageValue(sto.TimerDungeon, os.time() + dg[choiceId].DungeonTime) | |
| 211 | + | ||
| 212 | + | -- Back Dungeon | |
| 213 | + | addEvent(function() | |
| 214 | + | player:teleportTo(fromPosPlayer) | |
| 215 | + | player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime) | |
| 216 | + | player:getPosition():sendMagicEffect(40) | |
| 217 | + | player:popupFYI(msg.ToFail) | |
| 218 | + | ||
| 219 | + | -- Remove All monsters | |
| 220 | + | local monsterPos = {} | |
| 221 | + | for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do | |
| 222 | + | for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do | |
| 223 | + | for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do | |
| 224 | + | local tile = Tile(x, y, z) | |
| 225 | + | local monster = tile:getTopCreature() | |
| 226 | + | if monster and monster:isMonster() then | |
| 227 | + | monster:remove() | |
| 228 | + | end | |
| 229 | + | end | |
| 230 | + | end | |
| 231 | + | end | |
| 232 | + | ||
| 233 | + | end, dg[choiceId].DungeonTime*1000) | |
| 234 | + | ||
| 235 | + | end | |
| 236 | + | ||
| 237 | + | ||
| 238 | + | elseif buttonId == 201 then | |
| 239 | + | ||
| 240 | + | player:registerEvent("DungeonSystemDetails_Modal") | |
| 241 | + | ||
| 242 | + | local needPartyMsg, needLevelMsg = "", "" | |
| 243 | + | ||
| 244 | + | if (dg[choiceId].NeedParty) then | |
| 245 | + | needPartyMsg = string.format("Party: %s players", dg[choiceId].AmountParty) | |
| 246 | + | else | |
| 247 | + | needPartyMsg = "Party: 1 players" | |
| 248 | + | end | |
| 249 | + | ||
| 250 | + | if (dg[choiceId].NeedLevel) then | |
| 251 | + | needLevelMsg = string.format("Level: %s+", dg[choiceId].Level) | |
| 252 | + | else | |
| 253 | + | needLevelMsg = "Don't need Level" | |
| 254 | + | end | |
| 255 | + | ||
| 256 | + | local currentTime = os.time() | |
| 257 | + | local endTime = dg[choiceId].DungeonTime + currentTime -- Calculate the end time | |
| 258 | + | ||
| 259 | + | -- Check if the dungeon time has already passed | |
| 260 | + | if endTime < currentTime then | |
| 261 | + | endTime = currentTime -- Set it to the current time to avoid negative values | |
| 262 | + | end | |
| 263 | + | ||
| 264 | + | local timeDiff = endTime - currentTime | |
| 265 | + | ||
| 266 | + | -- Calculate hours, minutes, and seconds as before | |
| 267 | + | local hours = math.floor(timeDiff / 3600) | |
| 268 | + | local minutes = math.floor((timeDiff % 3600) / 60) | |
| 269 | + | local seconds = timeDiff % 60 | |
| 270 | + | ||
| 271 | + | -- Format the time difference as a string | |
| 272 | + | local timeDiffStr = string.format("%02d:%02d:%02d", hours, minutes, seconds) | |
| 273 | + | ||
| 274 | + | ||
| 275 | + | local detailsModal = ModalWindow(modal.IDDetails, modal.TitleDetails, string.format(" Dungeon %s \n\n%s\n%s\nTime to make Dungeon: %s", dg[choiceId].Name, needPartyMsg, needLevelMsg, timeDiffStr)) | |
| 276 | + | ||
| 277 | + | ||
| 278 | + | detailsModal:addButton(100, "Back") | |
| 279 | + | ||
| 280 | + | detailsModal:setDefaultEnterButton(100) | |
| 281 | + | detailsModal:setDefaultEscapeButton(100) | |
| 282 | + | ||
| 283 | + | detailsModal:sendToPlayer(player) | |
| 284 | + | ||
| 285 | + | -- player:popupFYI(string.format(">> Dungeon %s <<\n\n" .. needPartyMsg .. "\n" .. needLevelMsg .."\n\nTime to Dungeon: %s", dg[choiceId].Name, string.format(dg[choiceId].DungeonTime))) | |
| 286 | + | ||
| 287 | + | end | |
| 288 | + | ||
| 289 | + | end | |
| 290 | + | ||
| 291 | + | end |