Changed: Minor changes (spaces replaced by tabs)

This commit is contained in:
kervala 2016-03-14 23:58:58 +01:00
parent a7874615d4
commit d2bc560ca8
2 changed files with 427 additions and 422 deletions

View file

@ -20,90 +20,93 @@ end
-- Fyros -- Fyros
function outgame:getFyrosFirstName() function outgame:getFyrosFirstName()
local nbFyrosFirstNames = 0; local nbFyrosFirstNames = 0;
for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end for _ in pairs(fyrosFirstNames) do nbFyrosFirstNames = nbFyrosFirstNames + 1 end
return fyrosFirstNames[math.random(nbFyrosFirstNames)] return fyrosFirstNames[math.random(nbFyrosFirstNames)]
end end
function outgame:getFyrosLastName()
local nbFyrosLastNames = 0;
for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end
return fyrosLastNames[math.random(nbFyrosLastNames)] function outgame:getFyrosLastName()
local nbFyrosLastNames = 0;
for _ in pairs(fyrosLastNames) do nbFyrosLastNames = nbFyrosLastNames + 1 end
return fyrosLastNames[math.random(nbFyrosLastNames)]
end end
-- Matis -- Matis
function outgame:getMatisFirstName(sex) function outgame:getMatisFirstName(sex)
local dbNameSex = getDbProp("UI:TEMP:NAME_SEX"); -- 1 = male, 2 = female
local dbNameSex = getDbProp("UI:TEMP:NAME_SEX");
if sex ~= nil then if sex ~= nil then
dbNameSex = sex; dbNameSex = sex;
end end
local FirstName = "" local FirstName = ""
if tonumber( dbNameSex )== 1 then if tonumber(dbNameSex) == 1 then
local nbMatisMaleFirstNames = 0; local nbMatisMaleFirstNames = 0;
for _ in pairs(matisMaleFirstNames) do nbMatisMaleFirstNames = nbMatisMaleFirstNames + 1 end 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 = 0;
for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end for _ in pairs(matisFemaleFirstNames) do nbMatisFemaleFirstNames = nbMatisFemaleFirstNames + 1 end
FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)]; FirstName = matisFemaleFirstNames[math.random(nbMatisFemaleFirstNames)];
end end
return FirstName; return FirstName;
end end
function outgame:getMatisLastName() function outgame:getMatisLastName()
local nbMatisLastNames = 0; local nbMatisLastNames = 0;
for _ in pairs(matisLastNames) do nbMatisLastNames = nbMatisLastNames + 1 end 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 = 0;
for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end for _ in pairs(trykerFirstNames) do nbTrykerFirstNames = nbTrykerFirstNames + 1 end
return trykerFirstNames[math.random(nbTrykerFirstNames)] return trykerFirstNames[math.random(nbTrykerFirstNames)]
end end
function outgame:getTrykerLastName()
local nbTrykerLastNames = 0;
for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end
return trykerLastNames[math.random(nbTrykerLastNames)] function outgame:getTrykerLastName()
local nbTrykerLastNames = 0;
for _ in pairs(trykerLastNames) do nbTrykerLastNames = nbTrykerLastNames + 1 end
return trykerLastNames[math.random(nbTrykerLastNames)]
end end
-- Zoraï -- Zoraï
function outgame:getZoraiFirstName() function outgame:getZoraiFirstName()
local nbFirstNamesOne = 0; local nbFirstNamesOne = 0;
for _ in pairs(zoraiFirstNamesOne) do nbFirstNamesOne = nbFirstNamesOne + 1 end 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 = 0;
for _ in pairs(zoraiFirstNamesTwo) do nbFirstNamesTwo = nbFirstNamesTwo + 1 end 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 = 0;
for _ in pairs(zoraiLastNames) do nbLastNames = nbLastNames + 1 end for _ in pairs(zoraiLastNames) do nbLastNames = nbLastNames + 1 end
return zoraiLastNames[math.random(nbLastNames)] return zoraiLastNames[math.random(nbLastNames)]
end end
function outgame:procGenerateName() function outgame:procGenerateName()
local uiNameFull = getUI("ui:outgame:appear_name:name_full"); local uiNameFull = getUI("ui:outgame:appear_name:name_full");
local uiGenText = getUI("ui:outgame:appear_name:eb"); local uiGenText = getUI("ui:outgame:appear_name:eb");
local dbNameRace = getDbProp("UI:TEMP:NAME_RACE"); local dbNameRace = getDbProp("UI:TEMP:NAME_RACE");
local dbNameSubRace = getDbProp("UI:TEMP:NAME_SUB_RACE"); local dbNameSubRace = getDbProp("UI:TEMP:NAME_SUB_RACE");
local dbNameSubRace2 = getDbProp("UI:TEMP:NAME_SUB_RACE2"); local dbNameSubRace2 = getDbProp("UI:TEMP:NAME_SUB_RACE2");
local nameResult = ""; local nameResult = "";
local fullnameResult = ""; local fullnameResult = "";
-- Look at outgame:procUpdateNameRaceLabel() for the "race" list. -- Look at outgame:procUpdateNameRaceLabel() for the "race" list.
-- fy ma try zo --> -- fy ma try zo -->
@ -175,31 +178,35 @@ function outgame:procGenerateName()
uiNameFull.hardtext = fullnameResult; uiNameFull.hardtext = fullnameResult;
nameResult = string.gsub(nameResult, "'", ""); uiNameFull.hardtext = fullnameResult;
nameResult = string.gsub(nameResult, " ", "");
nameResult = string.gsub(nameResult, "-", ""); nameResult = string.gsub(nameResult, "'", "");
nameResult = string.lower( nameResult ); nameResult = string.gsub(nameResult, " ", "");
nameResult = nameResult:gsub("^%l", string.upper); nameResult = string.gsub(nameResult, "-", "");
uiGenText.input_string = nameResult; nameResult = string.lower( nameResult );
nameResult = nameResult:gsub("^%l", string.upper);
uiGenText.input_string = nameResult;
end end
-- Name sex slider update. -- Name sex slider update.
function outgame:procUpdateNameSexLabel() function outgame:procUpdateNameSexLabel()
local nameSexType = { "uiCP_Sex_Male", "uiCP_Sex_Female" } local nameSexType = { "uiCP_Sex_Male", "uiCP_Sex_Female" }
local uiNameSexText = getUI("ui:outgame:appear_name:name_sex_slider:name_sex"); local uiNameSexText = getUI("ui:outgame:appear_name:name_sex_slider:name_sex");
local uiNameSex = getDbProp("UI:TEMP:NAME_SEX"); local uiNameSex = getDbProp("UI:TEMP:NAME_SEX");
tempstr = tostring(i18n.get(nameSexType[tonumber(uiNameSex)])); tempstr = tostring(i18n.get(nameSexType[tonumber(uiNameSex)]));
tempstr = string.lower( tempstr ); tempstr = string.lower(tempstr);
tempstr = (tempstr:gsub("^%l", string.upper)); tempstr = (tempstr:gsub("^%l", string.upper));
uiNameSexText.hardtext= tempstr; uiNameSexText.hardtext = tempstr;
end end
-- Name race slider update. -- Name race slider update.
function outgame:procUpdateNameRaceLabel() function outgame:procUpdateNameRaceLabel()
local nameRaceType = { "Fyros", "Matis", "Tryker", "Zoraï", "uiCP_Maraudeur" } local nameRaceType = { "Fyros", "Matis", "Tryker", "Zoraï", "uiCP_Maraudeur" }
local uiNameRaceText = getUI("ui:outgame:appear_name:name_race_slider:name_race"); local uiNameRaceText = getUI("ui:outgame:appear_name:name_race_slider:name_race");
local dbNameRace = getDbProp("UI:TEMP:NAME_RACE"); local dbNameRace = getDbProp("UI:TEMP:NAME_RACE");
local uiNameSexSlider = getUI("ui:outgame:appear_name:name_sex_slider"); local uiNameSexSlider = getUI("ui:outgame:appear_name:name_sex_slider");
@ -207,15 +214,15 @@ function outgame:procUpdateNameRaceLabel()
local uiNameSubRace2Slider = getUI("ui:outgame:appear_name:name_sub_race2_slider"); local uiNameSubRace2Slider = getUI("ui:outgame:appear_name:name_sub_race2_slider");
local uiNameGenerate = getUI("ui:outgame:appear_name:generate"); local uiNameGenerate = getUI("ui:outgame:appear_name:generate");
-- Show/Hide sex slider -- Show/Hide sex slider
uiNameGenerate.y = "-50" uiNameGenerate.y = "-50"
if tonumber(dbNameRace) == 2 then if tonumber(dbNameRace) == 2 then
uiNameSexSlider.active = true; uiNameSexSlider.active = true;
uiNameGenerate.y = "-65" uiNameGenerate.y = "-65"
else else
uiNameSexSlider.active = false; uiNameSexSlider.active = false;
end end
-- Show/Hide sub race slider -- Show/Hide sub race slider
if tonumber(dbNameRace) == 5 then if tonumber(dbNameRace) == 5 then
@ -227,8 +234,7 @@ function outgame:procUpdateNameRaceLabel()
uiNameSubRace2Slider.active = false; uiNameSubRace2Slider.active = false;
end end
uiNameRaceText.hardtext = tostring(nameRaceType[tonumber(dbNameRace)]);
uiNameRaceText.hardtext= tostring(nameRaceType[tonumber(dbNameRace)]);
end end

View file

@ -49,14 +49,14 @@
<!-- Name Generator. --> <!-- Name Generator. -->
<!-- We start at 1 not 0. --> <!-- We start at 1 not 0. -->
<variable entry="UI:TEMP:NAME_RACE" type="sint64" value="1" /> <variable entry="UI:TEMP:NAME_RACE" type="sint64" value="1" />
<!-- used for marauder names. --> <!-- used for marauder names. -->
<variable entry="UI:TEMP:NAME_SUB_RACE" type="sint64" value="1" /> <variable entry="UI:TEMP:NAME_SUB_RACE" type="sint64" value="1" />
<variable entry="UI:TEMP:NAME_SUB_RACE2" type="sint64" value="1" /> <variable entry="UI:TEMP:NAME_SUB_RACE2" type="sint64" value="1" />
<!-- you will have to change the max value of the slider too, since it seam not working to set it using that var directly. --> <!-- you will have to change the max value of the slider too, since it seam not working to set it using that var directly. -->
<variable entry="UI:TEMP:NAME_RACE_NB" type="sint64" value="5" /> <variable entry="UI:TEMP:NAME_RACE_NB" type="sint64" value="5" />
<!-- We start at 1 not 0. --> <!-- We start at 1 not 0. -->
<variable entry="UI:TEMP:NAME_SEX" type="sint64" value="1" /> <variable entry="UI:TEMP:NAME_SEX" type="sint64" value="1" />
<!-- End Name Generator. --> <!-- End Name Generator. -->
<template name="char_var_dec" id="#id" > <template name="char_var_dec" id="#id" >
@ -1273,20 +1273,19 @@
<group type="modal" id="appear_name" posref="MM MM" w="400" h="680" <group type="modal" id="appear_name" posref="MM MM" w="400" h="680"
mouse_pos="false" escapable="false" exit_click_out="false" mouse_pos="false" escapable="false" exit_click_out="false"
on_active="proc" on_active_params="proc_appear_name_active" on_active="proc" on_active_params="proc_appear_name_active"
display="false" display="false">
>
<instance template="outgame_popup" id="back" posref="TL TL" /> <instance template="outgame_popup" id="back" posref="TL TL" />
<view type="text" id="text" posref="TM TM" x="0" y="-56" color="255 255 255 255" global_color="false" fontsize="17" multi_line="true" multi_line_space="0" <view type="text" id="text" posref="TM TM" x="0" y="-56" color="255 255 255 255" global_color="false" fontsize="17" multi_line="true" multi_line_space="0"
line_maxw="350" shadow="true" hardtext="uiCP_Name_Enter" /> line_maxw="350" shadow="true" hardtext="uiCP_Name_Enter" />
<!-- NamingPolicy --> <!-- NamingPolicy -->
<ctrl style="opt_button" id="name_policy" posref="BM BM" posparent="text" x="0" y="-40" hardtext="uiCP_Name_Policy" <ctrl style="opt_button" id="name_policy" posref="BM BM" posparent="text" x="0" y="-40" hardtext="uiCP_Name_Policy"
text_color_over="208 258 16 255" text_color_normal="255 255 46 255" text_color_pushed="108 158 16 255" text_color_over="208 258 16 255" text_color_normal="255 255 46 255" text_color_pushed="108 158 16 255"
onover="play_sound" params_over="name=specie_but_over" onover="play_sound" params_over="name=specie_but_over"
onclick_l="open_url" params_l="cfg_ConditionsTermsURL" /> onclick_l="open_url" params_l="cfg_ConditionsTermsURL" />
<!-- onclick_l="open_url" params_l="cfg_NamingPolicyURL" /> --> <!-- onclick_l="open_url" params_l="cfg_NamingPolicyURL" /> -->
<group type="edit_box" id="eb" posparent="name_policy" posref="BM TM" x="0" y="-8" w="300" h="52" render_layer="4" child_resize_h="true" <group type="edit_box" id="eb" posparent="name_policy" posref="BM TM" x="0" y="-8" w="300" h="52" render_layer="4" child_resize_h="true"
onenter="proc" params="proc_appear_name_enter" onenter="proc" params="proc_appear_name_enter"
@ -1531,7 +1530,7 @@
<action handler="set" params="target_property=ui:outgame:appear_name:eb:input_string|value=''" /> <action handler="set" params="target_property=ui:outgame:appear_name:eb:input_string|value=''" />
<action handler="set_keyboard_focus" params="target=ui:outgame:appear_name:eb|select_all=false" /> <action handler="set_keyboard_focus" params="target=ui:outgame:appear_name:eb|select_all=false" />
<!-- Name generator init. --> <!-- Name generator init. -->
<action handler="set" params="target_property=ui:outgame:appear_name:name_sex_slider:name_sex_scroll:value|value=add(@UI:TEMP:CHAR3D:VPA:SEX,1)" /> <action handler="set" params="target_property=ui:outgame:appear_name:name_sex_slider:name_sex_scroll:value|value=add(@UI:TEMP:CHAR3D:VPA:SEX,1)" />
<action handler="set" params="target_property=ui:outgame:appear_name:name_race_slider:name_race_scroll:value|value=add(@UI:TEMP:CHAR3D:PEOPLE,1)" /> <action handler="set" params="target_property=ui:outgame:appear_name:name_race_slider:name_race_scroll:value|value=add(@UI:TEMP:CHAR3D:PEOPLE,1)" />
<action handler="set" params="target_property=ui:outgame:appear_name:name_sub_race_slider:name_race_scroll:value|value=1" /> <action handler="set" params="target_property=ui:outgame:appear_name:name_sub_race_slider:name_race_scroll:value|value=1" />
@ -1539,14 +1538,14 @@
<action handler="set" params="dblink=UI:TEMP:NAME_SEX|value=add(@UI:TEMP:CHAR3D:VPA:SEX,1)" /> <action handler="set" params="dblink=UI:TEMP:NAME_SEX|value=add(@UI:TEMP:CHAR3D:VPA:SEX,1)" />
<action handler="set" params="dblink=UI:TEMP:NAME_RACE|value=add(@UI:TEMP:CHAR3D:PEOPLE,1)" /> <action handler="set" params="dblink=UI:TEMP:NAME_RACE|value=add(@UI:TEMP:CHAR3D:PEOPLE,1)" />
<action handler="set" params="dblink=UI:TEMP:NAME_SUB_RACE|value=1" /> <action handler="set" params="dblink=UI:TEMP:NAME_SUB_RACE_FIRST_NAME|value=1" />
<action handler="set" params="dblink=UI:TEMP:NAME_SUB2_RACE|value=1" /> <action handler="set" params="dblink=UI:TEMP:NAME_SUB_RACE_LAST_NAME|value=1" />
<action handler="lua:outgame:procUpdateNameSexLabel()" /> <action handler="lua:outgame:procUpdateNameSexLabel()" />
<action handler="lua:outgame:procUpdateNameRaceLabel()" /> <action handler="lua:outgame:procUpdateNameRaceLabel()" />
<action handler="lua:outgame:procUpdateNameSubRaceLabel()" /> <action handler="lua:outgame:procUpdateNameSubRaceFirstNameLabel()" />
<action handler="lua:outgame:procUpdateNameSubRace2Label()" /> <action handler="lua:outgame:procUpdateNameSubRaceLastNameLabel()" />
<!-- End Name Generator. --> <!-- End Name Generator. -->
</proc> </proc>
@ -1624,31 +1623,31 @@
<!-- Name Generator. --> <!-- Name Generator. -->
<proc id="proc_appear_name_generate"> <proc id="proc_appear_name_generate">
<action handler="lua:outgame:procGenerateName()" /> <action handler="lua:outgame:procGenerateName()" />
</proc> </proc>
<!-- Name Sex. --> <!-- Name Sex. -->
<proc id="proc_appear_name_sex_label_change"> <proc id="proc_appear_name_sex_label_change">
<action handler="lua:outgame:procUpdateNameSexLabel()" /> <action handler="lua:outgame:procUpdateNameSexLabel()" />
</proc> </proc>
<proc id="proc_appear_name_sex_add_one"> <proc id="proc_appear_name_sex_add_one">
<action handler="set" params="dblink=UI:TEMP:NAME_SEX|value=min(add(@UI:TEMP:NAME_SEX,1),2)" /> <action handler="set" params="dblink=UI:TEMP:NAME_SEX|value=min(add(@UI:TEMP:NAME_SEX,1),2)" />
<action handler="lua:outgame:procUpdateNameSexLabel()" /> <action handler="lua:outgame:procUpdateNameSexLabel()" />
</proc> </proc>
<proc id="proc_appear_name_sex_sub_one"> <proc id="proc_appear_name_sex_sub_one">
<action handler="set" params="dblink=UI:TEMP:NAME_SEX|value=max(sub(@UI:TEMP:NAME_SEX,1),1)" /> <action handler="set" params="dblink=UI:TEMP:NAME_SEX|value=max(sub(@UI:TEMP:NAME_SEX,1),1)" />
<action handler="lua:outgame:procUpdateNameSexLabel()" /> <action handler="lua:outgame:procUpdateNameSexLabel()" />
</proc> </proc>
<!-- Name Race. --> <!-- Name Race. -->
<proc id="proc_appear_name_race_label_change"> <proc id="proc_appear_name_race_label_change">
<action handler="lua:outgame:procUpdateNameRaceLabel()" /> <action handler="lua:outgame:procUpdateNameRaceLabel()" />
</proc> </proc>
<proc id="proc_appear_name_race_add_one"> <proc id="proc_appear_name_race_add_one">
<action handler="set" params="dblink=UI:TEMP:NAME_RACE|value=min(add(@UI:TEMP:NAME_RACE,1),@UI:TEMP:NAME_RACE_NB)" /> <action handler="set" params="dblink=UI:TEMP:NAME_RACE|value=min(add(@UI:TEMP:NAME_RACE,1),@UI:TEMP:NAME_RACE_NB)" />
<action handler="lua:outgame:procUpdateNameRaceLabel()" /> <action handler="lua:outgame:procUpdateNameRaceLabel()" />
</proc> </proc>
<proc id="proc_appear_name_race_sub_one"> <proc id="proc_appear_name_race_sub_one">
<action handler="set" params="dblink=UI:TEMP:NAME_RACE|value=max(sub(@UI:TEMP:NAME_RACE,1),1)" /> <action handler="set" params="dblink=UI:TEMP:NAME_RACE|value=max(sub(@UI:TEMP:NAME_RACE,1),1)" />
<action handler="lua:outgame:procUpdateNameRaceLabel()" /> <action handler="lua:outgame:procUpdateNameRaceLabel()" />
</proc> </proc>
<!-- Name Sub Race. --> <!-- Name Sub Race. -->
<proc id="proc_appear_name_sub_race_label_change"> <proc id="proc_appear_name_sub_race_label_change">