ajout de mission manquant et mise a jour pour le dernier client

This commit is contained in:
deed 2017-03-23 22:02:40 +01:00
parent fdea0cf6bd
commit 218b7c9299
22 changed files with 3009 additions and 64 deletions

View file

@ -464,24 +464,25 @@ R2EDReloadFiles = {
XMLInterfaceFiles = {
"config.xml",
"widgets.xml",
"webig_widgets.xml",
"webig_widgets.xml",
"appzone.xml",
"player.xml",
"inventory.xml",
"interaction.xml",
"phrase.xml",
"phrase.xml",
"harvest.xml",
"macros.xml",
"info_player.xml",
"outpost.xml",
"guild.xml",
"taskbar.xml",
"game_config.xml",
"game_config.xml",
"game_context_menu.xml",
"player_trade.xml",
"bot_chat_v4.xml",
"compass.xml",
"map.xml",
"hierarchy.xml",
"hierarchy.xml",
"reset.xml",
"actions.xml",
"help.xml",
@ -490,7 +491,8 @@ XMLInterfaceFiles = {
"commands2.xml",
"ring_access_point_filter.xml",
"ring_window.xml",
"bg_downloader.xml"
"bg_downloader.xml",
"ryzhome_toolbar.xml"
};
XMLR2EDInterfaceFiles =

View file

@ -464,24 +464,25 @@ R2EDReloadFiles = {
XMLInterfaceFiles = {
"config.xml",
"widgets.xml",
"webig_widgets.xml",
"webig_widgets.xml",
"appzone.xml",
"player.xml",
"inventory.xml",
"interaction.xml",
"phrase.xml",
"phrase.xml",
"harvest.xml",
"macros.xml",
"info_player.xml",
"outpost.xml",
"guild.xml",
"taskbar.xml",
"game_config.xml",
"game_config.xml",
"game_context_menu.xml",
"player_trade.xml",
"bot_chat_v4.xml",
"compass.xml",
"map.xml",
"hierarchy.xml",
"hierarchy.xml",
"reset.xml",
"actions.xml",
"help.xml",
@ -490,7 +491,8 @@ XMLInterfaceFiles = {
"commands2.xml",
"ring_access_point_filter.xml",
"ring_window.xml",
"bg_downloader.xml"
"bg_downloader.xml",
"ryzhome_toolbar.xml"
};
XMLR2EDInterfaceFiles =

View file

@ -464,24 +464,25 @@ R2EDReloadFiles = {
XMLInterfaceFiles = {
"config.xml",
"widgets.xml",
"webig_widgets.xml",
"webig_widgets.xml",
"appzone.xml",
"player.xml",
"inventory.xml",
"interaction.xml",
"phrase.xml",
"phrase.xml",
"harvest.xml",
"macros.xml",
"info_player.xml",
"outpost.xml",
"guild.xml",
"taskbar.xml",
"game_config.xml",
"game_config.xml",
"game_context_menu.xml",
"player_trade.xml",
"bot_chat_v4.xml",
"compass.xml",
"map.xml",
"hierarchy.xml",
"hierarchy.xml",
"reset.xml",
"actions.xml",
"help.xml",
@ -490,7 +491,8 @@ XMLInterfaceFiles = {
"commands2.xml",
"ring_access_point_filter.xml",
"ring_window.xml",
"bg_downloader.xml"
"bg_downloader.xml",
"ryzhome_toolbar.xml"
};
XMLR2EDInterfaceFiles =

View file

@ -464,24 +464,25 @@ R2EDReloadFiles = {
XMLInterfaceFiles = {
"config.xml",
"widgets.xml",
"webig_widgets.xml",
"webig_widgets.xml",
"appzone.xml",
"player.xml",
"inventory.xml",
"interaction.xml",
"phrase.xml",
"phrase.xml",
"harvest.xml",
"macros.xml",
"info_player.xml",
"outpost.xml",
"guild.xml",
"taskbar.xml",
"game_config.xml",
"game_config.xml",
"game_context_menu.xml",
"player_trade.xml",
"bot_chat_v4.xml",
"compass.xml",
"map.xml",
"hierarchy.xml",
"hierarchy.xml",
"reset.xml",
"actions.xml",
"help.xml",
@ -490,7 +491,8 @@ XMLInterfaceFiles = {
"commands2.xml",
"ring_access_point_filter.xml",
"ring_window.xml",
"bg_downloader.xml"
"bg_downloader.xml",
"ryzhome_toolbar.xml"
};
XMLR2EDInterfaceFiles =

View file

@ -464,24 +464,25 @@ R2EDReloadFiles = {
XMLInterfaceFiles = {
"config.xml",
"widgets.xml",
"webig_widgets.xml",
"webig_widgets.xml",
"appzone.xml",
"player.xml",
"inventory.xml",
"interaction.xml",
"phrase.xml",
"phrase.xml",
"harvest.xml",
"macros.xml",
"info_player.xml",
"outpost.xml",
"guild.xml",
"taskbar.xml",
"game_config.xml",
"game_config.xml",
"game_context_menu.xml",
"player_trade.xml",
"bot_chat_v4.xml",
"compass.xml",
"map.xml",
"hierarchy.xml",
"hierarchy.xml",
"reset.xml",
"actions.xml",
"help.xml",
@ -490,7 +491,8 @@ XMLInterfaceFiles = {
"commands2.xml",
"ring_access_point_filter.xml",
"ring_window.xml",
"bg_downloader.xml"
"bg_downloader.xml",
"ryzhome_toolbar.xml"
};
XMLR2EDInterfaceFiles =

View file

@ -0,0 +1,161 @@
-- global
WebBrowser = {
template = "webig_browser",
apps = {}
}
function WebBrowser:openWindow(id, url)
-- default value if url is not set
url = url or "http://app.ryzom.com/"
local newWindow = false
local app = self:findAppById(id)
if not app then
app = {}
app.id = id
app.title = ""
app.url = url
-- getUI() object
app.uiWindow = nil
app.winid = "ui:interface:" .. id
app.winw = 780
app.winh = 500
app.minimized = true
app.activeUrl = ""
table.insert(self.apps, app)
end
if not app.uiWindow then
-- if there is window present (eg, 'webig'), then reuse it
app.uiWindow = getUI(app.winid, false)
if not app.uiWindow then
app.uiWindow = createRootGroupInstance(self.template, app.id, {
x = 0, y = 0, w = app.winw, h = app.winh, home = app.url,
browse_redo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_redo",
browse_undo = "ui:interface:" .. app.id .. ":browser:header_opened:browse_undo",
browse_refresh = "ui:interface:" .. app.id .. ":browser:header_opened:browse_refresh"
})
if not app.uiWindow then
return
end
app.uiWindow:center()
end
newWindow = true
end
app.activeUrl = url
-- trigger on_open event
if not app.uiWindow.opened then
app.uiWindow.opened = true
end
-- trigger on_active event
if not app.uiWindow.active then
app.uiWindow.active = true
end
local html = app.uiWindow:find("html")
html:browse(url)
setTopWindow(app.uiWindow)
end
function WebBrowser:findAppById(id)
for k,app in pairs(self.apps) do
if app.id == id then
return app
end
end
return nil
end
function WebBrowser:findAppFromUiCaller()
-- id = app123
local id = getUICaller().id:match("ui:interface:([^:]*):?")
local app = self:findAppById(id)
if app then
return app
end
end
function WebBrowser:onActive()
if app then
self:restoreWindow(app)
end
end
function WebBrowser:onClickHeaderClose()
local app = self:findAppFromUiCaller()
if app then
self:saveWindow(app)
end
end
function WebBrowser:onClickHeaderOpen()
local app = self:findAppFromUiCaller()
if app then
self:restoreWindow(app)
end
end
-- save current window dimension and minimize window
function WebBrowser:saveWindow(app)
app.minimized = true
app.winw = app.uiWindow.w
app.winh = app.uiWindow.h
-- minimize
app.uiWindow.w = 150
app.uiWindow.h = 0
end
function WebBrowser:restoreWindow(app)
if app.minimized then
app.uiWindow.w = app.winw
app.uiWindow.h = app.winh
app.minimized = false
end
end
function WebBrowser:onClickRedo()
-- caller is :header_opened:browse_redo
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
runAH(nil, "browse_redo", "name=" .. html.id)
end
end
function WebBrowser:onClickUndo()
-- caller is :header_opened:browse_undo
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
runAH(nil, "browse_undo", "name=" .. html.id)
end
end
function WebBrowser:onClickRefresh()
-- caller is :header_opened:browse_refresh
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
html:refresh()
end
end
function WebBrowser:onClickHome()
-- caller is :header_opened:browse_home
local uiWindow = getUICaller().parent.parent
local html = uiWindow:find("html")
if html ~= nil then
html:browse("home")
end
end

File diff suppressed because it is too large Load diff

View file

@ -109,7 +109,7 @@ function game.RingAccessPointFilter:validate()
if config.Local == 1 then
ucUrl = ucstring(NicoMagicURL) -- for test in local mode
else
ucUrl = getDynString(game.NpcWebPage.UrlTextId);
ucUrl = getDynString(game.NpcWebPage.UrlTextId)
end
debugInfo(tostring(ucUrl))
local utf8Url = ucUrl:toUtf8()

View file

@ -49,7 +49,7 @@
<ctrl style="button_ok" id="ok" active="true" x="0" y="-10" posref="BR TR" posparent="label_gr"
text_y="-2" onclick_l="lua" params_l="game.RingAccessPointFilter:validate()" hardtext="OK" fontsize="10" />
text_y="0" onclick_l="lua" params_l="game.RingAccessPointFilter:validate()" hardtext="OK" fontsize="10" />
</group>
</group>

View file

@ -1077,15 +1077,15 @@
<group id="valid_scenario_control" sizeref="w" child_resize_h="true" w="0" posparent="invite_team"
posref="BL TL" x="0" y="-5" >
<ctrl style="button_ok" id="ok_button" x="-50" y="0" posref="TM TM" text_y="-2"
<ctrl style="button_ok" id="ok_button" x="-50" y="0" posref="TM TM" text_y="0"
onclick_l="load_scenario" params_l="" hardtext="uittOK" wmin="100"
tooltip="uiRingLaunchScenarioTooltip"
tooltip_parent="win" />
<ctrl style="button_ok" id="cancel_button" x="10" y="0" posparent="ok_button" posref="BR BL" text_y="-2"
<ctrl style="button_ok" id="cancel_button" x="10" y="0" posparent="ok_button" posref="BR BL" text_y="0"
onclick_l="proc" params_l="scenario_control_close" hardtext="uittCancel" wmin="100" />
<ctrl style="button_ok" id="load_button" x="10" y="0" posref="TL TL" text_y="-2"
<ctrl style="button_ok" id="load_button" x="10" y="0" posref="TL TL" text_y="0"
onclick_l="lua" params_l="GameR2Loading:displayLoadingWindow()" hardtext="uiR2EDChooseScenario" wmin="100" />
</group>
@ -1650,10 +1650,10 @@
<instance template="score_template" id="direction_rate" x="0" y="-13" posref="BL TL" posparent="originality_rate"
hardtext="uiRAP_RateDirection" />
<ctrl style="button_ok" id="ok" x="30" y="15" posref="BM BM" posparent="parent" text_y="-2"
<ctrl style="button_ok" id="ok" x="30" y="15" posref="BM BM" posparent="parent" text_y="0"
onclick_l="lua" params_l="ScenarioScores:updateScores()" hardtext="uittOK" wmin="50" />
<ctrl style="button_ok" id="cancel" x="-30" y="15" posref="BM BM" posparent="parent" text_y="-2"
<ctrl style="button_ok" id="cancel" x="-30" y="15" posref="BM BM" posparent="parent" text_y="0"
onclick_l="lua" params_l="ScenarioScores:getWindow().active=false" hardtext="uittCancel" wmin="50" />
</group>
@ -1679,7 +1679,7 @@
<instance template="average_score_template" id="direction_rate" x="0" y="-13" posref="BL TL" posparent="originality_rate"
hardtext="uiRAP_RateDirection" />
<ctrl style="button_ok" id="ok" x="30" y="15" posref="BM BM" posparent="parent" text_y="-2"
<ctrl style="button_ok" id="ok" x="30" y="15" posref="BM BM" posparent="parent" text_y="0"
onclick_l="lua" params_l="getUI('ui:interface:r2ed_scenario_scores').active=false" hardtext="uittOK" wmin="50" />
</group>

View file

@ -50,6 +50,24 @@
<command name="re" action="talk" params="mode=11|text=+" ctrlchar="false" />
<command name="r" action="talk" params="mode=11|text=+" ctrlchar="false" />
<command name="0" action="enter_talk" params="mode=12|channel=0" />
<command name="1" action="enter_talk" params="mode=12|channel=1" />
<command name="2" action="enter_talk" params="mode=12|channel=2" />
<command name="3" action="enter_talk" params="mode=12|channel=3" />
<command name="4" action="enter_talk" params="mode=12|channel=4" />
<command name="5" action="enter_talk" params="mode=12|channel=5" />
<command name="6" action="enter_talk" params="mode=12|channel=6" />
<command name="7" action="enter_talk" params="mode=12|channel=7" />
<command name="0" action="talk" params="mode=12|channel=0|text=+" ctrlchar="false" />
<command name="1" action="talk" params="mode=12|channel=1|text=+" ctrlchar="false" />
<command name="2" action="talk" params="mode=12|channel=2|text=+" ctrlchar="false" />
<command name="3" action="talk" params="mode=12|channel=3|text=+" ctrlchar="false" />
<command name="4" action="talk" params="mode=12|channel=4|text=+" ctrlchar="false" />
<command name="5" action="talk" params="mode=12|channel=5|text=+" ctrlchar="false" />
<command name="6" action="talk" params="mode=12|channel=6|text=+" ctrlchar="false" />
<command name="7" action="talk" params="mode=12|channel=7|text=+" ctrlchar="false" />
<command name="guild" action="enter_talk" params="mode=3" />
<command name="gu" action="enter_talk" params="mode=3" />
<command name="g" action="enter_talk" params="mode=3" />
@ -63,9 +81,15 @@
<command name="target" action="target" params="entity=$" />
<command name="tar" action="target" params="entity=$" />
<command name="target_quiet" action="target" params="entity=$|quiet=true" />
<command name="tarq" action="target" params="entity=$|quiet=true" />
<command name="target" action="target" params="entity=$|prefer_complete_match=$" />
<command name="tar" action="target" params="entity=$|prefer_complete_match=$" />
<command name="target_quiet" action="target" params="entity=$|prefer_complete_match=$|quiet=true" />
<command name="tarq" action="target" params="entity=$|prefer_complete_match=$|quiet=true" />
<command name="target" action="no_target" params="" />
<command name="tar" action="no_target" params="" />

View file

@ -19,7 +19,7 @@ end
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
-- WIDGET TO CHOOSE A COLOR
-- WIDGET TO CHOOSE A COLOR
------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------
@ -29,14 +29,14 @@ function game:mcwChooseColor(title, pal)
local ui = getUICaller();
-- get the color of the button and store it in temporary db location
-- get the color of the button and store it in temporary db location
local rgba = ui.col_normal_rgba;
game.ColorPicker.r = rgba.R;
game.ColorPicker.g = rgba.G;
game.ColorPicker.b = rgba.B;
game.ColorPicker.button = ui;
game.ColorPicker.pal = pal;
-- setup the color picker window
local uiModalWin = getUI('ui:interface:define_mcw_color');
if (game.ColorPicker.pal == 0) then
@ -64,8 +64,8 @@ end
-- called when we have finished choosing the color in the modal window and the chosen color is valid
function game:mcwValidateColor()
if (game.ColorPicker.button == nil) then
return;
if (game.ColorPicker.button == nil) then
return;
end
game.ColorPicker.button.col_normal = game.ColorPicker.r .. ' ' .. game.ColorPicker.g .. ' ' .. game.ColorPicker.b;
--debugInfo(game.ColorPicker.button.col_normal)
@ -85,6 +85,7 @@ function game:mcwOnColorChanged()
else
uiPath = uiPath .. 'pick2';
end
local ui = getUI(uiPath);
game.ColorPicker.r = ui.r;
game.ColorPicker.g = ui.g;
@ -108,10 +109,10 @@ end
-- hide all the pages of the config window
function game:configHideAll()
local uiList = {
local uiList = {
'explanation', 'general', 'landscape', 'fx', 'char', 'hud', 'language', 'alpha_colors',
'chat_colors', 'entity_colors', 'in_scene_user', 'in_scene_friend', 'in_scene_enemy',
'in_scene_chat_messages', 'win_colors', 'win_colors_r2', 'mouse', 'keyb', 'sound', 'landmark_colors', 'help'
'chat_colors', 'entity_colors', 'in_scene_user', 'in_scene_friend', 'in_scene_enemy',
'in_scene_chat_messages', 'win_colors', 'win_colors_r2', 'mouse', 'keyb', 'vr', 'sound', 'landmark_colors', 'help'
};
for k,v in pairs(uiList) do
@ -127,19 +128,19 @@ function game:configShowOne(strUIToShow)
game:configHideAll();
-- special case : if the display tab was shown, update the aspect ratio if needed
local generalGrp = getUI('ui:interface:game_config:content:general');
local uiGrp = getUI('ui:interface:game_config:content:' .. strUIToShow);
local uiGrp = getUI('ui:interface:game_config:content:' .. strUIToShow);
-- Removed the following code to solve RT n°14720
-- The 'game_config_change_screen_ratio_custom' action handler
-- should only be called if the user changed the apect ratio himself
-- The 'game_config_change_screen_ratio_custom' action handler
-- should only be called if the user changed the apect ratio himself
-- (else the edit box containing the aspect ratio may not have been initiliazed here)
--if uiGrp ~= generalGrp then
--if uiGrp ~= generalGrp then
-- runAH(nil, 'game_config_change_screen_ratio_custom', '')
--end
uiGrp.active = true;
end
------------------------------------------------------------------------------------------------------------
--
--
function game:configInit()
-- init language
@ -150,6 +151,10 @@ function game:configInit()
langNb = 2;
elseif (lang == 'fr') then
langNb = 1;
elseif (lang == 'ru') then
langNb = 3;
elseif (lang == 'es') then
langNb = 4;
end
-- force observers call
@ -187,9 +192,9 @@ function game:configInit()
winActive("wc_r2_dialogs", r2WinOn)
winActive("wc_r2_events", r2WinOn)
winActive("wc_r2_activities", r2WinOn)
winActive("wc_r2_feature_help", r2WinOn)
winActive("wc_r2_connect", not r2WinOn)
winActive("wc_r2_session_browser", not r2WinOn)
winActive("wc_r2_scenario_control", true)
winActive("wc_r2_feature_help", r2WinOn)
winActive("wc_r2_connect", not r2WinOn)
winActive("wc_r2_session_browser", not r2WinOn)
winActive("wc_r2_scenario_control", true)
winActive("wc_r2_player_tracking", r2WinOn)
end

View file

@ -537,3 +537,17 @@ function game:openWebIGBrowserHeader()
ui.w = ui_webig_browser_w;
end
end
------------------------------------------------------------------------------------------------------------
local SavedUrl = "";
function game:chatUrl(url)
SavedUrl = url
runAH(nil, "active_menu", "menu=ui:interface:chat_uri_action_menu");
end
function game:chatUrlCopy()
runAH(nil, "copy_to_clipboard", SavedUrl)
end
function game:chatUrlBrowse()
runAH(nil, "browse", "name=ui:interface:webig:content:html|url=" .. SavedUrl)
end

View file

@ -0,0 +1,376 @@
--
-- json.lua
--
-- Copyright (c) 2015 rxi
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details.
--
Json = { _version = "0.1.0" }
-------------------------------------------------------------------------------
-- Encode
-------------------------------------------------------------------------------
local encode
local escape_char_map = {
[ "\\" ] = "\\\\",
[ "\"" ] = "\\\"",
[ "\b" ] = "\\b",
[ "\f" ] = "\\f",
[ "\n" ] = "\\n",
[ "\r" ] = "\\r",
[ "\t" ] = "\\t",
}
local escape_char_map_inv = { [ "\\/" ] = "/" }
for k, v in pairs(escape_char_map) do
escape_char_map_inv[v] = k
end
local function escape_char(c)
return escape_char_map[c] or string.format("\\u%04x", c:byte())
end
local function encode_nil(val)
return "null"
end
local function encode_table(val, stack)
local res = {}
stack = stack or {}
-- Circular reference?
if stack[val] then error("circular reference") end
stack[val] = true
if val[1] ~= nil or next(val) == nil then
-- Treat as array -- check keys are valid and it is not sparse
local n = 0
for k in pairs(val) do
if type(k) ~= "number" then
error("invalid table: mixed or invalid key types")
end
n = n + 1
end
if n ~= #val then
error("invalid table: sparse array")
end
-- Encode
for i, v in ipairs(val) do
table.insert(res, encode(v, stack))
end
stack[val] = nil
return "[" .. table.concat(res, ",") .. "]"
else
-- Treat as an object
for k, v in pairs(val) do
if type(k) ~= "string" then
error("invalid table: mixed or invalid key types")
end
table.insert(res, encode(k, stack) .. ":" .. encode(v, stack))
end
stack[val] = nil
return "{" .. table.concat(res, ",") .. "}"
end
end
local function encode_string(val)
return '"' .. val:gsub('[%z\1-\31\\"]', escape_char) .. '"'
end
local function encode_number(val)
-- Check for NaN, -inf and inf
if val ~= val or val <= -math.huge or val >= math.huge then
error("unexpected number value '" .. tostring(val) .. "'")
end
return string.format("%.3f", val)
end
local type_func_map = {
[ "nil" ] = encode_nil,
[ "table" ] = encode_table,
[ "string" ] = encode_string,
[ "number" ] = encode_number,
[ "boolean" ] = tostring,
}
encode = function(val, stack)
local t = type(val)
local f = type_func_map[t]
if f then
return f(val, stack)
end
error("unexpected type '" .. t .. "'")
end
function Json.encode(val)
return ( encode(val) )
end
-------------------------------------------------------------------------------
-- Decode
-------------------------------------------------------------------------------
local parse
local function create_set(...)
local res = {}
for i = 1, select("#", ...) do
res[ select(i, ...) ] = true
end
return res
end
local space_chars = create_set(" ", "\t", "\r", "\n")
local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",")
local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u")
local literals = create_set("true", "false", "null")
local literal_map = {
[ "true" ] = true,
[ "false" ] = false,
[ "null" ] = nil,
}
local function next_char(str, idx, set, negate)
for i = idx, #str do
if set[str:sub(i, i)] ~= negate then
return i
end
end
return #str + 1
end
local function decode_error(str, idx, msg)
local line_count = 1
local col_count = 1
for i = 1, idx - 1 do
col_count = col_count + 1
if str:sub(i, i) == "\n" then
line_count = line_count + 1
col_count = 1
end
end
error( string.format("%s at line %d col %d", msg, line_count, col_count) )
end
local function codepoint_to_utf8(n)
-- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa
local f = math.floor
if n <= 0x7f then
return string.char(n)
elseif n <= 0x7ff then
return string.char(f(n / 64) + 192, n % 64 + 128)
elseif n <= 0xffff then
return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128)
elseif n <= 0x10ffff then
return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128,
f(n % 4096 / 64) + 128, n % 64 + 128)
end
error( string.format("invalid unicode codepoint '%x'", n) )
end
local function parse_unicode_escape(s)
local n1 = tonumber( s:sub(3, 6), 16 )
local n2 = tonumber( s:sub(9, 12), 16 )
-- Surrogate pair?
if n2 then
return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000)
else
return codepoint_to_utf8(n1)
end
end
local function parse_string(str, i)
local has_unicode_escape = false
local has_surrogate_escape = false
local has_escape = false
local last
for j = i + 1, #str do
local x = str:byte(j)
if x < 32 then
decode_error(str, j, "control character in string")
end
if last == 92 then -- "\\" (escape char)
if x == 117 then -- "u" (unicode escape sequence)
local hex = str:sub(j + 1, j + 5)
if not hex:find("%x%x%x%x") then
decode_error(str, j, "invalid unicode escape in string")
end
if hex:find("^[dD][89aAbB]") then
has_surrogate_escape = true
else
has_unicode_escape = true
end
else
local c = string.char(x)
if not escape_chars[c] then
decode_error(str, j, "invalid escape char '" .. c .. "' in string")
end
has_escape = true
end
last = nil
elseif x == 34 then -- '"' (end of string)
local s = str:sub(i + 1, j - 1)
if has_surrogate_escape then
s = s:gsub("\\u[dD][89aAbB]..\\u....", parse_unicode_escape)
end
if has_unicode_escape then
s = s:gsub("\\u....", parse_unicode_escape)
end
if has_escape then
s = s:gsub("\\.", escape_char_map_inv)
end
return s, j + 1
else
last = x
end
end
decode_error(str, i, "expected closing quote for string")
end
local function parse_number(str, i)
local x = next_char(str, i, delim_chars)
local s = str:sub(i, x - 1)
local n = tonumber(s)
if not n then
decode_error(str, i, "invalid number '" .. s .. "'")
end
return n, x
end
local function parse_literal(str, i)
local x = next_char(str, i, delim_chars)
local word = str:sub(i, x - 1)
if not literals[word] then
decode_error(str, i, "invalid literal '" .. word .. "'")
end
return literal_map[word], x
end
local function parse_array(str, i)
local res = {}
local n = 1
i = i + 1
while 1 do
local x
i = next_char(str, i, space_chars, true)
-- Empty / end of array?
if str:sub(i, i) == "]" then
i = i + 1
break
end
-- Read token
x, i = parse(str, i)
res[n] = x
n = n + 1
-- Next token
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
if chr == "]" then break end
if chr ~= "," then decode_error(str, i, "expected ']' or ','") end
end
return res, i
end
local function parse_object(str, i)
local res = {}
i = i + 1
while 1 do
local key, val
i = next_char(str, i, space_chars, true)
-- Empty / end of object?
if str:sub(i, i) == "}" then
i = i + 1
break
end
-- Read key
if str:sub(i, i) ~= '"' then
decode_error(str, i, "expected string for key")
end
key, i = parse(str, i)
-- Read ':' delimiter
i = next_char(str, i, space_chars, true)
if str:sub(i, i) ~= ":" then
decode_error(str, i, "expected ':' after key")
end
i = next_char(str, i + 1, space_chars, true)
-- Read value
val, i = parse(str, i)
-- Set
res[key] = val
-- Next token
i = next_char(str, i, space_chars, true)
local chr = str:sub(i, i)
i = i + 1
if chr == "}" then break end
if chr ~= "," then decode_error(str, i, "expected '}' or ','") end
end
return res, i
end
local char_func_map = {
[ '"' ] = parse_string,
[ "0" ] = parse_number,
[ "1" ] = parse_number,
[ "2" ] = parse_number,
[ "3" ] = parse_number,
[ "4" ] = parse_number,
[ "5" ] = parse_number,
[ "6" ] = parse_number,
[ "7" ] = parse_number,
[ "8" ] = parse_number,
[ "9" ] = parse_number,
[ "-" ] = parse_number,
[ "t" ] = parse_literal,
[ "f" ] = parse_literal,
[ "n" ] = parse_literal,
[ "[" ] = parse_array,
[ "{" ] = parse_object,
}
parse = function(str, idx)
local chr = str:sub(idx, idx)
local f = char_func_map[chr]
if f then
return f(str, idx)
end
decode_error(str, idx, "unexpected character '" .. chr .. "'")
end
function Json.decode(str)
if type(str) ~= "string" then
error("expected argument of type string, got " .. type(str))
end
return ( parse(str, next_char(str, 1, space_chars, true)) )
end

View file

@ -29,7 +29,7 @@
</branch>
<branch name="BAG">
<branch name=""
count="1500">
count="500">
<!-- Common Item Data -->
<leaf name="SHEET"
type="I32" />

View file

@ -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"

View file

@ -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
------------------------------------------------------------------------------------------------------------

View file

@ -21,8 +21,9 @@
<!-- Save the Time Zone config -->
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE" type="sint32" value="0" />
<variable entry="UI:SAVE:OUTPOST:TIME_ZONE_AUTO" type="sint32" value="1" />
<variable entry="UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE" type="sint32" value="0" />
<!-- just a script called at init and every 5 seconds, to setup TIME_ZONE, if time_zone is auto-->
<link expr="depends(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, @UI:VARIABLES:CURRENT_SERVER_TICK)" action="lua:game:outpostUpdateTimeZone()" />
<link expr="depends(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, @UI:VARIABLES:CURRENT_SERVER_TICK)" cond="and(eq(@UI:SAVE:OUTPOST:TIME_ZONE_AUTO, 1), ge(@UI:VARIABLES:CURRENT_SERVER_TICK, @UI:TEMP:OUTPOST:TIME_ZONE_NEXT_UPDATE))" action="lua:game:outpostUpdateTimeZone()" />
<!-- Temp Variables -->

View file

@ -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.."&amp;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

View file

@ -0,0 +1,445 @@
<interface_config>
<root id="interface" x="0" y="0" w="800" h="600" active="true" />
<lua file="ryzhome_toolbar.lua" />
<style style="button_over"
type="button"
id="button_over"
button_type="push_button"
posref="TR TR"
x="0"
y="0"
h="39"
w="44"
scale="true"
tx_over="W_button_32_over.tga"
global_color_normal="false"
global_color_pushed="false" />
<group type="container"
id="webig_ryzhome_toolbar"
x="0" y="0" w="200" h="56" posref="MM MM"
max_w="1600" pop_max_w="1600"
max_h="1600" pop_max_h="1600"
min_w="26" pop_min_w="26"
min_h="26" pop_min_h="26"
title=""
global_color="true"
global_color_over="true"
header_active="false"
right_button="false"
options="layer0_pad"
movable="true"
active="true"
opened="true"
openable="false"
resizer="false">
<group id="header_closed" x="0" y="0" w="0" h="0" posref="TL TL"></group>
<group id="header_opened" x="0" y="0" w="0" h="0" wmin="5" sizeref="w" posref="TL TL"></group>
<group id="content" x="0#" y="0#" w="200" h="56" posref="TL TL">
<view id="action_title"
type="text"
posref="TL TL"
x="2"
y="-2"
color="255 255 255 255"
fontsize="12"
shadow="true"
global_color="false"
hardtext="Ryzhome" />
<ctrl id="close"
type="button"
style="button_close"
button_type="push_button"
posref="TR TR"
x="1"
y="1"
tx_normal="w_win_close.tga"
tx_pushed="w_win_close.tga"
tooltip="uiNoteClose"
onclick_l="lua"
params_l="RyzhomeBar:close()"/>
<ctrl id="config"
type="button"
style="button_close"
button_type="push_button"
posref="TL TR"
posparent="close"
x="-2"
y="-1"
tx_normal="r2ed_permanent_pins.tga"
tx_pushed="r2ed_permanent_pins.tga"
tooltip="uiCreateUserLM"
onclick_l="lua"
params_l="RyzhomeBar:saveConfig()"/>
<ctrl id="add"
type="button"
style="button_over"
button_type="toggle_button"
posref="BL BL"
x="3"
y="0"
tx_normal="ryzhome_add_item.png"
tx_pushed="ryzhome_add_item.png"
tx_over="W_button_32_over.tga"
tooltip="uiPeopleAdd"
onclick_l="lua"
params_l="RyzhomeBar:addItems()"/>
<view id="new_items_quantity"
type="text"
posref="BL BL"
posparent="add"
x="-1"
y="-1"
color="255 200 0 255"
global_color="false"
fontsize="16"
shadow="true"
hardtext="" />
<ctrl id="move"
type="button"
style="button_over"
button_type="toggle_button"
posref="BR BL"
posparent="add"
x="3"
y="0"
tx_normal="ryzhome_move_item.png"
tx_pushed="ryzhome_move_item.png"
tx_over="W_button_32_over.tga"
tooltip="uimMoveTo"
onclick_l="lua"
params_l="RyzhomeBar:moveItems()"/>
<ctrl id="remove"
type="button"
style="button_over"
posref="BR BL"
posparent="move"
x="3"
tx_normal="ryzhome_remove_item.png"
tx_pushed="ryzhome_remove_item.png"
tx_over="W_button_32_over.tga"
tooltip="uimRemove"
onclick_l="lua"
params_l="RyzhomeBar:removeItems()"/>
<ctrl id="invite"
type="button"
style="button_over"
posref="BR BL"
posparent="remove"
x="3"
tx_normal="ryzhome_invite.png"
tx_pushed="ryzhome_invite.png"
tx_over="W_button_32_over.tga"
tooltip="uiRAP_Invite"
onclick_l="lua"
params_l="RyzhomeBar:inviteFriend()"/>
</group>
</group>
<tree node="webig_ryzhome_toolbar"></tree>
<style style="button_over"
id="over"
posref="TL TL"
render_layer="-1"
y="1" w="600" h="44" scale="true"
button_type="push_button"
tx_normal="blank.tga"
tx_pushed="blank.tga"
tx_over="blank.tga"
color="255 255 255 0"
col_over="255 255 255 64"
col_pushed="255 255 255 128"
global_color_over="false" />
<group id="webig_ryzhome_list_item"
style="bot_chat_window"
posref="MM MM"
min_w="316"
max_w="316"
max_h="420"
min_h="420"
w="316"
h="420"
x="0"
y="0"
pop_max_h="700"
active="false"
title=""
modal_parent="gestionsets">
<group id="header_opened"
child_resize_hmargin="24"
w="600"
h="420"
x="0"
y="0"
posref="TL TL">
<view id="action_title"
type="text"
posref="TL TL"
x="2"
y="-25"
color="255 255 255 255"
fontsize="12"
shadow="true"
hardtext="uiSelectMission" />
<ctrl id="page_next"
type="button"
posref="TR TR"
x="-2"
y="-20"
tx_normal="W_arrow_right_0.tga"
tx_pushed="W_arrow_right_0.tga"
tooltip="uiKeyNEXT"
onclick_l="lua"
params_l="RyzhomeBar:movePage(1)" />
<view id="page"
type="text"
posref="TL TR"
posparent="page_next"
x="-2"
y="0"
color="255 255 255 255"
fontsize="12"
shadow="true"
hardtext="1/1" />
<ctrl id="page_previous"
type="button"
posref="TL TR"
posparent="page"
x="-2"
y="0"
tx_normal="w_arrow_left_0.tga"
tx_pushed="w_arrow_left_0.tga"
tooltip="uiKeyPRIOR"
onclick_l="lua"
params_l="RyzhomeBar:movePage(-1)" />
<group id="scroll_text"
sizeref="w"
posref="TL TL"
w="0"
y="-40"
child_resize_h="false"
child_resize_hmargin="8">
<instance template="inner_thin_border_group" />
<group id="text_list"
posref="TL TL"
x="12"
y="-4"
sizeref="w"
max_h="380"
child_resize_h="true" >
<view type="bitmap" id="icon1" posref="TL TL" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text1" posref="TR TL" posparent="icon1" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info1" posref="BL TL" color="55 205 55 205" posparent="text1" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but1" posparent="icon1" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(1)" onclick_l="lua" params_l="RyzhomeBar:useItem(1)" />
<view type="bitmap" id="icon2" posparent="but1" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text2" posref="TR TL" posparent="icon2" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info2" posref="BL TL" color="55 205 55 205" posparent="text2" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but2" posparent="icon2" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(2)" onclick_l="lua" params_l="RyzhomeBar:useItem(2)" />
<view type="bitmap" id="icon3" posparent="but2" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text3" posref="TR TL" posparent="icon3" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info3" posref="BL TL" color="55 205 55 205" posparent="text3" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but3" posparent="icon3" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(3)" onclick_l="lua" params_l="RyzhomeBar:useItem(3)" />
<view type="bitmap" id="icon4" posparent="but3" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text4" posref="TR TL" posparent="icon4" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info4" posref="BL TL" color="55 205 55 205" posparent="text4" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but4" posparent="icon4" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(4)" onclick_l="lua" params_l="RyzhomeBar:useItem(4)" />
<view type="bitmap" id="icon5" posparent="but4" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text5" posref="TR TL" posparent="icon5" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info5" posref="BL TL" color="55 205 55 205" posparent="text5" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but5" posparent="icon5" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(5)" onclick_l="lua" params_l="RyzhomeBar:useItem(5)" />
<view type="bitmap" id="icon6" posparent="but5" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text6" posref="TR TL" posparent="icon6" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info6" posref="BL TL" color="55 205 55 205" posparent="text6" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but6" posparent="icon6" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(6)" onclick_l="lua" params_l="RyzhomeBar:useItem(6)" />
<view type="bitmap" id="icon7" posparent="but6" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text7" posref="TR TL" posparent="icon7" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info7" posref="BL TL" color="55 205 55 205" posparent="text7" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but7" posparent="icon7" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(7)" onclick_l="lua" params_l="RyzhomeBar:useItem(7)" />
<view type="bitmap" id="icon8" posparent="but7" posref="BL TL" y="-4" texture="r2ed_toolbar_freeze.tga" global_color="false" />
<view type="text" id="text8" posref="TR TL" posparent="icon8" fontsize="10" x="5" y="-5" hardtext="" />
<view type="text" id="info8" posref="BL TL" color="55 205 55 205" posparent="text8" fontsize="10" x="10" y="-5" hardtext="" />
<ctrl type="button" id="but8" posparent="icon8" style="button_over" onover="lua" params_over="RyzhomeBar:highlightItem(8)" onclick_l="lua" params_l="RyzhomeBar:useItem(8)" />
</group>
<ctrl style="skin_scroll"
id="scroll_row"
posref="TL TL"
target_stepy="44"
target="text_list" />
<group id="list"
max_sizeref="h"
max_sizeparent="parent"
max_h="0"
sizeref="w"
posref="TL TL"
x="8"
y="0"
w="-16" />
</group>
</group>
</group>
<tree node="webig_ryzhome_list_item"></tree>
<template name="t_webig_ryzhome_button">
<ctrl type="button"
button_type="push_button"
id="#id"
posref="TL TL"
x="#x"
y="#y"
tx_normal="#tx_normal"
global_color="false"
tooltip="#tooltip"
onclick_l="lua"
params_l="#params_l"/>
<view type="bitmap"
id="i_#id"
posref="TL TL"
x="#x"
y="#y"
rot="#rot"
texture="#texture"
global_color="false"/>
</template>
<group type="container"
id="webig_ryzhome_place_item"
x="0" y="0" w="200" h="140" posref="TL TL"
title=""
global_color="true"
global_color_over="true"
header_active="false"
right_button="false"
options="layer0_pad"
movable="true"
active="true"
opened="true"
openable="false"
resizer="false">
<group id="header_closed" x="0" y="0" w="0" h="0" posref="TL TL"></group>
<group id="header_opened" x="0" y="0" w="0" h="0" wmin="5" sizeref="w" posref="TL TL"></group>
<group id="content" x="0" y="0" w="400" h="140" posref="TL TL">
<view type="text"
id="item"
posref="TL TL"
x="2"
y="-4"
color="255 255 255 255"
shadow="true"
global_color="false"
fontsize="10"
hardtext="" />
<ctrl style="text_button_16"
id="quit"
posref="TR TR"
x="-2"
y="-2"
hardtext="uiClose"
onclick_l="lua"
params_l="RyzhomePlace:close()" />
<!--
<view type="bitmap" id="black" x="2" y="0" w="200" h="150" posref="ML ML" inherit_gc_alpha="true" scale="true" texture="blank.tga" color="0 0 0 240"/>
<scene3d id="scene3d" x="2" y="0" w="200" h="150" posref="ML ML" curcam="cam" curcs="env" render_layer="-2" active="false"
user_interaction="true" rotz_factor="0.017"
roty_factor="0.005" roty_limit_min="-80" roty_limit_max="90"
dist_factor="0.05" dist_limit_min="1" dist_limit_max="20.0"
ambient="128 96 64" sun_ambient="0 0 0" sun_diffuse="255 255 196" sun_specular="0 0 0" sun_direction="-1.0 1.0 -1.0" >
<camera id="cam" fov="80" pos="0.0 20.0 0" target="0.0 26.5 2" roll="0" />
<light id="back" pos="0.0 28.2 1.6" color="255 255 255" near="2.5" far="4.0" />
<light id="lgt" pos="0.0 25.3 2.48" color="255 255 255" near="3.0" far="4.0" />
<shape id="shape" name="" pos="0.0 26.5 0.0" rot="0.0 0.0 0.0" />
</scene3d>
-->
<group id="movers" x="0" y="-4" w="182" h="140" posref="MM MM">
<instance template="t_webig_ryzhome_button" id="previous_x2" rot="2" x="2" y="-16" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(-0.1, 0, 0)" />
<instance template="t_webig_ryzhome_button" id="previous_x" rot="2" x="32" y="-16" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(-0.01, 0, 0)" />
<view type="text" id="x" posref="TL TL" x="76" y="-20" color="255 255 255 255" shadow="true" global_color="false" fontsize="10" hardtext="Axe X" />
<instance template="t_webig_ryzhome_button" id="next_x" rot="0" x="130" y="-16" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0.01, 0, 0)" />
<instance template="t_webig_ryzhome_button" id="next_x2" rot="0" x="160" y="-16" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0.1, 0, 0)" />
<instance template="t_webig_ryzhome_button" id="previous_y2" rot="2" x="2" y="-34" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, -0.1, 0)" />
<instance template="t_webig_ryzhome_button" id="previous_y" rot="2" x="32" y="-34" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, -0.01, 0)" />
<view type="text" id="y" posref="TL TL" x="76" y="-38" color="255 255 255 255" shadow="true" global_color="false" fontsize="10" hardtext="Axe Y" />
<instance template="t_webig_ryzhome_button" id="next_y" rot="0" x="130" y="-34" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, 0.01, 0)" />
<instance template="t_webig_ryzhome_button" id="next_y2" rot="0" x="160" y="-34" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, 0.1, 0)" />
<instance template="t_webig_ryzhome_button" id="previous_z2" rot="2" x="2" y="-52" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, 0, -0.1, 0)" />
<instance template="t_webig_ryzhome_button" id="previous_z" rot="2" x="32" y="-52" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, 0, -0.01, 0)" />
<view type="text" id="z" posref="TL TL" x="76" y="-58" color="255 255 255 255" shadow="true" global_color="false" fontsize="10" hardtext="Axe Z" />
<instance template="t_webig_ryzhome_button" id="next_z" rot="0" x="130" y="-52" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, 0, 0.01, 0)" />
<instance template="t_webig_ryzhome_button" id="next_z2" rot="0" x="160" y="-52" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:move(0, 0, 0.1, 0)" />
<instance template="t_webig_ryzhome_button" id="previous_a2" rot="2" x="2" y="-70" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:rot(-0.1)" />
<instance template="t_webig_ryzhome_button" id="previous_a" rot="2" x="32" y="-70" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:rot(-0.01)" />
<view type="text" id="a" posref="TL TL" x="76" y="-76" color="255 255 255 255" shadow="true" global_color="false" fontsize="10" hardtext="Angle" />
<instance template="t_webig_ryzhome_button" id="next_a" rot="0" x="130" y="-70" tooltip="ll" texture="mp3_button_play.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:rot(0.01)" />
<instance template="t_webig_ryzhome_button" id="next_a2" rot="0" x="160" y="-70" tooltip="ll" texture="mp3_button_next.tga" tx_normal="mp3_button_play.tga" params_l="RyzhomePlace:rot(0.1)" />
</group>
<ctrl style="text_button_16"
id="validate"
posref="BR BR"
x="-2"
y="2"
hardtext="reset"
onclick_l="lua"
params_l="RyzhomePlace:apply()" />
<ctrl style="text_button_16"
id="reset"
posref="ML MR"
posparent="validate"
x="-2"
y="0"
hardtext="reset"
onclick_l="lua"
params_l="RyzhomePlace:reset()" />
</group>
</group>
<tree node="webig_ryzhome_place_item"></tree>
</interface_config>

View file

@ -0,0 +1,604 @@
--- Parse interface of ark_scene_editor_edit_menu ---
local script = [[<interface_config>
<root id="interface" x="0" y="0" w="800" h="600" active="true"/>
<group type="menu" id="ark_scene_editor_edit_menu" extends="base_menu" mouse_pos="true">
</group>
</interface_config>]]
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('<font color="#aa00000">'..self.T["no_selected_group"]..'</font>', '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 '<table width="100%" cellspacing="0" cellpadding="0"><tr bgcolor="'..color..'"><td align="center" valign="middle"><font color="#FFFFFF" size="12">'..message..'</font></td></tr></table>'
end
function SceneEditor:get_html(message, message_bg)
debug("get_html :"..message)
local new_group = '&nbsp;&nbsp;<a class="ryzom-ui-button" href="'..self.baseUrl..'_AddGroup&amp;add_new_group=1&amp;scene_id='..self.sceneId..'"><img src="'..self.iconsUrl..'/32/chart_organisation_add.png" alt="'..self.T["add_new_group"]..'" /></a>'
local show_hide_cols = '&nbsp;&nbsp;<a class="ryzom-ui-button" href="ah:ark_pacs_borders"><img src="'..self.iconsUrl..'/32/show_hide_cols.png" alt="'..self.T["show_hide_cols"]..'" /></a>'
local reset_scene = '</td><td align="center" bgcolor="#502020" width="40px"><a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;reset_scene=1&amp;scene_id='..self.sceneId..'"><img src="'..self.iconsUrl..'/32/bin.png" alt="'..self.T["reset_scene"]..'" /></a>'
local html = '<header><title>'..self.T["sceno_editor"]..'</title></header>'..self:get_html_section(message..'</td><td bgcolor="#202020" align="center" height="40px" width="140px" valign="middle">'..new_group..show_hide_cols..reset_scene, (message_bg or SceneEditor:get_random_color()))
html = html .. '<form action="'..self.baseUrl..'_SaveShapes" method="POST"><input type="hidden" name="group" value="'..(self.LastEditedGroup or "")..'" /><input type="hidden" name="scene_id" value="'..self.sceneId..'" />\
<table width="100%" cellspacing="0" cellpadding="0">'
local groups = self:getShapesByGroups()
for group, shapes in pairsByKeys(self.Groups) do
debug("Group : "..group)
local groupname = group
html = html .. '<tr bgcolor="#444444"><td height="20px"><table width="100%"><tr><td>&nbsp;'..groupname..' ('..(self.Groups[group].props.count or '0')..') </td><td align="right"><input type="hidden" name="shape[]", value="#"/>'
if self.Groups[group].props.show then
debug("Group : show")
if self.Groups[group].props.edit then
html = html .. '<a href="ah:lua:SceneEditor:show_shape_list()"><img src="'..self.iconsUrl..'/16/box_add.png" alt="'..self.T["add_shape"]..'"/></a></td><td align="right">'
if self.HaveUpdate then
html = html .. '<a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;hide_group='..group..'&amp;edit_group='..group..'">'..self.T["cancel"]..'</a>'
else
html = html .. '<a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;hide_group='..group..'">'..self.T["hide"]..'</a>'
end
else
html = html .. '<a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;hide_group='..group..'">'..self.T["hide"]..'</a>'
end
else
html = html .. '<a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;show_group='..group..'">'..self.T["show"]..'</a>'
end
local shapes_html = ""
local show = self.Groups[group].props.show
if self.Groups[group].props.edit then
shapes_id = groups[group]
if shapes_id then
for k,shape_id in pairs(shapes_id) do
shape = {}
if self.Shapes[shape_id] then
shape["db_id"] = self.Shapes[shape_id].db_id
shape["file"] = self.Shapes[shape_id].file
shape["pos"] = self:get_vector(getShapePos(shape_id))
scale_x, scale_y, scale_z = getShapeScale(shape_id)
shape["rot"] = self:get_vector(getShapeRot(shape_id))
colpos_x, colpos_y, colpos_z = getShapeColPos(shape_id)
colscale_x, colscale_y, colscale_z = getShapeColScale(shape_id)
shape["setup"] = {}
shape["setup"]["scale x"] = scale_x
shape["setup"]["scale y"] = scale_y
shape["setup"]["scale z"] = scale_z
shape["setup"]["col pos x"] = shape["pos"][1]+colpos_x
shape["setup"]["col pos y"] = shape["pos"][2]+colpos_y
shape["setup"]["col size x"] = colscale_x
shape["setup"]["col size y"] = colscale_y
shape["setup"]["col size z"] = colscale_z
local color = "202020"
if k % 2 == 0 then
color = "101010"
end
local text_color = "ef9b64"
if self.Shapes[shape_id].modified == "modified" then
text_color = "aa5555"
else
if self.Shapes[shape_id].modified == "added" then
text_color = "55aa55"
end
end
shapes_html = shapes_html .. "<tr bgcolor='#"..color.."'><td height='20px'>&nbsp;<input type='hidden' name='shape[]', value='"..SceneEditor:enc64((shape.db_id or '')..":"..Json.encode(shape)).."' />"..'#'..(shape.db_id or '0').." <a href='ah:lua:SceneEditor:launch_menu("..tostring(shape_id)..")'><font color='#"..text_color.."'>"..shape.file.."</font></a></td>\
<td width='16px'><a href='ah:lua:SceneEditor:removeShape("..tostring(shape_id)..")'><img src='"..self.iconsUrl.."/16/cross.png' /></a></td>\
</tr>"
end
end
end
else
if self.HaveUpdate == nil then
html = html .. '&nbsp;&nbsp;<a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;edit_group='..group..'">'..self.T["edit"]..'</a>'
html = html .. '</td><td align="right"><a class="ryzom-ui-button" href="'..self.baseUrl..'_SaveShapes&amp;reset_scene=1&amp;del_group='..group..'">'..self.T["remove"]..'</a>'
end
end
if self.Groups[group].props.modified then
html = html .. '&nbsp;&nbsp;<input type="submit" value="'..self.T["save"]..'" />'
end
html = html .. '</td></tr></table></td><td></td></tr>'..shapes_html
end
html = html .. '</table></form>'
ui = getUI("ui:interface:ark_scene_editor:browser:content:html", false)
if ui then
ui:renderHtml(html)
end
end

View file

@ -4,6 +4,8 @@
<interface_config>
<root id="interface" x="0" y="0" w="800" h="600" active="true" />
<lua file="webig.lua" />
<lua file="json.lua" />
<lua file="sceneedit.lua" />
<!-- //////////// STYLE : webigchat_desc /////////// -->
<style style="webigchat_desc" type="text" fontsize="12" justification="dont_clip_word" color="0 0 0 255" global_color="false" multi_line="true" multi_line_space="0" line_maxw="320" multi_line_maxw_only="true" />