Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-03-16 19:15:11 +01:00
commit 114543ba07
10 changed files with 100 additions and 106 deletions

View file

@ -1963,14 +1963,15 @@ bool CFile::createEmptyFile (const std::string& filename)
bool CFile::fileExists (const string& filename) bool CFile::fileExists (const string& filename)
{ {
//H_AUTO(FileExists); //H_AUTO(FileExists);
#ifdef NL_OS_WINDOWS FILE *file = nlfopen(filename, "rb");
DWORD attr = GetFileAttributesW(utf8ToWide(filename));
// attributes are valid and file is not a directory if (file)
if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_DIRECTORY)) return false; {
fclose(file);
return true; return true;
#else }
return access(filename.c_str(), R_OK) != -1;
#endif return false;
} }

View file

@ -32,7 +32,7 @@ end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
function bgdownloader:setIcon(icon) function bgdownloader:setIcon(icon)
local bm = self:getProgressGroup():find("bm"); local bm = self:getProgressGroup():find("bm")
if icon == "" then if icon == "" then
bm.active = false bm.active = false
else else

View file

@ -4,7 +4,7 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (game==nil) then if (game==nil) then
game= {}; game = {}
end end
@ -12,14 +12,14 @@ end
-- called to construct guild flags background in the modal window -- called to construct guild flags background in the modal window
function game:bcCreateGuildInitFlags() function game:bcCreateGuildInitFlags()
local ui = getUICaller(); local ui = getUICaller()
for i = 0,14 do for i = 0,14 do
local uiBack = getUI(getUIId(ui) .. ':back' .. i); local uiBack = getUI(getUIId(ui) .. ':back' .. i)
uiBack.image1.back = i+1; uiBack.image1.back = i+1
uiBack.image1.symbol = 0; uiBack.image1.symbol = 0
uiBack.image1.color1 = runExpr('makeRGB(255,255,255)'); uiBack.image1.color1 = runExpr('makeRGB(255,255,255)')
uiBack.image1.color2 = runExpr('makeRGB(0,0,0)'); uiBack.image1.color2 = runExpr('makeRGB(0,0,0)')
end end
end end
@ -28,37 +28,37 @@ end
-- trap some parts should be deprecated ... try to clean it up -- trap some parts should be deprecated ... try to clean it up
function game:bcMissionsUpdate() function game:bcMissionsUpdate()
local mt = getDbProp('UI:TEMP:MISSION:MISSION_TYPE'); local mt = getDbProp('UI:TEMP:MISSION:MISSION_TYPE')
-- init bot_chat_missions title -- init bot_chat_missions title
local title = 'uiBotChatMissions'; local title = 'uiBotChatMissions'
if (mt == 3) then title = 'uiBotChatZCCharges'; if (mt == 3) then title = 'uiBotChatZCCharges'
elseif (mt == 4) then title = 'uiBotChatBuilding'; elseif (mt == 4) then title = 'uiBotChatBuilding'
elseif (mt == 5) then title = 'uiBotChatRMBuy'; elseif (mt == 5) then title = 'uiBotChatRMBuy'
elseif (mt == 6) then title = 'uiBotChatRMUpgrade'; elseif (mt == 6) then title = 'uiBotChatRMUpgrade'
end end
local ui = getUI('ui:interface:bot_chat_missions'); local ui = getUI('ui:interface:bot_chat_missions')
ui.title = title; ui.title = title
-- init desc -- init desc
title = 'uiSelectMission'; title = 'uiSelectMission'
if (mt == 3) then title = 'uiSelectZCCharge'; if (mt == 3) then title = 'uiSelectZCCharge'
elseif (mt == 4) then title = 'uiSelectBuilding'; elseif (mt == 4) then title = 'uiSelectBuilding'
elseif (mt == 5) then title = 'uiSelectRMBuy'; elseif (mt == 5) then title = 'uiSelectRMBuy'
elseif (mt == 6) then title = 'uiSelectRMUpgrade'; elseif (mt == 6) then title = 'uiSelectRMUpgrade'
end end
ui.header_opened.mission_title.hardtext = title; ui.header_opened.mission_title.hardtext = title
ui.header_opened.zc_duty.active = (mt == 3); ui.header_opened.zc_duty.active = (mt == 3)
ui.header_opened.xp_guild.active = ((mt == 5) or (mt == 6)); ui.header_opened.xp_guild.active = ((mt == 5) or (mt == 6))
-- init bot_chat_accept_mission title -- init bot_chat_accept_mission title
title = 'uiAcceptMission'; title = 'uiAcceptMission'
if (mt == 3) then title = 'uiAcceptZCCharge'; if (mt == 3) then title = 'uiAcceptZCCharge'
elseif (mt == 4) then title = 'uiAcceptBuilding'; elseif (mt == 4) then title = 'uiAcceptBuilding'
elseif (mt == 5) then title = 'uiAcceptRMBuy'; elseif (mt == 5) then title = 'uiAcceptRMBuy'
elseif (mt == 6) then title = 'uiAcceptRMUpgrade'; elseif (mt == 6) then title = 'uiAcceptRMUpgrade'
end end
ui = getUI('ui:interface:bot_chat_accept_mission'); ui = getUI('ui:interface:bot_chat_accept_mission')
ui.title = title; ui.title = title;
end end

View file

@ -3,36 +3,36 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (help==nil) then if (help==nil) then
help= {}; help = {}
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function help:closeCSBrowserHeader() function help:closeCSBrowserHeader()
local ui = getUI('ui:interface:cs_browser'); local ui = getUI('ui:interface:cs_browser')
-- save size -- save size
ui_cs_browser_h = ui.h; ui_cs_browser_h = ui.h
ui_cs_browser_w = ui.w; ui_cs_browser_w = ui.w
-- reduce window size -- reduce window size
ui.pop_min_h = 32; ui.pop_min_h = 32
ui.h = 0; ui.h = 0
ui.w = 216; ui.w = 216
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function help:openCSBrowserHeader() function help:openCSBrowserHeader()
local ui = getUI('ui:interface:cs_browser'); local ui = getUI('ui:interface:cs_browser')
ui.pop_min_h = 96; ui.pop_min_h = 96
-- set size from saved values -- set size from saved values
if (ui_cs_browser_h ~= nil) then if (ui_cs_browser_h ~= nil) then
ui.h = ui_cs_browser_h; ui.h = ui_cs_browser_h
end end
if (ui_cs_browser_w ~= nil) then if (ui_cs_browser_w ~= nil) then
ui.w = ui_cs_browser_w; ui.w = ui_cs_browser_w
end end
end end

View file

@ -20,15 +20,13 @@ end
-- Fyros -- Fyros
function outgame:getFyrosFirstName() function outgame:getFyrosFirstName()
local nbFyrosFirstNames = 0 local nbFyrosFirstNames = #fyrosFirstNames
for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end
return fyrosFirstNames[math.random(nbFyrosFirstNames)] return fyrosFirstNames[math.random(nbFyrosFirstNames)]
end end
function outgame:getFyrosLastName() function outgame:getFyrosLastName()
local nbFyrosLastNames = 0 local nbFyrosLastNames = #fyrosLastNames
for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end
return fyrosLastNames[math.random(nbFyrosLastNames)] return fyrosLastNames[math.random(nbFyrosLastNames)]
end end
@ -44,12 +42,10 @@ function outgame:getMatisFirstName(sex)
local FirstName = "" local FirstName = ""
if tonumber(dbNameSex) == 1 then if tonumber(dbNameSex) == 1 then
local nbMatisMaleFirstNames = 0 local nbMatisMaleFirstNames = #matisMaleFirstNames
for _ in pairs(matisMaleFirstNames) do nbMatisMaleFirstNames = nbMatisMaleFirstNames + 1 end
FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)] FirstName = matisMaleFirstNames[math.random(nbMatisMaleFirstNames)]
else else
local nbMatisFemaleFirstNames = 0 local nbMatisFemaleFirstNames = #matisFemaleFirstNames
for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end
FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)] FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)]
end end
@ -57,44 +53,37 @@ function outgame:getMatisFirstName(sex)
end end
function outgame:getMatisLastName() function outgame:getMatisLastName()
local nbMatisLastNames = #matisLastNames
local nbMatisLastNames = 0
for _ in pairs(matisLastNames) do nbMatisLastNames = nbMatisLastNames + 1 end
return matisLastNames[math.random(nbMatisLastNames)] return matisLastNames[math.random(nbMatisLastNames)]
end end
-- Tryker -- Tryker
function outgame:getTrykerFirstName() function outgame:getTrykerFirstName()
local nbTrykerFirstNames = 0 local nbTrykerFirstNames = #trykerFirstNames
for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end
return trykerFirstNames[math.random(nbTrykerFirstNames)] return trykerFirstNames[math.random(nbTrykerFirstNames)]
end end
function outgame:getTrykerLastName() function outgame:getTrykerLastName()
local nbTrykerLastNames = 0 local nbTrykerLastNames = #trykerLastNames
for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end
return trykerLastNames[math.random(nbTrykerLastNames)] return trykerLastNames[math.random(nbTrykerLastNames)]
end end
-- Zoraï -- Zoraï
function outgame:getZoraiFirstName() function outgame:getZoraiFirstName()
local nbFirstNamesOne = 0 local nbFirstNamesOne = #zoraiFirstNamesOne
for _ in pairs(zoraiFirstNamesOne) do nbFirstNamesOne = nbFirstNamesOne + 1 end
local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)] local FirstNameOne = zoraiFirstNamesOne[math.random(nbFirstNamesOne)]
local nbFirstNamesTwo = 0 local nbFirstNamesTwo = #zoraiFirstNamesTwo
for _ in pairs(zoraiFirstNamesTwo) do nbFirstNamesTwo = nbFirstNamesTwo + 1 end
local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)] local FirstNameTwo = zoraiFirstNamesTwo[math.random(nbFirstNamesTwo)]
return FirstNameOne .. "-" .. FirstNameTwo return FirstNameOne .. "-" .. FirstNameTwo
end end
function outgame:getZoraiLastName() function outgame:getZoraiLastName()
local nbLastNames = 0 local nbLastNames = #zoraiLastNames
for _ in pairs(zoraiLastNames) do nbLastNames = nbLastNames + 1 end
return zoraiLastNames[math.random(nbLastNames)] return zoraiLastNames[math.random(nbLastNames)]
end end

View file

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

View file

@ -2,39 +2,39 @@
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- create the game namespace without reseting if already created in an other file. -- create the game namespace without reseting if already created in an other file.
if (game==nil) then if (game==nil) then
game= {}; game = {}
end end
------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------
-- --
function game:getMilkoTooltipWithKey(prop, tooltip, tooltip_pushed, name, param) function game:getMilkoTooltipWithKey(prop, tooltip, tooltip_pushed, name, param)
local tt; local tt
-- Check if button is toggled and choose the good tooltip -- Check if button is toggled and choose the good tooltip
if (prop ~= '' and tooltip_pushed ~= '') then if (prop ~= '' and tooltip_pushed ~= '') then
local db = getDbProp(prop); local db = getDbProp(prop)
if (db == 1) then if (db == 1) then
tt = tooltip_pushed; tt = tooltip_pushed
else else
tt = tooltip; tt = tooltip
end end
else else
tt = tooltip; tt = tooltip;
end end
-- Get key shortcut -- Get key shortcut
local text = i18n.get(tt); local text = i18n.get(tt)
local key = runExpr('getKey(\'' .. name .. '\',\'' .. param .. '\',1)'); local key = runExpr('getKey(\'' .. name .. '\',\'' .. param .. '\',1)')
if (key ~= nil and key ~= '') then if (key ~= nil and key ~= '') then
key = ' @{2F2F}(' .. key .. ')'; key = ' @{2F2F}(' .. key .. ')'
text = concatUCString(text, key); text = concatUCString(text, key)
end end
setContextHelpText(text); setContextHelpText(text)
end end
function game:taskbarDisableTooltip(ui) function game:taskbarDisableTooltip(ui)
local uiGroup = getUI(ui); local uiGroup = getUI(ui)
disableContextHelpForControl(uiGroup); disableContextHelpForControl(uiGroup)
end end

View file

@ -180,7 +180,7 @@ function webig:doRemoveDbSheetQuantity(sheet_list, ctrl)
end end
end end
--assert(nil, "RELOADABLE SCRIPT"); --assert(nil, "RELOADABLE SCRIPT")

View file

@ -922,21 +922,23 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
contentPrefix += "set RYZOM_CLIENT=\"%1\"\n"; contentPrefix += "set RYZOM_CLIENT=\"%1\"\n";
contentPrefix += "set UNPACKPATH=\"%2\"\n"; contentPrefix += "set UNPACKPATH=\"%2\"\n";
contentPrefix += "set ROOTPATH=\"%3\"\n"; contentPrefix += "set ROOTPATH=\"%3\"\n";
contentPrefix += "set STARTUPPATH=\"%4\"\n";
contentPrefix += toString("set UPGRADE_FILE=\"%%ROOTPATH%%\\%s\"\n", UpgradeBatchFilename.c_str()); contentPrefix += toString("set UPGRADE_FILE=\"%%ROOTPATH%%\\%s\"\n", UpgradeBatchFilename.c_str());
contentPrefix += "\n"; contentPrefix += "\n";
contentPrefix += "set LOGIN=%4\n"; contentPrefix += "set LOGIN=%5\n";
contentPrefix += "set PASSWORD=%5\n"; contentPrefix += "set PASSWORD=%6\n";
contentPrefix += "set SHARDID=%6\n"; contentPrefix += "set SHARDID=%7\n";
#else #else
contentPrefix += "#!/bin/sh\n"; contentPrefix += "#!/bin/sh\n";
contentPrefix += "export RYZOM_CLIENT=$1\n"; contentPrefix += "export RYZOM_CLIENT=$1\n";
contentPrefix += "export UNPACKPATH=$2\n"; contentPrefix += "export UNPACKPATH=$2\n";
contentPrefix += "export ROOTPATH=$3\n"; contentPrefix += "export ROOTPATH=$3\n";
contentPrefix += "export STARTUPPATH=$4\n";
contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str()); contentPrefix += toString("export UPGRADE_FILE=$ROOTPATH/%s\n", UpgradeBatchFilename.c_str());
contentPrefix += "\n"; contentPrefix += "\n";
contentPrefix += "LOGIN=$4\n"; contentPrefix += "LOGIN=$5\n";
contentPrefix += "PASSWORD=$5\n"; contentPrefix += "PASSWORD=$6\n";
contentPrefix += "SHARDID=$6\n"; contentPrefix += "SHARDID=$7\n";
#endif #endif
contentPrefix += "\n"; contentPrefix += "\n";
@ -958,7 +960,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
if (wantRyzomRestart) if (wantRyzomRestart)
{ {
// client shouldn't be in memory anymore else it couldn't be overwritten // client shouldn't be in memory anymore else it couldn't be overwritten
contentSuffix += toString("start \"\" /D \"%%ROOTPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str()); contentSuffix += toString("start \"\" /D \"%%STARTUPPATH%%\" \"%%RYZOM_CLIENT%%\" %s %%LOGIN%% %%PASSWORD%% %%SHARDID%%\n", additionalParams.c_str());
} }
#else #else
if (wantRyzomRestart) if (wantRyzomRestart)
@ -976,7 +978,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
if (wantRyzomRestart) if (wantRyzomRestart)
{ {
// change to previous client directory // change to previous client directory
contentSuffix += "cd \"$ROOTPATH\"\n\n"; contentSuffix += "cd \"$STARTUPPATH\"\n\n";
// launch new client // launch new client
contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str()); contentSuffix += toString("\"$RYZOM_CLIENT\" %s $LOGIN $PASSWORD $SHARDID\n", additionalParams.c_str());
@ -1017,10 +1019,25 @@ void CPatchManager::executeBatchFile()
std::string batchFilename; std::string batchFilename;
std::vector<std::string> arguments;
std::string startupPath = Args.getStartupPath();
// 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
batchFilename = CPath::standardizeDosPath(ClientRootPath); batchFilename = CPath::standardizeDosPath(ClientRootPath);
arguments.push_back(CPath::standardizeDosPath(RyzomFilename));
arguments.push_back(CPath::standardizeDosPath(ClientPatchPath));
arguments.push_back(CPath::standardizeDosPath(ClientRootPath));
arguments.push_back(CPath::standardizeDosPath(startupPath));
#else #else
batchFilename = ClientRootPath; batchFilename = ClientRootPath;
arguments.push_back(RyzomFilename);
arguments.push_back(ClientPatchPath);
arguments.push_back(ClientRootPath);
arguments.push_back(startupPath);
#endif #endif
batchFilename += UpdateBatchFilename; batchFilename += UpdateBatchFilename;
@ -1028,19 +1045,6 @@ void CPatchManager::executeBatchFile()
// make script executable // make script executable
CFile::setRWAccess(batchFilename); CFile::setRWAccess(batchFilename);
std::vector<std::string> arguments;
// 3 first parameters are Ryzom client full path, patch directory full path and client root directory full path
#ifdef NL_OS_WINDOWS
arguments.push_back(CPath::standardizeDosPath(RyzomFilename));
arguments.push_back(CPath::standardizeDosPath(ClientPatchPath));
arguments.push_back(CPath::standardizeDosPath(ClientRootPath));
#else
arguments.push_back(RyzomFilename);
arguments.push_back(ClientPatchPath);
arguments.push_back(ClientRootPath);
#endif
// append login, password and shard // append login, password and shard
if (!LoginLogin.empty()) if (!LoginLogin.empty())
{ {

View file

@ -10,6 +10,6 @@ fi
chmod +x "$ROOTPATH/ryzom_client" chmod +x "$ROOTPATH/ryzom_client"
chmod +x "$ROOTPATH/crash_report" chmod +x "$ROOTPATH/crash_report"
chmod +x "$ROOTPATH/ryzom_client_patcher" chmod +x "$ROOTPATH/ryzom_client_patcher"
chmod +x "$ROOTPATH/ryzom_configuration" chmod +x "$ROOTPATH/ryzom_configuration_qt"
exit 0 exit 0