|
|
@ -1535,8 +1535,8 @@ void CInterfaceManager::updateFrameEvents()
|
|
|
|
CCtrlBase *pTooltip= dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt"));
|
|
|
|
CCtrlBase *pTooltip= dynamic_cast<CCtrlBase*>(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt"));
|
|
|
|
if (pTooltip != NULL)
|
|
|
|
if (pTooltip != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
string tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour").toUtf8() +
|
|
|
|
string tt = toString("%02d", WeatherManager.getNextWeatherHour()) + CI18N::get("uiMissionTimerHour") +
|
|
|
|
" - " + CI18N::get("uiHumidity").toUtf8() + " " +
|
|
|
|
" - " + CI18N::get("uiHumidity") + " " +
|
|
|
|
toString("%d", (uint)(roundWeatherValue(WeatherManager.getNextWeatherValue()) * 100.f)) + "%";
|
|
|
|
toString("%d", (uint)(roundWeatherValue(WeatherManager.getNextWeatherValue()) * 100.f)) + "%";
|
|
|
|
pTooltip->setDefaultContextHelp(tt);
|
|
|
|
pTooltip->setDefaultContextHelp(tt);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -4040,11 +4040,11 @@ char* CInterfaceManager::getTimestampHuman(const char* format /* "[%H:%M:%S] " *
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* All \d's in default parameter remove a following character.
|
|
|
|
* All \d's in default parameter remove a following character.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
bool CInterfaceManager::parseTokens(string& ucstr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring str = ucstr;
|
|
|
|
string str = ucstr;
|
|
|
|
ucstring start_token("$");
|
|
|
|
string start_token("$");
|
|
|
|
ucstring end_token("$");
|
|
|
|
string end_token("$");
|
|
|
|
size_t start_pos = 0;
|
|
|
|
size_t start_pos = 0;
|
|
|
|
size_t end_pos = 1;
|
|
|
|
size_t end_pos = 1;
|
|
|
|
|
|
|
|
|
|
|
@ -4061,8 +4061,8 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
// Get the whole token substring first
|
|
|
|
// Get the whole token substring first
|
|
|
|
end_pos = str.find(end_token, start_pos + 1);
|
|
|
|
end_pos = str.find(end_token, start_pos + 1);
|
|
|
|
|
|
|
|
|
|
|
|
if ((start_pos == ucstring::npos) ||
|
|
|
|
if ((start_pos == string::npos) ||
|
|
|
|
(end_pos == ucstring::npos) ||
|
|
|
|
(end_pos == string::npos) ||
|
|
|
|
(end_pos <= start_pos + 1))
|
|
|
|
(end_pos <= start_pos + 1))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Wrong formatting; give up on this one.
|
|
|
|
// Wrong formatting; give up on this one.
|
|
|
@ -4080,19 +4080,19 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ucstring token_whole = str.luabind_substr(start_pos, end_pos - start_pos + 1);
|
|
|
|
string token_whole = str.substr(start_pos, end_pos - start_pos + 1);
|
|
|
|
ucstring token_string = token_whole.luabind_substr(1, token_whole.length() - 2);
|
|
|
|
string token_string = token_whole.substr(1, token_whole.length() - 2);
|
|
|
|
ucstring token_replacement = token_whole;
|
|
|
|
string token_replacement = token_whole;
|
|
|
|
ucstring token_default = token_whole;
|
|
|
|
string token_default = token_whole;
|
|
|
|
|
|
|
|
|
|
|
|
ucstring token_subject;
|
|
|
|
string token_subject;
|
|
|
|
ucstring token_param;
|
|
|
|
string token_param;
|
|
|
|
|
|
|
|
|
|
|
|
// Does the token have a parameter?
|
|
|
|
// Does the token have a parameter?
|
|
|
|
// If not it is 'name' by default
|
|
|
|
// If not it is 'name' by default
|
|
|
|
vector<ucstring> token_vector;
|
|
|
|
vector<string> token_vector;
|
|
|
|
vector<ucstring> param_vector;
|
|
|
|
vector<string> param_vector;
|
|
|
|
splitUCString(token_string, ucstring("."), token_vector);
|
|
|
|
splitString(token_string, ".", token_vector);
|
|
|
|
if (token_vector.empty())
|
|
|
|
if (token_vector.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Wrong formatting; give up on this one.
|
|
|
|
// Wrong formatting; give up on this one.
|
|
|
@ -4102,23 +4102,23 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
token_subject = token_vector[0];
|
|
|
|
token_subject = token_vector[0];
|
|
|
|
if (token_vector.size() == 1)
|
|
|
|
if (token_vector.size() == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
splitUCString(token_subject, ucstring("/"), param_vector);
|
|
|
|
splitString(token_subject, "/", param_vector);
|
|
|
|
token_subject = !param_vector.empty() ? param_vector[0] : ucstring("");
|
|
|
|
token_subject = !param_vector.empty() ? param_vector[0] : string();
|
|
|
|
token_param = ucstring("name");
|
|
|
|
token_param = string("name");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_vector.size() > 1)
|
|
|
|
else if (token_vector.size() > 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
token_param = token_vector[1];
|
|
|
|
token_param = token_vector[1];
|
|
|
|
if (token_param.luabind_substr(0, 3) != ucstring("gs("))
|
|
|
|
if (token_param.substr(0, 3) != "gs(")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
splitUCString(token_vector[1], ucstring("/"), param_vector);
|
|
|
|
splitString(token_vector[1], "/", param_vector);
|
|
|
|
token_param = !param_vector.empty() ? param_vector[0] : ucstring("");
|
|
|
|
token_param = !param_vector.empty() ? param_vector[0] : string();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get any default value, if not gs
|
|
|
|
// Get any default value, if not gs
|
|
|
|
sint extra_replacement = 0;
|
|
|
|
sint extra_replacement = 0;
|
|
|
|
if (token_param.luabind_substr(0, 3) != ucstring("gs("))
|
|
|
|
if (token_param.substr(0, 3) != "gs(")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (param_vector.size() == 2)
|
|
|
|
if (param_vector.size() == 2)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -4126,9 +4126,9 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
token_replacement = param_vector[1];
|
|
|
|
token_replacement = param_vector[1];
|
|
|
|
// Delete following chars for every '\d' in default
|
|
|
|
// Delete following chars for every '\d' in default
|
|
|
|
string::size_type token_replacement_pos;
|
|
|
|
string::size_type token_replacement_pos;
|
|
|
|
while ((token_replacement_pos = token_replacement.find(ucstring("\\d"))) != string::npos)
|
|
|
|
while ((token_replacement_pos = token_replacement.find(string("\\d"))) != string::npos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
token_replacement.replace(token_replacement_pos, 2, ucstring(""));
|
|
|
|
token_replacement.replace(token_replacement_pos, 2, string());
|
|
|
|
extra_replacement++;
|
|
|
|
extra_replacement++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
token_default = token_replacement;
|
|
|
|
token_default = token_replacement;
|
|
|
@ -4137,17 +4137,17 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
|
|
|
|
|
|
|
|
CEntityCL *pTokenSubjectEntity = NULL;
|
|
|
|
CEntityCL *pTokenSubjectEntity = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if (token_subject == ucstring("me"))
|
|
|
|
if (token_subject == "me")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pTokenSubjectEntity = static_cast<CEntityCL*>(UserEntity);
|
|
|
|
pTokenSubjectEntity = static_cast<CEntityCL*>(UserEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_subject == ucstring("t"))
|
|
|
|
else if (token_subject == "t")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Target
|
|
|
|
// Target
|
|
|
|
uint targetSlot = UserEntity->targetSlot();
|
|
|
|
uint targetSlot = UserEntity->targetSlot();
|
|
|
|
pTokenSubjectEntity = EntitiesMngr.entity(targetSlot);
|
|
|
|
pTokenSubjectEntity = EntitiesMngr.entity(targetSlot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_subject == ucstring("tt"))
|
|
|
|
else if (token_subject == "tt")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Target's target
|
|
|
|
// Target's target
|
|
|
|
uint targetSlot = UserEntity->targetSlot();
|
|
|
|
uint targetSlot = UserEntity->targetSlot();
|
|
|
@ -4165,11 +4165,11 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((token_subject.length() == 3) &&
|
|
|
|
else if ((token_subject.length() == 3) &&
|
|
|
|
(token_subject.luabind_substr(0, 2) == ucstring("tm")))
|
|
|
|
(token_subject.substr(0, 2) == "tm"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Teammate
|
|
|
|
// Teammate
|
|
|
|
uint indexInTeam = 0;
|
|
|
|
uint indexInTeam = 0;
|
|
|
|
fromString(token_subject.luabind_substr(2, 1).toString(), indexInTeam);
|
|
|
|
fromString(token_subject.substr(2, 1), indexInTeam);
|
|
|
|
|
|
|
|
|
|
|
|
// Make 0-based
|
|
|
|
// Make 0-based
|
|
|
|
--indexInTeam;
|
|
|
|
--indexInTeam;
|
|
|
@ -4205,22 +4205,22 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
if (pTokenSubjectEntity != NULL)
|
|
|
|
if (pTokenSubjectEntity != NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Parse the parameter
|
|
|
|
// Parse the parameter
|
|
|
|
if (token_param == ucstring("name"))
|
|
|
|
if (token_param == "name")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring name = pTokenSubjectEntity->getDisplayName();
|
|
|
|
string name = pTokenSubjectEntity->getDisplayName().toUtf8();
|
|
|
|
// special case where there is only a title, very rare case for some NPC
|
|
|
|
// special case where there is only a title, very rare case for some NPC
|
|
|
|
if (name.empty())
|
|
|
|
if (name.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
name = pTokenSubjectEntity->getTitle();
|
|
|
|
name = pTokenSubjectEntity->getTitle().toUtf8();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
token_replacement = name.empty() ? token_replacement : name;
|
|
|
|
token_replacement = name.empty() ? token_replacement : name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_param == ucstring("title"))
|
|
|
|
else if (token_param == "title")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring title = pTokenSubjectEntity->getTitle();
|
|
|
|
string title = pTokenSubjectEntity->getTitle().toUtf8();
|
|
|
|
token_replacement = title.empty() ? token_replacement : title;
|
|
|
|
token_replacement = title.empty() ? token_replacement : title;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_param == ucstring("race"))
|
|
|
|
else if (token_param == "race")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CCharacterCL *pC = dynamic_cast<CCharacterCL*>(pTokenSubjectEntity);
|
|
|
|
CCharacterCL *pC = dynamic_cast<CCharacterCL*>(pTokenSubjectEntity);
|
|
|
|
if (pC)
|
|
|
|
if (pC)
|
|
|
@ -4228,27 +4228,27 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
EGSPD::CPeople::TPeople race = pC->people();
|
|
|
|
EGSPD::CPeople::TPeople race = pC->people();
|
|
|
|
if (race >= EGSPD::CPeople::Playable && race <= EGSPD::CPeople::EndPlayable)
|
|
|
|
if (race >= EGSPD::CPeople::Playable && race <= EGSPD::CPeople::EndPlayable)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ucstring srace = NLMISC::CI18N::get("io" + EGSPD::CPeople::toString(race));
|
|
|
|
string srace = NLMISC::CI18N::get("io" + EGSPD::CPeople::toString(race));
|
|
|
|
token_replacement = srace.empty() ? token_replacement : srace;
|
|
|
|
token_replacement = srace.empty() ? token_replacement : srace;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_param == ucstring("guild"))
|
|
|
|
else if (token_param == "guild")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
|
|
|
|
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
|
|
|
|
ucstring ucGuildName;
|
|
|
|
ucstring ucGuildName;
|
|
|
|
if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName))
|
|
|
|
if (pSMC->getString(pTokenSubjectEntity->getGuildNameID(), ucGuildName))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName;
|
|
|
|
token_replacement = ucGuildName.empty() ? token_replacement : ucGuildName.toUtf8();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (token_param.luabind_substr(0, 3) == ucstring("gs(") &&
|
|
|
|
else if (token_param.substr(0, 3) == "gs(" &&
|
|
|
|
token_param.luabind_substr(token_param.length() - 1 , 1) == ucstring(")"))
|
|
|
|
token_param.substr(token_param.length() - 1 , 1) == ")")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Gender string
|
|
|
|
// Gender string
|
|
|
|
vector<ucstring> strList;
|
|
|
|
vector<string> strList;
|
|
|
|
ucstring gender_string = token_param.luabind_substr(3, token_param.length() - 4);
|
|
|
|
string gender_string = token_param.substr(3, token_param.length() - 4);
|
|
|
|
splitUCString(gender_string, ucstring("/"), strList);
|
|
|
|
splitString(gender_string, "/", strList);
|
|
|
|
|
|
|
|
|
|
|
|
if (strList.size() <= 1)
|
|
|
|
if (strList.size() <= 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -4277,8 +4277,8 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Nothing to replace; show message and exit
|
|
|
|
// Nothing to replace; show message and exit
|
|
|
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
|
|
|
CInterfaceManager *im = CInterfaceManager::getInstance();
|
|
|
|
ucstring message = ucstring(CI18N::get("uiUntranslatedToken"));
|
|
|
|
string message = CI18N::get("uiUntranslatedToken");
|
|
|
|
message.replace(message.find(ucstring("%s")), 2, token_whole);
|
|
|
|
message.replace(message.find("%s"), 2, token_whole);
|
|
|
|
im->displaySystemInfo(message);
|
|
|
|
im->displaySystemInfo(message);
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|