fendas.lua

main 261 lines · 8.6 KB Raw
Alex Alex Commit Server upload 18/10/2026 23:38
1local _FENDA_UID = {
2 [11100] = 01;
3 [11101] = 02;
4 [11102] = 03;
5 [11103] = 04;
6 [11104] = 05;
7 [11105] = 06;
8 [11106] = 07;
9 [11107] = 08;
10 [11108] = 09;
11 [11109] = 10;
12 [11110] = 11;
13 [11111] = 12;
14 [11112] = 13;
15 [11113] = 14;
16 [11114] = 15;
17 [11115] = 16;
18 [11116] = 17;
19 [11117] = 18;
20 [11118] = 19;
21 [11119] = 20;
22 [11120] = 21;
23 [11121] = 22;
24 [11122] = 23;
25 [11123] = 24;
26 [11124] = 25;
27 [11125] = 26;
28 [11126] = 27;
29 [11127] = 28;
30 [11128] = 29;
31 [11129] = 30;
32 [11130] = 31;
33 [11131] = 32;
34 [11132] = 33;
35 [11133] = 34;
36 [11134] = 35;
37 [11135] = 36;
38 [11136] = 37;
39 [11137] = 38;
40 [11138] = 39;
41 [11139] = 40;
42 [11140] = 41;
43 [11141] = 42;
44 [11142] = 43;
45 [11143] = 44;
46 [11144] = 45;
47 [11145] = 46;
48 [11146] = 47;
49 [11147] = 48;
50 [11148] = 49;
51 [11149] = 50;
52}
53local FENDA_M, FENDA_S = 0, 0
54
55local function EsquadraoDimensionalQuest(cid, step)
56 local creature = Player(cid)
57 if creature then
58 local SummPos = creature:getSummons()
59 local CHAT_TALK = {
60 [01] = {TALK = 'Outra vez atrasado?', SUM = 03, TIMER = 3000},
61 [02] = {TALK = 'Villauba...', SUM = 02, TIMER = 4000},
62 [03] = {TALK = 'Vamos encontrar o Nucleo Dimensional', SUM = 02, TIMER = 4000},
63
64
65
66 [07] = {TALK = 'Entendido?', SUM = 02, TIMER = 3000},
67 [08] = {TALK = 'Vamos logo!', SUM = 01, TIMER = 3000},
68 [09] = {TALK = 'Certo. Vamos acabar com isso.', SUM = 02, TIMER = 3000},
69 [10] = {TALK = '', SUM = nil, TIMER = 0001},
70 }
71
72 if CHAT_TALK[step].SUM == nil then
73 addEvent(function()
74 creature:setStorageValue(_QUESTLOG[167].UID_01, 03)
75
76 end, 3000)
77 return true
78 else
79 if #creature:getSummons() > 0 then
80 local timerDelay = CHAT_TALK[step].TIMER
81 SummPos[CHAT_TALK[step].SUM]:say(CHAT_TALK[step].TALK, TALKTYPE_SAY)
82 step = step + 01
83
84 addEvent(function() EsquadraoDimensionalQuest(creature.uid, step) end, timerDelay)
85 end
86 end
87 end
88end
89function onStepIn(creature, item, position, fromPosition)
90 if _FENDA_UID[item.uid] then
91 local X = _FENDA_UID[item.uid]
92 if creature:isPlayer() then
93 local party = creature:getParty()
94 if creature:getLevel() >= _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].LEVEL then
95 if party then
96 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
97 creature:getPosition():sendMagicEffect(03)
98
99 return false
100 end
101 if creature:getStorageValue(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].DELAY[01]) > 00 then
102 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
103 creature:getPosition():sendMagicEffect(03)
104 creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Aguarde " ..creature:getStorageValue(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].DELAY[01]).. " segundos para poder tentar novamente.")
105 return false
106 end
107 if PlayerFendasDimensionais(creature, 1000, 02, X) then
108 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
109 creature:getPosition():sendMagicEffect(03)
110
111 return true
112 end
113 if creature:getStorageValue(_QUESTLOG[167].UID_01) == 01 and item.uid == 11119 then
114 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
115 creature:getPosition():sendMagicEffect(03)
116
117 return false
118 end
119
120 local checkArea = 0
121 local from = _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].POS_INN_X
122 local to = _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].POS_INN_Y
123 for A = from.x, to.x do
124 for B = from.y, to.y do
125 for C = from.z, to.z do
126 local tile = Tile(A, B, C)
127 if tile then
128 local creature = tile:getTopCreature()
129 if creature and creature:isPlayer() then
130 checkArea = 1
131 break
132 end
133 end
134 end
135 end
136 end
137 if checkArea == 01 then
138 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
139 creature:getPosition():sendMagicEffect(03)
140
141 return true
142 end
143 for A = from.x, to.x do
144 for B = from.y, to.y do
145 for C = from.z, to.z do
146 local tile = Tile(A, B, C)
147 if tile then
148 local creature = tile:getTopCreature()
149 if creature and creature:isMonster() then
150 doRemoveCreature(creature:getId())
151 end
152 end
153 end
154 end
155 end
156 if party then
157 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
158 creature:getPosition():sendMagicEffect(03)
159
160 return false
161 end
162
163 for M = 01, #_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].MON_POS do
164 local MR = math.random(01, #_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].MONSTER)
165 Game.createMonster(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].MONSTER[MR], _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].MON_POS[M])
166 end
167
168 local NDR = math.random(01, #_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].NUCLEO_POS)
169 Game.createMonster("Nucleo Dimensional", _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].NUCLEO_POS[NDR])
170
171 creature:setStorageValue(_SYSTEM.FENDAS_DIMENSIONAL[01], X)
172 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].INN)
173 creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
174 FENDA_M = _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].TIMER
175 FENDA_S = 00
176 creature:sendCancelMessage("@CountTempo 3 0 0 0 0 0")
177 creature:sendCancelMessage("@DGTime 01 00 00 01")
178 addEvent(onFendaTime, 1000, creature.uid)
179
180 if item.uid == 11108 then
181 local EQUIPE_1 = Game.createMonster('Kanigher', {x=3737, y=1411, z=08})
182 local EQUIPE_2 = Game.createMonster('Ross', {x=3736, y=1411, z=08})
183 local EQUIPE_3 = Game.createMonster('Villauba', {x=3735, y=1411, z=08})
184
185 EQUIPE_1:setMaster(creature)
186 EQUIPE_2:setMaster(creature)
187 EQUIPE_3:setMaster(creature)
188
189 addEvent(function()
190 EsquadraoDimensionalQuest(creature.uid, 01)
191 end, 3000)
192 else
193
194 end
195 else
196 creature:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
197 creature:getPosition():sendMagicEffect(03)
198 creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Essa Fenda Dimensional requer level " .._GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].LEVEL.. " ou superior.")
199 return true
200 end
201 end
202 end
203
204 return true
205end
206function onFendaTime(cid)
207 local player = Player(cid)
208 if player then
209 if player:getStorageValue(_SYSTEM.FENDAS_DIMENSIONAL[01]) > 00 then
210 if FENDA_M == 0 and FENDA_S == 0 then
211 player:teleportTo({x=3999, y=991, z=7})
212 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
213 _GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].INN_FENDA_TIMER = nil
214 local X = player:getStorageValue(_SYSTEM.FENDAS_DIMENSIONAL[01]) or 0
215 player:teleportTo(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[X].OUT)
216 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
217
218 player:setStorageValue(_SYSTEM.FENDAS_DIMENSIONAL[01], nil)
219 player:sendCancelMessage("@DGTime 0 0 0")
220 player:setTown(Town(01))
221 else
222 local M1 = 0 local S1 = 0
223 local M2 = 0 local S2 = 0
224
225 if FENDA_M > 0 and FENDA_S > 0 then
226 FENDA_S = FENDA_S - 1
227 elseif FENDA_M > 0 and FENDA_S == 0 then
228 FENDA_S = 59
229 FENDA_M = FENDA_M - 1
230 elseif FENDA_M == 0 and FENDA_S > 0 then
231 FENDA_S = FENDA_S - 1
232 end
233
234 if string.len(FENDA_M) == 2 then
235 M1 = string.sub(FENDA_M, 1, 1)
236 M2 = string.sub(FENDA_M, 2, 2)
237 else
238 M1 = 0
239 M2 = string.sub(FENDA_M, 1, 1)
240 end
241 if string.len(FENDA_S) == 2 then
242 S1 = string.sub(FENDA_S, 1, 1)
243 S2 = string.sub(FENDA_S, 2, 2)
244 else
245 S1 = 0
246 S2 = string.sub(FENDA_S, 1, 1)
247 end
248
249 local party = player:getParty()
250 player:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2.." 00 00")
251 addEvent(onFendaTime, 1000, player.uid)
252 end
253 end
254 end
255end
256
257
258
259
260
261
Top