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 game
.mapArkPoints
[section
][name
] = nil
57 function game
:delMapArkSection(section
)
58 game
.mapArkPoints
[section
] = nil
61 function game
:updateMapArkPointColor()
62 local button
= getUICaller()
63 button
.texture_over
= "lm_respawn_over.tga"
66 function game
:openMapArkPointHelp(url
, h
)
67 local whm
= getUI("ui:interface:webig_html_modal")
68 local x
, y
= getMousePos()
71 if whm
.active
== false then
72 runAH(nil, "enter_modal", "group=ui:interface:webig_html_modal")
73 whm
.child_resize_h
= false
79 local whm_html
= getUI("ui:interface:webig_html_modal:html")
80 if game
.mapArkPointsCachedHelp
[url
] == nil then
81 if whm_html
~= nil then
82 game
.mapMapArkPointHelpUrl
= url
83 whm_html
:renderHtml("<body style:'background-color: #ffffff00'>...</body>")
87 whm_html
:renderHtml(game
.mapArkPointsCachedHelp
[url
])
89 setOnDraw(getUI("ui:interface:webig_html_modal"), "game:updateMapArkPointHelp([["..url
.."]])")
90 game
.mapArkPointHelpOpened
= 1
94 function game
:updateMapArkPointHelp()
95 local caller
= getUI("ui:interface:webig_html_modal")
96 local whm_html
= getUI("ui:interface:webig_html_modal:html")
97 if whm_html
.html
~= "<body style:'background-color: #ffffff00'>...</body>" and game
.mapArkPointsCachedHelp
[game
.mapMapArkPointHelpUrl
] == nil then
98 game
.mapArkPointsCachedHelp
[game
.mapMapArkPointHelpUrl
] = whm_html
.html
101 local x
, y
= getMousePos()
102 x0
= game
.mapArkPointHelpMousePosX
103 if caller
.x
~= 0 or caller
.y
~= 0 then
104 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
105 setOnDraw(getUI("ui:interface:webig_html_modal"), "")
106 runAH(nil, "leave_modal", "group=ui:interface:webig_html_modal")
111 function game
:onLoadMap(map
)
113 game
.currentMap
= map
114 if map
.continent
then
115 game
.currentMapContinent
= map
.continent
118 game
.currentMapTexture
= map
.texture
123 local texture
= game
.currentMap
.texture
125 texture
= game
.currentMapTexture
130 game
.mapMapArkPointHelpUrl
= ""
131 for section
, points
in pairs(game
.mapArkPoints
) do
133 map_section
= section
134 for k
, v
in string.gmatch(section
, "(%w+)/(%w+)") do
135 real_section
= {k
, v
}
138 if real_section
[1] then
139 section
= real_section
[1]
140 map_section
= real_section
[2]
143 if game
.mapHideSections
[section
] == nil then
144 if game
.mapRegionSections
[map_section
] == nil or game
.mapRegionSections
[map_section
][texture
] == true then
145 for name
, point
in pairs(points
) do
146 addLandMark(point
[1], point
[2], point
[3], point
[4], "lua", point
[5], "", "", "lua", point
[6])
152 -- if alt view not enabled
153 if getDbProp("UI:VARIABLES:SHOW_ALT_MAP") == 0 or map
:isIsland() then
158 if self
.mapTextures
[texture
] ~= nil then
159 -- debugInfo("-- using ".. self.mapTextures[texture] .." for " .. texture)
160 return self
.mapTextures
[texture
]
164 function game
:openFullMap()
165 local ui
= getUI("ui:interface:map")
166 if ui
.active
== false then
170 if game
.saveMapFull
then
171 game
.saveMapFull
= false
177 game
.savedMapFullZoom
= getActualMapZoom()
178 if game
.savedMapZoom
then
179 setActualMapZoom(game
.savedMapZoom
)
182 game
.saveMapFull
= true
189 ui
.w
= getUI("ui:interface").w
190 ui
.h
= getUI("ui:interface").h
191 game
.savedMapZoom
= getActualMapZoom()
192 if game
.savedMapFullZoom
then
193 setActualMapZoom(game
.savedMapFullZoom
)
199 function game
:addSpawnShapesByZone(zone
, continent
, name
, displayIcon
, setup
, finish
, openShape
, text
, icon
)
203 if game
.spawnShapesByZone
[continent
] == nil
205 game
.spawnShapesByZone
[continent
] = {}
208 if game
.spawnShapesByZone
[continent
][name
] then
209 id1
= game
.spawnShapesByZone
[continent
][name
][9]
210 id2
= game
.spawnShapesByZone
[continent
][name
][10]
213 table.insert(setup
, id1
)
214 table.insert(setup
, id2
)
215 table.insert(setup
, finish
)
216 table.insert(setup
, openShape
)
217 game
.spawnShapesByZone
[continent
][name
] = setup
218 game
.spawnShapesByZone
[continent
][name
][8] = Json
.decode(setup
[8])
221 text
= i18n
.get("uiWisdomChest"):toUtf8()
228 if displayIcon
== 1 then
229 game
:addMapArkPoint(zone
, setup
[2], setup
[3], setup
[1], text
, icon
..".tga")
231 game
:delMapArkPoint(zone
, setup
[1])
235 function game
:doSpawnShapesByZone(continent
)
236 if game
.spawnShapesByZone
[continent
] then
237 for name
, shape
in pairs(game
.spawnShapesByZone
[continent
]) do
239 deleteShape(shape
[9])
242 deleteShape(shape
[10])
245 local setup
= shape
[8]
246 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, true, setup
["action"], setup
["url"], false, false, setup
["textures"], "", false)
247 if shape
[11] == 0 then
248 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)
250 game
.spawnShapesByZone
[continent
][name
][10] = nil
256 game
.mapRegionSections
["Silan"] = {}
257 game
.mapRegionSections
["Silan"]["newbieland_city.tga"] = true
258 game
.mapRegionSections
["Zorai"] = {}
259 game
.mapRegionSections
["Zorai"]["zorai_map.tga"] = true
261 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)
262 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)
263 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)
264 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)
265 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)
267 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)
270 -- register map overrride
271 -- game:setAltMap("fyros_map.tga", "fyros_map_sp.tga")
274 RYZOM_MAP_VERSION
= 10469