| @@ -0,0 +1,208 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | local DG_SUNSET = { | |
| 3 | + | [10316] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 01, POS_X = {x=3929, y=1077, z=14}, POS_Y = {x=4013, y=1146, z=14}}; | |
| 4 | + | [10349] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 01, POS_X = {x=4014, y=1077, z=14}, POS_Y = {x=4098, y=1146, z=14}}; | |
| 5 | + | [10353] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 01, POS_X = {x=4099, y=1077, z=14}, POS_Y = {x=4183, y=1146, z=14}}; | |
| 6 | + | [10317] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 02, POS_X = {x=3929, y=1077, z=14}, POS_Y = {x=4013, y=1146, z=14}}; | |
| 7 | + | [10350] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 02, POS_X = {x=4014, y=1077, z=14}, POS_Y = {x=4098, y=1146, z=14}}; | |
| 8 | + | [10354] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 02, POS_X = {x=4099, y=1077, z=14}, POS_Y = {x=4183, y=1146, z=14}}; | |
| 9 | + | [10318] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 03, POS_X = {x=3929, y=1077, z=14}, POS_Y = {x=4013, y=1146, z=14}}; | |
| 10 | + | [10351] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 03, POS_X = {x=4014, y=1077, z=14}, POS_Y = {x=4098, y=1146, z=14}}; | |
| 11 | + | [10355] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 03, POS_X = {x=4099, y=1077, z=14}, POS_Y = {x=4183, y=1146, z=14}}; | |
| 12 | + | [10319] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 04, POS_X = {x=3929, y=1077, z=14}, POS_Y = {x=4013, y=1146, z=14}}; | |
| 13 | + | [10352] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 04, POS_X = {x=4014, y=1077, z=14}, POS_Y = {x=4098, y=1146, z=14}}; | |
| 14 | + | [10356] = {STORAGE = _SYSTEM.DANGEROUS[02][01].STORAGE, ID = 04, POS_X = {x=4099, y=1077, z=14}, POS_Y = {x=4183, y=1146, z=14}}; | |
| 15 | + | } | |
| 16 | + | ||
| 17 | + | if DG_SUNSET[item.uid] then | |
| 18 | + | local from = DG_SUNSET[item.uid].POS_X | |
| 19 | + | local to = DG_SUNSET[item.uid].POS_Y | |
| 20 | + | local checkArea = 0 | |
| 21 | + | for A = from.x, to.x do | |
| 22 | + | for B = from.y, to.y do | |
| 23 | + | for C = from.z, to.z do | |
| 24 | + | local tile = Tile(A, B, C) | |
| 25 | + | local creature = tile:getTopCreature() | |
| 26 | + | if creature and creature:isMonster() then | |
| 27 | + | local master = creature:getMaster() | |
| 28 | + | if master and master:isPlayer() then | |
| 29 | + | else | |
| 30 | + | checkArea = 01 | |
| 31 | + | break | |
| 32 | + | end | |
| 33 | + | end | |
| 34 | + | end | |
| 35 | + | end | |
| 36 | + | end | |
| 37 | + | ||
| 38 | + | if checkArea == 0 then | |
| 39 | + | X = DG_SUNSET[item.uid] | |
| 40 | + | local party = player:getParty() | |
| 41 | + | if X.ID == 01 then | |
| 42 | + | if player:getStorageValue(X.STORAGE) == 01 then | |
| 43 | + | if not party then | |
| 44 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 01/04 ]") | |
| 45 | + | player:setStorageValue(X.STORAGE, 02) | |
| 46 | + | player:getPosition():sendMagicEffect(13) | |
| 47 | + | else | |
| 48 | + | local members = party:getMembers() | |
| 49 | + | members[#members + 1] = party:getLeader() | |
| 50 | + | for _, member in ipairs(members) do | |
| 51 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 01/04 ]") | |
| 52 | + | member:setStorageValue(X.STORAGE, 02) | |
| 53 | + | member:getPosition():sendMagicEffect(13) | |
| 54 | + | end | |
| 55 | + | end | |
| 56 | + | ||
| 57 | + | if item.uid == 10316 then | |
| 58 | + | Game.createMonster("Water Elemental", {x=3954, y=1115, z=14}); | |
| 59 | + | Game.createMonster("Water Elemental", {x=3957, y=1118, z=14}); | |
| 60 | + | Game.createMonster("Water Elemental", {x=3954, y=1121, z=14}); | |
| 61 | + | Game.createMonster("Water Elemental", {x=3951, y=1118, z=14}); | |
| 62 | + | elseif item.uid == 10349 then | |
| 63 | + | Game.createMonster("Water Elemental", {x=4039, y=1115, z=14}); | |
| 64 | + | Game.createMonster("Water Elemental", {x=4042, y=1118, z=14}); | |
| 65 | + | Game.createMonster("Water Elemental", {x=4039, y=1121, z=14}); | |
| 66 | + | Game.createMonster("Water Elemental", {x=4036, y=1118, z=14}); | |
| 67 | + | elseif item.uid == 10353 then | |
| 68 | + | Game.createMonster("Water Elemental", {x=4124, y=1115, z=14}); | |
| 69 | + | Game.createMonster("Water Elemental", {x=4127, y=1118, z=14}); | |
| 70 | + | Game.createMonster("Water Elemental", {x=4124, y=1121, z=14}); | |
| 71 | + | Game.createMonster("Water Elemental", {x=4121, y=1118, z=14}); | |
| 72 | + | end | |
| 73 | + | ||
| 74 | + | elseif player:getStorageValue(X.STORAGE) == 05 then | |
| 75 | + | if not party then | |
| 76 | + | player:setStorageValue(X.STORAGE, 13) | |
| 77 | + | player:setStorageValue(_SYSTEM.DANGEROUS[02][01].RECOMPENSA[01], _SYSTEM.DANGEROUS[02][01].RECOMPENSA[02]) | |
| 78 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Retorne ao bau de Recompensa.") | |
| 79 | + | player:getPosition():sendMagicEffect(13) | |
| 80 | + | else | |
| 81 | + | local members = party:getMembers() | |
| 82 | + | members[#members + 1] = party:getLeader() | |
| 83 | + | for _, member in ipairs(members) do | |
| 84 | + | member:setStorageValue(X.STORAGE, 13) | |
| 85 | + | member:setStorageValue(_SYSTEM.DANGEROUS[02][01].RECOMPENSA[01], _SYSTEM.DANGEROUS[02][01].RECOMPENSA[02]) | |
| 86 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Retorne ao bau de Recompensa.") | |
| 87 | + | member:getPosition():sendMagicEffect(13) | |
| 88 | + | end | |
| 89 | + | end | |
| 90 | + | else | |
| 91 | + | player:getPosition():sendMagicEffect(03) | |
| 92 | + | end | |
| 93 | + | ||
| 94 | + | elseif X.ID == 02 then | |
| 95 | + | if player:getStorageValue(X.STORAGE) == 02 then | |
| 96 | + | if not party then | |
| 97 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 02/04 ]") | |
| 98 | + | player:setStorageValue(X.STORAGE, 03) | |
| 99 | + | player:getPosition():sendMagicEffect(13) | |
| 100 | + | else | |
| 101 | + | local members = party:getMembers() | |
| 102 | + | members[#members + 1] = party:getLeader() | |
| 103 | + | for _, member in ipairs(members) do | |
| 104 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 02/04 ]") | |
| 105 | + | member:setStorageValue(X.STORAGE, 03) | |
| 106 | + | member:getPosition():sendMagicEffect(13) | |
| 107 | + | end | |
| 108 | + | end | |
| 109 | + | ||
| 110 | + | if item.uid == 10317 then | |
| 111 | + | Game.createMonster("Crystal Wolf", {x=3969, y=1096, z=14}); | |
| 112 | + | Game.createMonster("Crystal Wolf", {x=3971, y=1098, z=14}); | |
| 113 | + | Game.createMonster("Crystal Wolf", {x=3969, y=1100, z=14}); | |
| 114 | + | Game.createMonster("Crystal Wolf", {x=3967, y=1098, z=14}); | |
| 115 | + | elseif item.uid == 10350 then | |
| 116 | + | Game.createMonster("Crystal Wolf", {x=4054, y=1096, z=14}); | |
| 117 | + | Game.createMonster("Crystal Wolf", {x=4056, y=1098, z=14}); | |
| 118 | + | Game.createMonster("Crystal Wolf", {x=4054, y=1100, z=14}); | |
| 119 | + | Game.createMonster("Crystal Wolf", {x=4052, y=1098, z=14}); | |
| 120 | + | elseif item.uid == 10354 then | |
| 121 | + | Game.createMonster("Crystal Wolf", {x=4139, y=1096, z=14}); | |
| 122 | + | Game.createMonster("Crystal Wolf", {x=4141, y=1098, z=14}); | |
| 123 | + | Game.createMonster("Crystal Wolf", {x=4139, y=1100, z=14}); | |
| 124 | + | Game.createMonster("Crystal Wolf", {x=4137, y=1098, z=14}); | |
| 125 | + | end | |
| 126 | + | else | |
| 127 | + | player:getPosition():sendMagicEffect(03) | |
| 128 | + | end | |
| 129 | + | ||
| 130 | + | elseif X.ID == 03 then | |
| 131 | + | if player:getStorageValue(X.STORAGE) == 03 then | |
| 132 | + | if not party then | |
| 133 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 03/04 ]") | |
| 134 | + | player:setStorageValue(X.STORAGE, 04) | |
| 135 | + | player:getPosition():sendMagicEffect(13) | |
| 136 | + | else | |
| 137 | + | local members = party:getMembers() | |
| 138 | + | members[#members + 1] = party:getLeader() | |
| 139 | + | for _, member in ipairs(members) do | |
| 140 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 03/04 ]") | |
| 141 | + | member:setStorageValue(X.STORAGE, 04) | |
| 142 | + | member:getPosition():sendMagicEffect(13) | |
| 143 | + | end | |
| 144 | + | end | |
| 145 | + | ||
| 146 | + | if item.uid == 10318 then | |
| 147 | + | Game.createMonster("Frost Dragon Hatchling", {x=3990, y=1102, z=14}); | |
| 148 | + | Game.createMonster("Frost Dragon Hatchling", {x=3992, y=1104, z=14}); | |
| 149 | + | Game.createMonster("Frost Dragon Hatchling", {x=3990, y=1106, z=14}); | |
| 150 | + | Game.createMonster("Frost Dragon Hatchling", {x=3988, y=1104, z=14}); | |
| 151 | + | elseif item.uid == 10351 then | |
| 152 | + | Game.createMonster("Frost Dragon Hatchling", {x=4075, y=1102, z=14}); | |
| 153 | + | Game.createMonster("Frost Dragon Hatchling", {x=4077, y=1104, z=14}); | |
| 154 | + | Game.createMonster("Frost Dragon Hatchling", {x=4075, y=1106, z=14}); | |
| 155 | + | Game.createMonster("Frost Dragon Hatchling", {x=4073, y=1104, z=14}); | |
| 156 | + | elseif item.uid == 10355 then | |
| 157 | + | Game.createMonster("Frost Dragon Hatchling", {x=4160, y=1102, z=14}); | |
| 158 | + | Game.createMonster("Frost Dragon Hatchling", {x=4162, y=1104, z=14}); | |
| 159 | + | Game.createMonster("Frost Dragon Hatchling", {x=4160, y=1106, z=14}); | |
| 160 | + | Game.createMonster("Frost Dragon Hatchling", {x=4158, y=1104, z=14}); | |
| 161 | + | end | |
| 162 | + | else | |
| 163 | + | player:getPosition():sendMagicEffect(03) | |
| 164 | + | end | |
| 165 | + | ||
| 166 | + | elseif X.ID == 04 then | |
| 167 | + | if player:getStorageValue(X.STORAGE) == 04 then | |
| 168 | + | if not party then | |
| 169 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 04/04 ]\nRetorne ao primeiro Monumento e clique nele.") | |
| 170 | + | player:setStorageValue(X.STORAGE, 05) | |
| 171 | + | player:getPosition():sendMagicEffect(13) | |
| 172 | + | else | |
| 173 | + | local members = party:getMembers() | |
| 174 | + | members[#members + 1] = party:getLeader() | |
| 175 | + | for _, member in ipairs(members) do | |
| 176 | + | member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monumento G�lido [ 04/04 ]\nRetorne ao primeiro Monumento e clique nele.") | |
| 177 | + | member:setStorageValue(X.STORAGE, 05) | |
| 178 | + | member:getPosition():sendMagicEffect(13) | |
| 179 | + | end | |
| 180 | + | end | |
| 181 | + | ||
| 182 | + | if item.uid == 10319 then | |
| 183 | + | Game.createMonster("Yeti", {x=3986, y=1125, z=14}); | |
| 184 | + | Game.createMonster("Yeti", {x=3988, y=1127, z=14}); | |
| 185 | + | Game.createMonster("Yeti", {x=3986, y=1129, z=14}); | |
| 186 | + | Game.createMonster("Yeti", {x=3984, y=1127, z=14}); | |
| 187 | + | elseif item.uid == 10352 then | |
| 188 | + | Game.createMonster("Yeti", {x=4071, y=1125, z=14}); | |
| 189 | + | Game.createMonster("Yeti", {x=4073, y=1127, z=14}); | |
| 190 | + | Game.createMonster("Yeti", {x=4071, y=1129, z=14}); | |
| 191 | + | Game.createMonster("Yeti", {x=4069, y=1127, z=14}); | |
| 192 | + | elseif item.uid == 10356 then | |
| 193 | + | Game.createMonster("Yeti", {x=4156, y=1125, z=14}); | |
| 194 | + | Game.createMonster("Yeti", {x=4158, y=1127, z=14}); | |
| 195 | + | Game.createMonster("Yeti", {x=4156, y=1129, z=14}); | |
| 196 | + | Game.createMonster("Yeti", {x=4154, y=1127, z=14}); | |
| 197 | + | end | |
| 198 | + | else | |
| 199 | + | player:getPosition():sendMagicEffect(03) | |
| 200 | + | end | |
| 201 | + | ||
| 202 | + | end | |
| 203 | + | else | |
| 204 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Limpe toda a �rea para poder prosseguir.") | |
| 205 | + | player:getPosition():sendMagicEffect(03) | |
| 206 | + | end | |
| 207 | + | end | |
| 208 | + | end |
| @@ -0,0 +1,159 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | ||
| 3 | + | -- ESTATUA SWORD | |
| 4 | + | if item.uid == 10250 then | |
| 5 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[01]) < 01 then | |
| 6 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) < 01 then | |
| 7 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Estatuas Ativadas [ 01/05 ]") | |
| 8 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], 01) | |
| 9 | + | player:getPosition():sendMagicEffect(13) | |
| 10 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 11 | + | ||
| 12 | + | if player:getStorageValue(_QUESTLOG[157].UID_01) == 02 then | |
| 13 | + | addEvent(function() | |
| 14 | + | player:setStorageValue(_QUESTLOG[157].UID_01, 03) | |
| 15 | + | player:getPosition():sendMagicEffect(14) | |
| 16 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 17 | + | ||
| 18 | + | player:addExperience(99000, true, true) | |
| 19 | + | doBackpack(player, 12) | |
| 20 | + | end, 3000) | |
| 21 | + | end | |
| 22 | + | else | |
| 23 | + | player:getPosition():sendMagicEffect(03) | |
| 24 | + | end | |
| 25 | + | else | |
| 26 | + | player:getPosition():sendMagicEffect(03) | |
| 27 | + | end | |
| 28 | + | end | |
| 29 | + | -- ESTATUA WAND | |
| 30 | + | if item.uid == 10251 then | |
| 31 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[01]) < 01 then | |
| 32 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 01 then | |
| 33 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Estatuas Ativadas [ 02/05 ]") | |
| 34 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], 02) | |
| 35 | + | player:getPosition():sendMagicEffect(13) | |
| 36 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 37 | + | ||
| 38 | + | if player:getStorageValue(_QUESTLOG[157].UID_01) == 03 then | |
| 39 | + | addEvent(function() | |
| 40 | + | player:setStorageValue(_QUESTLOG[157].UID_01, 04) | |
| 41 | + | player:getPosition():sendMagicEffect(14) | |
| 42 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 43 | + | ||
| 44 | + | doBackpack(player, 12) | |
| 45 | + | end, 3000) | |
| 46 | + | end | |
| 47 | + | else | |
| 48 | + | player:getPosition():sendMagicEffect(03) | |
| 49 | + | end | |
| 50 | + | else | |
| 51 | + | player:getPosition():sendMagicEffect(03) | |
| 52 | + | end | |
| 53 | + | end | |
| 54 | + | -- ESTATUA SPEAR | |
| 55 | + | if item.uid == 10252 then | |
| 56 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[01]) < 01 then | |
| 57 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 02 then | |
| 58 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Estatuas Ativadas [ 03/05 ]") | |
| 59 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], 03) | |
| 60 | + | player:getPosition():sendMagicEffect(13) | |
| 61 | + | ||
| 62 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 63 | + | if player:getStorageValue(_QUESTLOG[157].UID_01) == 04 then | |
| 64 | + | addEvent(function() | |
| 65 | + | player:setStorageValue(_QUESTLOG[157].UID_01, 05) | |
| 66 | + | player:getPosition():sendMagicEffect(14) | |
| 67 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 68 | + | ||
| 69 | + | doBackpack(player, 12) | |
| 70 | + | end, 3000) | |
| 71 | + | end | |
| 72 | + | else | |
| 73 | + | player:getPosition():sendMagicEffect(03) | |
| 74 | + | end | |
| 75 | + | else | |
| 76 | + | player:getPosition():sendMagicEffect(03) | |
| 77 | + | end | |
| 78 | + | end | |
| 79 | + | -- ESTATUA CLUB | |
| 80 | + | if item.uid == 10253 then | |
| 81 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[01]) < 01 then | |
| 82 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 03 then | |
| 83 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Estatuas Ativadas [ 04/05 ]") | |
| 84 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], 04) | |
| 85 | + | player:getPosition():sendMagicEffect(13) | |
| 86 | + | ||
| 87 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 88 | + | if player:getStorageValue(_QUESTLOG[157].UID_01) == 05 then | |
| 89 | + | addEvent(function() | |
| 90 | + | player:setStorageValue(_QUESTLOG[157].UID_01, 06) | |
| 91 | + | player:getPosition():sendMagicEffect(14) | |
| 92 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 93 | + | ||
| 94 | + | doBackpack(player, 12) | |
| 95 | + | end, 3000) | |
| 96 | + | end | |
| 97 | + | else | |
| 98 | + | player:getPosition():sendMagicEffect(03) | |
| 99 | + | end | |
| 100 | + | else | |
| 101 | + | player:getPosition():sendMagicEffect(03) | |
| 102 | + | end | |
| 103 | + | end | |
| 104 | + | -- ESTATUA AXE | |
| 105 | + | if item.uid == 10254 then | |
| 106 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[01]) < 01 then | |
| 107 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 04 then | |
| 108 | + | local ESP_ID = player:getStorageValue(_SYSTEM.ESPECIALISTA[04]) | |
| 109 | + | if ESP_ID == nil or ESP_ID < 01 or ESP_ID > 04 then | |
| 110 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[01], nil) | |
| 111 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[02], nil) | |
| 112 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], nil) | |
| 113 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[04], nil) | |
| 114 | + | ||
| 115 | + | PlayerGoldCoins(player, 02, 55000) | |
| 116 | + | doBackpack(tid, 11) | |
| 117 | + | player:sendTextMessage(MESSAGE_EVENT_WARNING, "[ DESAFIO CANCELADO ].") | |
| 118 | + | player:teleportTo({x=3281, y=1632, z=7}) | |
| 119 | + | player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 120 | + | return false | |
| 121 | + | end | |
| 122 | + | ||
| 123 | + | local ESPECIALISTA_NAME = { | |
| 124 | + | [01] = "Pistola"; | |
| 125 | + | [02] = "Metralhadora"; | |
| 126 | + | [03] = "Espingarda"; | |
| 127 | + | [04] = "Rifle"; | |
| 128 | + | } | |
| 129 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[ DESAFIO FINALIZADO ]\nVoc� agora � um especialista em " ..ESPECIALISTA_NAME[ESP_ID].. ". Acesse seu Menu, na aba STATUS para mais informa�es.") | |
| 130 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[01], ESP_ID) | |
| 131 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[02], 00) | |
| 132 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], nil) | |
| 133 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[04], nil) | |
| 134 | + | ||
| 135 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 136 | + | player:sendCancelMessage("@StarCliente") | |
| 137 | + | player:teleportTo({x=3281, y=1632, z=7}) | |
| 138 | + | player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 139 | + | ||
| 140 | + | if player:getStorageValue(_QUESTLOG[157].UID_01) == 06 then | |
| 141 | + | addEvent(function() | |
| 142 | + | player:setStorageValue(_QUESTLOG[157].UID_01, 100) | |
| 143 | + | player:setStorageValue(_QUESTLOG[158].UID_01, 01) | |
| 144 | + | player:getPosition():sendMagicEffect(14) | |
| 145 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.") | |
| 146 | + | ||
| 147 | + | doBackpack(player, 12) | |
| 148 | + | end, 5000) | |
| 149 | + | end | |
| 150 | + | else | |
| 151 | + | player:getPosition():sendMagicEffect(03) | |
| 152 | + | end | |
| 153 | + | else | |
| 154 | + | player:getPosition():sendMagicEffect(03) | |
| 155 | + | end | |
| 156 | + | end | |
| 157 | + | ||
| 158 | + | ||
| 159 | + | end |
| @@ -0,0 +1,105 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | ||
| 3 | + | -- TOCHA | |
| 4 | + | if item.uid == 10255 then | |
| 5 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[02]) < 06 then | |
| 6 | + | if player:getOutfit().lookType ~= 49 then | |
| 7 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) < 01 then | |
| 8 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Tienes 40 segundos para encender la torre de cristal 01.") | |
| 9 | + | elseif player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 01 then | |
| 10 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Tienes 40 segundos para encender la torre de cristal 02.") | |
| 11 | + | elseif player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 02 then | |
| 12 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Desafio completado!\nNivel de especialista aumentado. Accede al Menu, en la pesta�a ESTADO para mas informacion.") | |
| 13 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[02], 01) | |
| 14 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], nil) | |
| 15 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[04], nil) | |
| 16 | + | ||
| 17 | + | player:sendCancelMessage("@StarCliente") | |
| 18 | + | player:teleportTo({x=3281, y=1632, z=7}) | |
| 19 | + | player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | |
| 20 | + | ||
| 21 | + | if player:getStorageValue(_QUESTLOG[158].UID_01) == 04 then | |
| 22 | + | addEvent(function() | |
| 23 | + | player:setStorageValue(_QUESTLOG[158].UID_01, 100) | |
| 24 | + | player:setStorageValue(_QUESTLOG[159].UID_01, 01) | |
| 25 | + | player:getPosition():sendMagicEffect(14) | |
| 26 | + | ||
| 27 | + | player:addExperience(150000, true, true) | |
| 28 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Su Diario de Missiones fue actualizado.") | |
| 29 | + | ||
| 30 | + | doBackpack(player, 12) | |
| 31 | + | end, 3000) | |
| 32 | + | end | |
| 33 | + | return true | |
| 34 | + | else | |
| 35 | + | player:getPosition():sendMagicEffect(03) | |
| 36 | + | return true | |
| 37 | + | end | |
| 38 | + | ||
| 39 | + | player:getPosition():sendMagicEffect(13) | |
| 40 | + | ||
| 41 | + | local condition = Condition(CONDITION_OUTFIT) | |
| 42 | + | condition:setOutfit({lookType = 49}) | |
| 43 | + | condition:setTicks(40000) | |
| 44 | + | player:addCondition(condition) | |
| 45 | + | else | |
| 46 | + | player:getPosition():sendMagicEffect(03) | |
| 47 | + | return true | |
| 48 | + | end | |
| 49 | + | else | |
| 50 | + | player:getPosition():sendMagicEffect(03) | |
| 51 | + | return true | |
| 52 | + | end | |
| 53 | + | ||
| 54 | + | -- CRYSTAL TORRE 01 | |
| 55 | + | elseif item.uid == 10256 then | |
| 56 | + | if player:getOutfit().lookType == 49 then | |
| 57 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) < 01 then | |
| 58 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], 01) | |
| 59 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Cristal Energizado!\nDevuelve la llama.") | |
| 60 | + | player:getPosition():sendMagicEffect(13) | |
| 61 | + | ||
| 62 | + | if player:getStorageValue(_QUESTLOG[158].UID_01) == 02 then | |
| 63 | + | addEvent(function() | |
| 64 | + | player:setStorageValue(_QUESTLOG[158].UID_01, 03) | |
| 65 | + | player:getPosition():sendMagicEffect(14) | |
| 66 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Su Diario de Missiones fue actualizado.") | |
| 67 | + | ||
| 68 | + | doBackpack(player, 12) | |
| 69 | + | end, 3000) | |
| 70 | + | end | |
| 71 | + | else | |
| 72 | + | player:getPosition():sendMagicEffect(03) | |
| 73 | + | end | |
| 74 | + | else | |
| 75 | + | player:getPosition():sendMagicEffect(03) | |
| 76 | + | end | |
| 77 | + | ||
| 78 | + | -- CRYSTAL TORRE 02 | |
| 79 | + | elseif item.uid == 10257 then | |
| 80 | + | if player:getOutfit().lookType == 49 then | |
| 81 | + | if player:getStorageValue(_SYSTEM.ESPECIALISTA[03]) == 01 then | |
| 82 | + | player:setStorageValue(_SYSTEM.ESPECIALISTA[03], 02) | |
| 83 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Cristal Energizado!\nDevuelve la llama.") | |
| 84 | + | player:getPosition():sendMagicEffect(13) | |
| 85 | + | ||
| 86 | + | if player:getStorageValue(_QUESTLOG[158].UID_01) == 03 then | |
| 87 | + | addEvent(function() | |
| 88 | + | player:setStorageValue(_QUESTLOG[158].UID_01, 04) | |
| 89 | + | player:getPosition():sendMagicEffect(14) | |
| 90 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Su Diario de Missiones fue actualizado.") | |
| 91 | + | ||
| 92 | + | doBackpack(player, 12) | |
| 93 | + | end, 3000) | |
| 94 | + | end | |
| 95 | + | else | |
| 96 | + | player:getPosition():sendMagicEffect(03) | |
| 97 | + | end | |
| 98 | + | else | |
| 99 | + | player:getPosition():sendMagicEffect(03) | |
| 100 | + | end | |
| 101 | + | else | |
| 102 | + | player:getPosition():sendMagicEffect(03) | |
| 103 | + | end | |
| 104 | + | ||
| 105 | + | end |
| @@ -0,0 +1,39 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | local NEXUS_POSITION = { | |
| 3 | + | [10101] = {STORAGE = _SYSTEM.NEXUS[001].UID_01, ID = 01}; -- Kazemir | |
| 4 | + | [10102] = {STORAGE = _SYSTEM.NEXUS[002].UID_01, ID = 02}; -- Sunset | |
| 5 | + | [10103] = {STORAGE = _SYSTEM.NEXUS[003].UID_01, ID = 03}; -- Bonebrook | |
| 6 | + | [10104] = {STORAGE = _SYSTEM.NEXUS[004].UID_01, ID = 04}; -- Kimbolton | |
| 7 | + | [10105] = {STORAGE = _SYSTEM.NEXUS[005].UID_01, ID = 05}; -- Huampali | |
| 8 | + | [10106] = {STORAGE = _SYSTEM.NEXUS[006].UID_01, ID = 06}; -- Rivermine | |
| 9 | + | ||
| 10 | + | [10107] = {STORAGE = _SYSTEM.NEXUS[008].UID_01, ID = 08}; -- Kopec | |
| 11 | + | [10108] = {STORAGE = _SYSTEM.NEXUS[009].UID_01, ID = 09}; -- Hanva | |
| 12 | + | [10109] = {STORAGE = _SYSTEM.NEXUS[010].UID_01, ID = 10}; -- Sodon | |
| 13 | + | } | |
| 14 | + | if _DEBUG_MODE then | |
| 15 | + | print("[ACTION - SINC NEXUS] " ..player:getName().. " - Sincronizando Nexus [ " .._SYSTEM.NEXUS[NEXUS_POSITION[item.uid].ID].NAME.. " ]") | |
| 16 | + | end | |
| 17 | + | if NEXUS_POSITION[item.uid] then | |
| 18 | + | local X = NEXUS_POSITION[item.uid] | |
| 19 | + | if player:getStorageValue(X.STORAGE) < 01 then | |
| 20 | + | player:setStorageValue(X.STORAGE, 101) | |
| 21 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sincronizacion completa.\nLugares de caza descubiertos. Consulta tu mapa.") | |
| 22 | + | player:getPosition():sendMagicEffect(14) | |
| 23 | + | player:sendCancelMessage("@SolorNexus " ..X.ID) | |
| 24 | + | else | |
| 25 | + | player:getPosition():sendMagicEffect(03) | |
| 26 | + | end | |
| 27 | + | ||
| 28 | + | if X.ID == 01 and player:getStorageValue(_QUESTLOG[26].UID_01) == 1 then | |
| 29 | + | player:setStorageValue(_QUESTLOG[26].UID_01, 100) | |
| 30 | + | player:getPosition():sendMagicEffect(13) | |
| 31 | + | player:sendCancelMessage("@RemoveMarkMap") | |
| 32 | + | addEvent(function() | |
| 33 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Su Diario de Missiones fue actualizado.") | |
| 34 | + | end, 5000) | |
| 35 | + | end | |
| 36 | + | else | |
| 37 | + | player:getPosition():sendMagicEffect(03) | |
| 38 | + | end | |
| 39 | + | end |
| @@ -0,0 +1,18 @@ | |||
| 1 | + | -- keep in sync with actions.xml | |
| 2 | + | local alaItems = { | |
| 3 | + | [23496] = 23500, | |
| 4 | + | [23500] = 23496, | |
| 5 | + | [23497] = 23501, | |
| 6 | + | [23501] = 23497, | |
| 7 | + | [23498] = 23502, | |
| 8 | + | [23502] = 23498, | |
| 9 | + | [23499] = 23503, | |
| 10 | + | [23503] = 23499, | |
| 11 | + | [09827] = 09828, | |
| 12 | + | [09828] = 09827, | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 16 | + | item:transform(alaItems[item.itemid]) | |
| 17 | + | return true | |
| 18 | + | end |
| @@ -0,0 +1,50 @@ | |||
| 1 | + | local beds = { | |
| 2 | + | [7904] = {{7811, 7812}, {7813, 7814}}, -- green kit | |
| 3 | + | [7905] = {{7819, 7820}, {7821, 7822}}, -- yellow kit | |
| 4 | + | [7906] = {{7815, 7816}, {7817, 7818}}, -- red kit | |
| 5 | + | [7907] = {{1754, 1755}, {1760, 1761}}, -- removal kit | |
| 6 | + | [20252] = {{20197, 20198}, {20199, 20200}} -- canopy kit | |
| 7 | + | } | |
| 8 | + | ||
| 9 | + | local function internalBedTransform(item, targetItem, toPosition, itemArray) | |
| 10 | + | targetItem:transform(itemArray[1]) | |
| 11 | + | targetItem:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 12 | + | ||
| 13 | + | Tile(toPosition):getItemByType(ITEM_TYPE_BED):transform(itemArray[2]) | |
| 14 | + | toPosition:sendMagicEffect(CONST_ME_POFF) | |
| 15 | + | ||
| 16 | + | item:remove() | |
| 17 | + | end | |
| 18 | + | ||
| 19 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 20 | + | local newBed = beds[item:getId()] | |
| 21 | + | if not newBed or type(target) ~= "userdata" or not target:isItem() then | |
| 22 | + | return false | |
| 23 | + | end | |
| 24 | + | ||
| 25 | + | local tile = Tile(toPosition) | |
| 26 | + | if not tile or not tile:getHouse() then | |
| 27 | + | return false | |
| 28 | + | end | |
| 29 | + | ||
| 30 | + | local targetItemId = target:getId() | |
| 31 | + | if targetItemId == newBed[1][1] or targetItemId == newBed[2][1] then | |
| 32 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "You already have this bed modification.") | |
| 33 | + | return true | |
| 34 | + | end | |
| 35 | + | ||
| 36 | + | for _, bed in pairs(beds) do | |
| 37 | + | if bed[1][1] == targetItemId or table.contains({1758, 5502, 18027}, targetItemId) then | |
| 38 | + | toPosition:sendMagicEffect(CONST_ME_POFF) | |
| 39 | + | toPosition.y = toPosition.y + 1 | |
| 40 | + | internalBedTransform(item, target, toPosition, newBed[1]) | |
| 41 | + | break | |
| 42 | + | elseif bed[2][1] == targetItemId or table.contains({1756, 5500, 18029}, targetItemId) then | |
| 43 | + | toPosition:sendMagicEffect(CONST_ME_POFF) | |
| 44 | + | toPosition.x = toPosition.x + 1 | |
| 45 | + | internalBedTransform(item, target, toPosition, newBed[2]) | |
| 46 | + | break | |
| 47 | + | end | |
| 48 | + | end | |
| 49 | + | return true | |
| 50 | + | end |
| @@ -0,0 +1,9 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if math.random(100) == 1 then | |
| 3 | + | item:transform(2094) | |
| 4 | + | player:addAchievement("Oops") | |
| 5 | + | else | |
| 6 | + | item:getPosition():sendMagicEffect(CONST_ME_SOUND_YELLOW) | |
| 7 | + | end | |
| 8 | + | return true | |
| 9 | + | end |
| @@ -0,0 +1,7 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | item:transform(2786) | |
| 3 | + | item:decay() | |
| 4 | + | Game.createItem(2677, 3, fromPosition) | |
| 5 | + | player:addAchievementProgress("Bluebarian", 500) | |
| 6 | + | return true | |
| 7 | + | end |
| @@ -0,0 +1,19 @@ | |||
| 1 | + | local config = { | |
| 2 | + | [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN}, | |
| 3 | + | [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN}, | |
| 4 | + | [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN} | |
| 5 | + | } | |
| 6 | + | ||
| 7 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 8 | + | local coin = config[item:getId()] | |
| 9 | + | if coin.changeTo and item.type == 100 then | |
| 10 | + | item:remove() | |
| 11 | + | player:addItem(coin.changeTo, 1) | |
| 12 | + | elseif coin.changeBack then | |
| 13 | + | item:remove(1) | |
| 14 | + | player:addItem(coin.changeBack, 100) | |
| 15 | + | else | |
| 16 | + | return false | |
| 17 | + | end | |
| 18 | + | return true | |
| 19 | + | end |
| @@ -0,0 +1,31 @@ | |||
| 1 | + | local constructionKits = { | |
| 2 | + | [3901] = 1666, [3902] = 1670, [3903] = 1652, [3904] = 1674, [3905] = 1658, | |
| 3 | + | [3906] = 3813, [3907] = 3817, [3908] = 1619, [3909] = 12799, [3910] = 2105, | |
| 4 | + | [3911] = 1614, [3912] = 3806, [3913] = 3807, [3914] = 3809, [3915] = 1716, | |
| 5 | + | [3916] = 1724, [3917] = 1732, [3918] = 1775, [3919] = 1774, [3920] = 1750, | |
| 6 | + | [3921] = 3832, [3922] = 2095, [3923] = 2098, [3924] = 2064, [3925] = 2582, | |
| 7 | + | [3926] = 2117, [3927] = 1728, [3928] = 1442, [3929] = 1446, [3930] = 1447, | |
| 8 | + | [3931] = 2034, [3932] = 2604, [3933] = 2080, [3934] = 2084, [3935] = 3821, | |
| 9 | + | [3936] = 3811, [3937] = 2101, [3938] = 3812, [5086] = 5046, [5087] = 5055, | |
| 10 | + | [5088] = 5056, [6114] = 6111, [6115] = 6109, [6372] = 6356, [6373] = 6371, | |
| 11 | + | [8692] = 8688, [9974] = 9975, [11126] = 11127, [11133] = 11129, [11124] = 11125, | |
| 12 | + | [11205] = 11203, [14328] = 1616, [14329] = 1615, [16075] = 16020, [16099] = 16098, | |
| 13 | + | [20254] = 20295, [20255] = 20297, [20257] = 20299 | |
| 14 | + | } | |
| 15 | + | ||
| 16 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 17 | + | local kit = constructionKits[item.itemid] | |
| 18 | + | if not kit then | |
| 19 | + | return false | |
| 20 | + | end | |
| 21 | + | ||
| 22 | + | if fromPosition.x == CONTAINER_POSITION then | |
| 23 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "Put the construction kit on the floor first.") | |
| 24 | + | elseif not Tile(fromPosition):getHouse() then | |
| 25 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "You may construct this only inside a house.") | |
| 26 | + | else | |
| 27 | + | item:transform(kit) | |
| 28 | + | fromPosition:sendMagicEffect(CONST_ME_POFF) | |
| 29 | + | end | |
| 30 | + | return true | |
| 31 | + | end |
| @@ -0,0 +1,19 @@ | |||
| 1 | + | local liquidContainers = {1775, 2005, 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2023, 2031, 2032, 2033} | |
| 2 | + | local millstones = {1381, 1382, 1383, 1384} | |
| 3 | + | ||
| 4 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 5 | + | local itemId = item:getId() | |
| 6 | + | if itemId == 2692 then | |
| 7 | + | if target.type == 1 and table.contains(liquidContainers, target.itemid) then | |
| 8 | + | item:remove(1) | |
| 9 | + | player:addItem(2693, 1) | |
| 10 | + | target:transform(target.itemid, 0) | |
| 11 | + | return true | |
| 12 | + | end | |
| 13 | + | elseif table.contains(millstones, target.itemid) then | |
| 14 | + | item:remove(1) | |
| 15 | + | player:addItem(2692, 1) | |
| 16 | + | return true | |
| 17 | + | end | |
| 18 | + | return false | |
| 19 | + | end |
| @@ -0,0 +1,28 @@ | |||
| 1 | + | -- keep in sync with actions.xml | |
| 2 | + | local decayItems = { | |
| 3 | + | [1479] = 1480, [1480] = 1479, [1634] = 1635, [1635] = 1634, [1636] = 1637, | |
| 4 | + | [1637] = 1636, [1638] = 1639, [1639] = 1638, [1640] = 1641, [1641] = 1640, | |
| 5 | + | [1786] = 1787, [1787] = 1786, [1788] = 1789, [1789] = 1788, [1790] = 1791, | |
| 6 | + | [1791] = 1790, [1792] = 1793, [1793] = 1792, [1873] = 1874, [1874] = 1873, | |
| 7 | + | [1875] = 1876, [1876] = 1875, [1945] = 1946, [1946] = 1945, [2037] = 2038, | |
| 8 | + | [2038] = 2037, [2039] = 2040, [2040] = 2039, [2041] = 2042, [2042] = 2041, | |
| 9 | + | [2044] = 2045, [2045] = 2044, [2047] = 2048, [2048] = 2047, [2050] = 2051, | |
| 10 | + | [2051] = 2050, [2052] = 2053, [2053] = 2052, [2054] = 2055, [2055] = 2054, | |
| 11 | + | [2058] = 2059, [2059] = 2058, [2060] = 2061, [2061] = 2060, [2064] = 2065, | |
| 12 | + | [2065] = 2064, [2066] = 2067, [2067] = 2066, [2068] = 2069, [2069] = 2068, | |
| 13 | + | [2096] = 2097, [2097] = 2096, [2162] = 2163, [2163] = 2162, [2578] = 2579, | |
| 14 | + | [3947] = 3948, [3948] = 3947, [5812] = 5813, [5813] = 5812, [6489] = 6490, | |
| 15 | + | [6490] = 6489, [6572] = 6573, [7058] = 7059, [7059] = 7058, [7183] = 7184, | |
| 16 | + | [8684] = 8685, [8685] = 8684, [8686] = 8687, [8687] = 8686, [8688] = 8689, | |
| 17 | + | [8689] = 8688, [8690] = 8691, [8691] = 8690, [9575] = 9576, [9576] = 9575, | |
| 18 | + | [9577] = 9578, [9578] = 9577, [9579] = 9580, [9580] = 9579, [9581] = 9582, | |
| 19 | + | [9582] = 9581, [9747] = 9748, [9748] = 9747, [9749] = 9750, [9750] = 9749, | |
| 20 | + | [10719] = 10720, [11401] = 11402, [19691] = 19692, [19692] = 19691, [25545] = 25546, | |
| 21 | + | [26098] = 26099 | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 25 | + | item:transform(decayItems[item.itemid]) | |
| 26 | + | item:decay() | |
| 27 | + | return true | |
| 28 | + | end |
| @@ -0,0 +1,3 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | return destroyItem(player, target, toPosition) | |
| 3 | + | end |
| @@ -0,0 +1,15 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | local position = item:getPosition() | |
| 3 | + | local value = math.random(1, 6) | |
| 4 | + | local isInGhostMode = player:isInGhostMode() | |
| 5 | + | ||
| 6 | + | position:sendMagicEffect(CONST_ME_CRAPS, isInGhostMode and player) | |
| 7 | + | ||
| 8 | + | local spectators = Game.getSpectators(position, false, true, 3, 3) | |
| 9 | + | for _, spectator in ipairs(spectators) do | |
| 10 | + | player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, spectator, position) | |
| 11 | + | end | |
| 12 | + | ||
| 13 | + | item:transform(5791 + value) | |
| 14 | + | return true | |
| 15 | + | end |
| @@ -0,0 +1,118 @@ | |||
| 1 | + | local positionOffsets = { | |
| 2 | + | Position(1, 0, 0), -- east | |
| 3 | + | Position(0, 1, 0), -- south | |
| 4 | + | Position(-1, 0, 0), -- west | |
| 5 | + | Position(0, -1, 0) -- north | |
| 6 | + | } | |
| 7 | + | ||
| 8 | + | --[[ | |
| 9 | + | When closing a door with a creature in it findPushPosition will find the most appropriate | |
| 10 | + | adjacent position following a prioritization order. | |
| 11 | + | The function returns the position of the first tile that fulfills all the checks in a round. | |
| 12 | + | The function loops trough east -> south -> west -> north on each following line in that order. | |
| 13 | + | In round 1 it checks if there's an unhindered walkable tile without any creature. | |
| 14 | + | In round 2 it checks if there's a tile with a creature. | |
| 15 | + | In round 3 it checks if there's a tile blocked by a movable tile-blocking item. | |
| 16 | + | In round 4 it checks if there's a tile blocked by a magic wall or wild growth. | |
| 17 | + | ]] | |
| 18 | + | local function findPushPosition(creature, round) | |
| 19 | + | local pos = creature:getPosition() | |
| 20 | + | for _, offset in ipairs(positionOffsets) do | |
| 21 | + | local offsetPosition = pos + offset | |
| 22 | + | local tile = Tile(offsetPosition) | |
| 23 | + | if tile then | |
| 24 | + | local creatureCount = tile:getCreatureCount() | |
| 25 | + | if round == 1 then | |
| 26 | + | if tile:queryAdd(creature) == RETURNVALUE_NOERROR and creatureCount == 0 then | |
| 27 | + | if not tile:hasFlag(TILESTATE_PROTECTIONZONE) or (tile:hasFlag(TILESTATE_PROTECTIONZONE) and creature:canAccessPz()) then | |
| 28 | + | return offsetPosition | |
| 29 | + | end | |
| 30 | + | end | |
| 31 | + | elseif round == 2 then | |
| 32 | + | if creatureCount > 0 then | |
| 33 | + | if not tile:hasFlag(TILESTATE_PROTECTIONZONE) or (tile:hasFlag(TILESTATE_PROTECTIONZONE) and creature:canAccessPz()) then | |
| 34 | + | return offsetPosition | |
| 35 | + | end | |
| 36 | + | end | |
| 37 | + | elseif round == 3 then | |
| 38 | + | local topItem = tile:getTopDownItem() | |
| 39 | + | if topItem then | |
| 40 | + | if topItem:getType():isMovable() then | |
| 41 | + | return offsetPosition | |
| 42 | + | end | |
| 43 | + | end | |
| 44 | + | else | |
| 45 | + | if tile:getItemById(ITEM_MAGICWALL) or tile:getItemById(ITEM_WILDGROWTH) then | |
| 46 | + | return offsetPosition | |
| 47 | + | end | |
| 48 | + | end | |
| 49 | + | end | |
| 50 | + | end | |
| 51 | + | if round < 4 then | |
| 52 | + | return findPushPosition(creature, round + 1) | |
| 53 | + | end | |
| 54 | + | end | |
| 55 | + | ||
| 56 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 57 | + | local itemId = item:getId() | |
| 58 | + | if table.contains(questDoors, itemId) then | |
| 59 | + | if player:getStorageValue(item.actionid) ~= -1 then | |
| 60 | + | item:transform(itemId + 1) | |
| 61 | + | player:teleportTo(toPosition, true) | |
| 62 | + | else | |
| 63 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "The door seems to be sealed against unwanted intruders.") | |
| 64 | + | end | |
| 65 | + | return true | |
| 66 | + | elseif table.contains(levelDoors, itemId) then | |
| 67 | + | if item.actionid > 0 and player:getLevel() >= item.actionid - actionIds.levelDoor then | |
| 68 | + | item:transform(itemId + 1) | |
| 69 | + | player:teleportTo(toPosition, true) | |
| 70 | + | else | |
| 71 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Only the worthy may pass.") | |
| 72 | + | end | |
| 73 | + | return true | |
| 74 | + | elseif table.contains(keys, itemId) then | |
| 75 | + | if target.actionid > 0 then | |
| 76 | + | if item.actionid == target.actionid and doors[target.itemid] then | |
| 77 | + | target:transform(doors[target.itemid]) | |
| 78 | + | return true | |
| 79 | + | end | |
| 80 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "The key does not match.") | |
| 81 | + | return true | |
| 82 | + | end | |
| 83 | + | return false | |
| 84 | + | end | |
| 85 | + | ||
| 86 | + | if table.contains(horizontalOpenDoors, itemId) or table.contains(verticalOpenDoors, itemId) then | |
| 87 | + | local creaturePositionTable = {} | |
| 88 | + | local doorCreatures = Tile(toPosition):getCreatures() | |
| 89 | + | if doorCreatures and #doorCreatures > 0 then | |
| 90 | + | for _, doorCreature in pairs(doorCreatures) do | |
| 91 | + | local pushPosition = findPushPosition(doorCreature, 1) | |
| 92 | + | if not pushPosition then | |
| 93 | + | player:sendCancelMessage(RETURNVALUE_NOTENOUGHROOM) | |
| 94 | + | return true | |
| 95 | + | end | |
| 96 | + | table.insert(creaturePositionTable, {creature = doorCreature, position = pushPosition}) | |
| 97 | + | end | |
| 98 | + | for _, tableCreature in ipairs(creaturePositionTable) do | |
| 99 | + | tableCreature.creature:teleportTo(tableCreature.position, true) | |
| 100 | + | end | |
| 101 | + | end | |
| 102 | + | ||
| 103 | + | if not table.contains(openSpecialDoors, itemId) then | |
| 104 | + | item:transform(itemId - 1) | |
| 105 | + | end | |
| 106 | + | return true | |
| 107 | + | end | |
| 108 | + | ||
| 109 | + | if doors[itemId] then | |
| 110 | + | if item.actionid == 0 then | |
| 111 | + | item:transform(doors[itemId]) | |
| 112 | + | else | |
| 113 | + | player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "It is locked.") | |
| 114 | + | end | |
| 115 | + | return true | |
| 116 | + | end | |
| 117 | + | return false | |
| 118 | + | end |
| @@ -0,0 +1,14 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if fromPosition.x ~= CONTAINER_POSITION then | |
| 3 | + | fromPosition:sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)) | |
| 4 | + | else | |
| 5 | + | local position = player:getPosition() | |
| 6 | + | position:sendMagicEffect(CONST_ME_FIREAREA) | |
| 7 | + | player:say("Ouch! Rather place it on the ground next time.", TALKTYPE_MONSTER_SAY) | |
| 8 | + | player:addAchievementProgress("Rocket in Pocket", 3) | |
| 9 | + | doTargetCombat(0, player, COMBAT_PHYSICALDAMAGE, -10, -10, CONST_ME_EXPLOSIONAREA) | |
| 10 | + | end | |
| 11 | + | player:addAchievementProgress("Fireworks in the Sky", 250) | |
| 12 | + | item:remove() | |
| 13 | + | return true | |
| 14 | + | end |
| @@ -0,0 +1,85 @@ | |||
| 1 | + | local drunk = Condition(CONDITION_DRUNK) | |
| 2 | + | drunk:setParameter(CONDITION_PARAM_TICKS, 60000) | |
| 3 | + | ||
| 4 | + | local poison = Condition(CONDITION_POISON) | |
| 5 | + | poison:setParameter(CONDITION_PARAM_DELAYED, true) | |
| 6 | + | poison:setParameter(CONDITION_PARAM_MINVALUE, -50) | |
| 7 | + | poison:setParameter(CONDITION_PARAM_MAXVALUE, -120) | |
| 8 | + | poison:setParameter(CONDITION_PARAM_STARTVALUE, -5) | |
| 9 | + | poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 4000) | |
| 10 | + | poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true) | |
| 11 | + | ||
| 12 | + | local fluidMessage = { | |
| 13 | + | [3] = "Aah...", | |
| 14 | + | [4] = "Urgh!", | |
| 15 | + | [5] = "Mmmh.", | |
| 16 | + | [7] = "Aaaah...", | |
| 17 | + | [10] = "Aaaah...", | |
| 18 | + | [11] = "Urgh!", | |
| 19 | + | [13] = "Urgh!", | |
| 20 | + | [15] = "Aah...", | |
| 21 | + | [19] = "Urgh!", | |
| 22 | + | [27] = "Aah...", | |
| 23 | + | [43] = "Aaaah..." | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | local distillery = {[5513] = 5469, [5514] = 5470} | |
| 27 | + | ||
| 28 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 29 | + | local targetItemType = ItemType(target.itemid) | |
| 30 | + | if targetItemType and targetItemType:isFluidContainer() then | |
| 31 | + | if target.type == 0 and item.type ~= 0 then | |
| 32 | + | target:transform(target:getId(), item.type) | |
| 33 | + | item:transform(item:getId(), 0) | |
| 34 | + | return true | |
| 35 | + | elseif target.type ~= 0 and item.type == 0 then | |
| 36 | + | target:transform(target:getId(), 0) | |
| 37 | + | item:transform(item:getId(), target.type) | |
| 38 | + | return true | |
| 39 | + | end | |
| 40 | + | end | |
| 41 | + | ||
| 42 | + | if target.itemid == 1 then | |
| 43 | + | if item.type == 0 then | |
| 44 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.") | |
| 45 | + | elseif target.uid == player.uid then | |
| 46 | + | if table.contains({3, 15, 43}, item.type) then | |
| 47 | + | player:addCondition(drunk) | |
| 48 | + | elseif item.type == 4 then | |
| 49 | + | player:addCondition(poison) | |
| 50 | + | elseif item.type == 7 then | |
| 51 | + | player:addMana(math.random(50, 150)) | |
| 52 | + | fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) | |
| 53 | + | elseif item.type == 10 then | |
| 54 | + | player:addHealth(60) | |
| 55 | + | fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) | |
| 56 | + | end | |
| 57 | + | player:say(fluidMessage[item.type] or "Gulp.", TALKTYPE_MONSTER_SAY) | |
| 58 | + | item:transform(item:getId(), 0) | |
| 59 | + | else | |
| 60 | + | Game.createItem(2016, item.type, toPosition):decay() | |
| 61 | + | item:transform(item:getId(), 0) | |
| 62 | + | end | |
| 63 | + | else | |
| 64 | + | local fluidSource = targetItemType and targetItemType:getFluidSource() or 0 | |
| 65 | + | if fluidSource ~= 0 then | |
| 66 | + | item:transform(item:getId(), fluidSource) | |
| 67 | + | elseif table.contains(distillery, target.itemid) then | |
| 68 | + | local tmp = distillery[target.itemid] | |
| 69 | + | if tmp then | |
| 70 | + | item:transform(item:getId(), 0) | |
| 71 | + | else | |
| 72 | + | player:sendCancelMessage("You have to process the bunch into the distillery to get rum.") | |
| 73 | + | end | |
| 74 | + | elseif item.type == 0 then | |
| 75 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.") | |
| 76 | + | else | |
| 77 | + | if toPosition.x == CONTAINER_POSITION then | |
| 78 | + | toPosition = player:getPosition() | |
| 79 | + | end | |
| 80 | + | Game.createItem(2016, item.type, toPosition):decay() | |
| 81 | + | item:transform(item:getId(), 0) | |
| 82 | + | end | |
| 83 | + | end | |
| 84 | + | return true | |
| 85 | + | end |
| @@ -0,0 +1,125 @@ | |||
| 1 | + | local foods = { | |
| 2 | + | [2362] = {5, "Crunch."}, -- carrot | |
| 3 | + | [2666] = {15, "Munch."}, -- meat | |
| 4 | + | [2667] = {12, "Munch."}, -- fish | |
| 5 | + | [2668] = {10, "Mmmm."}, -- salmon | |
| 6 | + | [2669] = {17, "Munch."}, -- northern pike | |
| 7 | + | [2670] = {4, "Gulp."}, -- shrimp | |
| 8 | + | [2671] = {30, "Chomp."}, -- ham | |
| 9 | + | [2672] = {60, "Chomp."}, -- dragon ham | |
| 10 | + | [2673] = {5, "Yum."}, -- pear | |
| 11 | + | [2674] = {6, "Yum."}, -- red apple | |
| 12 | + | [2675] = {13, "Yum."}, -- orange | |
| 13 | + | [2676] = {8, "Yum."}, -- banana | |
| 14 | + | [2677] = {1, "Yum."}, -- blueberry | |
| 15 | + | [2678] = {18, "Slurp."}, -- coconut | |
| 16 | + | [2679] = {1, "Yum."}, -- cherry | |
| 17 | + | [2680] = {2, "Yum."}, -- strawberry | |
| 18 | + | [2681] = {9, "Yum."}, -- grapes | |
| 19 | + | [2682] = {20, "Yum."}, -- melon | |
| 20 | + | [2683] = {17, "Munch."}, -- pumpkin | |
| 21 | + | [2684] = {5, "Crunch."}, -- carrot | |
| 22 | + | [2685] = {6, "Munch."}, -- tomato | |
| 23 | + | [2686] = {9, "Crunch."}, -- corncob | |
| 24 | + | [2687] = {2, "Crunch."}, -- cookie | |
| 25 | + | [2688] = {2, "Munch."}, -- candy cane | |
| 26 | + | [2689] = {10, "Crunch."}, -- bread | |
| 27 | + | [2690] = {3, "Crunch."}, -- roll | |
| 28 | + | [2691] = {8, "Crunch."}, -- brown bread | |
| 29 | + | [2695] = {6, "Gulp."}, -- egg | |
| 30 | + | [2696] = {9, "Smack."}, -- cheese | |
| 31 | + | [2787] = {9, "Munch."}, -- white mushroom | |
| 32 | + | [2788] = {4, "Munch."}, -- red mushroom | |
| 33 | + | [2789] = {22, "Munch."}, -- brown mushroom | |
| 34 | + | [2790] = {30, "Munch."}, -- orange mushroom | |
| 35 | + | [2791] = {9, "Munch."}, -- wood mushroom | |
| 36 | + | [2792] = {6, "Munch."}, -- dark mushroom | |
| 37 | + | [2793] = {12, "Munch."}, -- some mushrooms | |
| 38 | + | [2794] = {3, "Munch."}, -- some mushrooms | |
| 39 | + | [2795] = {36, "Munch."}, -- fire mushroom | |
| 40 | + | [2796] = {5, "Munch."}, -- green mushroom | |
| 41 | + | [5097] = {4, "Yum."}, -- mango | |
| 42 | + | [5678] = {8, "Gulp."}, -- tortoise egg | |
| 43 | + | [6125] = {8, "Gulp."}, -- tortoise egg from Nargor | |
| 44 | + | [6278] = {10, "Mmmm."}, -- cake | |
| 45 | + | [6279] = {15, "Mmmm."}, -- decorated cake | |
| 46 | + | [6393] = {12, "Mmmm."}, -- valentine's cake | |
| 47 | + | [6394] = {15, "Mmmm."}, -- cream cake | |
| 48 | + | [6501] = {20, "Mmmm."}, -- gingerbread man | |
| 49 | + | [6541] = {6, "Gulp."}, -- coloured egg (yellow) | |
| 50 | + | [6542] = {6, "Gulp."}, -- coloured egg (red) | |
| 51 | + | [6543] = {6, "Gulp."}, -- coloured egg (blue) | |
| 52 | + | [6544] = {6, "Gulp."}, -- coloured egg (green) | |
| 53 | + | [6545] = {6, "Gulp."}, -- coloured egg (purple) | |
| 54 | + | [6569] = {1, "Mmmm."}, -- candy | |
| 55 | + | [6574] = {5, "Mmmm."}, -- bar of chocolate | |
| 56 | + | [7158] = {15, "Munch."}, -- rainbow trout | |
| 57 | + | [7159] = {13, "Munch."}, -- green perch | |
| 58 | + | [7372] = {2, "Yum."}, -- ice cream cone (crispy chocolate chips) | |
| 59 | + | [7373] = {2, "Yum."}, -- ice cream cone (velvet vanilla) | |
| 60 | + | [7374] = {2, "Yum."}, -- ice cream cone (sweet strawberry) | |
| 61 | + | [7375] = {2, "Yum."}, -- ice cream cone (chilly cherry) | |
| 62 | + | [7376] = {2, "Yum."}, -- ice cream cone (mellow melon) | |
| 63 | + | [7377] = {2, "Yum."}, -- ice cream cone (blue-barian) | |
| 64 | + | [7909] = {4, "Crunch."}, -- walnut | |
| 65 | + | [7910] = {4, "Crunch."}, -- peanut | |
| 66 | + | [7963] = {60, "Munch."}, -- marlin | |
| 67 | + | [8112] = {9, "Urgh."}, -- scarab cheese | |
| 68 | + | [8838] = {10, "Gulp."}, -- potato | |
| 69 | + | [8839] = {5, "Yum."}, -- plum | |
| 70 | + | [8840] = {1, "Yum."}, -- raspberry | |
| 71 | + | [8841] = {1, "Urgh."}, -- lemon | |
| 72 | + | [8842] = {7, "Munch."}, -- cucumber | |
| 73 | + | [8843] = {5, "Crunch."}, -- onion | |
| 74 | + | [8844] = {1, "Gulp."}, -- jalapeño pepper | |
| 75 | + | [8845] = {5, "Munch."}, -- beetroot | |
| 76 | + | [8847] = {11, "Yum."}, -- chocolate cake | |
| 77 | + | [9005] = {7, "Slurp."}, -- yummy gummy worm | |
| 78 | + | [9114] = {5, "Crunch."}, -- bulb of garlic | |
| 79 | + | [9996] = {0, "Slurp."}, -- banana chocolate shake | |
| 80 | + | [10454] = {0, "Your head begins to feel better."}, -- headache pill | |
| 81 | + | [11246] = {15, "Yum."}, -- rice ball | |
| 82 | + | [11370] = {3, "Urgh."}, -- terramite eggs | |
| 83 | + | [11429] = {10, "Mmmm."}, -- crocodile steak | |
| 84 | + | [12415] = {20, "Yum."}, -- pineapple | |
| 85 | + | [12416] = {10, "Munch."}, -- aubergine | |
| 86 | + | [12417] = {8, "Crunch."}, -- broccoli | |
| 87 | + | [12418] = {9, "Crunch."}, -- cauliflower | |
| 88 | + | [12637] = {55, "Gulp."}, -- ectoplasmic sushi | |
| 89 | + | [12638] = {18, "Yum."}, -- dragonfruit | |
| 90 | + | [12639] = {2, "Munch."}, -- peas | |
| 91 | + | [13297] = {20, "Crunch."}, -- haunch of boar | |
| 92 | + | [15405] = {55, "Munch."}, -- sandfish | |
| 93 | + | [15487] = {14, "Urgh."}, -- larvae | |
| 94 | + | [15488] = {15, "Munch."}, -- deepling filet | |
| 95 | + | [16014] = {60, "Mmmm."}, -- anniversary cake | |
| 96 | + | [18397] = {33, "Munch."}, -- mushroom pie | |
| 97 | + | [19737] = {10, "Urgh."}, -- insectoid eggs | |
| 98 | + | [20100] = {15, "Smack."}, -- soft cheese | |
| 99 | + | [20101] = {12, "Smack."}, -- rat cheese | |
| 100 | + | [23514] = {15, "Munch."}, -- glooth sandwich | |
| 101 | + | [23515] = {7, "Slurp."}, -- bowl of glooth soup | |
| 102 | + | [23516] = {6, "Burp."}, -- bottle of glooth wine | |
| 103 | + | [23517] = {25, "Chomp."}, -- glooth steak | |
| 104 | + | [24841] = {12, "Yum."}, -- prickly pear | |
| 105 | + | [24843] = {60, "Chomp."}, -- roasted meat | |
| 106 | + | [26191] = {25, "Mmmm."}, -- energy bar | |
| 107 | + | [26201] = {15, "Mmmm."} -- energy drink | |
| 108 | + | } | |
| 109 | + | ||
| 110 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 111 | + | local food = foods[item.itemid] | |
| 112 | + | if not food then | |
| 113 | + | return false | |
| 114 | + | end | |
| 115 | + | ||
| 116 | + | local condition = player:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT) | |
| 117 | + | if condition and math.floor(condition:getTicks() / 1000 + (food[1] * 12)) >= 1200 then | |
| 118 | + | player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are full.") | |
| 119 | + | else | |
| 120 | + | player:feed(food[1] * 12) | |
| 121 | + | player:say(food[2], TALKTYPE_MONSTER_SAY) | |
| 122 | + | item:remove(1) | |
| 123 | + | end | |
| 124 | + | return true | |
| 125 | + | end |
| @@ -0,0 +1,10 @@ | |||
| 1 | + | local LAMP_USER = { | |
| 2 | + | [3946] = 3945; | |
| 3 | + | [3945] = 3946; | |
| 4 | + | } | |
| 5 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 6 | + | if LAMP_USER[item.itemid] then | |
| 7 | + | item:transform(LAMP_USER[item.itemid]) | |
| 8 | + | end | |
| 9 | + | return true | |
| 10 | + | end |
| @@ -0,0 +1,24 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if player:getStorageValue(PlayerStorageKeys.delayLargeSeaShell) <= os.time() then | |
| 3 | + | local chance = math.random(100) | |
| 4 | + | local msg = "" | |
| 5 | + | if chance <= 16 then | |
| 6 | + | doTargetCombat(0, player, COMBAT_PHYSICALDAMAGE, -200, -200, CONST_ME_NONE) | |
| 7 | + | msg = "Ouch! You squeezed your fingers." | |
| 8 | + | elseif chance > 16 and chance <= 64 then | |
| 9 | + | Game.createItem(math.random(7632, 7633), 1, player:getPosition()) | |
| 10 | + | msg = "You found a beautiful pearl." | |
| 11 | + | player:addAchievementProgress("Shell Seeker", 100) | |
| 12 | + | else | |
| 13 | + | msg = "Nothing is inside." | |
| 14 | + | end | |
| 15 | + | player:say(msg, TALKTYPE_MONSTER_SAY, false, player, item:getPosition()) | |
| 16 | + | item:transform(7553) | |
| 17 | + | item:decay() | |
| 18 | + | player:setStorageValue(PlayerStorageKeys.delayLargeSeaShell, os.time() + 20 * 60 * 60) | |
| 19 | + | item:getPosition():sendMagicEffect(CONST_ME_BUBBLES) | |
| 20 | + | else | |
| 21 | + | player:say("You have already opened a shell today.", TALKTYPE_MONSTER_SAY, false, player, item:getPosition()) | |
| 22 | + | end | |
| 23 | + | return true | |
| 24 | + | end |
| @@ -0,0 +1,65 @@ | |||
| 1 | + | local instruments = { | |
| 2 | + | [2070] = {effect = CONST_ME_SOUND_GREEN}, -- wooden flute | |
| 3 | + | [2071] = {effect = CONST_ME_SOUND_GREEN}, -- lyre | |
| 4 | + | [2072] = {effect = CONST_ME_SOUND_GREEN}, -- lute | |
| 5 | + | [2073] = {effect = CONST_ME_SOUND_GREEN}, -- drum | |
| 6 | + | [2074] = {effect = CONST_ME_SOUND_GREEN}, -- panpipes | |
| 7 | + | [2075] = {effect = CONST_ME_SOUND_GREEN}, -- simple fanfare | |
| 8 | + | [2076] = {effect = CONST_ME_SOUND_GREEN}, -- fanfare | |
| 9 | + | [2077] = {effect = CONST_ME_SOUND_GREEN}, -- royal fanfare | |
| 10 | + | [2078] = {effect = CONST_ME_SOUND_GREEN}, -- post horn | |
| 11 | + | [2079] = {effect = CONST_ME_SOUND_GREEN}, -- war horn | |
| 12 | + | [2080] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano | |
| 13 | + | [2081] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano | |
| 14 | + | [2082] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano | |
| 15 | + | [2083] = {effects = {failure = CONST_ME_SOUND_PURPLE, success = CONST_ME_SOUND_GREEN}, chance = 50}, -- piano | |
| 16 | + | [2084] = {effect = CONST_ME_SOUND_GREEN}, -- harp | |
| 17 | + | [2085] = {effect = CONST_ME_SOUND_GREEN}, -- harp | |
| 18 | + | [2332] = {effect = CONST_ME_SOUND_GREEN}, -- Waldo's post horn | |
| 19 | + | [2367] = {effect = CONST_ME_SOUND_GREEN}, -- drum (immovable) | |
| 20 | + | [2368] = {effect = CONST_ME_SOUND_GREEN}, -- simple fanfare (immovable) | |
| 21 | + | [2369] = {effect = CONST_ME_SOUND_YELLOW, itemId = 2681, itemCount = 10, chance = 80, remove = true}, -- cornucopia (immovable) | |
| 22 | + | [2370] = {effect = CONST_ME_SOUND_GREEN}, -- lute (immovable) | |
| 23 | + | [2371] = {effect = CONST_ME_SOUND_BLUE}, -- the horn of sundering (actual effect is unknown; immovable) | |
| 24 | + | [2372] = {effect = CONST_ME_SOUND_GREEN}, -- lyre (immovable) | |
| 25 | + | [2373] = {effect = CONST_ME_SOUND_GREEN}, -- panpipes (immovable) | |
| 26 | + | [3951] = {effect = CONST_ME_SOUND_BLUE}, -- bongo drum (actual effect is unknown) | |
| 27 | + | [3952] = {effects = {failure = CONST_ME_POFF, success = CONST_ME_SOUND_GREEN}, chance = 20}, -- didgeridoo | |
| 28 | + | [3953] = {effect = CONST_ME_SOUND_RED}, -- war drum | |
| 29 | + | [3957] = {effect = CONST_ME_SOUND_YELLOW, itemId = 2681, itemCount = 10, chance = 80, remove = true}, -- cornucopia | |
| 30 | + | [5786] = {effects = {failure = CONST_ME_SOUND_RED, success = CONST_ME_SOUND_YELLOW}, monster = "war wolf", chance = 60, remove = true}, -- wooden whistle | |
| 31 | + | [6572] = {effect = CONST_ME_SOUND_GREEN, text = "TOOOOOOT", transformId = 13578, decayId = 6572}, -- party trumpet | |
| 32 | + | [6573] = {effect = CONST_ME_SOUND_GREEN, text = "TOOOOOOT", transformId = 13578, decayId = 6573}, -- party trumpet | |
| 33 | + | [13759] = {effect = CONST_ME_SOUND_BLUE}, -- small whistle (actual effect is unknown) | |
| 34 | + | [23923] = {effect = CONST_ME_SOUND_WHITE} -- small crystal bell | |
| 35 | + | } | |
| 36 | + | ||
| 37 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 38 | + | local instrument, chance = instruments[item:getId()] | |
| 39 | + | if instrument.chance then | |
| 40 | + | chance = instrument.chance >= math.random(1, 100) | |
| 41 | + | ||
| 42 | + | if instrument.monster and chance then | |
| 43 | + | local monster = Game.createMonster(instrument.monster, player:getPosition(), true) | |
| 44 | + | if monster then | |
| 45 | + | player:addSummon(monster) | |
| 46 | + | end | |
| 47 | + | elseif instrument.itemId and chance then | |
| 48 | + | player:addItem(instrument.itemId, instrument.itemCount) | |
| 49 | + | end | |
| 50 | + | end | |
| 51 | + | ||
| 52 | + | item:getPosition():sendMagicEffect(instrument.effect or instrument.effects and chance and instrument.effects.success or instrument.effects.failure) | |
| 53 | + | ||
| 54 | + | if instrument.transformId then | |
| 55 | + | player:say(instrument.text, TALKTYPE_MONSTER_SAY, false, nil, item:getPosition()) | |
| 56 | + | item:transform(instrument.transformId) | |
| 57 | + | item:decay(instrument.decayId) | |
| 58 | + | end | |
| 59 | + | ||
| 60 | + | if not chance and instrument.remove then | |
| 61 | + | item:remove() | |
| 62 | + | end | |
| 63 | + | player:addAchievementProgress("Rockstar", 10000) | |
| 64 | + | return true | |
| 65 | + | end |
| @@ -0,0 +1,9 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | local headSlotItem = player:getSlotItem(CONST_SLOT_HEAD) | |
| 3 | + | if not headSlotItem or item.uid ~= headSlotItem:getUniqueId() then | |
| 4 | + | return false | |
| 5 | + | end | |
| 6 | + | player:addAchievementProgress("Party Animal", 200) | |
| 7 | + | player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS) | |
| 8 | + | return true | |
| 9 | + | end |
| @@ -0,0 +1,12 @@ | |||
| 1 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 2 | + | if math.random(6) == 1 then | |
| 3 | + | item:getPosition():sendMagicEffect(CONST_ME_POFF) | |
| 4 | + | player:addItem(ITEM_GOLD_COIN, 1) | |
| 5 | + | item:transform(2115) | |
| 6 | + | player:addAchievementProgress("Allowance Collector", 50) | |
| 7 | + | else | |
| 8 | + | item:getPosition():sendMagicEffect(CONST_ME_SOUND_YELLOW) | |
| 9 | + | player:addItem(ITEM_PLATINUM_COIN, 1) | |
| 10 | + | end | |
| 11 | + | return true | |
| 12 | + | end |
| @@ -0,0 +1,82 @@ | |||
| 1 | + | local berserk = Condition(CONDITION_ATTRIBUTES) | |
| 2 | + | berserk:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000) | |
| 3 | + | berserk:setParameter(CONDITION_PARAM_SKILL_MELEE, 5) | |
| 4 | + | berserk:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10) | |
| 5 | + | berserk:setParameter(CONDITION_PARAM_BUFF_SPELL, true) | |
| 6 | + | ||
| 7 | + | local mastermind = Condition(CONDITION_ATTRIBUTES) | |
| 8 | + | mastermind:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000) | |
| 9 | + | mastermind:setParameter(CONDITION_PARAM_STAT_MAGICPOINTS, 3) | |
| 10 | + | mastermind:setParameter(CONDITION_PARAM_BUFF_SPELL, true) | |
| 11 | + | ||
| 12 | + | local bullseye = Condition(CONDITION_ATTRIBUTES) | |
| 13 | + | bullseye:setParameter(CONDITION_PARAM_TICKS, 10 * 60 * 1000) | |
| 14 | + | bullseye:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 5) | |
| 15 | + | bullseye:setParameter(CONDITION_PARAM_SKILL_SHIELD, -10) | |
| 16 | + | bullseye:setParameter(CONDITION_PARAM_BUFF_SPELL, true) | |
| 17 | + | ||
| 18 | + | local potions = { | |
| 19 | + | [6558] = {transform = {7588, 7589}, effect = CONST_ME_DRAWBLOOD}, | |
| 20 | + | [7439] = {condition = berserk, vocations = {4, 8}, effect = CONST_ME_MAGIC_RED, description = "Only knights may drink this potion.", text = "You feel stronger."}, | |
| 21 | + | [7440] = {condition = mastermind, vocations = {1, 2, 5, 6}, effect = CONST_ME_MAGIC_BLUE, description = "Only sorcerers and druids may drink this potion.", text = "You feel smarter."}, | |
| 22 | + | [7443] = {condition = bullseye, vocations = {3, 7}, effect = CONST_ME_MAGIC_GREEN, description = "Only paladins may drink this potion.", text = "You feel more accurate."}, | |
| 23 | + | [7588] = {health = {250, 350}, vocations = {3, 4, 7, 8}, level = 50, flask = 7634, description = "Only knights and paladins of level 50 or above may drink this fluid."}, | |
| 24 | + | [7589] = {mana = {115, 185}, vocations = {1, 2, 3, 5, 6, 7}, level = 50, flask = 7634, description = "Only sorcerers, druids and paladins of level 50 or above may drink this fluid."}, | |
| 25 | + | [7590] = {mana = {150, 250}, vocations = {1, 2, 5, 6}, level = 80, flask = 7635, description = "Only druids and sorcerers of level 80 or above may drink this fluid."}, | |
| 26 | + | [7591] = {health = {425, 575}, vocations = {4, 8}, level = 80, flask = 7635, description = "Only knights of level 80 or above may drink this fluid."}, | |
| 27 | + | [7618] = {health = {125, 175}, flask = 7636}, | |
| 28 | + | [7620] = {mana = {75, 125}, flask = 7636}, | |
| 29 | + | [8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3, 7}, level = 80, flask = 7635, description = "Only paladins of level 80 or above may drink this fluid."}, | |
| 30 | + | [8473] = {health = {650, 850}, vocations = {4, 8}, level = 130, flask = 7635, description = "Only knights of level 130 or above may drink this fluid."}, | |
| 31 | + | [8474] = {antidote = true, flask = 7636}, | |
| 32 | + | [8704] = {health = {60, 90}, flask = 7636}, | |
| 33 | + | [26029] = {mana = {425, 575}, vocations = {1, 2, 5, 6}, level = 130, flask = 7635, description = "Only druids and sorcerers of level 130 or above may drink this fluid."}, | |
| 34 | + | [26030] = {health = {420, 580}, mana = {200, 350}, vocations = {3, 7}, level = 130, flask = 7635, description = "Only paladins of level 130 or above may drink this fluid."}, | |
| 35 | + | [26031] = {health = {875, 1125}, vocations = {4, 8}, level = 200, flask = 7635, description = "Only knights of level 200 or above may drink this fluid."} | |
| 36 | + | } | |
| 37 | + | ||
| 38 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 39 | + | if type(target) == "userdata" and not target:isPlayer() then | |
| 40 | + | return false | |
| 41 | + | end | |
| 42 | + | ||
| 43 | + | local potion = potions[item:getId()] | |
| 44 | + | if potion.level and player:getLevel() < potion.level or potion.vocations and not table.contains(potion.vocations, player:getVocation():getId()) then | |
| 45 | + | player:say(potion.description, TALKTYPE_MONSTER_SAY) | |
| 46 | + | return true | |
| 47 | + | end | |
| 48 | + | ||
| 49 | + | if potion.condition then | |
| 50 | + | player:addCondition(potion.condition) | |
| 51 | + | player:say(potion.text, TALKTYPE_MONSTER_SAY) | |
| 52 | + | player:getPosition():sendMagicEffect(potion.effect) | |
| 53 | + | elseif potion.transform then | |
| 54 | + | item:transform(potion.transform[math.random(#potion.transform)]) | |
| 55 | + | item:getPosition():sendMagicEffect(potion.effect) | |
| 56 | + | return true | |
| 57 | + | else | |
| 58 | + | if potion.health then | |
| 59 | + | doTargetCombat(0, target, COMBAT_HEALING, potion.health[1], potion.health[2]) | |
| 60 | + | end | |
| 61 | + | ||
| 62 | + | if potion.mana then | |
| 63 | + | doTargetCombat(0, target, COMBAT_MANADRAIN, potion.mana[1], potion.mana[2]) | |
| 64 | + | end | |
| 65 | + | ||
| 66 | + | if potion.antidote then | |
| 67 | + | target:removeCondition(CONDITION_POISON) | |
| 68 | + | end | |
| 69 | + | ||
| 70 | + | player:addAchievementProgress("Potion Addict", 100000) | |
| 71 | + | player:addItem(potion.flask) | |
| 72 | + | target:say("Aaaah...", TALKTYPE_MONSTER_SAY) | |
| 73 | + | target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) | |
| 74 | + | end | |
| 75 | + | ||
| 76 | + | if not configManager.getBoolean(configKeys.REMOVE_POTION_CHARGES) then | |
| 77 | + | return true | |
| 78 | + | end | |
| 79 | + | ||
| 80 | + | item:remove(1) | |
| 81 | + | return true | |
| 82 | + | end |
| @@ -0,0 +1,23 @@ | |||
| 1 | + | local statues = { | |
| 2 | + | [18488] = SKILL_SWORD, | |
| 3 | + | [18489] = SKILL_AXE, | |
| 4 | + | [18490] = SKILL_CLUB, | |
| 5 | + | [18491] = SKILL_DISTANCE, | |
| 6 | + | [18492] = SKILL_MAGLEVEL | |
| 7 | + | } | |
| 8 | + | ||
| 9 | + | function onUse(player, item, fromPosition, target, toPosition, isHotkey) | |
| 10 | + | local skill = statues[item:getId()] | |
| 11 | + | if not player:isPremium() then | |
| 12 | + | player:sendCancelMessage(RETURNVALUE_YOUNEEDPREMIUMACCOUNT) | |
| 13 | + | return true | |
| 14 | + | end | |
| 15 | + | ||
| 16 | + | if player:isPzLocked() then | |
| 17 | + | return false | |
| 18 | + | end | |
| 19 | + | ||
| 20 | + | player:setOfflineTrainingSkill(skill) | |
| 21 | + | player:remove() | |
| 22 | + | return true | |
| 23 | + | end |