1local NINHO_DIFICULTY = {
2 [01] = {"FACIL", 2000, 500};
3 [02] = {"MEDIO", 10000, 3000};
4 [03] = {"DIFICIL", 35000, 15000};
5 [04] = {"IMPOSSIVEL", 55000, 25000};
6}
7local TREE_CLICK = {
8 [01] = 10150;
9 [02] = 10151;
10 [03] = 10152;
11 [04] = 10153;
12 [05] = 10153;
13}
14function onUse(player, item, fromPosition, target, toPosition, isHotkey)
15 local checkArea = 0
16 local from = {x=4043, y=934, z=08}
17 local to = {x=4067, y=955, z=08}
18 for A = from.x, to.x do
19 for B = from.y, to.y do
20 for C = from.z, to.z do
21 local tile = Tile(A, B, C)
22 local creature = tile:getTopCreature()
23 if creature and creature:isMonster() then
24 checkArea = 1
25 break
26 end
27 end
28 end
29 end
30
31 if checkArea == 00 then
32 local TAG = _SYSTEM.GLOBAL_INDEX[02]
33 local CHECK_STEP = player:getStorageValue(TAG)
34 local HARD = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][01]
35 if CHECK_STEP < 1 then CHECK_STEP = 01 end
36
37 if _DEBUG_MODE then
38
39 end
40 if item.uid == TREE_CLICK[CHECK_STEP] then
41 if CHECK_STEP == 05 then
42 local EXPERIENCE = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][02]
43 player:teleportTo({x=3685, y=1033, z=7})
44 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
45 player:setStorageValue(TAG, nil)
46 player:addExperience(EXPERIENCE, true, true)
47
48 if HARD == "FACIL" then
49 local RANDOM_ITEM = math.random(00, 10)
50 if RANDOM_ITEM < 08 then
51 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
52 PlayerGoldCoins(player, 02, GoldQnt)
53 else
54 local Atributos = {
55 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040
56 }
57 local itemid = Atributos[math.random(01, #Atributos)]
58 local rare = _ITEMS[itemid].RARE
59 local star = 00
60 local slot = 03
61 local uni = false
62 if doBackpack(player, 00, slot, 00, 01) then
63 if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then
64 player:getPosition():sendMagicEffect(14)
65 end
66 else
67 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
68 PlayerGoldCoins(player, 02, GoldQnt)
69 player:getPosition():sendMagicEffect(03)
70
71 end
72 end
73 elseif HARD == "MEDIO" then
74 local RANDOM_ITEM = math.random(00, 10)
75 if RANDOM_ITEM < 06 then
76 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
77 PlayerGoldCoins(player, 02, GoldQnt)
78 else
79 local Atributos = {
80 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040, 11003, 11010, 11012, 11016, 11026
81 }
82 local itemid = Atributos[math.random(01, #Atributos)]
83 local rare = _ITEMS[itemid].RARE
84 local star = 00
85 local slot = 03
86 local uni = false
87 if doBackpack(player, 00, slot, 00, 01) then
88 if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then
89 player:getPosition():sendMagicEffect(14)
90 end
91 else
92 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
93 PlayerGoldCoins(player, 02, GoldQnt)
94 player:getPosition():sendMagicEffect(03)
95
96 end
97 end
98 elseif HARD == "DIFICIL" then
99 local RANDOM_ITEM = math.random(00, 10)
100 if RANDOM_ITEM < 03 then
101 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
102 PlayerGoldCoins(player, 02, GoldQnt)
103 elseif RANDOM_ITEM > 02 and RANDOM_ITEM < 08 then
104 local Atributos = {
105 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040, 11003, 11010, 11012, 11016, 11026, 11002, 11013, 11017, 11018, 11019, 11021, 11022, 11023, 11024
106 }
107 local itemid = Atributos[math.random(01, #Atributos)]
108 local rare = _ITEMS[itemid].RARE
109 local star = 00
110 local slot = 03
111 local uni = false
112 if doBackpack(player, 00, slot, 00, 01) then
113 if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then
114 player:getPosition():sendMagicEffect(14)
115 end
116 else
117 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
118 PlayerGoldCoins(player, 02, GoldQnt)
119 player:getPosition():sendMagicEffect(03)
120
121 end
122 else
123 local itemid = math.random(7000, 7014)
124 local rare = math.random(00, 01)
125 local star = 0
126 local slot = 07
127 local uni = false
128 if doBackpack(player, 00, slot, 00, 01) then
129 if doBackpack(player, 01, slot, 00, 0, itemid, rare, star, 01, uni) then
130 player:getPosition():sendMagicEffect(14)
131 end
132 else
133 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
134 PlayerGoldCoins(player, 02, GoldQnt)
135 player:getPosition():sendMagicEffect(03)
136
137 end
138 end
139 else
140 local RANDOM_ITEM = math.random(00, 10)
141 if RANDOM_ITEM < 02 then
142 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
143 PlayerGoldCoins(player, 02, GoldQnt)
144 elseif RANDOM_ITEM > 01 and RANDOM_ITEM < 06 then
145 local Atributos = {
146 11001, 11006, 11007, 11008, 11015, 11020, 11004, 11005, 11011, 11014, 11032, 11040, 11003, 11010, 11012, 11016, 11026, 11002, 11013, 11017, 11018, 11019, 11021, 11022, 11023, 11024
147 }
148 local itemid = Atributos[math.random(01, #Atributos)]
149 local rare = _ITEMS[itemid].RARE
150 local star = 00
151 local slot = 03
152 if doBackpack(player, 00, slot, 00, 01) then
153 if doBackpack(player, 01, slot, 00, 0, itemid, rare, star) then
154 player:getPosition():sendMagicEffect(14)
155 end
156 else
157 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
158 PlayerGoldCoins(player, 02, GoldQnt)
159 player:getPosition():sendMagicEffect(03)
160
161 end
162 else
163 local itemid = math.random(7000, 7014)
164 local rare = math.random(00, 02)
165 local star = 0
166 local slot = 07
167 if doBackpack(player, 00, slot, 00, 01) then
168 if doBackpack(player, 01, slot, 00, 0, itemid, rare, star) then
169 player:getPosition():sendMagicEffect(14)
170 end
171 else
172 local GoldQnt = NINHO_DIFICULTY[player:getStorageValue(_SYSTEM.GLOBAL_INDEX[01])][03]
173 PlayerGoldCoins(player, 02, GoldQnt)
174 player:getPosition():sendMagicEffect(03)
175
176 end
177 end
178 end
179
180 -- DESAFIO
181 if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then
182 if HARD == "FACIL" then
183 onPlayerDesafios(player, 54, 01)
184 elseif HARD == "MEDIO" then
185 onPlayerDesafios(player, 55, 01)
186 elseif HARD == "DIFICIL" then
187 onPlayerDesafios(player, 56, 01)
188 elseif HARD == "IMPOSSIVEL" then
189 onPlayerDesafios(player, 57, 01)
190 end
191 end
192 player:setStorageValue(_SYSTEM.CURSED_TREE, nil)
193
194 if player:getStorageValue(_QUESTLOG[31].UID_01) == 02 then
195 addEvent(function()
196 player:setStorageValue(_QUESTLOG[31].UID_01, 03)
197
198 player:getPosition():sendMagicEffect(14)
199 player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
200 doBackpack(player, 12)
201 end, 3000)
202 end
203 if HARD == "MEDIO" then
204 if player:getStorageValue(_QUESTLOG[153].UID_01) == 01 then
205 addEvent(function()
206 player:setStorageValue(_QUESTLOG[153].UID_01, 100)
207 player:setStorageValue(_QUESTLOG[154].UID_01, 01)
208
209 player:addExperience(40000, true, true)
210 player:getPosition():sendMagicEffect(14)
211 player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
212 doBackpack(player, 12)
213 end, 3000)
214 end
215 end
216 if HARD == "DIFICIL" then
217 if player:getStorageValue(_QUESTLOG[154].UID_01) == 01 then
218 addEvent(function()
219 player:setStorageValue(_QUESTLOG[154].UID_01, 100)
220 player:setStorageValue(_QUESTLOG[155].UID_01, 01)
221
222 player:addExperience(60000, true, true)
223 player:getPosition():sendMagicEffect(14)
224 player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
225 doBackpack(player, 12)
226 end, 3000)
227 end
228 end
229 if HARD == "IMPOSSIVEL" then
230 if player:getStorageValue(_QUESTLOG[155].UID_01) == 01 then
231 addEvent(function()
232 player:setStorageValue(_QUESTLOG[155].UID_01, 100)
233
234 player:addExperience(80000, true, true)
235 player:getPosition():sendMagicEffect(14)
236 player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
237 doBackpack(player, 12)
238 end, 3000)
239 end
240 end
241 else
242 player:setStorageValue(TAG, (CHECK_STEP + 1))
243 player:getPosition():sendMagicEffect(13)
244
245 Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4048, y=945, z=08}, false, true)
246 Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4050, y=948, z=08}, false, true)
247 Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4053, y=942, z=08}, false, true)
248 Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4055, y=950, z=08}, false, true)
249 Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4059, y=948, z=08}, false, true)
250 Game.createMonster(_GLOBAL_RANDOM.NINHOS[HARD][math.random(01, #_GLOBAL_RANDOM.NINHOS[HARD])].NAME, {x=4059, y=944, z=08}, false, true)
251 end
252 else
253 player:getPosition():sendMagicEffect(03)
254 end
255 else
256
257 player:getPosition():sendMagicEffect(03)
258 end
259
260 return true
261end
262