7 <meta http-equiv="content-type" content="text/html;charset=utf-8" />
9 <body style="background-image:url(skin_blank.tga);">
10 <table cellspacing="3" cellpadding="3" width="100%">
11 <div name="info_banner">
12 <tr><img src="#faction.tga"></tr>
14 <table cellspacing="#csp" cellpadding="2" width="100%">
21 <table cellspacing="#csp" cellpadding="2" width="100%">
28 <table cellspacing="#csp" cellpadding="2" width="100%">
35 <table cellspacing="#csp" cellpadding="2" width="100%">
42 <table cellspacing="#csp" cellpadding="2" width="100%">
49 <div name="info_footer">
52 <div name="info_money">
53 <td><img align="left" src="money_seve.tga"></td>
54 <td width="100%"><font color="white" size="12">#money</font></td>
56 <td><font color="white" size="10">#dopact</font></td>
57 <td><form><input name="auto" alt="#help" type="checkbox" #check></form></td>
65 if artefact
== nil then
78 isLogoMinimized
= false,
79 web_item
= "params_l:#L;template:webig_inv_item_artefact;\
80 display:inline-block;id:pact#P;tooltip:#T;\
81 quantity:q0;#Q;#O;img1:tp_#I.tga;\
82 bg:bk_#E.tga;col_over:255 255 255 45", -- slotbg:blank2.tga;
85 idWindow
= "ui:interface:artefact",
86 idWindowBag
= "ui:interface:inventory:content:bag",
89 items_labels
= Json
.decode([[{"kami_almati":"almati","kami_avalae":"avalae","kami_avendale":"avendale","kami_bountybeaches":"bounty","kami_citiesofintuition":"","kami_corrupted_moor":"","kami_corrupted_moor_fairhaven":"","kami_corrupted_moor_pyr":"","kami_corrupted_moor_yrkanis":"","kami_corrupted_moor_zora":"","kami_crystabell":"crystabell","kami_davae":"davae","kami_dewdrops":"dewdrops","kami_dunesofexil":"dunes","kami_dyron":"dyron","kami_enchantedisle":"enchanted","kami_fairhaven":"fairhaven","kami_fleetinggarden":"fleeting","kami_forbidden_depths":"forbidden","kami_frahartowers":"frahar","kami_gate_of_obscurity":"gate","kami_groveofconfusion":"grove","kami_groveofumbra":"grove","kami_havenofpurity":"haven","kami_hereticshovel":"heretic","kami_hiddensource":"hidden","kami_hoi_cho":"hoicho","kami_jen_lai":"jenlai","kami_knollofdissent":"knoll","kami_knotofdementia":"knot","kami_lagoonsofloria":"lagoon","kami_maidengrove":"maiden","kami_min_cho":"mincho","kami_natae":"natae","kami_nexus_bagne":"","kami_nexus_route_gouffre":"","kami_nexus_terre":"nexus","kami_oflovaksoasis":"oflovak","kami_outlawcanyon":"outlaw","kami_pyr":"pyr","kami_ranger_camp":"ranger","kami_restingwater":"resting","kami_sawdustmines":"sawdust","kami_shining_lake":"shining","kami_the_abyss_of_ichor_matis":"abyss","kami_the_abyss_of_ichor_nexus":"","kami_the_elusive_forest":"elusive","kami_the_land_of_continuity":"land","kami_the_sunken_city":"sunken","kami_the_trench_of_trials_tryker":"","kami_the_trench_of_trials_zorai":"trench","kami_the_under_spring_fyros":"under","kami_the_under_spring_zorai":"","kami_the_windy_gate":"windy","kami_thefount":"fount","kami_thesavagedunes":"savage","kami_thescorchedcorridor":"scorched","kami_thesos":"thesos","kami_thevoid":"void","kami_upperbog":"upper","kami_windermeer":"windermeer","kami_windsofmuse":"winds","kami_yrkanis":"yrkanis","kami_zora":"zora","kami_zorai_nland":"","karavan_almati":"almati","karavan_avalae":"avalae","karavan_avendale":"avendale","karavan_bountybeaches":"bounty","karavan_corrupted_moor":"","karavan_corrupted_moor_fairhaven":"","karavan_corrupted_moor_pyr":"","karavan_corrupted_moor_yrkanis":"","karavan_corrupted_moor_zora":"","karavan_crystabell":"crystabell","karavan_davae":"davae","karavan_dewdrops":"dewdrops","karavan_dunesofexil":"dunes","karavan_dyron":"dyron","karavan_enchantedisle":"enchanted","karavan_fairhaven":"fairhaven","karavan_fleetinggarden":"fleeting","karavan_forbidden_depths":"forbidden","karavan_frahartowers":"frahar","karavan_gate_of_obscurity":"gate","karavan_groveofconfusion":"grove","karavan_groveofumbra":"grove","karavan_havenofpurity":"haven","karavan_hereticshovel":"heretic","karavan_hiddensource":"hidden","karavan_hoi_cho":"hoicho","karavan_jen_lai":"jenlai","karavan_knollofdissent":"knoll","karavan_knotofdementia":"knot","karavan_lagoonsofloria":"lagoon","karavan_maidengrove":"maiden","karavan_majesticgarden":"","karavan_matis_nland":"","karavan_min_cho":"mincho","karavan_natae":"natae","karavan_nexus_bagne":"","karavan_nexus_route_gouffre":"","karavan_nexus_terre":"nexus","karavan_oflovaksoasis":"oflovak","karavan_outlawcanyon":"outlaw","karavan_pyr":"pyr","karavan_ranger_camp":"ranger","karavan_restingwater":"resting","karavan_sawdustmines":"sawdust","karavan_shattered_ruins":"shattered","karavan_the_abyss_of_ichor_matis":"abyss","karavan_the_abyss_of_ichor_nexus":"","karavan_the_elusive_forest":"elusive","karavan_the_land_of_continuity":"land","karavan_the_sunken_city":"sunken","karavan_the_trench_of_trials_tryker":"","karavan_the_trench_of_trials_zorai":"trench","karavan_the_under_spring_fyros":"under","karavan_the_under_spring_zorai":"","karavan_the_windy_gate":"windy","karavan_thefount":"fount","karavan_thesavagedunes":"savage","karavan_thescorchedcorridor":"scorched","karavan_thesos":"thesos","karavan_thevoid":"void","karavan_upperbog":"upper","karavan_windermeer":"windermeer","karavan_windsofmuse":"winds","karavan_yrkanis":"yrkanis","karavan_zora":"zora"}]])
93 function artefact
:onActive()
96 self
:bagObserver(true)
100 function artefact
:onDeactive()
101 if self
.uiWindow
then
102 self
.uiWindow
.active
= false
103 self
.uiWindow
.opened
= false
104 if self
.observer
then
105 self
:bagObserver(false)
110 function artefact
:onClose()
111 if self
.uiWindow
then
112 runAH(getUICaller(), "proc", "artefact_proc_deactive")
117 function artefact
:onClickHeader(opened
)
118 if self
.uiWindow
then
121 self
.uiWindow
:find("header_minimize").params_l
= "artefact:onClickHeader(0)"
126 self
.uiWindow
:find("header_minimize").params_l
= "artefact:onClickHeader(1)"
130 function artefact
:onResize()
131 -- on resize max width
132 if self
.uiWindow
.w
== self
.max_w
then
134 -- adjust height size
135 if getDbProp(self
.banner
) == 0 then
138 self
.uiWindow
.pop_max_h
= self
.max_h
- size
139 -- vertical down only
140 if self
.uiWindow
.h
>= self
.uiWindow
.pop_max_h
then
141 -- now resize window height
142 self
.uiWindow
.h
= self
.uiWindow
.pop_max_h
145 if not self
.isCompact
then
146 if getDbProp(self
.banner
) == 0 then
147 self
.uiWindow
.pop_max_h
= self
.max_h
- 69
148 -- on resize height if width not maxed
149 if self
.uiWindow
.h
>= self
.uiWindow
.pop_max_h
then
150 self
.uiWindow
.h
= self
.uiWindow
.pop_max_h
154 self
.uiWindow
.pop_max_h
= self
.max_h
159 if self
.isMinimized
then
160 self
.uiWindow
.h
= self
.uiWindow
.pop_min_h
161 self
.uiWindow
.w
= self
.uiWindow
.pop_min_w
164 if self
.isCompact
then
165 if not self
.isMinimized
then
166 self
.uiWindow
.pop_max_w
= self
.min_h
/2 + 1
167 self
.uiWindow
.pop_max_h
= getUI("ui:interface").h
172 -- toggle on checkbox event
173 function artefact
:onChecked()
174 if getDbProp(self
.dopact
) == 1 then
175 setDbProp(self
.dopact
, 0)
176 sendMsgToServerAutoPact(false)
179 setDbProp(self
.dopact
, 1)
180 sendMsgToServerAutoPact(true)
183 function artefact
:onMenu(menu
)
184 local node
= ":toggle_banner_"
185 -- can not switch logo in compact mode
186 if self
.isCompact
then
187 getUI(menu
..node
.."hide").active
= false
188 getUI(menu
..node
.."show").active
= false
190 if getDbProp(self
.banner
) == 1 then
191 getUI(menu
..node
.."hide").active
= true
192 getUI(menu
..node
.."show").active
= false
194 getUI(menu
..node
.."hide").active
= false
195 getUI(menu
..node
.."show").active
= true
198 node
= ":window_on_tp_"
199 -- toggle on teleport close menu
200 if getDbProp(self
.closeTp
) == 1 then
201 getUI(menu
..node
.."close").active
= false
202 getUI(menu
..node
.."open").active
= true
204 getUI(menu
..node
.."close").active
= true
205 getUI(menu
..node
.."open").active
= false
207 node
= ":window_compact"
208 -- disable compact mode if minimized
209 if self
.isMinimized
then
210 getUI(menu
..node
).active
= false
212 getUI(menu
..node
).active
= true
214 runAH(getUICaller(), "active_menu", "menu="..menu
)
217 -- event onclick menu
218 function artefact
:onSelect(event
)
219 -- toggle on teleport close
221 if getDbProp(self
.closeTp
) == 1 then
222 setDbProp(self
.closeTp
, 0)
225 setDbProp(self
.closeTp
, 1)
228 -- do not switch mode while minimized
229 if self
.isMinimized
and event
== 4 then
232 -- do not allow logo in compact mode
234 if self
.isCompact
then
238 if getDbProp(self
.banner
) == 1 then
239 setDbProp(self
.banner
, 0)
240 self
.uiWindow
.h
= self
.max_h
- 69
242 setDbProp(self
.banner
, 1)
243 self
.uiWindow
.pop_max_h
= self
.max_h
244 self
.uiWindow
.h
= self
.max_h
246 if self
.isMinimized
then
247 self
.isLogoMinimized
= true
253 if not self
.isCompact
then
254 -- store original window
255 self
.pop_compact_h
= self
.uiWindow
.h
256 self
.pop_compact_w
= self
.uiWindow
.w
257 self
.pop_compact_l
= getDbProp(self
.banner
)
259 setDbProp(self
.banner
, 0)
260 self
.isCompact
= true
262 self
.isCompact
= false
263 -- restore default mode
264 self
.uiWindow
.h
= self
.pop_compact_h
265 self
.uiWindow
.w
= self
.pop_compact_w
266 self
.uiWindow
.pop_max_w
= self
.max_w
267 if self
.pop_compact_l
== 1 then
268 setDbProp(self
.banner
, 1)
272 -- attach it to inventory bag
274 runAH(getUICaller(), "proc", "artefact_win_attach")
277 self
:doRefresh() -- event 3
283 function artefact
:saveWindow()
284 -- save current window dimension
285 self
.isMinimized
= true
286 self
.h
= self
.uiWindow
.h
287 self
.w
= self
.uiWindow
.w
289 self
.uiWindow
.pop_min_h
= 32
290 self
.uiWindow
.pop_min_w
= self
.min_h
/ 2
291 self
.uiWindow
.w
= self
.min_h
/ 2
295 function artefact
:restoreWindow()
296 if self
.isMinimized
then
297 self
.isMinimized
= false
299 self
.uiWindow
.pop_min_h
= self
.min_h
300 self
.uiWindow
.pop_min_w
= self
.min_w
301 self
.uiWindow
.h
= self
.h
302 self
.uiWindow
.w
= self
.w
303 -- logo is activated when minimized
304 if self
.isLogoMinimized
then
305 self
.uiWindow
.h
= self
.uiWindow
.pop_max_h
307 self
.isLogoMinimized
= false
313 function artefact
:attachWindow()
314 if self
.uiWindow
.opened
then
315 self
.uiWindow
.opened
= false
317 if self
.uiWindow
.active
then
318 self
.uiWindow
.active
= false
320 self
.isAttached
= true
321 -- render content in bag
322 self
.uiWindowBag
= getUI(self
.idWindowBag
..":artefact_content")
323 if self
.uiWindowBag
then
326 if not self
.observer
then
327 self
:bagObserver(true)
331 function artefact
:detachWindow()
332 if self
.observer
then
333 self
:bagObserver(false)
335 self
.isAttached
= false
336 self
.uiWindow
.opened
= true
337 self
.uiWindow
.active
= true
338 self
.uiWindowBag
= nil
342 -- hide inventory bag pacts
343 function artefact
:hidePact()
344 if getDbProp(self
.filter
) == 1 then
345 self
.isFiltered
= true
346 setDbProp(self
.filter
, 0)
350 -- restore inventory bag pacts
351 function artefact
:restorePact()
352 if self
.isFiltered
then
353 if getDbProp(self
.active
) == 0 then
354 self
.isFiltered
= false
355 setDbProp(self
.filter
, 1)
360 function artefact
:doRefresh()
362 if not artefact
:checkfame() then
363 if artefact
.observer
then
364 artefact
:bagObserver(false)
366 if self
.isAttached
then
367 runAH(getUICaller(), "proc", "artefact_win_detach")
369 artefact
:startInterface()
373 local html
= artefact
.uiWindow
:find("html")
374 if artefact
.uiWindowBag
and artefact
.isAttached
then
375 html
= artefact
.uiWindowBag
:find("html")
378 artefact
:dynRender(html
)
382 function artefact
:usePact(id
)
383 if not artefact
:checkfame() then
384 if self
.isAttached
then
385 runAH(getUICaller(), "proc", "artefact_win_detach")
391 sendMsgToServerUseItem(id
)
393 if getDbProp(self
.closeTp
) == 1 then
394 if self
.isAttached
then
395 runAH(getUICaller(), "proc", "select_bag_items")
402 function artefact
:bagObserver(listen
)
403 if not self
.observer
then
404 self
.observer
= misc
:initInvObserver(
406 self
.doRefresh
, -- on_add
407 self
.doRefresh
, -- on_del
408 self
.doRefresh
, -- on_change
413 local window
= self
.uiWindow
414 if self
.isAttached
then
415 if self
.uiWindowBag
then
416 window
= self
.uiWindowBag
420 self
.observer
:add(window
, 1)
422 if self
.observer
then
423 self
.observer
:remove(window
, 1)
429 function artefact
:dynRender(html
)
430 local content
= self
.webcode
431 -- list teleportation pacts
432 for eco
, tp
in pairs(self
.currentPacts
) do
433 for _
, item
in pairs(tp
) do
435 for i
= 0, self
.max_slots
-1 do
436 local sheet
= self
:getitem(i
, "sheet")
439 local name
= getSheetName(sheet
)
440 local quantity
= self
:getitem(i
, "quantity")
441 -- matches with owned pacts
442 if self
:strcmp(name
, "tp_"..self
.faction
) then
443 if self
:strcmp(name
, ".sitem", false) then
444 if name
:find(item
.name
) then
445 self
.zone
= self
:webInv(item
, eco
, quantity
, i
)
452 content
= string.gsub(content
, "#"..eco
, self
.zone
)
455 local banner
= "ban_artefact_"
456 local dappers
= getDbProp(self
.dapper
)
457 local checkbox
= getDbProp(self
.dopact
)
458 local autopact
= "Auto Pacts"
459 -- reset table cellspace
460 if self
.cellspace
> 5 then
464 local space
= self
.cellspace
466 if self
.isCompact
then
467 autopact
= "Pacts "
471 content
= string.gsub(content
, "#csp", space
)
472 -- toggle auto pact checkbox
474 checkbox
= "checked" else checkbox
= ""
476 if dappers
< 0 then dappers
= 0 end
479 faction
= banner
..self
.faction
,
482 money
= self
:formatint(dappers
),
483 help
= i18n
.get("uiArtefactHelp"):toUtf8()
485 content
= string.gsub(content
, "#"..k
, v
)
489 html
:renderHtml(content
)
491 if self
.isCompact
then
492 html
:showDiv("info_money", false)
495 if self
.isAttached
then
496 local uiWindowBag
= getUI(self
.idWindowBag
)
498 uiWindowBag
:find("autopact_vt").hardtext
= "Auto Pact"
500 html
:showDiv("info_banner", false)
501 html
:showDiv("info_footer", false)
505 if getDbProp(self
.banner
) == 0 then
506 html
:showDiv("info_banner", false)
509 -- trigger checkbox event
510 self
.uiWindow
:find("auto").onclick_l
= "lua:artefact:onChecked()"
515 function artefact
:webInv(item
, ecosystem
, quantity
, id
)
516 -- limit max quantity
517 if quantity
> 999 then
522 -- format quantity as q1:;q2:;q3:;..
523 for q
in string.gmatch(tostring(quantity
), "%d") do
524 s
= s
.."q"..n
..":"..q
..";"
527 -- format overlay label as o1:;o2:;o3:;..
528 for i
= 1, math
.min(8, #item
.label
) do
529 s
= s
.."o"..tostring(i
-1)..":"..item
.label
:sub(i
, i
)..";"
533 local wi
= string.gsub(self
.web_item
, "#Q", s
)
534 local desc
= item
.desc
:toUtf8()
535 -- keep only the name of the zone
536 for i
= 1, #self
.blacklist
do
537 desc
= string.gsub(desc
, self
.blacklist
[i
], "")
540 desc
= desc
:gsub("^%l", string.upper
)
543 T
= desc
.." - "..self
:formatint(item
.cost
),
544 L
= "artefact:usePact("..id
..")",
549 wi
= string.gsub(wi
, "#"..k
, v
)
552 if self
.faction
:find("kar") then
553 wi
= string.gsub(wi
, "karavan", "caravane")
555 return self
.zone
..string.gsub(
556 '<div class="ryzom-ui-grouptemplate" id="icon" style="#webitem"></div>',
561 function artefact
:strcmp(str
, offset
, s
)
563 return offset
== '' or str
:sub(-#offset
) == offset
565 return str
:sub(1, #offset
) == offset
568 function artefact
:formatint(n
)
569 local left
, num
, right
= string.match(n
, "^([^%d]*%d)(%d*)(.-)$")
570 return left
..(num
:reverse():gsub("(%d%d%d)", "%1,"):reverse())..right
573 function artefact
:getitem(id
, s
)
575 return getDbProp(self
.bag
..':'..id
..':'..s
:upper())
579 function artefact
:getfaction(id
)
580 if not id
then id
= getDbProp(self
.fame
) end
581 if id
== 3 then return "karavan" end
582 if id
== 2 then return "kami" end
585 function artefact
:checkRestriction(cult
)
586 local fame
= getDbProp(self
.fame
)
587 if fame
> 1 and fame
< 4 then
589 if cult
~= self
:getfaction() then
598 function artefact
:checkfame()
599 if self
:checkRestriction() then
600 local fame
= getDbProp(self
.fame
)
601 if self
.faction
== self
:getfaction(fame
) then
608 artefact
.__index
= artefact
612 function artefact
:__init__()
614 bag
= "SERVER:INVENTORY:BAG",
615 kami
= "SERVER:FAME:PLAYER4:VALUE",
616 kara
= "SERVER:FAME:PLAYER5:VALUE",
617 fame
= "SERVER:FAME:CULT_ALLEGIANCE",
618 dapper
= "SERVER:INVENTORY:MONEY",
619 filter
= "UI:SAVE:INV_BAG:FILTER_TP",
620 dopact
= "UI:SAVE:TELEPORT:DO_PACT",
621 banner
= "UI:SAVE:TELEPORT:BANNER",
622 active
= "UI:SAVE:ISACTIVE:ARTEFACT",
623 detach
= "UI:SAVE:TELEPORT:ISDETACHED",
624 closeTp
= "UI:SAVE:TELEPORT:CLOSE_AFTER_TP",
625 -- minimum fame required
636 tp_f_oflovaksoasis
= 1500,
637 tp_f_frahartowers
= 2500,
638 tp_f_sawdustmines
= 2500,
639 tp_f_outlawcanyon
= 4000,
640 tp_f_thescorchedcorridor
= 6000
643 tp_f_fairhaven
= 1000,
644 tp_karavan_crystabell
= 1000,
645 tp_karavan_windermeer
= 1000,
646 tp_karavan_avendale
= 1000,
647 tp_f_dewdrops
= 1500,
648 tp_f_windsofmuse
= 1500,
649 tp_f_thefount
= 2500,
650 tp_f_restingwater
= 2500,
651 tp_f_bountybeaches
= 4000,
652 tp_f_enchantedisle
= 4000,
653 tp_f_lagoonsofloria
= 6000
657 tp_karavan_davae
= 1000,
658 tp_karavan_avalae
= 1000,
659 tp_karavan_natae
= 1000,
660 tp_f_fleetinggarden
= 1500,
661 tp_f_knollofdissent
= 2500,
662 tp_f_hiddensource
= 4000,
663 tp_f_hereticshovel
= 4000,
664 tp_f_upperbog
= 4000,
665 tp_f_groveofconfusion
= 6000
669 tp_kami_hoi_cho
= 1000,
670 tp_kami_jen_lai
= 1000,
671 tp_kami_min_cho
= 1000,
672 tp_f_maidengrove
= 1500,
673 tp_f_havenofpurity
= 2500,
674 tp_f_groveofumbra
= 4000,
675 tp_f_knotofdementia
= 4000,
679 tp_f_ranger_camp
= 1000,
680 tp_kami_shining_lake
= 1000,
681 tp_karavan_shattered_ruins
= 1000,
683 tp_f_nexus_terre
= 10000,
684 tp_f_the_windy_gate
= 10000,
685 tp_f_the_sunken_city
= 10000,
686 tp_f_forbidden_depths
= 10000,
687 tp_f_gate_of_obscurity
= 10000,
688 tp_f_the_elusive_forest
= 10000,
689 tp_f_the_land_of_continuity
= 10000,
690 tp_f_the_under_spring_fyros
= 10000,
691 tp_f_the_abyss_of_ichor_matis
= 10000,
692 tp_f_the_trench_of_trials_zorai
= 10000
695 -- item description to remove
696 -- TODO: translation fixes we need unique format
699 "Pacte kami %/ Téléporteur vers ", -- FR
700 "Pacte Kami %/ Téléporteur vers ",
701 "Соглашение с Ками о перемещении в ", -- RU
702 "Kami Teleportationspakt für Den ", -- DE
703 "Kami Teleportationspakt für Die ",
704 "Kami Teleportationspakt für Das ",
705 "Kami Teleportationspakt für das ",
706 "Kami Teleportationspakt für den ",
707 "Kami Teleportationspakt für ",
708 "Kami%-Teleportationspakt für den ",
709 "Kami%-Teleportationspakt für das ",
710 "Kami%-Teleportationspakt für die ",
711 "Kami%-Teleportationspakt für ",
712 "Kami Teleporter Pact for the ", -- EN
713 "Kami Teleporter Pact for ",
714 "Pacto Teletransportador Kami para ", -- ES
715 "Pacto Teletransportador para ",
716 "Pacto Teletransportador Kamik ",
717 "Pacto Kami %/ Teleportador hacia ",
718 "Pacto Teletransportador ",
719 "Pacto de Teletransportacoin Kama para madera ",
721 "Pacte karavan %/ Téléporteur vers ", -- FR
722 "Pacte Karavan %/ Téléporteur vers ",
723 "Соглашение с Караваном о перемещении в", -- RU
724 "Karavan Teleportationspakt für Den ", -- DE
725 "Karavan Teleportationspakt für Die ",
726 "Karavan Teleportationspakt für Das ",
727 "Karavan Teleportationspakt für das ",
728 "Karavan Teleportationspakt für ",
729 "Karavan%-Teleportationspakt für den ",
730 "Karavan%-Teleportationspakt für das ",
731 "Karavan%-Teleportationspakt für die ",
732 "Karavan%-Teleportationspakt für ",
733 "Karavan Teleporter Pact for the ", -- EN
734 "Karavan Teleporter Pact for ",
735 "Pacto Teletransportador Karavan para ", -- ES
736 "Pacto Teletransportdor Karavan para ",
737 "Pacto Teletransportador Karavn para ",
738 "Pacto Teletransportador para ",
739 "Pacto Karavan %/ Teleportador hacia ",
740 "Pacto de Teletransportacion Karavan para madera ",
741 "Pacto Teletransportador "
743 psort
= function(p0
, p1
) return p0
.label
< p1
.label
end
747 setmetatable(artefact
, vars
)
750 function artefact
:startInterface(cult
)
751 if not self
.active
then
755 if not self
:checkRestriction(cult
) or not cult
then
756 displaySystemInfo(i18n
.get("uiArtefactRestrict"), "BC")
760 if not self
:checkfame() then
763 self
.faction
= self
:getfaction()
765 if getDbProp(self
.kara
) >= self
.threshold
or
766 getDbProp(self
.kami
) >= self
.threshold
then
768 -- load the bunch of pacts at first run
769 if not self
.uiWindow
then
770 for eco
, tp
in pairs(self
.pacts
) do
772 for sheet
, price
in pairs(tp
) do
773 sheet
= string.gsub(sheet
, "_f_", "_"..self
.faction
.."_")
775 if self
:strcmp(sheet
, "tp_"..self
.faction
) then
776 local sheet_name
= string.gsub(sheet
, "tp_", "")
777 sheet_name
= string.gsub(sheet_name
, ".sitem", "")
778 label
= self
.items_labels
[sheet_name
]
779 tmp
[eco
][#tmp
[eco
]+1] = {
781 desc
= getSheetLocalizedName(sheet
..".sitem"),
783 cost
= tostring(price
)
788 table.sort(tmp
[eco
], self
.psort
)
791 self
.currentPacts
= tmp
793 -- window is loaded from xml
794 if not self
.uiWindow
then
795 -- reuse the previous frame if exist
796 self
.uiWindow
= getUI(self
.idWindow
, false)
797 if not self
.uiWindow
then
801 self
.uiWindow
.w
= self
.w
802 self
.uiWindow
.h
= self
.h
803 self
.uiWindow
.pop_max_w
= self
.max_w
804 self
.uiWindow
.pop_max_h
= self
.max_h
805 self
.uiWindow
.pop_min_w
= self
.min_w
806 self
.uiWindow
.pop_min_h
= self
.min_h
809 -- is window attached?
810 if getDbProp(self
.detach
) == 0 then
811 if self
.observer
then
812 self
:bagObserver(false)
814 runAH(getUICaller(), "proc", "artefact_win_attach")
816 -- trigger on_open event
817 if not self
.uiWindow
.opened
then
818 self
.uiWindow
.opened
= true
820 -- trigger on_active event
821 if not self
.uiWindow
.active
then
822 self
.uiWindow
.active
= true
824 local html
= self
.uiWindow
:find("html")
829 setTopWindow(self
.uiWindow
)
831 if not self
.observer
then
832 runAH(getUICaller(), "proc", "artefact_proc_active")