+ count="500">
diff --git a/data/ryz/ryz_zzz_bazaar/out_v2_widgets.xml b/data/ryz/ryz_zzz_bazaar/out_v2_widgets.xml
index c5cdf683..3ef5ffe4 100644
--- a/data/ryz/ryz_zzz_bazaar/out_v2_widgets.xml
+++ b/data/ryz/ryz_zzz_bazaar/out_v2_widgets.xml
@@ -83,7 +83,7 @@
tx_normal="qh_off" tx_pushed="qh_on" tx_over="qh_off" wmin="80" wmargin="40"
global_color_normal="false" global_color_over="false" global_color_pushed="false"
color="255 255 255 255" col_over="255 255 255 0" col_pushed="255 255 255 255"
- text_y="-1" fontsize="13" shadow="true"
+ text_y="1" fontsize="13" shadow="true"
text_color_normal="222 201 182 255"
text_color_pushed="222 201 182 255"
text_color_over="255 255 255 255"
diff --git a/data/ryz/ryz_zzz_bazaar/outpost.lua b/data/ryz/ryz_zzz_bazaar/outpost.lua
index 1036148a..77f1b112 100644
--- a/data/ryz/ryz_zzz_bazaar/outpost.lua
+++ b/data/ryz/ryz_zzz_bazaar/outpost.lua
@@ -62,17 +62,10 @@ end
------------------------------------------------------------------------------------------------------------
function game:outpostUpdateTimeZone()
- -- update time zone auto?
- local tzAuto= getDbProp('UI:SAVE:OUTPOST:TIME_ZONE_AUTO');
- if(tzAuto==0) then
- return;
- end
- -- every 5 seconds?
- local curTick= getDbProp('UI:VARIABLES:CURRENT_SERVER_TICK');
- if(curTick - game.Outpost.LastTimeZoneUpdate > 50) then
- game.Outpost.LastTimeZoneUpdate= curTick;
- runAH(nil,'outpost_update_time_zone_auto','');
- end
+ local curTick = getDbProp('UI:VARIABLES:CURRENT_SERVER_TICK');
+ setDbProp('UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE', curTick + 50);
+ game.Outpost.LastTimeZoneUpdate = curTick;
+ runAH(nil,'outpost_update_time_zone_auto','');
end
------------------------------------------------------------------------------------------------------------
diff --git a/data/ryz/ryz_zzz_bazaar/outpost.xml b/data/ryz/ryz_zzz_bazaar/outpost.xml
index 8d43f602..8888d9e1 100644
--- a/data/ryz/ryz_zzz_bazaar/outpost.xml
+++ b/data/ryz/ryz_zzz_bazaar/outpost.xml
@@ -21,8 +21,9 @@
+
-
+
diff --git a/data/ryz/ryz_zzz_bazaar/ryzhome_toolbar.lua b/data/ryz/ryz_zzz_bazaar/ryzhome_toolbar.lua
new file mode 100644
index 00000000..21b035f4
--- /dev/null
+++ b/data/ryz/ryz_zzz_bazaar/ryzhome_toolbar.lua
@@ -0,0 +1,242 @@
+RyzhomeBar = {
+ id = "ui:interface:webig_ryzhome_toolbar",
+ saveuri = "http://app.ryzom.com/app_ryzhome/index.php?action=toolbar_save",
+ selectedPage = 1
+}
+
+function RyzhomeBar:close()
+ getUI("ui:interface:webig_ryzhome_toolbar").active=false
+ self:saveConfig()
+
+end
+
+function RyzhomeBar:addItems()
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_LuaListItems&command=add"
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:moveItems()
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_LuaListItems&command=move"
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:removeItems()
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_LuaListItems&command=remove"
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:inviteFriend()
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_InviteFriend"
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:listFriends()
+ getUI("ui:interface:web_transactions:content:html"):browse(RyzhomeBar.listFriendsUrl)
+ getUI("ui:interface:web_transactions:header_opened:browse_undo").active=false
+ getUI("ui:interface:web_transactions:header_opened:browse_redo").active=false
+ getUI("ui:interface:web_transactions:header_opened:browse_refresh").active=false
+ getUI("ui:interface:web_transactions:header_opened:browse_home").active=false
+ local wt = getUI("ui:interface:web_transactions")
+ wt.w=316
+ wt.h=420
+ wt.pop_min_w=316
+ wt.pop_max_w=316
+ wt.pop_min_h=420
+ wt.pop_max_h=420
+
+ local framewin = getUI("ui:interface:webig_ryzhome_list_item")
+ if framewin ~= nil then
+ framewin.active=false
+ wt.x = framewin.x
+ wt.y = framewin.y
+ end
+
+ getUI("ui:interface:web_transactions").active=true
+
+ setOnDraw(getUI("ui:interface:web_transactions"), "RyzhomeBar:autocloseWebTransactions()")
+end
+
+function RyzhomeBar:autocloseWebTransactions()
+ local current_url = getUI("ui:interface:web_transactions:content:html").url
+ if (current_url ~= RyzhomeBar.listFriendsUrl and current_url ~= inviteFriendsUrl) then
+ local framewin = getUI("ui:interface:webig_ryzhome_list_item")
+ framewin.x = getUI("ui:interface:web_transactions").x
+ framewin.y = getUI("ui:interface:web_transactions").y
+ getUI("ui:interface:web_transactions").active=false
+ setOnDraw(getUI("ui:interface:web_transactions"), "")
+ end
+end
+
+
+function RyzhomeBar:serialize()
+ local ui = getUI(self.id)
+ local url = "&posx=" .. tostring(ui.x) .. "&posy=" .. tostring(ui.y)
+ return url
+end
+
+function RyzhomeBar:updateNbrItems(offset)
+ RyzhomeBar.nbrItems = RyzhomeBar.nbrItems + offset
+ if RyzhomeBar.nbrItems == 0 then
+ getUI("ui:interface:webig_ryzhome_toolbar:content:new_items_quantity").hardtext=""
+ else
+ getUI("ui:interface:webig_ryzhome_toolbar:content:new_items_quantity").hardtext=tostring(RyzhomeBar.nbrItems)
+ end
+end
+
+function RyzhomeBar:saveConfig()
+ local url = self.saveuri .. self:serialize()
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:movePage(offset)
+ RyzhomeBar.selectedPage = RyzhomeBar.selectedPage + offset
+ if RyzhomeBar.selectedPage <= 0 then
+ RyzhomeBar.selectedPage = 1
+ elseif RyzhomeBar.selectedPage > RyzhomeBar.nbrPages then
+ RyzhomeBar.selectedPage = RyzhomeBar.nbrPages
+ end
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened:page").hardtext=tostring(RyzhomeBar.selectedPage).." / "..tostring(RyzhomeBar.nbrPages)
+ RyzhomeBar:setupItems()
+end
+
+function RyzhomeBar:listItems()
+ RyzhomeBar.recently_removed_item = false
+
+ local framewin = getUI("ui:interface:webig_ryzhome_list_item")
+ --framewin.opened=true
+ framewin.active=true
+ if framewin.x == 0 and framewin.y == 0 then
+ local ui = getUI("ui:interface")
+ framewin.x = (ui.w - framewin.w) / 2
+ framewin.y = (ui.h + framewin.h) / 2
+ end
+
+ if RyzhomeBar.Items == nil then
+ RyzhomeBar.Items = {}
+ end
+end
+
+function RyzhomeBar:useItem(id)
+ id = tostring(RyzhomeBar.Items[RyzhomeBar.selectedPage][id][1])
+ if RyzhomeBar.itemCommand == "add" then
+ RyzhomeBar:addItem(id)
+ elseif RyzhomeBar.itemCommand == "remove" then
+ RyzhomeBar:removeItem(id)
+ elseif RyzhomeBar.itemCommand == "move" then
+ RyzhomeBar:moveItem(id)
+ end
+end
+
+function RyzhomeBar:addItem(id)
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_Place&command=add&id="..id
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:removeItem(id)
+ RyzhomeBar.recently_removed_item = true
+ RyzhomeBar:spawnItems()
+ local v = RyzhomeBar.spawnedItems[id]
+ runAH(nil,"add_shape", "shape=sp_mort.ps|x="..v[2].."|y="..v[3].."|z="..v[4].."|angle="..v[5].."|scale="..tostring(tonumber(v[6])*4)..v[7]..v[8]..v[9])
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_Remove&id="..id
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:moveItem(id)
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_Place&command=move&id="..id
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:highlightItem(id)
+ if RyzhomeBar.itemCommand == "add" then
+ return
+ end
+ if RyzhomeBar.recently_removed_item then
+ RyzhomeBar.recently_removed_item = false
+ else
+ RyzhomeBar:spawnItems()
+ local v = RyzhomeBar.spawnedItems[tostring(RyzhomeBar.Items[RyzhomeBar.selectedPage][id][1])]
+ if v then
+ runAH(nil, "add_shape", "shape=ma_acc_ascenseur.ps|x="..v[2].."|y="..v[3].."|z="..v[4].."|angle="..v[5].."|scale="..tostring(tonumber(v[6])*2)..v[7]..v[8]..v[9])
+ end
+ end
+end
+
+function RyzhomeBar:callFriendUrl(action, target)
+ local url = "http://app.ryzom.com/app_arcc/index.php?action=player_ryzhome_"..action.."&target="..target
+ getUI("ui:interface:web_transactions:content:html"):browse(url)
+end
+
+function RyzhomeBar:spawnItems()
+ runAH(nil, "remove_shapes", "")
+ for k,v in pairs(RyzhomeBar.spawnedItems) do
+ runAH(nil, "add_shape", "shape="..v[1].."|x="..v[2].."|y="..v[3].."|z="..v[4].."|angle="..v[5].."|scale="..v[6]..v[7]..v[8]..v[9])
+ end
+
+end
+
+function RyzhomeBar:setupItems()
+ for k = 1, 8 do
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":but"..tostring(k)).active=false
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":icon"..tostring(k)).active=false
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":text"..tostring(k)).uc_hardtext=""
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":info"..tostring(k)).uc_hardtext=""
+ end
+ for k,v in pairs(RyzhomeBar.Items[RyzhomeBar.selectedPage]) do
+ if k ~= nil then
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":icon"..tostring(k)).active=true
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":but"..tostring(k)).active=true
+ local text = ucstring()
+ text:fromUtf8(v[3])
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":text"..tostring(k)).uc_hardtext=text
+ text:fromUtf8(v[4])
+ getUI("ui:interface:webig_ryzhome_list_item:header_opened"):find(":info"..tostring(k)).uc_hardtext=text
+ end
+ end
+end
+
+if RyzhomePlace == nil then
+ RyzhomePlace = {
+ saveuri = "",
+ }
+end
+
+function RyzhomePlace:move(x, y, z)
+ pos_x=pos_x+x
+ pos_y=pos_y+y
+ pos_z=pos_z+z
+ RyzhomePlace:update()
+end
+
+function RyzhomePlace:rot(a)
+ pos_a=pos_a+a
+ RyzhomePlace:update()
+end
+
+function RyzhomePlace:reset()
+ --Ryzhome:addShapes()
+ pos_x, pos_y, pos_z = getPlayerPos()
+ pos_a = (3.14*getUI("ui:interface:compass:arrow3d:arrow").rotz)/18
+ RyzhomePlace:addShape()
+ RyzhomeBar:spawnItems()
+end
+
+function RyzhomePlace:update()
+ RyzhomePlace:addShapes()
+ RyzhomePlace:addShape()
+ RyzhomeBar:spawnItems()
+end
+
+function RyzhomePlace:apply()
+ getUI("ui:interface:web_transactions:content:html"):browse(RyzhomePlace.saveuri.."&pos_x="..pos_x.."&pos_y="..pos_y.."&pos_z="..pos_z.."&pos_a="..pos_a)
+end
+
+function RyzhomePlace:close()
+ --runAH(nil, "remove_shapes", "")
+ getUI("ui:interface:webig_ryzhome_place_item").active=false
+end
+
+function debug(text)
+ local uc = ucstring()
+ uc:fromUtf8(tostring(text))
+ displaySystemInfo(ucstring(uc), "sys")
+end
diff --git a/data/ryz/ryz_zzz_bazaar/ryzhome_toolbar.xml b/data/ryz/ryz_zzz_bazaar/ryzhome_toolbar.xml
new file mode 100644
index 00000000..ef470005
--- /dev/null
+++ b/data/ryz/ryz_zzz_bazaar/ryzhome_toolbar.xml
@@ -0,0 +1,445 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/ryz/ryz_zzz_bazaar/sceneedit.lua b/data/ryz/ryz_zzz_bazaar/sceneedit.lua
new file mode 100644
index 00000000..71777d8a
--- /dev/null
+++ b/data/ryz/ryz_zzz_bazaar/sceneedit.lua
@@ -0,0 +1,604 @@
+--- Parse interface of ark_scene_editor_edit_menu ---
+local script = [[
+
+
+]]
+parseInterfaceFromString(script)
+
+
+if SceneEditor == nil then
+ SceneEditor = {
+ Shapes = {},
+ Groups = {},
+ LastEditedGroup = nil,
+ HaveUpdate = nil
+
+ };
+end
+
+
+function debug(text)
+ local message = ucstring()
+ message:fromUtf8(tostring(text))
+ displaySystemInfo(message, "SYS")
+end
+
+
+function SceneEditor:init(scene_id, form_url, translations, icons_url)
+ self.sceneId = scene_id
+ self.baseUrl = form_url
+ self.iconsUrl = icons_url
+ self.T = translations
+end
+
+function SceneEditor:reset(no_get_html)
+ self.Shapes = {}
+ self.Groups = {}
+ self.LastEditedGroup = nil
+ self.HaveUpdate = nil
+ runAH(nil, "remove_shapes", "")
+ if no_get_html == true then
+ self:get_html("Reseted")
+ end
+end
+
+function SceneEditor:show_menu()
+ if (rightClick) then
+ SceneEditor:launch_menu()
+ end
+end
+
+
+function SceneEditor:launch_menu(id)
+ -- SelectedInstanceId can be set by client application
+ if id ~= nil then
+ SelectedInstanceId = id
+ end
+ local menu = getUI("ui:interface:ark_scene_editor_edit_menu")
+ menu:setMinW(85)
+ menu:updateCoords()
+ menu = menu:getRootMenu()
+ menu:reset()
+ menu:addLine(ucstring("-- SHAPE EDITION --"), "", "", "shape_header")
+ menu:addLine(ucstring("Move"), "", "", "shape_move")
+ menu:addSubMenu(1)
+ local subMenu = menu:getSubMenu(1)
+ subMenu:addIconLine(ucstring("Axe X"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_x()')", "shape_move_x", "ark_move_x.tga")
+ subMenu:addIconLine(ucstring("Axe Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_y()')", "shape_move_y", "ark_move_y.tga")
+ subMenu:addIconLine(ucstring("Axe Z"), "lua", "x, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_z()')", "shape_move_z", "ark_move_z.tga")
+ subMenu:addIconLine(ucstring("Axes X & Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_xy()')", "shape_move_xy", "ark_move_xy.tga")
+ subMenu:addIconLine(ucstring("Axes X & Y Snap to ground"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:move_xysnap()')", "shape_move_xy_snap", "ark_move_xysnap.tga")
+ subMenu:addSeparator()
+ subMenu:addIconLine(ucstring("Move to player"), "lua", "SceneEditor:move_player()", "shape_move_player", "ark_move_player.tga")
+
+ menu:addLine(ucstring("Rotate"), "", "", "shape_rotate")
+ menu:addSubMenu(2)
+ subMenu = menu:getSubMenu(2)
+ subMenu:addIconLine(ucstring("Axe X"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:rotate(SelectedInstanceId, \"x\")')", "shape_rotate_x", "ark_rotate_x.tga")
+ subMenu:addIconLine(ucstring("Axe Y"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:rotate(SelectedInstanceId, \"y\")')", "shape_rotate_y", "ark_rotate_y.tga")
+ subMenu:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:rotate(SelectedInstanceId, \"z\")')", "shape_rotate_z", "ark_rotate_z.tga")
+
+ menu:addLine(ucstring("Scale"), "", "", "shape_scale")
+ menu:addSubMenu(3)
+ subMenu = menu:getSubMenu(3)
+ subMenu:addIconLine(ucstring("Axe X"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"x\")')", "shape_scale_x", "ark_scale_x.tga")
+ subMenu:addIconLine(ucstring("Axe Y"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"y\")')", "shape_scale_y", "ark_scale_y.tga")
+ subMenu:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:scale(SelectedInstanceId, \"z\")')", "shape_scale_z", "ark_scale_z.tga")
+
+ menu:addLine(ucstring("-- COLLISION EDITION --"), "", "", "col_header")
+ menu:addLine(ucstring("Move"), "", "", "col_move")
+ menu:addSubMenu(5)
+ subMenu = menu:getSubMenu(5)
+ subMenu:addIconLine(ucstring("Axe X"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_x()')", "col_move_x", "ark_move_x.tga")
+ subMenu:addIconLine(ucstring("Axe Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_y()')", "col_move_y", "ark_move_y.tga")
+ subMenu:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_z()')", "col_move_z", "ark_move_xy.tga")
+ subMenu:addIconLine(ucstring("Axe X & Y"), "lua", "setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_move_xy()')", "col_move_xy", "ark_move_xy.tga")
+ subMenu:addSeparator()
+ subMenu:addIconLine(ucstring("Move to Shape"), "lua", "SceneEditor:col_move_to_shape()", "col_move_to_shape", "ark_move_player.tga")
+
+ menu:addIconLine(ucstring("Rotate"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_rotate(SelectedInstanceId, \"x\")')", "col_rotate_x", "ark_rotate_x.tga")
+
+ menu:addLine(ucstring("Scale"), "", "", "col_scale")
+ menu:addSubMenu(7)
+ subMenu = menu:getSubMenu(7)
+ subMenu:addIconLine(ucstring("Axe X"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_scale(SelectedInstanceId, \"x\")')", "col_scale_x", "ark_scale_x.tga")
+ subMenu:addIconLine(ucstring("Axe Y"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_scale(SelectedInstanceId, \"y\")')", "col_scale_y", "ark_scale_y.tga")
+ subMenu:addIconLine(ucstring("Axe Z"), "lua", "ARK_SHAPE_LATEST_X, ARK_SHAPE_LATEST_Y = getMousePos(); setOnDraw(getUI('ui:interface:ark_scene_editor'), 'SceneEditor:col_scale(SelectedInstanceId, \"z\")')", "col_scale_z", "ark_scale_z.tga")
+
+ launchContextMenuInGame("ui:interface:ark_scene_editor_edit_menu")
+end
+
+
+function arcc_tools_check_rclick()
+ root = getUI("ui:interface")
+ local rx, ry = getMousePos()
+ i_id = getShapeIdAt(rx, ry)
+ if i_id >= 0 then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ end
+end
+
+function SceneEditor:move(id, axe)
+ local d, mx, my = getMouseDown()
+ if d then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ SceneEditor:set_modified(id)
+ self:get_html("Moved")
+ else
+ local x,y,z = getGroundAtMouse()
+ if axe == "x" then moveShape(id, tostring(x), "+0", "+0") end
+ if axe == "y" then moveShape(id, "+0", tostring(y), "+0") end
+ if axe == "z" then
+ mx, my = getMousePos()
+ moveShape(id, "+0", "+0", "+"..tostring((my-ARK_SHAPE_LATEST_Y)/100))
+ ARK_SHAPE_LATEST_Y = my
+ end
+ if axe == "xysnap" then moveShape(id, tostring(x), tostring(y), tostring(z)) end
+ if axe == "xy" then moveShape(id, tostring(x), tostring(y), "+0") end
+ if axe == "player" then
+ x, y, z = getPlayerPos()
+ moveShape(id, tostring(x), tostring(y), tostring(z))
+ SceneEditor:set_modified(id)
+ self:get_html("Moved to player")
+ end
+
+ end
+end
+
+function SceneEditor:rotate(id, axe)
+ local d, mx, my = getMouseDown()
+ if d then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ SceneEditor:set_modified(id)
+ self:get_html("Rotate")
+ else
+ mx, my = getMousePos()
+ if axe == "x" then rotateShape(id, "+"..tostring((my-ARK_SHAPE_LATEST_Y)/100), "+0", "+0") end
+ if axe == "y" then rotateShape(id, "+0", "+"..tostring((my-ARK_SHAPE_LATEST_Y)/100), "+0") end
+ if axe == "z" then rotateShape(id, "+0", "+0", "+"..tostring((mx-ARK_SHAPE_LATEST_X)/100)) end
+ ARK_SHAPE_LATEST_X = mx
+ ARK_SHAPE_LATEST_Y = my
+ end
+end
+
+function SceneEditor:scale(id, axe)
+ local d, mx, my = getMouseDown()
+ if d then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ SceneEditor:set_modified(id)
+ self:get_html("Rotate")
+ else
+ mx, my = getMousePos()
+ local setup = {}
+ if axe == "x" then setup["scale x"]="+"..tostring((mx-ARK_SHAPE_LATEST_X)/100) end
+ if axe == "y" then setup["scale y"]="+"..tostring((mx-ARK_SHAPE_LATEST_X)/100) end
+ if axe == "z" then setup["scale z"]="+"..tostring((my-ARK_SHAPE_LATEST_Y)/100) end
+ setupShape(id, setup)
+ ARK_SHAPE_LATEST_X = mx
+ ARK_SHAPE_LATEST_Y = my
+ end
+end
+
+
+function SceneEditor:move_x()
+ self:move(SelectedInstanceId, "x")
+end
+
+function SceneEditor:move_y()
+ self:move(SelectedInstanceId, "y")
+end
+
+function SceneEditor:move_xy()
+ self:move(SelectedInstanceId, "xy")
+end
+
+function SceneEditor:move_xysnap()
+ self:move(SelectedInstanceId, "xysnap")
+end
+
+function SceneEditor:move_z()
+ self:move(SelectedInstanceId, "z")
+end
+
+function SceneEditor:move_player()
+ self:move(SelectedInstanceId, "player")
+end
+
+
+function SceneEditor:col_move(id, axe)
+ local d, mx, my = getMouseDown()
+
+ if d then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ self:set_modified(id)
+ self:get_html("Updated")
+ else
+ local x,y,z = getGroundAtMouse()
+ local setup = {}
+ if axe == "x" then setup["col pos x"]=tostring(x) end
+ if axe == "y" then setup["col pos y"]=tostring(y) end
+ if axe == "z" then
+ mx, my = getMousePos()
+ setup["col pos z"]="+"..tostring((my-ARK_SHAPE_LATEST_Y)/100)
+ ARK_SHAPE_LATEST_X = mx
+ ARK_SHAPE_LATEST_Y = my
+ end
+ if axe == "xy" then setup["col pos x"]=tostring(x); setup["col pos y"]=tostring(y) end
+ if axe == "shape" then
+ x, y, z = getShapePos(id)
+ setup["col pos x"]=tostring(x)
+ setup["col pos y"]=tostring(y)
+ self:set_modified(id)
+ setupShape(id, setup)
+ self:get_html("Updated")
+ else
+ setupShape(id, setup)
+ end
+ end
+end
+
+function SceneEditor:col_rotate(id, axe)
+ local d, mx, my = getMouseDown()
+ if d then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ SceneEditor:set_modified(id)
+ self:get_html("Rotate")
+ else
+ mx, my = getMousePos()
+ local setup = {}
+ setup["col orientation"]="+"..tostring((mx-ARK_SHAPE_LATEST_X)/100)
+ setupShape(id, setup)
+ ARK_SHAPE_LATEST_X = mx
+ ARK_SHAPE_LATEST_Y = my
+ end
+end
+
+
+
+function SceneEditor:col_scale(id, axe)
+ local d, mx, my = getMouseDown()
+ if d then
+ setOnDraw(getUI("ui:interface:ark_scene_editor"), "")
+ SceneEditor:set_modified(id)
+ self:get_html("Rotate")
+ else
+ mx, my = getMousePos()
+ local setup = {}
+ if axe == "x" then setup["col size x"]="+"..tostring((mx-ARK_SHAPE_LATEST_X)/100) end
+ if axe == "y" then setup["col size y"]="+"..tostring((mx-ARK_SHAPE_LATEST_X)/100) end
+ if axe == "z" then setup["col size z"]="+"..tostring((my-ARK_SHAPE_LATEST_Y)/100) end
+ setupShape(id, setup)
+ ARK_SHAPE_LATEST_X = mx
+ ARK_SHAPE_LATEST_Y = my
+ end
+end
+
+
+function SceneEditor:set_modified(id)
+ self.Groups[self.Shapes[id].group].props.modified=true
+ self.Shapes[id].modified = "modified"
+ self.HaveUpdate = true
+end
+
+
+function SceneEditor:col_move_x()
+ self:col_move(SelectedInstanceId, "x")
+end
+
+function SceneEditor:col_move_y()
+ self:col_move(SelectedInstanceId, "y")
+end
+function SceneEditor:col_move_z()
+ self:col_move(SelectedInstanceId, "z")
+end
+
+
+function SceneEditor:col_move_xy()
+ self:col_move(SelectedInstanceId, "xy")
+end
+
+
+function SceneEditor:col_move_to_shape()
+ self:col_move(SelectedInstanceId, "shape")
+end
+
+
+function SceneEditor:setup_shape(shape_id, setup)
+ final_setup = self.Shapes[new_shape.id].setup
+ if final_setup == nil then
+ final_setup = {}
+ end
+ for k,v in pairs(setup) do
+ final_setup[k] = v
+ end
+ self.Shapes[new_shape.id].setup = final_setup
+ setupShape(shape_id, setup)
+end
+
+function SceneEditor:add(shape)
+ if self.LastEditedGroup == nil then
+ self:get_html(''..self.T["no_selected_group"]..'', '000000')
+ end
+ local new_shape = {}
+ new_shape.file = shape
+ new_shape.group = self.LastEditedGroup
+ self.Groups[new_shape.group].props.modified=true
+ new_shape.db_id = self.Groups[new_shape.group].props.count + 1
+ new_shape.modified = "added"
+ new_shape_id = addShape(shape, 0, 0, 0, "user", 1, true, "", "SceneEditor:show_menu()")
+ table.insert(self.Groups[new_shape.group], new_shape_id)
+ self.Groups[new_shape.group].props.count = self.Groups[new_shape.group].props.count + 1
+ self.Shapes[new_shape_id] = new_shape
+ self:get_html("Added")
+end
+
+
+function SceneEditor:removeShape(shape_id)
+ deleteShape(shape_id)
+ local group = self.Shapes[shape_id].group
+ for k,g_shape_id in pairs(self.Groups[group]) do
+ if shape_id == g_shape_id then
+ self.Groups[group][k] = nil
+ end
+ end
+ self:set_modified(shape_id)
+ self.Shapes[shape_id] = nil
+ self:get_html("Removed")
+end
+
+function SceneEditor:addGroup(name, count, show, edit)
+ if name == nil then
+ return
+ end
+ if self.Groups[name] == nil then
+ self.Groups[name] = {}
+ self.Groups[name].props = {}
+ self.Groups[name].props.count = count
+ self.Groups[name].props.show = show
+ self.Groups[name].props.edit = edit
+ self.Groups[name].props.modified = false
+ else
+ self.Groups[name].props.show = show
+ self.Groups[name].props.edit = edit
+ end
+end
+
+function SceneEditor:editGroup(group)
+ if self.LastEditedGroup then
+ self:removeGroup(self.LastEditedGroup, true)
+ self:addGroup(self.LastEditedGroup, 0, true, false)
+ end
+ self:removeGroup(group, true);
+ self:addGroup(group, 0, true, true)
+ self.LastEditedGroup = group
+end
+
+function SceneEditor:addFromDb(group, db_id, json_shape, edit)
+ shape = Json.decode(json_shape)
+ shape.db_id = db_id
+
+ shape.group = group
+ shape.modified = ""
+ if edit then
+ shape_id = addShape(shape.file, shape.pos[1], shape.pos[2], shape.pos[3], "user", 1, true, "", "SceneEditor:show_menu()")
+ else
+ shape_id = addShape(shape.file, shape.pos[1], shape.pos[2], shape.pos[3], "user", 1, true, "", "")
+ end
+ rotateShape(shape_id, tostring(shape.rot[1]), tostring(shape.rot[2]), tostring(shape.rot[3]))
+ setupShape(shape_id, shape.setup)
+ self.Shapes[shape_id] = shape
+ table.insert(self.Groups[group], shape_id)
+ if db_id > self.Groups[group].props.count then
+ self.Groups[group].props.count = db_id
+ end
+end
+
+
+function SceneEditor:removeGroup(group, no_get_html)
+ if self.Groups[group] == nil then
+ return
+ end
+
+ for k,shape_id in pairs(self.Groups[group]) do
+ if k ~= "props" then
+ self.Shapes[shape_id] = nil
+ deleteShape(shape_id)
+ end
+ end
+
+ self.Groups[group] = nil
+ if self.LastEditedGroup == group then
+ self.LastEditedGroup = nil
+ local ui = getUI("ui:interface:ark_list_of_shapes")
+ if ui then
+ ui.active=false
+ end
+ end
+ if no_get_html == nil then
+ self:get_html("Group Removed")
+ end
+end
+
+function SceneEditor:enc64(data)
+ local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
+ return ((data:gsub('.', function(x)
+ local r,b='',x:byte()
+ for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
+ return r;
+ end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
+ if (#x < 6) then return '' end
+ local c=0
+ for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
+ return b:sub(c+1,c+1)
+ end)..({ '', '==', '=' })[#data%3+1])
+end
+
+function SceneEditor:get_vector(x, y, z)
+ local vector = {}
+ table.insert(vector, x)
+ table.insert(vector, y)
+ table.insert(vector, z)
+
+ return vector
+end
+
+function SceneEditor:get_random_color()
+ local r = math.random(44, 66);
+ local g = math.random(44, 66);
+ local b = math.random(44, 66);
+ return '#'..tostring(r)..tostring(g)..tostring(b)
+
+end
+
+function pairsByKeys(t, f)
+ local a = {}
+ for n in pairs(t) do table.insert(a, n) end
+ table.sort(a, f)
+ local i = 0 -- iterator variable
+ local iter = function () -- iterator function
+ i = i + 1
+ if a[i] == nil then
+ return nil
+ else
+ return a[i], t[a[i]]
+ end
+ end
+ return iter
+end
+
+function SceneEditor:show_shape_list()
+ local ui = getUI("ui:interface:ark_list_of_shapes")
+ local need_setup = ui == nil
+ if need_setup then
+ WebBrowser:openWindow("ark_list_of_shapes", self.baseUrl..'_ListShapes')
+ ui = getUI("ui:interface:ark_list_of_shapes")
+ ui.pop_min_w = 400
+ ui.w = 400
+ getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_redo").active=false
+ getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_undo").active=false
+ getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_refresh").active=false
+ getUI("ui:interface:ark_list_of_shapes:browser:header_opened:browse_home").active=false
+ else
+ ui.active = true
+ end
+end
+
+function SceneEditor:getShapesByGroups()
+ local groups = {}
+ for shape_id, shape in pairs(self.Shapes) do
+ if shape.group == nil then
+ shape.group = ""
+ end
+
+ if groups[shape.group] == nil then
+ groups[shape.group] = {}
+ end
+ table.insert(groups[shape.group], shape_id)
+ end
+ return groups
+end
+
+
+function SceneEditor:get_html_section(message, color)
+ return ''
+end
+
+function SceneEditor:get_html(message, message_bg)
+ debug("get_html :"..message)
+ local new_group = ' '
+ local show_hide_cols = ' '
+ local reset_scene = ''
+
+ local html = ''..self.T["sceno_editor"]..''..self:get_html_section(message..' | '..new_group..show_hide_cols..reset_scene, (message_bg or SceneEditor:get_random_color()))
+
+ html = html .. ''
+ ui = getUI("ui:interface:ark_scene_editor:browser:content:html", false)
+ if ui then
+ ui:renderHtml(html)
+ end
+end
+
diff --git a/data/ryz/ryz_zzz_bazaar/webig_widgets.xml b/data/ryz/ryz_zzz_bazaar/webig_widgets.xml
index 3c147048..9392c94f 100644
--- a/data/ryz/ryz_zzz_bazaar/webig_widgets.xml
+++ b/data/ryz/ryz_zzz_bazaar/webig_widgets.xml
@@ -4,6 +4,8 @@
+
+
|