Update lua versions
[ryzomcore.git] / ryzom / client / data / gamedev / interfaces_v3 / ark.lua
blobac32ba43eb72806d5bf129177b801c24a1d86d30
1 if Ark == nil then
2 Ark = {}
3 end
5 function print_r(arr, indentLevel)
6 local str = ""
7 local indentStr = "#"
9 if(indentLevel == nil) then
10 debug(print_r(arr, 0))
11 return
12 end
14 for i = 0, indentLevel do
15 indentStr = indentStr.." "
16 end
18 for index,value in pairs(arr) do
19 if type(value) == "table" then
20 str = str..indentStr..index..": \n"..print_r(value, (indentLevel + 1))
21 else
22 str = str..indentStr..index..": "..value.."\n"
23 end
24 end
25 return str
26 end
29 function openPageInWebIg(url)
30 getUI("ui:interface:webig:content:html"):browse(url)
31 getUI("ui:interface:webig").active = true
32 getUI("ui:interface:webig").opened = true
33 end
35 function broadcast(text, t)
36 if t == nil then
37 t = "AMB"
38 end
39 local message = ucstring()
40 text = message:fromUtf8(tostring(text))
41 displaySystemInfo(message, t)
42 end
44 function fixUrl(url)
45 return url:gsub("{amp}", "&")
46 end
48 function openArkScript(id, winid, extra)
49 if winid == nil then
50 winid = "ui:interface:web_transactions"
51 end
52 if extra == nil then
53 extra = ""
54 end
55 getUI(winid):find("html"):browse("https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script="..id.."&command=reset_all&"..extra)
56 end
58 function openMissionArkScript(winid, id)
59 WebBrowser:openWindow(winid, "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script="..id.."&command=reset_all")
60 end
62 function getArkScript(id, selected)
63 if selected ~= nil then
64 url = "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script="..id.."&_hideWindow=1&command=reset_all&selected="..tostring(selected)
65 else
66 url = "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script="..id.."&_hideWindow=1&command=reset_all"
67 end
68 return url
69 end
71 --------------------------------------------------------------------------------
72 --- ARK MISSION CATALOG ---
73 --------------------------------------------------------------------------------
74 if ArkMissionCatalog == nil then
75 ArkMissionCatalog = {
76 window = nil,
77 window_id = "ui:interface:encyclopedia"
79 end
81 function ArkMissionCatalog:OpenWindow(urlA, urlB, dont_active)
82 local winframe = getUI(ArkMissionCatalog.window_id)
83 winframe.opened=true
84 if dont_active ~= true then
85 winframe.active=true
86 end
88 ArkMissionCatalog.window = winframe
90 getUI("ui:interface:encyclopedia:content:htmlA"):browse(urlA)
92 local htmlb = getUI("ui:interface:encyclopedia:content:htmlB")
93 htmlb.home = urlB
94 htmlb:browse("home")
95 end
97 function ArkMissionCatalog:OpenCat(cat, url)
98 local ency = getUI("ui:interface:encyclopedia")
99 setOnDraw(ency, "")
100 ArkMissionCatalog.cat = cat
101 local htmlA = getUI(ArkMissionCatalog.window_id..":content:htmlA")
102 local htmlB = getUI(ArkMissionCatalog.window_id..":content:htmlB")
103 local htmlC = getUI(ArkMissionCatalog.window_id..":content:htmlC")
104 if cat ~= "storyline" and cat ~= "daily" and cat ~= "achv" and cat ~= "puzzle" then
105 ArkMissionCatalog.posxB = 180
106 ArkMissionCatalog.widthB = 240
107 ArkMissionCatalog.widthC = 530
108 ArkMissionCatalog.posxC = 405
110 htmlB.x = ArkMissionCatalog.posxB
111 htmlB.w = ArkMissionCatalog.widthB
112 htmlC.w = ArkMissionCatalog.widthC
113 htmlC.x = ArkMissionCatalog.posxC
114 htmlC.active = true
115 else
116 ArkMissionCatalog.widthB = 740
117 htmlB.w = ArkMissionCatalog.widthB
118 if htmlC then
119 htmlC.active = false
122 htmlB.home = url.."&continent="..getContinentSheet()
123 htmlB:browse("home")
124 setOnDraw(ency, "ArkMissionCatalog:autoResize()")
125 if ArkMissionCatalog.continent ~= getContinentSheet() then
126 ArkMissionCatalog.continent = getContinentSheet()
127 htmlA:browse("https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=8746&command=reset_all&no_html_header=1&ig=1")
131 function ArkMissionCatalog:UpdateMissionTexts(win, id, text1, text2)
132 local w = win:find("ark_mission_"..id)
133 local text = ucstring()
134 text:fromUtf8(text1)
135 w:find("text1").uc_hardtext = text
136 text:fromUtf8(text2)
137 w:find("text2").uc_hardtext = text
140 function ArkMissionCatalog:startResize()
141 local ency = getUI("ui:interface:encyclopedia")
142 ency.w = 950
143 ency.h = 700
144 setOnDraw(ency, "ArkMissionCatalog:autoResize()")
147 function ArkMissionCatalog:autoResize()
148 if ArkMissionCatalog.bypass_resize then
149 ArkMissionCatalog.bypass_resize = false
150 return
153 local ui = getUI(ArkMissionCatalog.window_id)
154 local htmlA = getUI(ArkMissionCatalog.window_id..":content:htmlA")
155 local htmlB = getUI(ArkMissionCatalog.window_id..":content:htmlB")
156 local htmlC = getUI(ArkMissionCatalog.window_id..":content:htmlC")
158 if htmlC == nil or htmlC.active == false then
159 if ArkMissionCatalog.cat == "storyline" then
160 if ui.w < 784 then
161 local td30 = htmlB:find("storyline_content")
162 if td30 ~= nil then
163 td30.x = math.max(0, 200-784+ui.w)
164 ArkMissionCatalog.need_restore_td30 = true
166 else
167 if ArkMissionCatalog.need_restore_td30 then
168 local td30 = htmlB:find("storyline_content")
169 if td30 ~= nil then
170 td30.x = 200
171 ArkMissionCatalog.need_restore_td30 = false
177 if ui.w < 950 then
178 htmlA.w = math.max(68, 220-950+ui.w)
179 htmlB.x = math.max(35, 190-950+ui.w)
180 ArkMissionCatalog.need_restore = true
181 else
182 if ArkMissionCatalog.need_restore then
183 htmlA.w = 220
184 htmlB.x = 180
185 ArkMissionCatalog.need_restore = false
188 else
189 htmlA.w = math.max(68, 220-950+ui.w)
190 htmlB.x = math.max(35, ArkMissionCatalog.posxB-950+ui.w)
191 htmlC.x = math.max(75, ui.w-htmlC.w-16)
192 htmlB.w = math.max(55, htmlC.x-htmlB.x+16)
196 function ArkMissionCatalog:showLegacyEncyclopedia(state)
197 if state == 1 then
198 getUI("ui:interface:legacy_encyclopedia").active=1
199 else
200 getUI("ui:interface:legacy_encyclopedia").active=0
204 if S2E1 == nil then
205 S2E1 = {}
208 runAH(nil, "stop_event_music", "")
210 S2E1.WindowOpened = false
211 S2E1.texts = {}
212 S2E1.texts["de"] = {}
213 S2E1.texts["en"] = {}
214 S2E1.texts["es"] = {}
215 S2E1.texts["fr"] = {}
216 S2E1.texts["ru"] = {}
219 S2E1.texts["de"][1] = {"Aus der Rinde kommt ein leichtes Knirschen.",
220 "Die leisen Knirsch-Geräusche fangen an dich zu nerven.",
221 "Die Rinde scheint sich unter deinen Füßen zu winden...",
222 "Du hast Schwierigkeiten geradeaus zu gehen; vielleicht war die Shooki nicht sehr frisch.",
223 "Ein Rindenbeben muss irgendwo weit weg von hier passiert sein...."}
224 S2E1.texts["de"][2] = {"Ein dumpfes Schlaggeräusch kommt von der Rinde.",
225 "Plötzliche Beben erschüttern die Rinde und die Vegetation um dich herum.",
226 "Sie bringen dich aus dem Gleichgewicht...",
227 "Man muss aufpassen, dass man nicht hinfällt.",
228 "Das Beben lässt nach, die Rinde kommt wieder zur Ruhe."}
229 S2E1.texts["de"][3] = {"Aus der Rinde steigt ein dumpfes Rumoren auf.",
230 "Eine erste Erschütterung bringt dich ins Wanken.",
231 "Die, die folgen, sind heftig...",
232 "Es fällt dir schwer aufzustehen.",
233 "Die Erschütterungen werden schwächer, die Rinde kommt wieder zur Ruhe."}
234 S2E1.texts["de"][4] = {"Aus der Rinde steigt ein Grollen auf.",
235 "Plötzlich gibt die Rinde unter deinen Füßen nach und du fällst zu Boden.",
236 "Du stehst auf und versuchst zu fliehen...",
237 "aber fällst gleich wieder hin.",
238 "Die Erschütterungen werden schwächer..."}
239 S2E1.texts["de"][5] = {"Aus der Rinde dringt ein rumpelndes Geräusch empor.",
240 "Plötzlich gibt sie unter deinen Füßen nach und du fällst hin.",
241 "Du stehst wieder auf."}
244 S2E1.texts["en"][1] = {"A slight squeak raise from the Bark.",
245 "The little squeals begin to irk you.",
246 "The Bark seems to wriggle under your feet…",
247 "You have trouble walking straight; maybe the Shooki wasn't very fresh.",
248 "A barkquake must have happened somewhere far from here…"}
249 S2E1.texts["en"][2] = {"A thumping sound rises from the Bark.",
250 "Jolts suddenly shake the Bark and the vegetation around you.",
251 "They throw you off balance…",
252 "You have to pay attention not to fall down.",
253 "The shaking subsides, the Bark reverts to a stable state."}
254 S2E1.texts["en"][3] = {"A thudding murmur raises from the Bark.",
255 "A first jolt makes you waver.",
256 "Those following are violent…",
257 "You're having a hard time standing up.",
258 "The jolts become weaker, the Bark becomes stable again."}
259 S2E1.texts["en"][4] = {"A rumble comes out of the Bark.",
260 "The Bark suddenly gives way under your feet and you fall to the ground.",
261 "You get up, trying to get away…",
262 "But fall back immediately.",
263 "The jolts are beginning to weaken…"}
264 S2E1.texts["en"][5] = {"Out of the Bark comes a rumbling sound.",
265 "Suddenly it gives way under your feet and you fall to the ground.",
266 "You get up again."}
269 S2E1.texts["es"][1] = {"Un ligero chirrido de la corteza.",
270 "Los pequeños chillidos comienzan a molestarte.",
271 "La corteza parece retorcerse bajo tus pies...",
272 "Tienes problemas para caminar recto; tal vez el Shooki no era muy fresco.",
273 "Un terremoto debe haber ocurrido en algún lugar lejos de aquí..."}
274 S2E1.texts["es"][2] = {"Un sonido de golpeteo se eleva desde la corteza.",
275 "Las sacudidas repentinamente sacuden la corteza y la vegetación a su alrededor.",
276 "Te desequilibran...",
277 "Tienes que prestar atención para no caerte.",
278 "El temblor disminuye, la corteza vuelve a un estado estable."}
279 S2E1.texts["es"][3] = {"Un estruendoso murmullo se eleva desde la corteza.",
280 "La primera sacudida te hace temblar.",
281 "Los siguientes son violentos...",
282 "Te cuesta mucho trabajo estar de pie.",
283 "Las sacudidas se debilitan, la corteza se vuelve estable de nuevo."}
284 S2E1.texts["es"][4] = {"Un estruendo sale de la corteza.",
285 "La corteza de repente cede bajo tus pies y caes al suelo.",
286 "Te levantas, tratando de escapar...",
287 "Pero retroceda inmediatamente.",
288 "Las sacudidas están empezando a debilitarse..."}
289 S2E1.texts["es"][5] = {"De la Corteza sale un sonido estruendoso.",
290 "De repente cede bajo tus pies y caes al suelo.",
291 "Te levantas de nuevo."}
294 S2E1.texts["fr"][1] = {"Un léger grincement s'échappe de l'Écorce.",
295 "Les petits crissements commencent à vous agacer.",
296 "L'Écorce semble frétiller sous vos pieds…",
297 "Vous avez du mal à marcher droit ; peut-être la Shooki n'était-elle pas très fraîche.",
298 "Un tremblement d'écorce a dû se produire quelque part, loin d'ici…"}
299 S2E1.texts["fr"][2] = {"Un bruit sourd monte de l'Écorce.",
300 "Des secousses agitent soudain l'Écorce et la végétation autour de vous.",
301 "Elles vous déséquilibrent…",
302 "Vous devez faire attention pour ne pas tomber.",
303 "Le tremblement s'apaise, l'Écorce redevient stable."}
304 S2E1.texts["fr"][3] = {"Une sourde rumeur monte de l'Écorce.",
305 "Une première secousse vous fait vaciller.",
306 "Celles qui suivent sont violentes…",
307 "Vous avez beaucoup de mal à tenir debout.",
308 "Les secousses deviennent plus faibles, l'Écorce redevient stable."}
309 S2E1.texts["fr"][4] = {"Un grondement monte de l'Écorce.",
310 "L'Écorce se dérobe soudain sous vos pieds et vous tombez sur le sol.",
311 "Vous vous relevez, cherchant à vous éloigner…",
312 "Mais retombez aussitôt.",
313 "Les secousses commencent à s'affaiblir…"}
314 S2E1.texts["fr"][5] = {"De l'Écorce s'élève un grondement.",
315 "Elle se dérobe soudain sous vos pieds et vous tombez sur le sol.",
316 "Vous vous relevez."}
318 S2E1.texts["ru"][1] = {"Легкий скрип коры.",
319 "Эти тихие скрипы начинают тебя раздражать.",
320 "Кора, похоже, виляет у тебя под ногами...",
321 "Тебе трудно шагать прямо, может быть, Шуки был не очень свежим.",
322 "Наверное, где-то произошло трясение коры..."}
323 S2E1.texts["ru"][2] = {"Из коры поднимается стук.",
324 "Толчки внезапно трясут Кору и растительность вокруг тебя.",
325 "Они сбивают тебя с пути...",
326 "Тебе нужно сосредоточиться, чтобы не упасть.",
327 "Тряска утихает, кора возвращается в стабильное состояние."}
328 S2E1.texts["ru"][3] = {"Громкий шум поднимается из коры.",
329 "Первый толчок заставляет тебя колебаться.",
330 "Следующие жестокие...",
331 "Тебе тяжело стоять.",
332 "Толчки слабеют, кора снова становится стабильной."}
333 S2E1.texts["ru"][4] = {"Грохот исходит из коры.",
334 "Кора внезапно поддается под ногами, и ты падаешь на поверхность.",
335 "Ты встаешь, пытаешься убежать...",
336 "Но немедленно опять падаешь.",
337 "Толчки начинают ослабляться..."}
338 S2E1.texts["ru"][5] = {"Из коры доносится грохот.",
339 "Кора внезапно поддается под ногами, и ты падаешь на поверхность.",
340 "Ты снова встаешь."}
342 function utf8decode(text)
343 local utext = ucstring()
344 utext:fromUtf8(text)
345 return utext
348 function point_inside_poly(x,y,poly)
349 local inside = false
350 local p1x = poly[1][1]
351 local p1y = poly[1][2]
353 for i=0,#poly do
355 local p2x = poly[((i)%#poly)+1][1]
356 local p2y = poly[((i)%#poly)+1][2]
358 if y > math.min(p1y,p2y) then
359 if y <= math.max(p1y,p2y) then
360 if x <= math.max(p1x,p2x) then
361 if p1y ~= p2y then
362 xinters = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
364 if p1x == p2x or x <= xinters then
365 inside = not inside
370 p1x,p1y = p2x,p2y
372 return inside
375 function S2E1:loopActions()
376 local action_params = S2E1.AutoActions[S2E1.AutoActionId]
377 if action_params ~= nil then
378 local action = action_params[1]
379 local param = action_params[2]
380 local ttime = action_params[3]
381 S2E1.crazy_time = nltime.getLocalTime()
382 if action == "broadcast" then
383 displaySystemInfo(utf8decode("@{9E9F}"..param), "BC")
384 action = "wait"
385 elseif action == "crunsh" then
386 runAH(nil, "run_action", "forward")
387 runAH(nil, "force_sit", "")
388 action = "wait"
389 elseif action == "open_window" then
390 S2E1:openWindow(param)
391 action = "wait"
392 elseif action ~= "Cam" then
393 runAH(nil, action, param)
394 action = "wait"
396 S2E1.camPosX = 0
397 S2E1.camPosY = 0
398 getUI("ui:interface:storyline_window").active=1
399 setOnDraw(getUI("ui:interface:storyline_window"), "S2E1:loopAction("..tostring(ttime)..", [["..action.."]], [["..param.."]])")
403 function S2E1:loopAction(ttime, action, param)
404 if action == "Cam" then
405 local params = {}
406 for p in string.gmatch(param, "([^:]+)") do
407 table.insert(params, p)
409 paramX = tonumber(params[1]) / 100
410 paramY = tonumber(params[2]) / 100
411 S2E1.camPosX = S2E1.camPosX + paramX
412 S2E1.camPosY = S2E1.camPosY + paramY
413 moveCam(S2E1.camPosY, 0, S2E1.camPosX)
416 local tick = nltime.getLocalTime()
417 if tick > S2E1.crazy_time + ttime then
418 setOnDraw(getUI("ui:interface:storyline_window"), "")
419 S2E1.AutoActionId = S2E1.AutoActionId + 1
420 S2E1.camPosX = 0
421 S2E1.camPosY = 0
422 if action == "Cam" then
423 moveCam(0, 0, 0)
425 S2E1:loopActions()
431 function S2E1:AddQuake(force)
432 for n=1,force*10 do
433 posX = force * 4 * (math.random() - 0.5)
434 posY = force * 0.1 * (math.random() - 0.5)
435 timer = 50+(40*math.random())
436 S2E1.AutoActions[#S2E1.AutoActions+1] = {"Cam", tostring(posX)..":"..tostring(posY), timer}
440 function S2E1:getText(size, id)
441 local lang = getClientCfg("LanguageCode")
442 return S2E1.texts[lang][size][id]
445 function S2E1:StartQuake(size)
446 local delays = {}
447 delays[1] = {3000, 4000, 300, 1000, 7700}
448 delays[2] = {3000, 4000, 300, 1000, 7700, 4000, 1000}
449 delays[3] = {3000, 4000, 300, 1000, 200, 4000, 5000}
450 delays[4] = {5000, 1000, 500, 3000, 700, 500}
451 delays[5] = {300, 300}
453 local first_delay = 3000
454 if size == 5 then
455 first_delay = 1000
458 S2E1.AutoActions = {
459 {"stop_event_music", "", 10},
460 {"broadcast", S2E1:getText(size, 1), 10},
461 {"play_event_music", "music=bg_quake"..tostring(size)..".ogg", first_delay}
464 if size == 1 then
465 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][1]}
466 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 2), delays[size][2]}
467 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 3), delays[size][3]}
468 S2E1:AddQuake(1)
469 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][4]}
470 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 4), delays[size][5]}
471 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 5), 10}
474 if size == 2 then
475 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][1]}
476 S2E1:AddQuake(1)
477 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 2), delays[size][2]}
478 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 3), delays[size][3]}
479 S2E1:AddQuake(2)
480 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][4]}
481 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 4), delays[size][5]}
483 S2E1:AddQuake(1)
484 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][6]}
486 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][7]}
488 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 5), 10}
491 if size == 3 then
492 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][1]}
493 S2E1:AddQuake(1)
494 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 2), delays[size][1]}
495 S2E1:AddQuake(1)
496 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][4]}
497 S2E1:AddQuake(2)
498 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 3), delays[size][2]}
499 S2E1:AddQuake(3)
500 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 4), delays[size][3]}
502 S2E1:AddQuake(2)
503 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][6]}
504 S2E1:AddQuake(1)
505 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][7]}
506 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 5), 10}
510 if size == 4 then
511 S2E1:AddQuake(1)
512 S2E1:AddQuake(1)
513 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][1]}
514 S2E1:AddQuake(2)
515 S2E1:AddQuake(3)
516 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", delays[size][2]}
517 S2E1:AddQuake(4)
518 S2E1:AddQuake(3)
520 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 2), delays[size][3]}
521 S2E1.AutoActions[#S2E1.AutoActions+1] = {"crunsh", "", 10}
523 S2E1:AddQuake(2)
524 S2E1:AddQuake(1)
525 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 3), delays[size][4]}
526 S2E1:AddQuake(1)
527 S2E1.AutoActions[#S2E1.AutoActions+1] = {"crunsh", "", 10}
528 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 4), delays[size][5]}
530 S2E1:AddQuake(1)
531 S2E1.AutoActions[#S2E1.AutoActions+1] = {"run_action", "forward", 300}
532 S2E1.AutoActions[#S2E1.AutoActions+1] = {"stop_action", "forward", 300}
533 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 5), delays[size][6]}
536 if size == 5 then
537 S2E1:AddQuake(2)
538 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 2), delays[size][1]}
539 S2E1.AutoActions[#S2E1.AutoActions+1] = {"crunsh", "", 10}
540 S2E1:AddQuake(2)
541 S2E1.AutoActions[#S2E1.AutoActions+1] = {"broadcast", S2E1:getText(size, 3), delays[size][2]}
542 S2E1.AutoActions[#S2E1.AutoActions+1] = {"run_action", "forward", 300}
543 S2E1.AutoActions[#S2E1.AutoActions+1] = {"stop_action", "forward", 300}
547 S2E1.AutoActions[#S2E1.AutoActions+1] = {"", "", 5000}
549 S2E1.AutoActionId = 1
550 S2E1:loopActions()
554 function S2E1:newQuake(timer)
555 local nbr_p = 0
556 local polygons = {}
557 local zones = {}
559 nbr_p = nbr_p + 1
560 polygons[nbr_p] = {{7846,-6097}, {9754,-6093}, {9778,-8349}, {7844,-8321}}
561 zones[nbr_p] = "nexus"
563 nbr_p = nbr_p + 1
564 polygons[nbr_p] = {{8128,-10208}, {11368,-10208}, {11392,-12392}, {8096,-12368}}
565 zones[nbr_p] = "silan"
567 nbr_p = nbr_p + 1
568 polygons[nbr_p] = {{3716,-4726}, {5228,-5118}, {5468,-5478}, {5596,-5894}, {5604,-6302}, {5524,-6958}, {5220,-7310}, {4692,-7582}, {3588,-7550}, {3060,-6681}, {3076,-5630}}
569 zones[nbr_p] = "surround"
570 nbr_p = nbr_p + 1
571 polygons[nbr_p] = {{13764,-29482}, {19540,-29434}, {19156,-30090}, {18836,-30330}, {17732,-30506}, {17060,-30458}, {16484,-31049}, {15820,-31538}, {15650,-31590}, {15496,-31578}, {14436,-30890}}
572 zones[nbr_p] = "surround"
573 nbr_p = nbr_p + 1
574 polygons[nbr_p] = {{6684,-14990}, {6431,-14820}, {6292,-14726}, {6221,-14689}, {6236,-14606}, {5972,-14414}, {5580,-12246}, {5692,-11230}, {5860,-11054}, {6164,-10854}, {7404,-11166}, {7380,-14382}}
575 zones[nbr_p] = "surround"
576 nbr_p = nbr_p + 1
577 polygons[nbr_p] = {{432,-9729}, {1644,-9693}, {1672,-11433}, {452,-11397}}
578 zones[nbr_p] = "surround"
580 nbr_p = nbr_p + 1
581 polygons[nbr_p] = {{308,-350}, {4004,-318}, {5428,-1918}, {6116,-3086}, {6308,-7982}, {3588,-7710}, {308,-2606}}
582 zones[nbr_p] = "far"
583 nbr_p = nbr_p + 1
584 polygons[nbr_p] = {{20064,-29262}, {19972,-34986}, {13652,-34954}, {13548,-29330}}
585 zones[nbr_p] = "far"
586 nbr_p = nbr_p + 1
587 polygons[nbr_p] = {{5300,-9485}, {7524,-9445}, {7556,-17189}, {5280,-17106}}
588 zones[nbr_p] = "far"
589 nbr_p = nbr_p + 1
590 polygons[nbr_p] = {{191,-13148}, {119,-15892}, {3103,-15868}, {3055,-13100}}
591 zones[nbr_p] = "far"
592 nbr_p = nbr_p + 1
593 polygons[nbr_p] = {{9990,-1580}, {10046,-2300}, {10246,-2676}, {10510,-2884}, {10990,-3212}, {11646,-3428}, {12486,-3124}, {12522,-712}}
594 zones[nbr_p] = "far"
595 nbr_p = nbr_p + 1
596 polygons[nbr_p] = {{16578,-27080}, {17290,-26192}, {17638,-25860}, {17714,-25613}, {17870,-25436}, {18790,-24648}, {19534,-24168}, {20374,-23800}, {20394,-27100}}
597 zones[nbr_p] = "far"
600 local x,y=getPlayerPos()
601 local zone = "farfar"
602 for i=1,nbr_p do
603 z = point_inside_poly(x, y, polygons[i])
604 if z == true then
605 zone = zones[i]
606 break
610 if zone == "farfar" and (timer % 6) == 0 then
611 S2E1:StartQuake(1)
612 elseif zone == "far" and (timer % 4) == 0 then
613 S2E1:StartQuake(2)
614 elseif zone == "surround" and (timer % 2) == 0 then
615 S2E1:StartQuake(3)
616 elseif zone == "nexus" then
617 S2E1:StartQuake(4)
625 -- VERSION --
626 RYZOM_ARK_VERSION = 10469