From 72de8b044f12a18b3651e6469b959bef427fda19 Mon Sep 17 00:00:00 2001 From: deed Date: Fri, 14 Oct 2016 13:11:34 +0200 Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20jour=20data=20des=20modif=20cli?= =?UTF-8?q?ent=20v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../r2_core_user_component_manager.lua | 2 +- data/ryz/ryz_ring/r2_debug.lua | 3 +- data/ryz/ryz_ring/r2_features_default.lua | 2 +- data/ryz/ryz_ring/r2_features_easter_egg.lua | 2 +- data/ryz/ryz_ring/r2_logic.lua | 2 +- data/ryz/ryz_ring/r2_logic_entities.xml | 8 +- data/ryz/ryz_ring/r2_misc.lua | 49 +- data/ryz/ryz_ring/r2_translator.lua | 4 +- data/ryz/ryz_ring/r2_triggers.xml | 4 +- data/ryz/ryz_ring/r2_ui_char_tracking.lua | 2 +- data/ryz/ryz_ring/r2_ui_event_handlers.lua | 3 +- data/ryz/ryz_ring/r2_ui_forms.lua | 2 +- data/ryz/ryz_ring/r2_ui_player_tracking.lua | 2 +- data/ryz/ryz_ring/r2_ui_property_sheet.lua | 92 +-- data/ryz/ryz_ring/r2_unit_test.lua | 12 +- data/ryz/ryz_ring/r2ed.xml | 38 +- data/ryz/ryz_ring/r2ed_acts.xml | 10 +- data/ryz/ryz_ring/r2ed_scenario.xml | 4 +- data/ryz/ryz_zzz_bazaar/appzone.lua | 192 +++++ data/ryz/ryz_zzz_bazaar/appzone.xml | 257 ++++++ data/ryz/ryz_zzz_bazaar/compass.xml | 124 ++- data/ryz/ryz_zzz_bazaar/game_context_menu.xml | 2 +- data/ryz/ryz_zzz_bazaar/help.lua | 22 +- data/ryz/ryz_zzz_bazaar/interaction.lua | 72 +- data/ryz/ryz_zzz_bazaar/inventory.xml | 432 +++++++++- data/ryz/ryz_zzz_bazaar/login_config.xml | 2 + data/ryz/ryz_zzz_bazaar/out_v2_config.xml | 2 + data/ryz/ryz_zzz_bazaar/outgame_config.xml | 2 + data/ryz/ryz_zzz_bazaar/r2_logic_entities.xml | 574 +++++++++++++ data/ryz/ryz_zzz_bazaar/r2_triggers.xml | 780 ++++++++++++++++++ data/ryz/ryz_zzz_bazaar/taskbar.lua | 24 +- data/ryz/ryz_zzz_bazaar/taskbar.xml | 5 +- data/ryz/ryz_zzz_bazaar/webig.lua | 4 +- 33 files changed, 2520 insertions(+), 215 deletions(-) create mode 100644 data/ryz/ryz_zzz_bazaar/appzone.lua create mode 100644 data/ryz/ryz_zzz_bazaar/appzone.xml create mode 100644 data/ryz/ryz_zzz_bazaar/r2_logic_entities.xml create mode 100644 data/ryz/ryz_zzz_bazaar/r2_triggers.xml diff --git a/data/ryz/ryz_ring/r2_core_user_component_manager.lua b/data/ryz/ryz_ring/r2_core_user_component_manager.lua index 6769d503..4aa44548 100644 --- a/data/ryz/ryz_ring/r2_core_user_component_manager.lua +++ b/data/ryz/ryz_ring/r2_core_user_component_manager.lua @@ -1116,7 +1116,7 @@ function userComponentManager:export(list, refX, refY, refZ) messageBox(i18n.get("uiR2EDInvalidName")) return end - if string.find(form.ComponentFileName, '\.lua', -4) == nil then + if string.find(form.ComponentFileName, '.lua', -4) == nil then form.ComponentFileName = form.ComponentFileName .. ".lua" end local refPosition = form.RefPosition diff --git a/data/ryz/ryz_ring/r2_debug.lua b/data/ryz/ryz_ring/r2_debug.lua index 6a63b547..78501dca 100644 --- a/data/ryz/ryz_ring/r2_debug.lua +++ b/data/ryz/ryz_ring/r2_debug.lua @@ -140,7 +140,8 @@ end function assert(cond) if not cond then - rawDebugInfo(colorTag(255, 0, 255) .. "ASSERTION FAILED !! ") + -- rawDebugInfo(colorTag(255, 0, 255) .. "ASSERTION FAILED !! ") + rawDebugInfo("@{FOFF}ASSERTION FAILED !! ") dumpCallStack(2); error("") end diff --git a/data/ryz/ryz_ring/r2_features_default.lua b/data/ryz/ryz_ring/r2_features_default.lua index d64113c9..70d12938 100644 --- a/data/ryz/ryz_ring/r2_features_default.lua +++ b/data/ryz/ryz_ring/r2_features_default.lua @@ -371,7 +371,7 @@ local registerFeature = function () -------------------- convertToWidgetValue = function(value) - local result = math.mod(math.floor(180 * value / math.pi), 360) + local result = math.fmod(math.floor(180 * value / math.pi), 360) if result < 0 then result = 360 + result end return result end, diff --git a/data/ryz/ryz_ring/r2_features_easter_egg.lua b/data/ryz/ryz_ring/r2_features_easter_egg.lua index 3756d0ab..76b185f8 100644 --- a/data/ryz/ryz_ring/r2_features_easter_egg.lua +++ b/data/ryz/ryz_ring/r2_features_easter_egg.lua @@ -78,7 +78,7 @@ feature.Components.EasterEgg = function(value) local angle = value if angle == nil then angle = 0 end - local result = math.mod(math.floor(180 * angle / math.pi), 360) + local result = math.fmod(math.floor(180 * angle / math.pi), 360) if result < 0 then result = 360 + result end return result end, diff --git a/data/ryz/ryz_ring/r2_logic.lua b/data/ryz/ryz_ring/r2_logic.lua index 1ee35d56..d50a15fa 100644 --- a/data/ryz/ryz_ring/r2_logic.lua +++ b/data/ryz/ryz_ring/r2_logic.lua @@ -1679,7 +1679,7 @@ Logic.translateChatSequences = function (context, hlComponent, behavior, rtNpcGr event.Name = "activity_sequence_changed" table.insert(context.RtAct.Events, event) - local rtInitChatStep = r2.Translator.createAction("code", "oldChatStepVar = -1;\n" .. Logic.chatStepVar .." = 0;\n()setTimer(1, " ..Logic.chatTimerId .. ")\;\n") + local rtInitChatStep = r2.Translator.createAction("code", "oldChatStepVar = -1;\n" .. Logic.chatStepVar .." = 0;\n()setTimer(1, " ..Logic.chatTimerId .. ");\n") rtInitChatStep.Name = "init_chat_step" table.insert(context.RtAct.Actions, rtInitChatStep) table.insert(event.ActionsId, rtInitChatStep.Id) diff --git a/data/ryz/ryz_ring/r2_logic_entities.xml b/data/ryz/ryz_ring/r2_logic_entities.xml index 218d281b..b126c6f0 100644 --- a/data/ryz/ryz_ring/r2_logic_entities.xml +++ b/data/ryz/ryz_ring/r2_logic_entities.xml @@ -318,7 +318,7 @@ on_change_params="r2.events:initFilterMenu()" color_text="255 255 0 255" /> + text_y="0" onclick_l="lua" params_l="r2.events:newActionUI()" hardtext="uiR2EDAddAction" fontsize="10" text_color_normal="255 255 255 170" /> @@ -488,7 +488,7 @@ + text_y="0" onclick_l="lua" params_l="r2.events:newConditionUI()" hardtext="uiR2EDAddCondition" fontsize="10" text_color_normal="255 255 255 170" /> @@ -500,7 +500,7 @@ color="#col_pushed" col_over="#col_pushed" col_pushed="#col_pushed"/> + text_y="0" onclick_l="lua" params_l="r2.events:advancedEditor('true')" hardtext="Advanced..." fontsize="12" text_color_normal="255 255 255 150" /> diff --git a/data/ryz/ryz_ring/r2_misc.lua b/data/ryz/ryz_ring/r2_misc.lua index ee9e2885..d85744bd 100644 --- a/data/ryz/ryz_ring/r2_misc.lua +++ b/data/ryz/ryz_ring/r2_misc.lua @@ -28,6 +28,19 @@ function forEach(table, fn) end end + +------------------------------------------------------------------------------------------------------------ +-- whatever +table.setn = function(table, n) + assert(table) + local mt = getmetatable(table) + if mt ~= nil then + if mt.__next ~= nil then + table.Size = n + end + end +end + ------------------------------------------------------------------------------------------------------------ -- extension to table library : remove all content of a table without deleting the table object function table.clear(tbl) @@ -175,6 +188,17 @@ function strify(str) return [["]] .. tostring(str) .. [["]] end +------------------------------------------------------------------------------------------------- +-- enclose a string by double quotes +function strifyXml(str) + local strxml = string.gsub(tostring(str), ">", ">") + strxml = string.gsub(strxml, "<", "<") + strxml = string.gsub(strxml, "&", "&") + strxml = string.gsub(strxml, "'", "'") + strxml = string.gsub(strxml, '"', """) + return [["]] .. strxml .. [["]] +end + ------------------------------------------------------------------------------------------------------------ -- snap a position to ground, returning the z snapped coordinate function r2:snapZToGround(x, y) @@ -251,26 +275,37 @@ end -assert(table.getn ~= nil) -- default lib should have been opened +-- assert(table.getn ~= nil) -- default lib should have been opened + +--if oldTableGetnFunction == nil then +-- oldTableGetnFunction = table.getn +--end +-- +--table.getn = function(table) +-- assert(table) +-- local mt = getmetatable(table) +-- if mt ~= nil then +-- if mt.__next ~= nil then +-- return table.Size +-- end +-- end +-- return oldTableGetnFunction(table) +--end -if oldTableGetnFunction == nil then - oldTableGetnFunction = table.getn -end table.getn = function(table) assert(table) local mt = getmetatable(table) if mt ~= nil then if mt.__next ~= nil then - return table.Size + return table.Size end end - return oldTableGetnFunction(table) + return #table end - -- redefine the hardcoded 'pairs' function to use the redefined 'next' -- hardcoded version uses the C version of next, not the lua one if it has been redefined diff --git a/data/ryz/ryz_ring/r2_translator.lua b/data/ryz/ryz_ring/r2_translator.lua index 600928d9..e1c4701b 100644 --- a/data/ryz/ryz_ring/r2_translator.lua +++ b/data/ryz/ryz_ring/r2_translator.lua @@ -541,7 +541,7 @@ Translator.translateEventHandlers = function(context, hlNpc, eventHandlers, rtNp while k do local caller = nil if devMode then - caller = function (...) arg[1](arg[2], arg[3], arg[4], arg[5]) return true end + caller = function (...) local arg = {...} arg[1](arg[2], arg[3], arg[4], arg[5]) return true end else caller = pcall @@ -898,6 +898,7 @@ end -- Returns a RtNpcEventHandlerAction if the action is allowed --first parameter: action type Translator.createAction = function(...) + local arg = {...} local debug=config.R2EDExtendedDebug local function header(toto) @@ -2774,6 +2775,7 @@ end --third param : GroupsByName --then, parameters Translator.createEvent = function(...) + local arg = {...} local event = r2.newComponent("RtNpcEventHandler") local eventType = arg[1] event.Event = eventType diff --git a/data/ryz/ryz_ring/r2_triggers.xml b/data/ryz/ryz_ring/r2_triggers.xml index fce09b73..8647e779 100644 --- a/data/ryz/ryz_ring/r2_triggers.xml +++ b/data/ryz/ryz_ring/r2_triggers.xml @@ -196,7 +196,7 @@ + text_y="0" onclick_l="lua" params_l="#new_elt" hardtext="#new_elt_text" /> @@ -333,7 +333,7 @@ seq_color="" over_seq_color="" repeat_seq="" right_seq="" left_seq="" on_change="" > + text_y="0" onclick_l="lua" params_l="#new_seq" hardtext="#new_seq_text" /> \|]", "_") + local name = string.gsub(formInstance.Name, "[\\/:*?\"<>|]", "_") if name ~= formInstance.Name then fromInstance.Name = name formInstance.Modified = true diff --git a/data/ryz/ryz_ring/r2_ui_player_tracking.lua b/data/ryz/ryz_ring/r2_ui_player_tracking.lua index e64ca716..b9f6a367 100644 --- a/data/ryz/ryz_ring/r2_ui_player_tracking.lua +++ b/data/ryz/ryz_ring/r2_ui_player_tracking.lua @@ -613,7 +613,7 @@ function PlayerTracking:onDraw() local timeInSec = nltime.getLocalTime() / 1000 if self.WaitingList then - local waitText = i18n.get("uiRAP_WaitMsg" .. math.mod(os.time(), 3)) + local waitText = i18n.get("uiRAP_WaitMsg" .. math.fmod(os.time(), 3)) if not self.ListReceived then self:setInfoMessage(waitText) waitTextColor.A = 127 + 127 * (0.5 + 0.5 * math.cos(6 * timeInSec)) diff --git a/data/ryz/ryz_ring/r2_ui_property_sheet.lua b/data/ryz/ryz_ring/r2_ui_property_sheet.lua index 962eaf31..e4fbd463 100644 --- a/data/ryz/ryz_ring/r2_ui_property_sheet.lua +++ b/data/ryz/ryz_ring/r2_ui_property_sheet.lua @@ -47,13 +47,13 @@ function r2:buildEditBox(prop, textRef, entryType, multiLine, maxNumChars, onCha bg_texture="grey_40.tga" onchange="lua" onchange_params="getUICaller():setupDisplayText(); getUICaller():find('edit_text'):updateCoords(); getUICaller():getEnclosingContainer().Env.updateSize()" onenter="lua" on_focus_lost="lua"]] .. - [[ id= ]] .. strify(prop.Name) .. - [[ text_ref = ]] .. strify(textRef) .. - [[ entry_type = ]] .. strify(entryType) .. - [[ multi_line = ]] .. strify(multiLine) .. - [[ max_num_chars = ]] .. strify(maxNumChars) .. - [[ params = ]] .. strify(onChangeAction) .. - [[ on_focus_lost_params = ]] .. strify(onFocusLostAction) .. + [[ id= ]] .. strifyXml(prop.Name) .. + [[ text_ref = ]] .. strifyXml(textRef) .. + [[ entry_type = ]] .. strifyXml(entryType) .. + [[ multi_line = ]] .. strifyXml(multiLine) .. + [[ max_num_chars = ]] .. strifyXml(maxNumChars) .. + [[ params = ]] .. strifyXml(onChangeAction) .. + [[ on_focus_lost_params = ]] .. strifyXml(onFocusLostAction) .. "/>" return result end @@ -73,13 +73,13 @@ end -- bg_texture="grey_40.tga" -- onchange="lua" onchange_params="getUICaller():setupDisplayText(); getUICaller():find('edit_text'):updateCoords(); getUICaller():getEnclosingContainer().Env.updateSize()" -- onenter="lua" on_focus_lost="lua"]] .. --- [[ id= ]] .. strify(prop.Name) .. --- [[ text_ref = ]] .. strify(textRef) .. --- [[ entry_type = ]] .. strify(entryType) .. --- [[ multi_line = ]] .. strify(multiLine) .. --- [[ max_num_chars = ]] .. strify(maxNumChars) .. --- [[ params = ]] .. strify(onChangeAction) .. --- [[ on_focus_lost_params = ]] .. strify(onChangeAction) .. +-- [[ id= ]] .. strifyXml(prop.Name) .. +-- [[ text_ref = ]] .. strifyXml(textRef) .. +-- [[ entry_type = ]] .. strifyXml(entryType) .. +-- [[ multi_line = ]] .. strifyXml(multiLine) .. +-- [[ max_num_chars = ]] .. strifyXml(maxNumChars) .. +-- [[ params = ]] .. strifyXml(onChangeAction) .. +-- [[ on_focus_lost_params = ]] .. strifyXml(onChangeAction) .. -- [[ /> -- -- @@ -1043,7 +1043,7 @@ r2.WidgetStyles.Number = width1 = tmp end - local part0 = [[ ]] + local part0 = [[ ]] local tooltipTextId, tooltipTextIdFound = buildPropTooltipName(className, prop.Name) @@ -1051,7 +1051,7 @@ r2.WidgetStyles.Number = tooltip_parent="win" tooltip_posref="auto" instant_help="true" - tooltip=]] .. strify(tooltipTextId) .. ">" + tooltip=]] .. strifyXml(tooltipTextId) .. ">" part0 = part0 .. buildCoverAllButton(prop) local color = "255 255 255 255" @@ -1066,10 +1066,10 @@ r2.WidgetStyles.Number = end part0 = part0 .. [[ ]] + [[ id = ]] .. strifyXml(prop.Name .. "_Caption") .. + [[ hardtext = ]] .. strifyXml(hardText) .. + [[ color = ]] .. strifyXml(color) .. + [[ global_color=]] .. strifyXml(globalColor) .. [[ fontsize="12" shadow="true" auto_clamp="true"/> ]] part0 = part0 .. "" part0 = part0 .. "" @@ -1086,7 +1086,7 @@ r2.WidgetStyles.Number = -- local widgetXml = string.format([[ - " .. [[ + " .. [[ " result = result .. [[]] -- append enumerated values for k, v in pairs(prop.Enum) do - result = result .. [[]] + result = result .. [[]] end result = result .. "" return result, setter @@ -1201,10 +1201,10 @@ function r2:createPropertyXmlTable(props, className, posparent, posref, x, y, wi result = result .. value end add([[ ]] + part0 = [[ ]] part0 = part0 .. [[" + tooltip=]] .. strifyXml(tooltipTextId) .. ">" part0 = part0 .. [[ ]] + [[ id = ]] .. strifyXml(prop.Name .. "_Caption") .. + [[ hardtext = ]] .. strifyXml(hardText) .. + [[ color = ]] .. strifyXml(color) .. + [[ global_color=]] .. strifyXml(globalColor) .. [[ fontsize="12" shadow="true" auto_clamp="true"/> ]] part0 = part0 .. "" part0 = part0 .. "" else @@ -1268,13 +1268,13 @@ function r2:createPropertyXmlTable(props, className, posparent, posref, x, y, wi end -- build the widget - local part1 = [[ ]] + local part1 = [[ ]] part1 = part1 .. [[" + tooltip=]] .. strifyXml(tooltipTextId) .. ">" part1 = part1 .. widgetXmlDesc .. [[]] if invertWidget then @@ -1397,15 +1397,15 @@ function r2:buildPropRolloutXml(caption, id, posparent, posref, props, className -- add the rollout bar if not isForm then result = result .. - [[ ]] else result = result .. - [[ ]] end @@ -1475,9 +1475,9 @@ function r2:buildPropertySheetXml(class, className, id, title, isForm) if isForm then -- for forms, closing the form is equivalent to clicking on 'cancel' add(' resizer="true" ') local w = defaulting(class.Width, 500) - add(' pop_min_w=' .. strify(w)) - add(' pop_max_w=' .. strify(w)) - add(' w=' .. strify(w)) + add(' pop_min_w=' .. strifyXml(w)) + add(' pop_max_w=' .. strifyXml(w)) + add(' w=' .. strifyXml(w)) local cancelCode = [[ local form = getUICaller() if form.Env.Choice == nil then @@ -1518,7 +1518,7 @@ function r2:buildPropertySheetXml(class, className, id, title, isForm) - add([[id=]] .. strify(id) .. [[ + add([[id=]] .. strifyXml(id) .. [[ >]]) @@ -1647,7 +1647,7 @@ function r2:buildPropertySheetXml(class, className, id, title, isForm) - + ]]) diff --git a/data/ryz/ryz_ring/r2_unit_test.lua b/data/ryz/ryz_ring/r2_unit_test.lua index 572f2080..b48e3da5 100644 --- a/data/ryz/ryz_ring/r2_unit_test.lua +++ b/data/ryz/ryz_ring/r2_unit_test.lua @@ -36,7 +36,7 @@ UnitTest.testLoadAnimationScenarioUi = function() end local filename = form.LoadScenario_Name - if string.find(filename, '\.r2', -3) == nil then + if string.find(filename, '.r2', -3) == nil then local ui = r2:getForm("LoadScenario") ui.active = true @@ -134,12 +134,12 @@ UnitTest.testLoadScenarioUi = function() local ucName = ucstring() ucName:fromUtf8(form.LoadScenario_Name) local filename = tostring(ucName) - if string.find(filename, '\.r2', -3) == nil then + if string.find(filename, '.r2', -3) == nil then messageBox(i18n.get("uiR2EDLoadScenario_InvalidFileName")) return end --- if string.find(filename, '\.r2', -3) == nil then +-- if string.find(filename, '.r2', -3) == nil then -- filename = form.Name .. ".r2" -- end @@ -206,7 +206,7 @@ function UnitTest.saveScenario(name, overwrite) messageBox(i18n.get("uiR2EDInvalidName")) return end - if string.find(name, '\.r2', -3) == nil then + if string.find(name, '.r2', -3) == nil then name = name .. ".r2" end -- update scenario name with the new name @@ -1103,8 +1103,8 @@ end function t5() - local toto = "&ezr_חא'_\\)d //:1' 2 יייא'..)א\/:*?\"<>|א)@4 58ftgsfdg\"\/:*?\"<>|" - toto = string.gsub(toto, "[\\\/\:\*\?\"\<\>\|]", "_") + local toto = "&ezr_חא'_\\)d //:1' 2 יייא'..)א/:*?\"<>|א)@4 58ftgsfdg\"/:*?\"<>|" + toto = string.gsub(toto, "[\\/:*?\"<>|]", "_") end diff --git a/data/ryz/ryz_ring/r2ed.xml b/data/ryz/ryz_ring/r2ed.xml index d7567f31..54021b5b 100644 --- a/data/ryz/ryz_ring/r2ed.xml +++ b/data/ryz/ryz_ring/r2ed.xml @@ -77,7 +77,7 @@ - - @@ -1981,7 +1981,7 @@ text_y="-2" + text_y="0" onclick_l="lua" params_l="r2:changeView()" hardtext="uiR2EDChangeView" tooltip="" /> @@ -2131,7 +2131,7 @@ text_y="-2" + text_y="0" onclick_l="" params_l="" hardtext="uiR2EdCreateNew" tooltip="" /> --> @@ -2209,11 +2209,11 @@ text_y="-2" + text_y="0" onclick_l="lua" params_l="r2:randomEquipment()" hardtext="uiR2EdRandomEquipment" /> + text_y="0" onclick_l="lua" params_l="r2:randomColor()" hardtext="uiR2EdRandomColor" /> + text_y="0" hardtext="uiR2EdManageSets" onclick_l="proc" params_l="add_equipment_active" /> @@ -2230,7 +2230,7 @@ text_y="-2" @@ -2509,7 +2509,7 @@ text_y="-2" + text_y="0" onclick_l="lua" params_l="r2:preview()" hardtext="uiR2EdPreview" /> @@ -2628,7 +2628,7 @@ text_y="-2" + text_y="0" onclick_l="" params_l="" hardtext="uiR2EdAddList" tooltip="" /> @@ -2638,15 +2638,15 @@ text_y="-2" + text_y="0" onclick_l="leave_modal" params_l="" hardtext=" OK " tooltip="" /> + text_y="0" onclick_l="leave_modal" params_l="" hardtext=" CANCEL " tooltip="" /> + text_y="0" onclick_l="leave_modal" params_l="" hardtext=" UPDATE " tooltip="" /> @@ -2680,11 +2680,11 @@ text_y="-2" + text_y="0" onclick_l="lua" params_l="#add_params" hardtext="uiR2EdAdd" /> + text_y="0" onclick_l="lua" params_l="#random_params" hardtext="uiR2EdRandomSet" /> + text_y="0" onclick_l="lua" params_l="#update_params" hardtext="uiR2EdUpdate" /> + text_y="0" onclick_l="lua" params_l="#remove_params" hardtext="uiR2EdRemove" tooltip="" /> @@ -3072,7 +3072,7 @@ text_y="-2" /> - diff --git a/data/ryz/ryz_ring/r2ed_acts.xml b/data/ryz/ryz_ring/r2ed_acts.xml index 4c89edc2..bacc3a88 100644 --- a/data/ryz/ryz_ring/r2ed_acts.xml +++ b/data/ryz/ryz_ring/r2ed_acts.xml @@ -12,7 +12,7 @@ child_resize_h="true" child_resize_hmargin="0" > + text_y="0" onclick_l="lua" params_l="r2:showFilteredScenarios()" hardtext="OK" fontsize="10" /> diff --git a/data/ryz/ryz_zzz_bazaar/appzone.lua b/data/ryz/ryz_zzz_bazaar/appzone.lua new file mode 100644 index 00000000..1332eb3d --- /dev/null +++ b/data/ryz/ryz_zzz_bazaar/appzone.lua @@ -0,0 +1,192 @@ + +-- global +AppZone = { + id = "ui:interface:appzone", + homeuri = "?action=appzone_toolbar", + launchuri = "?action=launch_app", + addappuri = "?action=list_user_apps", + mode = "h_bar", + imagesize = 26 +} + +-- use client.cfg value when available +local uri getClientCfg("AppZoneUrl") +if uri == nil or uri == '' then + uri = 'http://app.ryzom.com/' +end + +AppZone.homeuri = uri .. AppZone.homeuri +AppZone.launchuri = uri .. AppZone.launchuri +AppZone.addappuri = uri .. AppZone.addappuri + +function AppZone:getRoot() + return getUI(self.id) +end + +function AppZone:onButtonHome() + local webig = getUI("ui:interface:webig") + webig:find("html").url = self.addappuri + webig.active = true +end + +function AppZone:calculateSize(count, spacer, mode) + local w, h + if mode == "h_bar" then + -- icon=32, space=2+2 + w = count * self.imagesize + spacer * 15 + w = w + 55 + 10 + 20 + h = self.imagesize + 2 + elseif mode == "h_box" then + w = count * self.imagesize + w = w + 20 + h = self.imagesize + 2 + h = h * spacer + h = h + 15 + elseif mode == "v_bar" then + -- icon=32, space=2+2 + h = count * self.imagesize + spacer * 15 + h = h + 20 + 20 + 12 + w = self.imagesize + 2 + 18 + else + h = count * self.imagesize + h = h + 20 + 25 + w = self.imagesize + 2 + w = w * spacer + w = w + 16 + end + + local ui = getUI("ui:interface") + if w > ui.w then + w = ui.w + end + if h > ui.h then + h = ui.h + end + + return w, h +end + +function AppZone:setElementCount(count,spacer,m) + self.mode = m + + local root = self:getRoot() + local content = root:find("content") + local html = root:find("html") + + local button_toggle = root:find("toggle_mode") + local button_reload = root:find("browse_reload") + local button_home = root:find("browse_home") + + local w, h = self:calculateSize(count, spacer, self.mode) + root.h = h + root.w = w + content.w = w + content.h = h + + -- set position of buttons + if self.mode == "h_bar" then + -- button_toggle.posref = "BL BL" + button_toggle.x = 2 + button_toggle.y = 0 + -- button_reload.posref = "TL BL" + html.x = 15 + html.y = 0 + button_reload.x = -25 + button_reload.y = -25 + -- button_home.posref = "BR BR" + button_home.x = 0 + button_home.y = -3 + 5 + elseif self.mode == "h_box" then + -- button_toggle.posref = "TL TL" + button_toggle.x = 2 + button_toggle.y = h - 15 + -- button_reload.posref = "TL BL" + html.x = 0 + html.y = -20 + button_reload.x = -25 + button_reload.y = -4 - 20 + -- button_home.posref = "BR BR" + button_home.x = 0 + button_home.y = -3 + h - 18 + elseif self.mode == "v_bar" then + -- button_toggle.posref = "TL TL" + button_toggle.x = 2 + button_toggle.y = h - 15 + -- button_reload.posref = "TL BL" + html.x = 0 + html.y = -20 + button_reload.x = 0 + button_reload.y = -4 + -- button_home.posref = "BR BR" + button_home.x = 4 - 7 + button_home.y = -3 + else + -- button_toggle.posref = "TL TL" + button_toggle.x = 2 + button_toggle.y = h - 15 + -- button_reload.posref = "TL BL" + html.x = 0 + html.y = -20 + button_reload.x = -25 + button_reload.y = -4 - 20 + -- button_home.posref = "BR BR" + button_home.x = 0 - w + 54 + 12 + button_home.y = -3 + end +end + +function AppZone:setMode(m) + self.mode = m + + self:reload() +end + +function AppZone:setActive(s) + self:getRoot().active = s +end + +function AppZone:launchApp(appid, appwin, appurl) + if not appwin then + if string.match(appid, "^[0-9]+$") then + appwin = "app" .. tostring(appid) + else + appwin = "webig" + end + end + + if not appurl then + appurl = self.launchuri .. "&appid=" .. tostring(appid) + end + + if WebBrowser then + WebBrowser:openWindow(appwin, appurl) + else + -- fallback if WebBrowser not present + local webig = getUI("ui:interface:webig") + webig:find("html").url = appurl; + webig.active = true + end +end + +function AppZone:reload() + local url = self.homeuri + url = url .. "&mode=" .. tostring(self.mode) + + local html = self:getRoot():find("html") + html.url = url +end + +-- slash command: /appzone +function AppZone:handle(cmd) + if cmd == 'show' then + self:setActive(true) + elseif cmd == 'hide' then + self:setActive(false) + elseif cmd == 'reload' then + self:reload() + elseif cmd == 'list' then + self:onButtonHome() + else + self:launchApp(cmd) + end +end diff --git a/data/ryz/ryz_zzz_bazaar/appzone.xml b/data/ryz/ryz_zzz_bazaar/appzone.xml new file mode 100644 index 00000000..51bc0417 --- /dev/null +++ b/data/ryz/ryz_zzz_bazaar/appzone.xml @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/ryz/ryz_zzz_bazaar/compass.xml b/data/ryz/ryz_zzz_bazaar/compass.xml index c2bd7a40..a88f49f4 100644 --- a/data/ryz/ryz_zzz_bazaar/compass.xml +++ b/data/ryz/ryz_zzz_bazaar/compass.xml @@ -8,7 +8,7 @@ - @@ -25,23 +25,38 @@ + + + + + + + + + + + - + + + params="volume=@UI:SAVE:MP3_VOLUME" /> + onclick_l="enter_modal" + params_l="group=ui:interface:playlist" + tooltip="uiMP3Playlist" /> @@ -645,7 +679,7 @@ id="dist" posref="BM BM" x="0" - y="0" + y="2" hardtext="uiRadarZoom0" shadow="true" color="255 255 255 255" @@ -694,7 +728,7 @@ id="range" posref="BM MM" x="0" - y="16" + y="20" hardtext="uiRadarZoom0" shadow="true" color="255 255 255 255" @@ -748,8 +782,8 @@ posref="BM BM" x="0" y="26" - w="44" - h="18" /> + w="46" + h="25" /> diff --git a/data/ryz/ryz_zzz_bazaar/help.lua b/data/ryz/ryz_zzz_bazaar/help.lua index 07a7fcd2..d6c6da72 100644 --- a/data/ryz/ryz_zzz_bazaar/help.lua +++ b/data/ryz/ryz_zzz_bazaar/help.lua @@ -3,36 +3,36 @@ ------------------------------------------------------------------------------------------------------------ -- create the game namespace without reseting if already created in an other file. if (help==nil) then - help= {}; + help = {} end ------------------------------------------------------------------------------------------------------------ -- function help:closeCSBrowserHeader() - local ui = getUI('ui:interface:cs_browser'); + local ui = getUI('ui:interface:cs_browser') -- save size - ui_cs_browser_h = ui.h; - ui_cs_browser_w = ui.w; + ui_cs_browser_h = ui.h + ui_cs_browser_w = ui.w -- reduce window size - ui.pop_min_h = 32; - ui.h = 0; - ui.w = 216; + ui.pop_min_h = 32 + ui.h = 0 + ui.w = 216 end ------------------------------------------------------------------------------------------------------------ -- function help:openCSBrowserHeader() - local ui = getUI('ui:interface:cs_browser'); - ui.pop_min_h = 96; + local ui = getUI('ui:interface:cs_browser') + ui.pop_min_h = 96 -- set size from saved values if (ui_cs_browser_h ~= nil) then - ui.h = ui_cs_browser_h; + ui.h = ui_cs_browser_h end if (ui_cs_browser_w ~= nil) then - ui.w = ui_cs_browser_w; + ui.w = ui_cs_browser_w end end \ No newline at end of file diff --git a/data/ryz/ryz_zzz_bazaar/interaction.lua b/data/ryz/ryz_zzz_bazaar/interaction.lua index d36486e9..489484ee 100644 --- a/data/ryz/ryz_zzz_bazaar/interaction.lua +++ b/data/ryz/ryz_zzz_bazaar/interaction.lua @@ -10,7 +10,7 @@ end ------------------------------------------------------------------------------------------------------------ -- called when server send an invitaion we receive a text id containing the string to display (invitor name) function game:onTeamInvation(textID) - + local ui = getUI('ui:interface:join_team_proposal'); ui.content.inside.invitor_name.textid = textID; ui.active = true; @@ -20,7 +20,7 @@ function game:onTeamInvation(textID) end ------------------------------------------------------------------------------------------------------------ --- +-- function game:teamInvitationAccept() local ui = getUI('ui:interface:join_team_proposal'); @@ -29,7 +29,7 @@ function game:teamInvitationAccept() end ------------------------------------------------------------------------------------------------------------ --- +-- function game:teamInvitationRefuse() local ui = getUI('ui:interface:join_team_proposal'); @@ -38,7 +38,7 @@ function game:teamInvitationRefuse() end ------------------------------------------------------------------------------------------------------------ --- +-- function game:switchChatTab(dbEntry) local db= 'UI:SAVE:ISENABLED:' .. dbEntry; local val= getDbProp(db); @@ -51,13 +51,13 @@ function game:switchChatTab(dbEntry) end ------------------------------------------------------------------------------------------------------------ --- +-- function game:updateEmoteMenu(prop, tooltip, tooltip_pushed, name, param) for i=0,9 do -- Get key shortcut local text = i18n.get('uiTalkMemMsg0' .. i); local key = runExpr( "getKey('talk_message','0" .. i .. "',1)" ); - + if (key ~= nil and key ~= '') then key = ' @{T25}@{2F2F}(' .. key .. ')'; text = concatUCString(text, key); @@ -67,11 +67,11 @@ function game:updateEmoteMenu(prop, tooltip, tooltip_pushed, name, param) local uiQC= getUI("ui:interface:user_chat_emote_menu:quick_chat:" .. "qc" .. i); uiQC.uc_hardtext_format= text; end - + end ------------------------------------------------------------------------------------------------------------ --- +-- if (ui_free_chat_h == nil) then ui_free_chat_h = {} end @@ -81,14 +81,14 @@ if (ui_free_chat_w == nil) then end ------------------------------------------------------------------------------------------------------------ --- +-- function game:closeTellHeader(uiID) local ui = getUI('ui:interface:' .. uiID); - + -- save size ui_free_chat_h[uiID] = ui.h; ui_free_chat_w[uiID] = ui.w; - + -- reduce window size ui.pop_min_h = 32; ui.h = 0; @@ -96,7 +96,7 @@ function game:closeTellHeader(uiID) end ------------------------------------------------------------------------------------------------------------ --- +-- function game:openTellHeader(uiID) local ui = getUI('ui:interface:' .. uiID); ui.pop_min_h = 96; @@ -105,7 +105,7 @@ function game:openTellHeader(uiID) if (ui_free_chat_h[uiID] ~= nil) then ui.h = ui_free_chat_h[uiID]; end - + if (ui_free_chat_w[uiID] ~= nil) then ui.w = ui_free_chat_w[uiID]; end @@ -127,12 +127,12 @@ local function levelToForceRegion(level) return 6 else return math.floor(level / 50) + 2 - end -end + end +end local function levelToLevelForce(level) - return math.floor(math.fmod(level, 50) * 5 / 50) + 1 -end + return math.floor(math.fmod(level, 50) * 5 / 50) + 1 +end @@ -186,7 +186,7 @@ end local function twIsTargetPlayer() if config.Local == 1 then return twTargetPlayer - else + else return isTargetPlayer() end end @@ -195,7 +195,7 @@ end local function twIsPlayerInPVPMode() if config.Local == 1 then return twPlayerInPVPMode - else + else return isPlayerInPVPMode() end end @@ -204,7 +204,7 @@ end local function twIsTargetInPVPMode() if config.Local == 1 then return twTargetInPVPMode - else + else return isTargetInPVPMode() end end @@ -219,17 +219,16 @@ end function game:updateTargetConsiderUI() --debugInfo("Updating consider widget") - - local targetWindow = getUI("ui:interface:target") - -- + local targetWindow = getUI("ui:interface:target") + -- local wgTargetSlotForce = targetWindow:find("slot_force") local wgTargetLevel = targetWindow:find("target_level") local wgImpossible = targetWindow:find("impossible") local wgSlotRing = targetWindow:find("slot_ring") local wgToolTip = targetWindow:find("target_tooltip") - local wgPvPTag = targetWindow:find("pvp_tags") - local wgHeader = targetWindow:find("header_opened") - + local wgPvPTag = targetWindow:find("pvp_tags") + local wgHeader = targetWindow:find("header_opened") + wgTargetSlotForce.active = true wgImpossible.active = true @@ -238,7 +237,7 @@ function game:updateTargetConsiderUI() wgTargetSlotForce.active = false wgTargetLevel.active = false wgImpossible.active = false - wgSlotRing.active = false + wgSlotRing.active = false if (isTargetUser() and twIsPlayerInPVPMode()) then wgToolTip.tooltip = "" wgPvPTag.active = true @@ -289,14 +288,14 @@ function game:updateTargetConsiderUI() local impossible = (twGetTargetLevel() - twGetPlayerLevel() > maxDiffLevel) wgSlotRing.active = false - + if impossible then -- targeted object is too hard too beat, display a skull wgTargetLevel.active = false wgImpossible.y = -5 wgImpossible.color = "255 50 50 255" else - -- player can see the level of the targeted creature + -- player can see the level of the targeted creature wgTargetLevel.active = true wgImpossible.y = 6 wgTargetLevel.hardtext = tostring(twGetTargetLevel()) @@ -310,7 +309,7 @@ function game:updateTargetConsiderUI() wgImpossible.texture = getDefine("force_level_" .. tostring(levelForce)) wgImpossible.active = true - if levelForce < 6 then + if levelForce < 6 then wgToolTip.tooltip = i18n.get("uittConsiderTargetLevel") elseif levelForce == 6 then -- Named creature @@ -343,7 +342,6 @@ function game:updateTargetConsiderUI() if impossible then wgToolTip.tooltip = concatUCString(wgToolTip.tooltip, ucstring("\n"), i18n.get("uittConsiderUnknownLevel")) end - end ---------------------- @@ -506,18 +504,18 @@ function twGroup(groupSize) else setDbProp("SERVER:GROUP:" .. tostring(gm) .. ":PRESENT", 0) end - end + end end ------------------------------------------------------------------------------------------------------------ --- +-- function game:closeWebIGBrowserHeader() local ui = getUI('ui:interface:webig'); - + -- save size ui_webig_browser_h = ui.h; ui_webig_browser_w = ui.w; - + -- reduce window size ui.pop_min_h = 32; ui.h = 0; @@ -525,7 +523,7 @@ function game:closeWebIGBrowserHeader() end ------------------------------------------------------------------------------------------------------------ --- +-- function game:openWebIGBrowserHeader() local ui = getUI('ui:interface:webig'); ui.pop_min_h = 96; @@ -534,7 +532,7 @@ function game:openWebIGBrowserHeader() if (ui_webig_browser_h ~= nil) then ui.h = ui_webig_browser_h; end - + if (ui_webig_browser_w ~= nil) then ui.w = ui_webig_browser_w; end diff --git a/data/ryz/ryz_zzz_bazaar/inventory.xml b/data/ryz/ryz_zzz_bazaar/inventory.xml index 83a8dc08..e9ff0719 100644 --- a/data/ryz/ryz_zzz_bazaar/inventory.xml +++ b/data/ryz/ryz_zzz_bazaar/inventory.xml @@ -27,6 +27,15 @@ + + + + + + + + + @@ -44,6 +53,83 @@ onclick_l="proc" params_l="inv_left_click_on_slot" auto_grayed="false" /> + + + + +