9 -- alternative textures for maps
11 -- game.mapTextures["zorai_map.tga"] = "tryker_map.tga"
13 -- Dynamic points/icons for the map
14 game
.mapArkPoints
= {}
16 -- Hide sections for the map
17 game
.mapHideSections
= {}
19 -- Region sections for the map
20 game
.mapRegionSections
= {}
22 -- Region sections for the map
23 game
.mapArkPointsCachedHelp
= {}
26 game
.spawnShapesByZone
= {}
28 -- register alternative texture for map1
29 function game
:setAltMap(mapName
, altMap
)
30 self
.mapTextures
[mapName
] = altMap
33 -- remove alternative map texture
34 function game
:removeAltMap(mapName
)
35 self
.mapTextures
[mapName
] = nil
38 function game
:addMapArkPoint(section
, x
, y
, name
, title
, texture
, url
, h
)
39 if game
.mapArkPoints
[section
] == nil then
40 game
.mapArkPoints
[section
] = {}
43 game
.mapArkPoints
[section
][name
] = {x
, y
, title
, texture
, "", ""}
45 if h
~= nil and h
> 0 then
46 game
.mapArkPoints
[section
][name
] = {x
, y
, title
, texture
, "", "game:openMapArkPointHelp([["..url
.."]], "..tostring(h
)..")"}
48 game
.mapArkPoints
[section
][name
] = {x
, y
, title
, texture
, "game:openUrlOnWebig([["..url
.."]])", "game:updateMapArkPointColor()"}
53 function game
:delMapArkPoint(section
, name
)
54 if game
.mapArkPoints
[section
] ~= nil then
55 game
.mapArkPoints
[section
][name
] = nil
59 function game
:delMapArkSection(section
)
60 game
.mapArkPoints
[section
] = nil
63 function game
:updateMapArkPointColor()
64 local button
= getUICaller()
65 button
.texture_over
= "lm_respawn_over.tga"
68 function game
:openMapArkPointHelp(url
, h
)
69 local whm
= getUI("ui:interface:webig_html_modal")
70 local x
, y
= getMousePos()
73 if whm
.active
== false then
74 runAH(nil, "enter_modal", "group=ui:interface:webig_html_modal")
75 whm
.child_resize_h
= false
81 local whm_html
= getUI("ui:interface:webig_html_modal:html")
82 if game
.mapArkPointsCachedHelp
[url
] == nil then
83 if whm_html
~= nil then
84 game
.mapMapArkPointHelpUrl
= url
85 whm_html
:renderHtml("<body style:'background-color: #ffffff00'>...</body>")
89 whm_html
:renderHtml(game
.mapArkPointsCachedHelp
[url
])
91 setOnDraw(getUI("ui:interface:webig_html_modal"), "game:updateMapArkPointHelp([["..url
.."]])")
92 game
.mapArkPointHelpOpened
= 1
96 function game
:updateMapArkPointHelp()
97 local caller
= getUI("ui:interface:webig_html_modal")
98 local whm_html
= getUI("ui:interface:webig_html_modal:html")
99 if whm_html
.html
~= "<body style:'background-color: #ffffff00'>...</body>" and game
.mapArkPointsCachedHelp
[game
.mapMapArkPointHelpUrl
] == nil then
100 game
.mapArkPointsCachedHelp
[game
.mapMapArkPointHelpUrl
] = whm_html
.html
103 local x
, y
= getMousePos()
104 x0
= game
.mapArkPointHelpMousePosX
105 if caller
.x
~= 0 or caller
.y
~= 0 then
106 if x
< caller
.x
- 20 or x
> caller
.x
+ caller
.w
+ 20 or y
< caller
.y
- caller
.h
- 20 or y
> caller
.y
+ 20 then
107 setOnDraw(getUI("ui:interface:webig_html_modal"), "")
108 runAH(nil, "leave_modal", "group=ui:interface:webig_html_modal")
113 function game
:onLoadMap(map
)
115 game
.currentMap
= map
116 if map
.continent
then
117 game
.currentMapContinent
= map
.continent
120 game
.currentMapTexture
= map
.texture
125 local texture
= game
.currentMap
.texture
127 texture
= game
.currentMapTexture
132 game
.mapMapArkPointHelpUrl
= ""
133 for section
, points
in pairs(game
.mapArkPoints
) do
135 map_section
= section
136 for k
, v
in string.gmatch(section
, "(%w+)/(%w+)") do
137 real_section
= {k
, v
}
140 if real_section
[1] then
141 section
= real_section
[1]
142 map_section
= real_section
[2]
145 if game
.mapHideSections
[section
] == nil then
146 if game
.mapRegionSections
[map_section
] == nil or game
.mapRegionSections
[map_section
][texture
] == true then
147 for name
, point
in pairs(points
) do
148 addLandMark(point
[1], point
[2], point
[3], point
[4], "lua", point
[5], "", "", "lua", point
[6])
154 -- if alt view not enabled
155 if getDbProp("UI:VARIABLES:SHOW_ALT_MAP") == 0 or map
:isIsland() then
160 if self
.mapTextures
[texture
] ~= nil then
161 -- debugInfo("-- using ".. self.mapTextures[texture] .." for " .. texture)
162 return self
.mapTextures
[texture
]
166 function game
:openFullMap()
167 local ui
= getUI("ui:interface:map")
168 if ui
.active
== false then
172 if game
.saveMapFull
then
173 game
.saveMapFull
= false
179 game
.savedMapFullZoom
= getActualMapZoom()
180 if game
.savedMapZoom
then
181 setActualMapZoom(game
.savedMapZoom
)
184 game
.saveMapFull
= true
191 ui
.w
= getUI("ui:interface").w
192 ui
.h
= getUI("ui:interface").h
193 game
.savedMapZoom
= getActualMapZoom()
194 if game
.savedMapFullZoom
then
195 setActualMapZoom(game
.savedMapFullZoom
)
201 function game
:addSpawnShapesByZone(zone
, continent
, name
, displayIcon
, setup
, finish
, openShape
, text
, icon
)
205 if game
.spawnShapesByZone
[continent
] == nil
207 game
.spawnShapesByZone
[continent
] = {}
210 if game
.spawnShapesByZone
[continent
][name
] then
211 id1
= game
.spawnShapesByZone
[continent
][name
][9]
212 id2
= game
.spawnShapesByZone
[continent
][name
][10]
215 table.insert(setup
, id1
)
216 table.insert(setup
, id2
)
217 table.insert(setup
, finish
)
218 table.insert(setup
, openShape
)
219 game
.spawnShapesByZone
[continent
][name
] = setup
220 game
.spawnShapesByZone
[continent
][name
][8] = Json
.decode(setup
[8])
223 text
= i18n
.get("uiWisdomChest"):toUtf8()
230 if displayIcon
== 1 then
231 game
:addMapArkPoint(zone
, setup
[2], setup
[3], setup
[1], text
, icon
..".tga")
233 game
:delMapArkPoint(zone
, setup
[1])
237 function game
:doSpawnShapesByZone(continent
)
238 if game
.spawnShapesByZone
[continent
] then
239 for name
, shape
in pairs(game
.spawnShapesByZone
[continent
]) do
241 if shape
[9] ~= nil and shape
[9] > 0 then
242 deleteShape(shape
[9])
245 if shape
[10] ~= nil and shape
[9] > 0then
246 deleteShape(shape
[10])
249 local setup
= shape
[8]
250 game
.spawnShapesByZone
[continent
][name
][9] = SceneEditor
:doSpawnShape(shape
[1]..".shape", setup
, shape
[2], shape
[3], shape
[4], shape
[5], shape
[6], shape
[7], "user", 1, false, setup
["action"], setup
["url"], false, false, setup
["textures"], "", false)
251 if shape
[11] == 0 then
252 game
.spawnShapesByZone
[continent
][name
][10] = SceneEditor
:doSpawnShape("ge_mission_evenement.ps", setup
, shape
[2], shape
[3], shape
[4]+0.35, shape
[5], shape
[6], shape
[7], "user", 1, false, setup
["action"], setup
["url"], false, false, setup
["textures"], "", false)
254 game
.spawnShapesByZone
[continent
][name
][10] = nil
260 game
.mapRegionSections
["Silan"] = {}
261 game
.mapRegionSections
["Silan"]["newbieland_city.tga"] = true
262 game
.mapRegionSections
["Zorai"] = {}
263 game
.mapRegionSections
["Zorai"]["zorai_map.tga"] = true
265 game
:addMapArkPoint("Vip/Silan", 10276, -11791, "vip_silan_tryker", "", "dynicon_vip.tga", "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=9894&vip=nb_tryker_leader&title=fct_chief_explorer&gender=1", 150)
266 game
:addMapArkPoint("Vip/Silan", 10341, -11822, "vip_silan_matis", "", "dynicon_vip.tga", "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=9894&vip=nb_matis_leader&title=fct_matis_master_artisan&gender=1", 150)
267 game
:addMapArkPoint("Vip/Silan", 10382, -11741, "vip_silan_zorai", "", "dynicon_vip.tga", "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=9894&vip=nb_zorai_leader&title=fct_sage&gender=1", 150)
268 game
:addMapArkPoint("Vip/Silan", 10366, -11692, "vip_silan_fyros", "", "dynicon_vip.tga", "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=9894&vip=nb_fyros_leader&title=fct_fyros_commander&gender=1", 150)
269 game
:addMapArkPoint("Vip/Silan", 10304, -11719, "vip_silan_ranger", "", "dynicon_vipbox.tga", "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=9894&vip=chiang_the_strong&title=fct_ranger_leader&gender=1", 150)
271 game
:addMapArkPoint("Vip", 4154, -3305, "vip_allegory", "", "allegory_16.tga", "https://app.ryzom.com/app_arcc/index.php?action=mScript_Run&script=9894&vip=allegory_vip&title=fct_allegory_maker&gender=1", 150)
274 -- register map overrride
275 -- game:setAltMap("fyros_map.tga", "fyros_map_sp.tga")
278 RYZOM_MAP_VERSION
= 324