kaetemi 4 years ago
parent 5fe2fae8b0
commit ad0e970785

@ -10367,7 +10367,7 @@ NLMISC_COMMAND(pvpMode, "modify pvp mode", "[<pvp mode> <state>]")
str+="in_safe_zone "; str+="in_safe_zone ";
if( pvpMode&PVP_MODE::PvpSafe) if( pvpMode&PVP_MODE::PvpSafe)
str+="safe "; str+="safe ";
IM->displaySystemInfo(ucstring(str)); IM->displaySystemInfo(str);
nlinfo("<pvpMode> %s",str.c_str()); nlinfo("<pvpMode> %s",str.c_str());
} }
else else

@ -241,7 +241,7 @@ CClientChatManager::CClientChatManager()
} }
//------------------------------------------------------- //-------------------------------------------------------
const ucstring *CClientChatManager::cycleLastTell() const string *CClientChatManager::cycleLastTell()
{ {
if (_TellPeople.empty()) return NULL; if (_TellPeople.empty()) return NULL;
_TellPeople.push_front(_TellPeople.back()); _TellPeople.push_front(_TellPeople.back());
@ -282,10 +282,10 @@ void CClientChatManager::init( const string& /* staticDBFileName */ )
// chat // chat
// //
//----------------------------------------------- //-----------------------------------------------
void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam ) void CClientChatManager::chat( const string& strIn, bool isChatTeam )
{ {
// Truncate to 255 chars max (because of server restriction) // Truncate to 255 chars max (because of server restriction)
ucstring str= strIn.substr(0,255); ucstring str= ucstring(strIn).substr(0,255);
// send str to IOS // send str to IOS
CBitMemStream bms; CBitMemStream bms;
@ -303,7 +303,7 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam )
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( str ); bms.serial( str ); // FIXME: UTF-8
NetMngr.push( bms ); NetMngr.push( bms );
//nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str()); //nlinfo("impulseCallBack : %s %s sent", msgType.c_str(), str.toString().c_str());
} }
@ -321,11 +321,11 @@ void CClientChatManager::chat( const ucstring& strIn, bool isChatTeam )
// tell // tell
// //
//----------------------------------------------- //-----------------------------------------------
void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn ) void CClientChatManager::tell( const string& receiverIn, const string& strIn )
{ {
// Truncate to 255 chars max (because of server restriction) // Truncate to 255 chars max (because of server restriction)
string receiver= receiverIn.substr(0,255); string receiver= receiverIn.substr(0,255);
ucstring str= strIn.substr(0,255); ucstring str= ucstring(strIn).substr(0,255);
// *** send str // *** send str
CBitMemStream bms; CBitMemStream bms;
@ -333,7 +333,7 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn )
if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) ) if( GenericMsgHeaderMngr.pushNameToStream(msgType,bms) )
{ {
bms.serial( receiver ); bms.serial( receiver );
bms.serial( str ); bms.serial( str ); // FIXME: UTF-8
NetMngr.push( bms ); NetMngr.push( bms );
//nlinfo("impulseCallBack : %s %s %s sent", msgType.c_str(), receiver.c_str(), str.toString().c_str()); //nlinfo("impulseCallBack : %s %s %s sent", msgType.c_str(), receiver.c_str(), str.toString().c_str());
} }
@ -345,10 +345,10 @@ void CClientChatManager::tell( const string& receiverIn, const ucstring& strIn )
// *** manage list of last telled people // *** manage list of last telled people
// remove the telled people from list (if present) // remove the telled people from list (if present)
std::list<ucstring>::iterator it = _TellPeople.begin(); std::list<string>::iterator it = _TellPeople.begin();
while(it != _TellPeople.end()) while(it != _TellPeople.end())
{ {
if (*it == ucstring(receiver)) if (*it == receiver)
{ {
it = _TellPeople.erase(it); it = _TellPeople.erase(it);
nlassert(_NumTellPeople != 0); nlassert(_NumTellPeople != 0);
@ -454,14 +454,14 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp
// Serial. For tell message, there is no chat mode, coz we know we are in tell mode ! // Serial. For tell message, there is no chat mode, coz we know we are in tell mode !
bms.serial (chatMsg.CompressedIndex); bms.serial (chatMsg.CompressedIndex);
bms.serial (chatMsg.SenderNameId); bms.serial (chatMsg.SenderNameId);
bms.serial (chatMsg.Content); bms.serial (chatMsg.Content); // FIXME: UTF-8
if (PermanentlyBanned) return; if (PermanentlyBanned) return;
chatMsg.ChatMode = (uint8) CChatGroup::tell; chatMsg.ChatMode = (uint8) CChatGroup::tell;
// If !complete, wait // If !complete, wait
ucstring senderStr; string senderStr;
bool complete = true; bool complete = true;
complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);
if (!complete) if (!complete)
@ -472,8 +472,8 @@ void CClientChatManager::processTellString(NLMISC::CBitMemStream& bms, IChatDisp
} }
// display // display
ucstring ucstr; string ucstr;
buildTellSentence(senderStr, chatMsg.Content, ucstr); buildTellSentence(senderStr, chatMsg.Content.toUtf8(), ucstr);
chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr);
} }
@ -488,9 +488,9 @@ void CClientChatManager::processFarTellString(NLMISC::CBitMemStream& bms, IChatD
if (PermanentlyBanned) return; if (PermanentlyBanned) return;
// display // display
ucstring ucstr; string ucstr;
buildTellSentence(farTellMsg.SenderName, farTellMsg.Text, ucstr); buildTellSentence(farTellMsg.SenderName.toUtf8(), farTellMsg.Text.toUtf8(), ucstr);
chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, farTellMsg.SenderName.toUtf8());
} }
@ -505,7 +505,7 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis
CChatMsg chatMsg; CChatMsg chatMsg;
bms.serial( chatMsg ); bms.serial( chatMsg );
CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode); CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode);
ucstring senderStr; string senderStr;
bool complete = true; bool complete = true;
complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);
@ -528,9 +528,9 @@ void CClientChatManager::processChatString( NLMISC::CBitMemStream& bms, IChatDis
} }
// display // display
ucstring ucstr; string ucstr;
buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content, type, ucstr); buildChatSentence(chatMsg.CompressedIndex, senderStr, chatMsg.Content.toUtf8(), type, ucstr);
chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content, type, chatMsg.DynChatChanID, senderStr); chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, chatMsg.Content.toUtf8(), type, chatMsg.DynChatChanID, senderStr);
} }
@ -545,8 +545,8 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis
bms.serial(chatMsg.PhraseId); bms.serial(chatMsg.PhraseId);
// if !complete, wait // if !complete, wait
ucstring senderStr; string senderStr;
ucstring rawMessage; string rawMessage;
bool complete = true; bool complete = true;
complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr); complete &= STRING_MANAGER::CStringManagerClient::instance()->getString(chatMsg.SenderNameId, senderStr);
complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, rawMessage); complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, rawMessage);
@ -558,7 +558,7 @@ void CClientChatManager::processTellString2(NLMISC::CBitMemStream& bms, IChatDis
} }
// display // display
ucstring ucstr; string ucstr;
buildTellSentence(senderStr, rawMessage, ucstr); buildTellSentence(senderStr, rawMessage, ucstr);
chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr); chatDisplayer.displayTell(/*chatMsg.CompressedIndex, */ucstr, senderStr);
} }
@ -571,8 +571,8 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis
bms.serial( chatMsg ); bms.serial( chatMsg );
if (PermanentlyBanned) return; if (PermanentlyBanned) return;
CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode); CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(chatMsg.ChatMode);
ucstring senderStr; string senderStr;
ucstring rawMessage; string rawMessage;
// here, the type cannot be dyn_chat (no DynChatId in the message) => discard // here, the type cannot be dyn_chat (no DynChatId in the message) => discard
if(type==CChatGroup::dyn_chat) if(type==CChatGroup::dyn_chat)
@ -592,11 +592,11 @@ void CClientChatManager::processChatString2(NLMISC::CBitMemStream& bms, IChatDis
return; return;
} }
rawMessage += ucstring(" "); rawMessage += " ";
rawMessage += chatMsg.CustomTxt; rawMessage += chatMsg.CustomTxt.toUtf8();
// display // display
ucstring ucstr; string ucstr;
buildChatSentence(chatMsg.CompressedIndex, senderStr, rawMessage, type, ucstr); buildChatSentence(chatMsg.CompressedIndex, senderStr, rawMessage, type, ucstr);
chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, rawMessage, type, CEntityId::Unknown, senderStr); chatDisplayer.displayChat(chatMsg.CompressedIndex, ucstr, rawMessage, type, CEntityId::Unknown, senderStr);
} }
@ -615,7 +615,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b
chatMsg.SenderNameId = 0; chatMsg.SenderNameId = 0;
chatMsg.ChatMode = type; chatMsg.ChatMode = type;
chatMsg.PhraseId = phraseID; chatMsg.PhraseId = phraseID;
ucstring ucstr; string ucstr;
// if !complete, wait // if !complete, wait
bool complete = STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, ucstr); bool complete = STRING_MANAGER::CStringManagerClient::instance()->getDynString(chatMsg.PhraseId, ucstr);
@ -627,7 +627,7 @@ void CClientChatManager::processChatStringWithNoSender( NLMISC::CBitMemStream& b
} }
// diplay // diplay
ucstring senderName(""); string senderName;
chatDisplayer.displayChat(INVALID_DATASET_INDEX, ucstr, ucstr, type, CEntityId::Unknown, senderName); chatDisplayer.displayChat(INVALID_DATASET_INDEX, ucstr, ucstr, type, CEntityId::Unknown, senderName);
} }
@ -643,7 +643,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); ) for( itMsg = _ChatBuffer.begin(); itMsg != _ChatBuffer.end(); )
{ {
CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(itMsg->ChatMode); CChatGroup::TGroupType type = static_cast<CChatGroup::TGroupType>(itMsg->ChatMode);
ucstring sender, content; string sender, content;
// all strings received? // all strings received?
bool complete = true; bool complete = true;
@ -652,7 +652,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
if(itMsg->UsePhraseId) if(itMsg->UsePhraseId)
complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content); complete &= STRING_MANAGER::CStringManagerClient::instance()->getDynString(itMsg->PhraseId, content);
else else
content= itMsg->Content; content= itMsg->Content.toUtf8();
if (type == CChatGroup::dyn_chat) if (type == CChatGroup::dyn_chat)
{ {
@ -666,7 +666,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
// if complete, process // if complete, process
if (complete) if (complete)
{ {
ucstring ucstr; string ucstr;
if (itMsg->SenderNameId == 0) if (itMsg->SenderNameId == 0)
{ {
ucstr = content; ucstr = content;
@ -703,7 +703,7 @@ void CClientChatManager::flushBuffer(IChatDisplayer &chatDisplayer)
// getString // getString
// //
//----------------------------------------------- //-----------------------------------------------
ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr ) string CClientChatManager::getString( CBitMemStream& bms, string& ucstr )
{ {
// deal with parameters // deal with parameters
@ -714,8 +714,8 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
// search if a parameter exists in the string // search if a parameter exists in the string
sprintf(chTmp,"$%d",dynParamIdx); sprintf(chTmp,"$%d",dynParamIdx);
ucstring ucstrTmp( chTmp ); string ucstrTmp( chTmp );
ucstring::size_type idx = ucstr.find(ucstrTmp); string::size_type idx = ucstr.find(ucstrTmp);
// if there's a parameter in the string // if there's a parameter in the string
if( idx != ucstring::npos ) if( idx != ucstring::npos )
@ -728,7 +728,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
bool huff; bool huff;
bms.serialBit(huff); bms.serialBit(huff);
const ucstring dynStr("???"); const string dynStr("???");
if( huff ) if( huff )
{ {
nldebug("<CClientChatManager::getString> receiving huffman dynamic parameter in static string"); nldebug("<CClientChatManager::getString> receiving huffman dynamic parameter in static string");
@ -756,8 +756,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
string dynStr; string dynStr;
bms.serial( dynStr ); bms.serial( dynStr );
ucstring ucDynStr(dynStr); ucstr.replace( idx, ucstrTmp.size()+1, dynStr );
ucstr.replace( idx, ucstrTmp.size()+1, ucDynStr );
} }
break; break;
@ -766,7 +765,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
uint32 nb; uint32 nb;
bms.serial( nb ); bms.serial( nb );
ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) );
} }
break; break;
/* /*
@ -794,7 +793,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
sint32 nb; sint32 nb;
bms.serial( nb ); bms.serial( nb );
ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) );
} }
break; break;
/* /*
@ -823,7 +822,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
{ {
float nb; float nb;
bms.serial( nb ); bms.serial( nb );
ucstr.replace( idx, ucstrTmp.size()+1, ucstring(toString(nb)) ); ucstr.replace( idx, ucstrTmp.size()+1, toString(nb) );
} }
break; break;
@ -849,7 +848,7 @@ ucstring CClientChatManager::getString( CBitMemStream& bms, ucstring& ucstr )
// getString // getString
// //
//----------------------------------------------- //-----------------------------------------------
bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args, const ucstring &ucstrbase ) bool CClientChatManager::getString( string &result, std::vector<uint64>& args, const string &ucstrbase )
{ {
result = ucstrbase; result = ucstrbase;
@ -863,17 +862,17 @@ bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args,
{ {
// search if a parameter exists in the string // search if a parameter exists in the string
sprintf(chTmp,"$%d",dynParamIdx); sprintf(chTmp,"$%d",dynParamIdx);
ucstring ucstrTmp( chTmp ); string ucstrTmp( chTmp );
ucstring::size_type idx = result.find(ucstrTmp); string::size_type idx = result.find(ucstrTmp);
// if there's a parameter in the string // if there's a parameter in the string
if( idx != ucstring::npos ) if( idx != string::npos )
{ {
ucstring rep; string rep;
rep = "???"; rep = "???";
if (dynParamIdx >= args.size()) if (dynParamIdx >= args.size())
{ {
nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.toString().c_str(), args.size(), dynParamIdx); nlwarning ("Missing args for string '%s', only %d args, need arg %d", ucstrbase.c_str(), args.size(), dynParamIdx);
} }
else else
{ {
@ -948,15 +947,15 @@ bool CClientChatManager::getString( ucstring &result, std::vector<uint64>& args,
} // getString // } // getString //
// *************************************************************************** // ***************************************************************************
void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result) void CClientChatManager::buildTellSentence(const string &sender, const string &msg, string &result)
{ {
// If no sender name was provided, show only the msg // If no sender name was provided, show only the msg
if ( sender.empty() ) if ( sender.empty() )
result = msg; result = msg;
else else
{ {
ucstring name = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); string name = CEntityCL::removeTitleAndShardFromName(sender);
ucstring csr; string csr;
// 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())
@ -965,29 +964,29 @@ void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstrin
CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true)); CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true));
bool bWoman = entity && entity->getGender() == GSGENDER::female; bool bWoman = entity && entity->getGender() == GSGENDER::female;
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman);
{ {
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = name.find('$'); ucstring::size_type pos = name.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name.toUtf8()), bWoman); name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman);
} }
} }
} }
else else
{ {
// Does the char have a CSR title? // Does the char have a CSR title?
csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : "";
} }
result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; result = csr + name + " " + CI18N::get("tellsYou") + ": " + msg;
} }
} }
// *************************************************************************** // ***************************************************************************
void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result) void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const string &sender, const string &msg, CChatGroup::TGroupType type, string &result)
{ {
// if its a tell, then use buildTellSentence // if its a tell, then use buildTellSentence
if(type==CChatGroup::tell) if(type==CChatGroup::tell)
@ -1005,35 +1004,35 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
// get the category if any. Note, in some case (chat from other player), there is not categories // get the category if any. Note, in some case (chat from other player), there is not categories
// and we do not want getStringCategory to return 'SYS' category. // and we do not want getStringCategory to return 'SYS' category.
ucstring finalMsg; string finalMsg;
string catStr = getStringCategory(msg, finalMsg, false); string catStr = getStringCategory(msg, finalMsg, false);
ucstring cat; string cat;
if (!catStr.empty()) if (!catStr.empty())
cat = string("&")+catStr+"&"; cat = "&" + catStr + "&";
if ( ! cat.empty()) if (!cat.empty())
{ {
result = msg; result = msg;
return; return;
} }
// Format the sentence with the provided sender name // Format the sentence with the provided sender name
ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender.toUtf8()); string senderName = CEntityCL::removeTitleAndShardFromName(sender);
ucstring csr; string csr;
// Does the char have a CSR title? // Does the char have a CSR title?
csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender.toUtf8())) ? ucstring("(CSR) ") : ucstring(""); csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? "(CSR) " : "";
if (UserEntity && senderName.toUtf8() == UserEntity->getDisplayName()) if (UserEntity && senderName == UserEntity->getDisplayName())
{ {
// The player talks // The player talks
switch(type) switch(type)
{ {
case CChatGroup::shout: case CChatGroup::shout:
result = cat + csr + CI18N::get("youShout") + ucstring(": ") + finalMsg; result = cat + csr + CI18N::get("youShout") + ": " + finalMsg;
break; break;
default: default:
result = cat + csr + CI18N::get("youSay") + ucstring(": ") + finalMsg; result = cat + csr + CI18N::get("youSay") + ": " + finalMsg;
break; break;
} }
} }
@ -1046,13 +1045,13 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
// We need the gender to display the correct title // We need the gender to display the correct title
bool bWoman = entity && entity->getGender() == GSGENDER::female; bool bWoman = entity && entity->getGender() == GSGENDER::female;
senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender.toUtf8()), bWoman); senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman);
{ {
// Sometimes translation contains another title // Sometimes translation contains another title
ucstring::size_type pos = senderName.find('$'); ucstring::size_type pos = senderName.find('$');
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName.toUtf8()), bWoman); senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman);
} }
} }
} }
@ -1061,10 +1060,10 @@ void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderInde
switch(type) switch(type)
{ {
case CChatGroup::shout: case CChatGroup::shout:
result = cat + csr + senderName + ucstring(" ") + CI18N::get("heShout") + ucstring(": ") + finalMsg; result = cat + csr + senderName + " " + CI18N::get("heShout") + ": " + finalMsg;
break; break;
default: default:
result = cat + csr + senderName + ucstring(" ") + CI18N::get("heSays") + ucstring(": ") + finalMsg; result = cat + csr + senderName + " " + CI18N::get("heSays") + ": " + finalMsg;
break; break;
} }
} }
@ -1174,7 +1173,7 @@ void CClientChatManager::updateDynamicChatChannels(IChatDisplayer &chatDisplayer
class CHandlerTell : public IActionHandler class CHandlerTell : public IActionHandler
{ {
void execute (CCtrlBase *pCaller, const std::string &sParams) void execute (CCtrlBase *pCaller, const string &sParams)
{ {
string receiver = getParam (sParams, "player"); string receiver = getParam (sParams, "player");
string message; string message;
@ -1219,7 +1218,7 @@ REGISTER_ACTION_HANDLER( CHandlerTell, "tell");
class CHandlerEnterTell : public IActionHandler class CHandlerEnterTell : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
string receiver = getParam (sParams, "player"); string receiver = getParam (sParams, "player");
@ -1295,7 +1294,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break; case CChatGroup::guild: if (guildActive) pUserBut->setHardText("uiFilterGuild"); break;
case CChatGroup::dyn_chat: case CChatGroup::dyn_chat:
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChannelDbIndex);
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
if (title.empty()) if (title.empty())
{ {
@ -1305,7 +1304,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
} }
else else
{ {
pUserBut->setHardText(title.toUtf8()); pUserBut->setHardText(title);
} }
break; break;
} }
@ -1337,7 +1336,7 @@ void CClientChatManager::updateChatModeAndButton(uint mode, uint32 dynamicChanne
class CHandlerTalk : public IActionHandler class CHandlerTalk : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
// Param // Param
uint mode; uint mode;
@ -1376,7 +1375,7 @@ class CHandlerTalk : public IActionHandler
else else
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists"));
} }
} }
else else
@ -1409,7 +1408,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalk, "talk");
class CHandlerEnterTalk : public IActionHandler class CHandlerEnterTalk : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
// Param // Param
uint mode; uint mode;
@ -1436,10 +1435,10 @@ REGISTER_ACTION_HANDLER( CHandlerEnterTalk, "enter_talk");
class CHandlerTalkMessage : public IActionHandler class CHandlerTalkMessage : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
// Param // Param
ucstring text = CI18N::get ("uiTalkMemMsg"+sParams); string text = CI18N::get ("uiTalkMemMsg"+sParams);
// Find the base group // Find the base group
if (!text.empty()) if (!text.empty())
@ -1455,7 +1454,7 @@ REGISTER_ACTION_HANDLER( CHandlerTalkMessage, "talk_message");
class CHandlerSwapChatMode : public IActionHandler class CHandlerSwapChatMode : public IActionHandler
{ {
void execute (CCtrlBase * /* pCaller */, const std::string &sParams) void execute (CCtrlBase * /* pCaller */, const string &sParams)
{ {
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
bool updateCapture= getParam(sParams, "update_capture")=="1"; bool updateCapture= getParam(sParams, "update_capture")=="1";

@ -137,11 +137,11 @@ public:
* \param mode in which channel should this message goes * \param mode in which channel should this message goes
* \param dynChatId is valid only if mode==dyn_chat. This the Id of channel (not the index in DB!) * \param dynChatId is valid only if mode==dyn_chat. This the Id of channel (not the index in DB!)
*/ */
virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0) =0; virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0) =0;
/** /**
* display a player tell message * display a player tell message
*/ */
virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) =0; virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName) =0;
/** /**
* Clear a channel. * Clear a channel.
* \param dynChatDbIndex is valid only if mode==dyn_chat. Contrary to displayChat, this is the Db Index (0..MaxDynChanPerPlayer) * \param dynChatDbIndex is valid only if mode==dyn_chat. Contrary to displayChat, this is the Db Index (0..MaxDynChanPerPlayer)
@ -177,18 +177,18 @@ public :
* \param str is the chat content (truncated to 255 char max) * \param str is the chat content (truncated to 255 char max)
* \param isChatTeam special case for Chat TEAM * \param isChatTeam special case for Chat TEAM
*/ */
void chat( const ucstring& str, bool isChatTeam = false ); void chat( const std::string& str, bool isChatTeam = false );
/** /**
* Transmit a chat message to the receiver * Transmit a chat message to the receiver
* \param receiver is the name of the listening char (truncated to 255 char max) * \param receiver is the name of the listening char (truncated to 255 char max)
* \param str is the chat content (truncated to 255 char max) * \param str is the chat content (truncated to 255 char max)
*/ */
void tell( const std::string& receiver, const ucstring& str ); void tell( const std::string& receiver, const std::string& str );
/** Get the last name of the people with which a 'tell' has been done, then move that name at the start of the list /** Get the last name of the people with which a 'tell' has been done, then move that name at the start of the list
*/ */
const ucstring *cycleLastTell(); const std::string *cycleLastTell();
/** Set the max number of name in the tell list /** Set the max number of name in the tell list
*/ */
@ -263,12 +263,12 @@ public :
* \param result decoded string * \param result decoded string
* \return true if the string is finalize, false if some param are missing from network * \return true if the string is finalize, false if some param are missing from network
*/ */
bool getString( ucstring &result, std::vector<uint64>& args, const ucstring& strbase ); bool getString( std::string &result, std::vector<uint64>& args, const std::string& strbase );
// build a sentence to be displayed in the chat (e.g add "you say", "you shout", "[user name] says" or "[user name] shout") // build a sentence to be displayed in the chat (e.g add "you say", "you shout", "[user name] says" or "[user name] shout")
static void buildChatSentence(TDataSetIndex compressedSenderIndex, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result); static void buildChatSentence(TDataSetIndex compressedSenderIndex, const std::string &sender, const std::string &msg, CChatGroup::TGroupType type, std::string &result);
// build a sentence to be displayed in the tell // build a sentence to be displayed in the tell
static void buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result); static void buildTellSentence(const std::string &sender, const std::string &msg, std::string &result);
/// \name Dynamic Chat channel mgt /// \name Dynamic Chat channel mgt
@ -338,7 +338,7 @@ private :
std::list<CChatMsgNode> _ChatBuffer; std::list<CChatMsgNode> _ChatBuffer;
// peoples // peoples
std::list<ucstring> _TellPeople; // the last people on which tells ha been done std::list<std::string> _TellPeople; // the last people on which tells ha been done
uint _NumTellPeople; uint _NumTellPeople;
uint _MaxNumTellPeople; uint _MaxNumTellPeople;
@ -361,7 +361,7 @@ private :
* \param str string with parameter values at end (str will change after) * \param str string with parameter values at end (str will change after)
* \return decoded string (str) * \return decoded string (str)
*/ */
ucstring getString( NLMISC::CBitMemStream& bms, ucstring& str ); std::string getString( NLMISC::CBitMemStream& bms, std::string& str );
}; };

@ -240,20 +240,18 @@ NLMISC_COMMAND(equipGroup, "equip group <name>", "name")
} }
if(CItemGroupManager::getInstance()->equipGroup(args[0])) if(CItemGroupManager::getInstance()->equipGroup(args[0]))
{ {
ucstring msg = CI18N::get("cmdEquipGroupSuccess"); string msg = CI18N::get("cmdEquipGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return true; return true;
} }
else else
{ {
ucstring msg = CI18N::get("cmdEquipGroupError"); string msg = CI18N::get("cmdEquipGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -274,10 +272,9 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1]))) if(CItemGroupManager::getInstance()->moveGroup(args[0], INVENTORIES::toInventory(args[1])))
{ {
ucstring msg = CI18N::get("cmdMoveGroupSuccess"); string msg = CI18N::get("cmdMoveGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
strFindReplace(msg, "%inventory", args[1]); strFindReplace(msg, "%inventory", args[1]);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
@ -285,10 +282,9 @@ NLMISC_COMMAND(moveGroup, "move group <name> to <dst>", "name dst")
} }
else else
{ {
ucstring msg = CI18N::get("cmdMoveGroupError"); string msg = CI18N::get("cmdMoveGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
strFindReplace(msg, "%inventory", args[1]); strFindReplace(msg, "%inventory", args[1]);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
@ -312,24 +308,22 @@ NLMISC_COMMAND(createGroup, "create group <name> [true](create a <remove> for ev
removeUnequiped = !args[1].empty(); removeUnequiped = !args[1].empty();
if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped)) if(CItemGroupManager::getInstance()->createGroup(args[0], removeUnequiped))
{ {
ucstring msg; string msg;
if(removeUnequiped) if(removeUnequiped)
msg = CI18N::get("cmdCreateGroupSuccess2"); msg = CI18N::get("cmdCreateGroupSuccess2");
else else
msg = CI18N::get("cmdCreateGroupSuccess1"); msg = CI18N::get("cmdCreateGroupSuccess1");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return true; return true;
} }
else else
{ {
ucstring msg = CI18N::get("cmdCreateGroupError"); string msg = CI18N::get("cmdCreateGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -350,20 +344,18 @@ NLMISC_COMMAND(deleteGroup, "delete group <name>", "name")
} }
if(CItemGroupManager::getInstance()->deleteGroup(args[0])) if(CItemGroupManager::getInstance()->deleteGroup(args[0]))
{ {
ucstring msg = CI18N::get("cmdDeleteGroupSuccess"); string msg = CI18N::get("cmdDeleteGroupSuccess");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return true; return true;
} }
else else
{ {
ucstring msg = CI18N::get("cmdDeleteGroupError"); string msg = CI18N::get("cmdDeleteGroupError");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = args[0];
nameUC.fromUtf8(args[0]);
strFindReplace(msg, "%name", nameUC); strFindReplace(msg, "%name", nameUC);
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -494,7 +486,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[<min>] <max> [h
if (!randomFromString(args[0], max)) if (!randomFromString(args[0], max))
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg = CI18N::get("uiRandomBadParameter"); string msg = CI18N::get("uiRandomBadParameter");
strFindReplace(msg, "%s", args[0] ); strFindReplace(msg, "%s", args[0] );
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -504,7 +496,7 @@ NLMISC_COMMAND(random, "Roll a dice and say the result around","[<min>] <max> [h
if (!randomFromString(args[1], min)) if (!randomFromString(args[1], min))
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg = CI18N::get("uiRandomBadParameter"); string msg = CI18N::get("uiRandomBadParameter");
strFindReplace(msg, "%s", args[1] ); strFindReplace(msg, "%s", args[1] );
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
return false; return false;
@ -544,7 +536,7 @@ NLMISC_COMMAND(dumpShapePos, "Dump Last Added Shape Pos.", "")
CInterfaceManager *IM = CInterfaceManager::getInstance(); CInterfaceManager *IM = CInterfaceManager::getInstance();
CVector pos = ShapeAddedByCommand.back().getPos(); CVector pos = ShapeAddedByCommand.back().getPos();
IM->displaySystemInfo(ucstring(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z))); IM->displaySystemInfo(toString("Shape Pos = %f, %f, %f", pos.x, pos.y, pos.z));
return true; return true;
} }
//----------------------------------------------- //-----------------------------------------------
@ -1096,11 +1088,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic"
{ {
// Help // Help
CInterfaceManager *IM = CInterfaceManager::getInstance(); CInterfaceManager *IM = CInterfaceManager::getInstance();
IM->displaySystemInfo(ucstring("This command need 1 parameter :")); IM->displaySystemInfo("This command need 1 parameter :");
IM->displaySystemInfo(ucstring("<string> :")); IM->displaySystemInfo("<string> :");
IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); IM->displaySystemInfo("- none(to remove all verboses)");
IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); IM->displaySystemInfo("- magic(to add debug infos about magic)");
IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); IM->displaySystemInfo("- anim (to add debug infos about animation)");
} }
else else
{ {
@ -1114,11 +1106,11 @@ NLMISC_COMMAND(verbose, "Enable/Disable some Debug Information", "none or magic"
else else
{ {
CInterfaceManager *IM = CInterfaceManager::getInstance(); CInterfaceManager *IM = CInterfaceManager::getInstance();
IM->displaySystemInfo(ucstring("This command need 1 parameter :")); IM->displaySystemInfo("This command need 1 parameter :");
IM->displaySystemInfo(ucstring("<string> :")); IM->displaySystemInfo("<string> :");
IM->displaySystemInfo(ucstring("- none(to remove all verboses)")); IM->displaySystemInfo("- none(to remove all verboses)");
IM->displaySystemInfo(ucstring("- magic(to add debug infos about magic)")); IM->displaySystemInfo("- magic(to add debug infos about magic)");
IM->displaySystemInfo(ucstring("- anim (to add debug infos about animation)")); IM->displaySystemInfo("- anim (to add debug infos about animation)");
} }
} }
return true; return true;
@ -1323,7 +1315,7 @@ NLMISC_COMMAND(execScript, "Execute a script file (.cmd)","<FileName>")
} }
else else
{ {
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("Cannot open file")); CInterfaceManager::getInstance()->displaySystemInfo("Cannot open file");
} }
return true; return true;
@ -1368,7 +1360,7 @@ NLMISC_COMMAND(db, "Modify Database","<Property> <Value>")
{ {
sint64 prop = node->getValue64(); sint64 prop = node->getValue64();
string str = toString(prop); string str = toString(prop);
pIM->displaySystemInfo(ucstring(str)); pIM->displaySystemInfo(str);
nlinfo("%s", str.c_str()); nlinfo("%s", str.c_str());
} }
else else
@ -1722,7 +1714,7 @@ NLMISC_COMMAND(getSheetId, "get_sheet_id","<sheet file name>")
return false; return false;
CSheetId id(args[0]); CSheetId id(args[0]);
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(toString(id.asInt()))); CInterfaceManager::getInstance()->displaySystemInfo(toString(id.asInt()));
return true; return true;
} }
@ -1737,7 +1729,7 @@ NLMISC_COMMAND(getSheetName, "get_sheet_name","<Sheet Id>")
string name = id.toString(); string name = id.toString();
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(name)); CInterfaceManager::getInstance()->displaySystemInfo(name);
return true; return true;
} }
@ -2388,7 +2380,7 @@ NLMISC_COMMAND(sheet2idx, "Return the index of a sheet", "<sheet name> <visual s
else else
result = NLMISC::toString("sheet '%s' not valid", args[0].c_str()); result = NLMISC::toString("sheet '%s' not valid", args[0].c_str());
IM->displaySystemInfo(ucstring(result)); IM->displaySystemInfo(result);
nlinfo("'sheet2idx': %s", result.c_str()); nlinfo("'sheet2idx': %s", result.c_str());
return true; return true;
} }
@ -2411,7 +2403,7 @@ NLMISC_COMMAND(dynstr, "display a dyn string value", "<dyn string_id>")
uint dynId; uint dynId;
fromString(args[0], dynId); fromString(args[0], dynId);
ucstring result; string result;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result); STRING_MANAGER::CStringManagerClient::instance()->getDynString(dynId, result);
CInterfaceManager::getInstance()->displaySystemInfo(result); CInterfaceManager::getInstance()->displaySystemInfo(result);
@ -2426,7 +2418,7 @@ NLMISC_COMMAND(serverstr, "display a server string value", "<serverstr string_id
uint dynId; uint dynId;
fromString(args[0], dynId); fromString(args[0], dynId);
ucstring result; string result;
STRING_MANAGER::CStringManagerClient::instance()->getString(dynId, result); STRING_MANAGER::CStringManagerClient::instance()->getString(dynId, result);
CInterfaceManager::getInstance()->displaySystemInfo(result); CInterfaceManager::getInstance()->displaySystemInfo(result);
@ -2510,11 +2502,11 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", "<Slot> <Mode> [
if(args.size() < 2) if(args.size() < 2)
{ {
// Help // Help
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 paramters :")); CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 paramters :");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Slot> : the slot number of the entity to change")); CInterfaceManager::getInstance()->displaySystemInfo(" <Slot> : the slot number of the entity to change");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Mode> : the mode wanted for the entity, one of the following number :")); CInterfaceManager::getInstance()->displaySystemInfo(" <Mode> : the mode wanted for the entity, one of the following number :");
for(uint i = 0; i<MBEHAV::NUMBER_OF_MODES; ++i) for(uint i = 0; i<MBEHAV::NUMBER_OF_MODES; ++i)
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()))); CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::modeToString((MBEHAV::EMode)i).c_str()));
} }
// Right parameters number // Right parameters number
else else
@ -2544,7 +2536,7 @@ NLMISC_COMMAND(mode, "Change the mode for an entity in a slot", "<Slot> <Mode> [
} }
// Invalid slot. // Invalid slot.
else else
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot");
} }
// Command well done. // Command well done.
@ -2557,12 +2549,12 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "<Slot
if(args.size() < 2 || args.size() > 6) if(args.size() < 2 || args.size() > 6)
{ {
// Help // Help
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("This command need 2 to 6 paramters :")); CInterfaceManager::getInstance()->displaySystemInfo("This command need 2 to 6 paramters :");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Slot> : the slot number of the entity to change")); CInterfaceManager::getInstance()->displaySystemInfo(" <Slot> : the slot number of the entity to change");
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(" <Behaviour> : the behaviour to play for the entity, one of the following number :")); CInterfaceManager::getInstance()->displaySystemInfo(" <Behaviour> : the behaviour to play for the entity, one of the following number :");
for(uint i = 0; i<MBEHAV::EMOTE_BEGIN; ++i) for(uint i = 0; i<MBEHAV::EMOTE_BEGIN; ++i)
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()))); CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d - %s", i, MBEHAV::behaviourToString((MBEHAV::EBehaviour)i).c_str()));
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END))); CInterfaceManager::getInstance()->displaySystemInfo(NLMISC::toString(" %d-%d - Emotes", MBEHAV::EMOTE_BEGIN, MBEHAV::EMOTE_END));
} }
else else
{ {
@ -2633,7 +2625,7 @@ NLMISC_COMMAND(behaviour, "Change the behaviour for an entity in a slot", "<Slot
entity->updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR); entity->updateVisualProperty(NetMngr.getCurrentServerTick()+dt, CLFECOMMON::PROPERTY_BEHAVIOUR);
} }
else else
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot");
} }
// Command well done. // Command well done.
@ -2782,7 +2774,7 @@ NLMISC_COMMAND(spell, "Cast a spell", "\n"
entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR); entity->updateVisualProperty(NetMngr.getCurrentServerTick()+50, CLFECOMMON::PROPERTY_BEHAVIOUR);
} }
else else
CInterfaceManager::getInstance()->displaySystemInfo(ucstring("There is no entity in the given slot")); CInterfaceManager::getInstance()->displaySystemInfo("There is no entity in the given slot");
} }
// Command well done. // Command well done.
@ -4005,7 +3997,7 @@ NLMISC_COMMAND(displayInventoryCounter, "display the Inventory counter to compar
srvVal&= pIM->getLocalSyncActionCounterMask(); srvVal&= pIM->getLocalSyncActionCounterMask();
locVal&= pIM->getLocalSyncActionCounterMask(); locVal&= pIM->getLocalSyncActionCounterMask();
pIM->displaySystemInfo(ucstring( "ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); pIM->displaySystemInfo("ServerCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal));
// Well done. // Well done.
return true; return true;
@ -4023,7 +4015,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "")
srvVal&= PHRASE_EXECUTE_COUNTER_MASK; srvVal&= PHRASE_EXECUTE_COUNTER_MASK;
locVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK;
pIM->displaySystemInfo(ucstring( "NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); pIM->displaySystemInfo("NextCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal));
// cycle // cycle
srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32(); srvVal= NLGUI::CDBManager::getInstance()->getDbProp(PHRASE_DB_COUNTER_CYCLE)->getValue32();
@ -4031,7 +4023,7 @@ NLMISC_COMMAND(displayActionCounter, "display the action counters", "")
srvVal&= PHRASE_EXECUTE_COUNTER_MASK; srvVal&= PHRASE_EXECUTE_COUNTER_MASK;
locVal&= PHRASE_EXECUTE_COUNTER_MASK; locVal&= PHRASE_EXECUTE_COUNTER_MASK;
pIM->displaySystemInfo(ucstring( "CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal)) ); pIM->displaySystemInfo("CycleCounter: " + toString(srvVal) + "/ LocalCounter: " + toString(locVal));
return true; return true;
} }
@ -4114,7 +4106,7 @@ NLMISC_COMMAND(skillToInt, "Convert a skill to an int", "")
{ {
if (args.size() != 1) return false; if (args.size() != 1) return false;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring(toString((uint) SKILLS::toSkill(args[0])))); im->displaySystemInfo(toString((uint) SKILLS::toSkill(args[0])));
return true; return true;
} }
@ -4520,7 +4512,7 @@ NLMISC_COMMAND(getSkillValue, "get a skill value by its name", "skill_name")
CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false); CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:SKILL", skillId), false);
if(node) if(node)
{ {
pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); pIM->displaySystemInfo(toString(node->getValue32()));
} }
return true; return true;
@ -4550,7 +4542,7 @@ NLMISC_COMMAND(getBaseSkillValue, "get a baseskill value by its name", "skill_na
CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false); CCDBNodeLeaf *node= NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:CHARACTER_INFO:SKILLS:%d:BaseSKILL", skillId), false);
if(node) if(node)
{ {
pIM->displaySystemInfo(ucstring(toString(node->getValue32()))); pIM->displaySystemInfo(toString(node->getValue32()));
} }
return true; return true;
@ -4812,7 +4804,7 @@ NLMISC_COMMAND(stick_log, "", "<slot>")
skel->getStickedObjects(sticks); skel->getStickedObjects(sticks);
nlinfo("StickedModels: %d", sticks.size()); nlinfo("StickedModels: %d", sticks.size());
pIM->displaySystemInfo(ucstring(toString("StickedModels: %d", sticks.size()))); pIM->displaySystemInfo(toString("StickedModels: %d", sticks.size()));
for(uint i=0;i<sticks.size();i++) for(uint i=0;i<sticks.size();i++)
{ {
@ -5377,7 +5369,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std:
if ((uint)index >= args.size()) if ((uint)index >= args.size())
{ {
// Not enough arguments // Not enough arguments
pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount"));
return false; return false;
} }
else else
@ -5414,7 +5406,7 @@ bool CUserCommand::execute(const std::string &/* rawCommandString */, const std:
else else
{ {
// Not enough argument // Not enough argument
pIM->displaySystemInfo (ucstring(CommandName+" : ")+CI18N::get ("uiCommandWrongArgumentCount")); pIM->displaySystemInfo (CommandName+" : "+CI18N::get ("uiCommandWrongArgumentCount"));
return false; return false;
} }
return true; return true;
@ -5658,7 +5650,7 @@ NLMISC_COMMAND(tickToDate, "convert a tick value into a readable ryzom time", ""
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
float ryTime = rt.getRyzomTime(); float ryTime = rt.getRyzomTime();
std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f))); std::string readableDate = toString("Day = %d, hour = %d:%d", rt.getRyzomDay(), (int) floorf(ryTime), (int) floorf(60.f * fmodf(ryTime, 1.f)));
im->displaySystemInfo(ucstring(readableDate)); im->displaySystemInfo(readableDate);
return true; return true;
} }
@ -5930,7 +5922,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "")
tm = gmtime(&date); tm = gmtime(&date);
strftime(cs_utc, size, "%X", tm); strftime(cs_utc, size, "%X", tm);
ucstring msg = CI18N::get("uiCurrentLocalAndUtcTime"); string msg = CI18N::get("uiCurrentLocalAndUtcTime");
strFindReplace(msg, "%local", cs_local); strFindReplace(msg, "%local", cs_local);
strFindReplace(msg, "%utc", cs_utc); strFindReplace(msg, "%utc", cs_utc);
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
@ -5939,7 +5931,7 @@ NLMISC_COMMAND(time, "Shows information about the current time", "")
NLMISC_COMMAND(playedTime, "Display character played time", "") NLMISC_COMMAND(playedTime, "Display character played time", "")
{ {
ucstring msg = CI18N::get("uiPlayedTime"); string msg = CI18N::get("uiPlayedTime");
strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime)); strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime));
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
return true; return true;
@ -5947,7 +5939,7 @@ NLMISC_COMMAND(playedTime, "Display character played time", "")
NLMISC_COMMAND(version, "Display client version", "") NLMISC_COMMAND(version, "Display client version", "")
{ {
ucstring msg = getDebugVersion(); string msg = getDebugVersion();
CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
return true; return true;
} }

@ -647,7 +647,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
if (!im->isInGame()) return; if (!im->isInGame()) return;
// there was no / at the start of the line so try to cycle through the last people on which a tell was done // there was no / at the start of the line so try to cycle through the last people on which a tell was done
const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); const string *lastTellPeople = ChatMngr.cycleLastTell();
if (!lastTellPeople) return; if (!lastTellPeople) return;
// Get chat box from ist edit box // Get chat box from ist edit box
// If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window // If it isn't a user chat or the main chat, just display 'tell' with the name. Otherwise, change the target of the window
@ -661,7 +661,7 @@ class CAHEditExpandOrCycleTell : public CAHEdit
else else
{ {
// it is not a filtered chat, display 'tell' (must be ingame) // it is not a filtered chat, display 'tell' (must be ingame)
_GroupEdit->setCommand("tell " + (*lastTellPeople).toUtf8() + ' ', false); _GroupEdit->setCommand("tell " + (*lastTellPeople) + ' ', false);
} }
} }
}; };

@ -1358,19 +1358,19 @@ class CSelectItemSheet : public IActionHandler
// display msg in the system infos // display msg in the system infos
if (!canUse) if (!canUse)
{ {
ucstring msg = CI18N::get("msgCantUseItem"); string msg = CI18N::get("msgCantUseItem");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
} }
if (!canBuild) if (!canBuild)
{ {
ucstring msg = CI18N::get("msgCantBuild"); string msg = CI18N::get("msgCantBuild");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
} }
if (!canUseBuiltItem) if (!canUseBuiltItem)
{ {
ucstring msg = CI18N::get("msgCantUseBuiltItem"); string msg = CI18N::get("msgCantUseBuiltItem");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
} }
@ -3797,7 +3797,7 @@ class CHandlerSetInterfaceScale : public IActionHandler
} }
} }
ucstring help("/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max)); string help = "/setuiscale "+toString("%.1f .. %.1f", ClientCfg.InterfaceScale_min, ClientCfg.InterfaceScale_max);
CInterfaceManager::getInstance()->displaySystemInfo(help); CInterfaceManager::getInstance()->displaySystemInfo(help);
} }
}; };
@ -3981,7 +3981,7 @@ public:
// display parry mode msg // display parry mode msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserModeParry"); string msg = CI18N::get("msgUserModeParry");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -3998,7 +3998,7 @@ public:
// display dodge mode msg // display dodge mode msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserModeDodge"); string msg = CI18N::get("msgUserModeDodge");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -4533,7 +4533,7 @@ public:
if( sCustomPhrase.empty() ) if( sCustomPhrase.empty() )
{ {
// Create the message and send. // Create the message and send.
const string msgName = "COMMAND:EMOTE"; static const string msgName = "COMMAND:EMOTE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4548,7 +4548,7 @@ public:
else else
{ {
// Create the message and send. // Create the message and send.
const string msgName = "COMMAND:CUSTOM_EMOTE"; static const string msgName = "COMMAND:CUSTOM_EMOTE";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -4561,7 +4561,7 @@ public:
{ {
// display "no animation for emote" // display "no animation for emote"
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCustomizedEmoteNoAnim"); string msg = CI18N::get("msgCustomizedEmoteNoAnim");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
return; return;
@ -4573,7 +4573,7 @@ public:
} }
out.serialEnum(behavToSend); out.serialEnum(behavToSend);
out.serial(ucstr); out.serial(ucstr); // FIXME: UTF-8 (serial)
NetMngr.push(out); NetMngr.push(out);
//nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str()); //nlinfo("impulseCallBack : %s %d %s sent", msgName.c_str(), (uint32)behavToSend, sCustomPhrase.c_str());
} }

@ -598,7 +598,7 @@ void getBuffer (CBitmap &btm)
void displayScreenShotSavedInfo(const string &filename) void displayScreenShotSavedInfo(const string &filename)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg("'" + filename + "' " + CI18N::get("uiScreenshotSaved")); string msg = "'" + filename + "' " + CI18N::get("uiScreenshotSaved");
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);
} }
@ -885,7 +885,7 @@ class CAHCycleTell : public IActionHandler
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
if (!im->isInGame()) return; if (!im->isInGame()) return;
const ucstring *lastTellPeople = ChatMngr.cycleLastTell(); const string *lastTellPeople = ChatMngr.cycleLastTell();
if (!lastTellPeople) return; if (!lastTellPeople) return;
// just popup the main chat // just popup the main chat
//CChatWindow *w = PeopleInterraction.MainChat.Window; //CChatWindow *w = PeopleInterraction.MainChat.Window;

@ -441,7 +441,7 @@ class CAHToggleDodgeParry : public IActionHandler
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg; string msg;
// 0 - dodge mode // 0 - dodge mode
// 1 - parry mode // 1 - parry mode
if (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEFENSE:DEFENSE_MODE")->getValue32() == 0) if (NLGUI::CDBManager::getInstance()->getDbProp("SERVER:DEFENSE:DEFENSE_MODE")->getValue32() == 0)

@ -1173,7 +1173,7 @@ public:
{ {
// display "you can't cast while moving" // display "you can't cast while moving"
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgNoCastWhileMoving"); string msg = CI18N::get("msgNoCastWhileMoving");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
return; return;
@ -1417,7 +1417,7 @@ public:
else else
{ {
// debug: // debug:
pIM->displaySystemInfo( ucstring("PHRASE:CANCEL_ALL") ); pIM->displaySystemInfo("PHRASE:CANCEL_ALL");
} }
} }
}; };

@ -97,7 +97,7 @@ public:
std::vector<SDispString> &rVal = acces.value (); std::vector<SDispString> &rVal = acces.value ();
for (uint i = 0; i < rVal.size(); ++i) for (uint i = 0; i < rVal.size(); ++i)
{ {
CInterfaceManager::getInstance()->displayDebugInfo(ucstring(rVal[i].Str), rVal[i].Mode); CInterfaceManager::getInstance()->displayDebugInfo(rVal[i].Str, rVal[i].Mode);
} }
rVal.clear(); rVal.clear();
} }

@ -170,7 +170,7 @@ void CChatInputFilter::chatWindowRemoved(CChatWindow *cw)
} }
//============================================================================================================= //=============================================================================================================
void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible) void CChatInputFilter::displayMessage(const string &msg, NLMISC::CRGBA col, uint numBlinks /*=0*/, bool *windowVisible)
{ {
bool windowVisibleTmp = false; bool windowVisibleTmp = false;
std::vector<CChatWindow *>::iterator it; std::vector<CChatWindow *>::iterator it;
@ -187,10 +187,9 @@ void CChatInputFilter::displayMessage(const ucstring &msg, NLMISC::CRGBA col, ui
} }
//============================================================================================================= //=============================================================================================================
void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/) void CChatInputFilter::displayTellMessage(/*TDataSetIndex &receiverIndex, */const string &msg, const string &sender, NLMISC::CRGBA col, uint numBlinks /*=0*/,bool *windowVisible /*=NULL*/)
{ {
ucstring senderLwr; string senderLwr = NLMISC::toLower(sender);
senderLwr.fromUtf8(NLMISC::toLower(sender.toUtf8()));
// look in people lists // look in people lists
std::vector<CPeopleList *>::iterator peopleListIt; std::vector<CPeopleList *>::iterator peopleListIt;
@ -290,7 +289,7 @@ void CChatTargetFilter::setChat(CChatWindow *w)
} }
//============================================================================================================= //=============================================================================================================
void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow) void CChatTargetFilter::msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
// Common Target case // Common Target case
if (ClientCfg.Local) if (ClientCfg.Local)
@ -307,9 +306,9 @@ void CChatTargetFilter::msgEntered(const ucstring &msg, CChatWindow *chatWindow)
else if (!_TargetPlayer.empty()) else if (!_TargetPlayer.empty())
{ {
// the target must be a player, make a tell on him // the target must be a player, make a tell on him
ChatMngr.tell(_TargetPlayer.toString(), msg); ChatMngr.tell(_TargetPlayer, msg);
// direct output in the chat // direct output in the chat
chatWindow->displayLocalPlayerTell(_TargetPlayer.toString(), msg); chatWindow->displayLocalPlayerTell(_TargetPlayer, msg);
} }
else else
{ {
@ -334,7 +333,7 @@ void CChatTargetFilter::setTargetPartyChat(CChatWindow *w)
} }
//============================================================================================================= //=============================================================================================================
void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer) void CChatTargetFilter::setTargetPlayer(const string &targetPlayer)
{ {
_TargetPlayer = targetPlayer; _TargetPlayer = targetPlayer;
if (_TargetPartyChat) if (_TargetPartyChat)
@ -345,7 +344,7 @@ void CChatTargetFilter::setTargetPlayer(const ucstring &targetPlayer)
// set the prompt // set the prompt
if (_Chat) if (_Chat)
{ {
_Chat->setPrompt(targetPlayer + (ucchar) '>'); _Chat->setPrompt(targetPlayer + '>');
} }
} }

@ -42,10 +42,10 @@ public:
* Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message * Listening windows will blick only if there isnt a single visible listening window, so that the player can know if there's a message
* \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible. * \param windowVisible is not NULL, points a bool that will be filled with true if one of the window on the which the msg was displayed is visible.
*/ */
void displayMessage(const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); void displayMessage(const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL);
/** The same as displayMessage, but with sender name, so that the msg will be displayed in attached people lists as well /** The same as displayMessage, but with sender name, so that the msg will be displayed in attached people lists as well
*/ */
void displayTellMessage(/*TDataSetIndex &senderIndex, */const ucstring &msg, const ucstring &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL); void displayTellMessage(/*TDataSetIndex &senderIndex, */const std::string &msg, const std::string &sender, NLMISC::CRGBA col, uint numBlinks = 0, bool *windowVisible = NULL);
/** Clear the messages in all registered chat windows /** Clear the messages in all registered chat windows
*/ */
void clearMessages(); void clearMessages();
@ -134,8 +134,8 @@ public:
/** Set a player as the target. This remove any previous window target /** Set a player as the target. This remove any previous window target
* NB : this replace any previous party chat or target group or player * NB : this replace any previous party chat or target group or player
*/ */
void setTargetPlayer(const ucstring &targetPlayer); void setTargetPlayer(const std::string &targetPlayer);
const ucstring &getTargetPlayer() const { return _TargetPlayer; } const std::string &getTargetPlayer() const { return _TargetPlayer; }
//@} //@}
private: private:
@ -148,14 +148,14 @@ private:
// @{ // @{
CChatWindow *_TargetPartyChat; // the target party chat CChatWindow *_TargetPartyChat; // the target party chat
CChatGroup::TGroupType _TargetGroup; CChatGroup::TGroupType _TargetGroup;
ucstring _TargetPlayer; std::string _TargetPlayer;
// relevant only if _TargetGroup==dyn_chat // relevant only if _TargetGroup==dyn_chat
uint32 _TargetDynamicChannelDbIndex; uint32 _TargetDynamicChannelDbIndex;
// @} // @}
private: private:
// from IChatWindowListener // from IChatWindowListener
void chatWindowRemoved(CChatWindow *cw); void chatWindowRemoved(CChatWindow *cw);
void msgEntered(const ucstring &msg, CChatWindow *chatWindow); void msgEntered(const std::string &msg, CChatWindow *chatWindow);
// copy not supported // copy not supported
CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); } CChatTargetFilter(const CChatTargetFilter &/* other */):NLMISC::CRefCount() { nlassert(0); }
CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; } CChatTargetFilter& operator=(const CChatTargetFilter &/* other */) { nlassert(0); return *this; }

@ -106,15 +106,13 @@ bool CChatTextManager::showTimestamps() const
} }
//================================================================================= //=================================================================================
static CInterfaceGroup *parseCommandTag(ucstring &line) static CInterfaceGroup *parseCommandTag(string &line)
{ {
string::size_type start = line.find(ucstring("/$$")); string::size_type start = line.find("/$$");
if (start == string::npos) return NULL; if (start == string::npos) return NULL;
string::size_type end = line.find(ucstring("$$/"), start + 3); string::size_type end = line.find("$$/", start + 3);
if (end == string::npos) return NULL; if (end == string::npos) return NULL;
std::string commandLine; std::string commandLine = line.substr(start + 3, end - start - 3);
ucstring ucCommandLine = line.substr(start + 3, end - start - 3);
ucCommandLine.toString(commandLine);
line = line.substr(0, start) + line.substr(end +3); line = line.substr(0, start) + line.substr(end +3);
vector<string> params; vector<string> params;
explode(commandLine, std::string("|"), params); explode(commandLine, std::string("|"), params);
@ -221,11 +219,11 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri
// *************************************************************************** // ***************************************************************************
// isUrlTag must match // isUrlTag must match
static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucstring &url, ucstring &title) static inline void getUrlTag(const string &s, string::size_type &index, string &url, string &title)
{ {
bool isMarkdown = false; bool isMarkdown = false;
ucstring::size_type textSize = s.size(); string::size_type textSize = s.size();
ucstring::size_type pos; string::size_type pos;
// see if we have markdown format // see if we have markdown format
if (s[index] == '(') if (s[index] == '(')
@ -250,8 +248,8 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
} }
} }
ucchar chOpen = ' '; char chOpen = ' ';
ucchar chClose = ' '; char chClose = ' ';
if (isMarkdown) if (isMarkdown)
{ {
chOpen = '['; chOpen = '[';
@ -272,7 +270,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
pos = s.find_first_of(chClose, index); pos = s.find_first_of(chClose, index);
// handle common special case: 'text http://.../, text' // handle common special case: 'text http://.../, text'
if (pos != ucstring::npos && index > 0) if (pos != string::npos && index > 0)
{ {
if (s[index-1] == ' ' && (s[pos-1] == ',' || s[pos-1] == '.')) if (s[index-1] == ' ' && (s[pos-1] == ',' || s[pos-1] == '.'))
{ {
@ -308,7 +306,7 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
} }
// fallback to full string length as we did match http:// already and url spans to the end probably // fallback to full string length as we did match http:// already and url spans to the end probably
if (pos == ucstring::npos) if (pos == string::npos)
{ {
pos = textSize; pos = textSize;
} }
@ -321,22 +319,22 @@ static inline void getUrlTag(const ucstring &s, ucstring::size_type &index, ucst
} }
//================================================================================= //=================================================================================
static void prependTimestamp(ucstring &msg) static void prependTimestamp(string &msg)
{ {
ucstring cur_time; string cur_time;
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false); CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:SHOW_CLOCK_12H", false);
if (node && node->getValueBool()) if (node && node->getValueBool())
cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] "); cur_time = CInterfaceManager::getTimestampHuman("[%I:%M:%S %p] ");
else else
cur_time = CInterfaceManager::getTimestampHuman(); cur_time = CInterfaceManager::getTimestampHuman();
ucstring::size_type codePos = msg.find(ucstring("@{")); string::size_type codePos = msg.find("@{");
if (codePos != ucstring::npos) if (codePos != string::npos)
{ {
// Prepend the current time (do it after the color if the color at first position. // Prepend the current time (do it after the color if the color at first position.
if (codePos == 0) if (codePos == 0)
{ {
codePos = msg.find(ucstring("}")); codePos = msg.find(string("}"));
msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos); msg = msg.substr(0, codePos + 1) + cur_time + msg.substr(codePos + 1, msg.length() - codePos);
} }
else else
@ -351,9 +349,9 @@ static void prependTimestamp(ucstring &msg)
} }
//================================================================================= //=================================================================================
CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/) CViewBase *CChatTextManager::createMsgText(const string &cstMsg, NLMISC::CRGBA col, bool justified /*=false*/, bool plaintext /*=false*/)
{ {
ucstring msg = cstMsg; string msg = cstMsg;
CInterfaceGroup *commandGroup = parseCommandTag(msg); CInterfaceGroup *commandGroup = parseCommandTag(msg);
if (showTimestamps()) if (showTimestamps())
@ -365,7 +363,7 @@ CViewBase *CChatTextManager::createMsgText(const ucstring &cstMsg, NLMISC::CRGBA
} }
//================================================================================= //=================================================================================
CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup) CViewBase *CChatTextManager::createMsgTextSimple(const string &msg, NLMISC::CRGBA col, bool justified, CInterfaceGroup *commandGroup)
{ {
CViewText *vt = new CViewText(CViewText::TCtorParam()); CViewText *vt = new CViewText(CViewText::TCtorParam());
// get parameters from config.xml // get parameters from config.xml
@ -379,14 +377,14 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR
// if text contain any color code, set the text formated and white, // if text contain any color code, set the text formated and white,
// otherwise, set text normal and apply global color // otherwise, set text normal and apply global color
if (msg.find(ucstring("@{")) != ucstring::npos) if (msg.find("@{") != string::npos)
{ {
vt->setTextFormatTaged(msg.toUtf8()); vt->setTextFormatTaged(msg);
vt->setColor(NLMISC::CRGBA::White); vt->setColor(NLMISC::CRGBA::White);
} }
else else
{ {
vt->setText(msg.toUtf8()); vt->setText(msg);
vt->setColor(col); vt->setColor(col);
} }
@ -401,9 +399,9 @@ CViewBase *CChatTextManager::createMsgTextSimple(const ucstring &msg, NLMISC::CR
} }
//================================================================================= //=================================================================================
CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup) CViewBase *CChatTextManager::createMsgTextComplex(const string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, CInterfaceGroup *commandGroup)
{ {
ucstring::size_type textSize = msg.size(); string::size_type textSize = msg.size();
CGroupParagraph *para = new CGroupParagraph(CViewBase::TCtorParam()); CGroupParagraph *para = new CGroupParagraph(CViewBase::TCtorParam());
para->setId("line"); para->setId("line");
@ -412,7 +410,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
// use right click because left click might be used to activate chat window // use right click because left click might be used to activate chat window
para->setRightClickHandler("copy_chat_popup"); para->setRightClickHandler("copy_chat_popup");
para->setRightClickHandlerParams(msg.toUtf8()); para->setRightClickHandlerParams(msg);
if (plaintext) if (plaintext)
{ {
@ -427,12 +425,12 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
// quickly check if text has links or not // quickly check if text has links or not
bool hasUrl; bool hasUrl;
{ {
ucstring s = toLower(msg); string s = toLower(msg);
hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://"))); hasUrl = (s.find("http://") || s.find("https://"));
} }
ucstring::size_type pos = 0; string::size_type pos = 0;
for (ucstring::size_type i = 0; i< textSize;) for (string::size_type i = 0; i< textSize;)
{ {
if (hasUrl && isUrlTag(msg, i, textSize)) if (hasUrl && isUrlTag(msg, i, textSize))
{ {
@ -442,8 +440,8 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
para->addChild(vt); para->addChild(vt);
} }
ucstring url; string url;
ucstring title; string title;
getUrlTag(msg, i, url, title); getUrlTag(msg, i, url, title);
if (url.size() > 0) if (url.size() > 0)
{ {
@ -465,29 +463,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
if (title.size() > 0) if (title.size() > 0)
{ {
vt->LinkTitle = title.toUtf8(); vt->LinkTitle = title;
vt->setText(vt->LinkTitle); vt->setText(vt->LinkTitle);
} }
else else
{ {
vt->LinkTitle = url.toUtf8(); vt->LinkTitle = url;
vt->setText(vt->LinkTitle); vt->setText(vt->LinkTitle);
} }
if (url.find_first_of('\'') != string::npos) if (url.find_first_of('\'') != string::npos)
{ {
ucstring clean; string clean;
for(string::size_type i = 0; i< url.size(); ++i) for(string::size_type i = 0; i< url.size(); ++i)
{ {
if (url[i] == '\'') if (url[i] == '\'')
clean += ucstring("%27"); clean += "%27";
else else
clean += url[i]; clean += url[i];
} }
url = clean; url = clean;
} }
vt->setActionOnLeftClick("lua"); vt->setActionOnLeftClick("lua");
vt->setParamsOnLeftClick("game:chatUrl('" + url.toUtf8() + "')"); vt->setParamsOnLeftClick("game:chatUrl('" + url + "')");
para->addChildLink(vt); para->addChildLink(vt);

@ -55,7 +55,7 @@ public:
* \param justified Should be true for justified text (stretch spaces of line to fill the full width) * \param justified Should be true for justified text (stretch spaces of line to fill the full width)
* \param plaintext Text will not be parsed for uri markup links * \param plaintext Text will not be parsed for uri markup links
*/ */
NLGUI::CViewBase *createMsgText(const ucstring &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false); NLGUI::CViewBase *createMsgText(const std::string &msg, NLMISC::CRGBA col, bool justified = false, bool plaintext = false);
// Singleton access // Singleton access
static CChatTextManager &getInstance(); static CChatTextManager &getInstance();
@ -79,8 +79,8 @@ private:
bool showTimestamps() const; bool showTimestamps() const;
NLGUI::CViewBase *createMsgTextSimple(const ucstring &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup); NLGUI::CViewBase *createMsgTextSimple(const std::string &msg, NLMISC::CRGBA col, bool justified, NLGUI::CInterfaceGroup *commandGroup);
NLGUI::CViewBase *createMsgTextComplex(const ucstring &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup); NLGUI::CViewBase *createMsgTextComplex(const std::string &msg, NLMISC::CRGBA col, bool justified, bool plaintext, NLGUI::CInterfaceGroup *commandGroup);
}; };
// shortcut to get text manager instance // shortcut to get text manager instance

@ -204,11 +204,11 @@ bool CChatWindow::isVisible() const
} }
//================================================================================= //=================================================================================
void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/) void CChatWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks /* = 0*/, bool *windowVisible /*= NULL*/)
{ {
if (!_Chat) if (!_Chat)
{ {
if (msg.toUtf8() != "WRN: <CChatWindow::displayMessage> There's no global chat") if (msg != "WRN: <CChatWindow::displayMessage> There's no global chat")
nlwarning("<CChatWindow::displayMessage> There's no global chat"); nlwarning("<CChatWindow::displayMessage> There's no global chat");
return; return;
} }
@ -538,11 +538,11 @@ void CChatWindow::clearMessages(CChatGroup::TGroupType /* gt */, uint32 /* dynam
// CChatGroupWindow // // CChatGroupWindow //
////////////////////// //////////////////////
void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible) void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks, bool *windowVisible)
{ {
if (!_Chat) if (!_Chat)
{ {
if (msg.toUtf8() != "WRN: <CChatGroupWindow::displayMessage> There's no global chat") if (msg != "WRN: <CChatGroupWindow::displayMessage> There's no global chat")
nlwarning("<CChatGroupWindow::displayMessage> There's no global chat"); nlwarning("<CChatGroupWindow::displayMessage> There's no global chat");
return; return;
} }
@ -563,8 +563,8 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str()); CRGBA newMsgColor= CRGBA::stringToRGBA(CWidgetManager::getInstance()->getParser()->getDefine("chat_group_tab_color_newmsg").c_str());
ucstring newmsg = msg; string newmsg = msg;
ucstring prefix; string prefix;
if (gl != NULL) if (gl != NULL)
{ {
@ -599,20 +599,20 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
gl = gl2; gl = gl2;
// Add dyn chan number before string // Add dyn chan number before string
ucstring prefix("[" + NLMISC::toString(dynamicChatDbIndex) + "]"); string prefix = "[" + NLMISC::toString(dynamicChatDbIndex) + "]";
// Find position to put the new string // Find position to put the new string
// After timestamp? // After timestamp?
size_t pos = newmsg.find(ucstring("]")); size_t pos = newmsg.find("]");
size_t colonpos = newmsg.find(ucstring(": @{")); size_t colonpos = newmsg.find(": @{");
// If no ] found or if found but after the colon (so part of the user chat) // If no ] found or if found but after the colon (so part of the user chat)
if (pos == ucstring::npos || (colonpos < pos)) if (pos == string::npos || (colonpos < pos))
{ {
// No timestamp, so put it right after the color and add a space // No timestamp, so put it right after the color and add a space
pos = newmsg.find(ucstring("}")); pos = newmsg.find("}");
prefix += " "; prefix += " ";
} }
if (pos == ucstring::npos) if (pos == string::npos)
newmsg = prefix + newmsg; newmsg = prefix + newmsg;
else else
newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1); newmsg = newmsg.substr(0, pos + 1) + prefix + newmsg.substr(pos + 1);
@ -622,10 +622,10 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
if (node && node->getValueBool()) if (node && node->getValueBool())
{ {
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dynamicChatDbIndex);
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title; prefix = (title.empty() ? "" : " ") + title;
pos = newmsg.find(ucstring("] ")); pos = newmsg.find("] ");
if (pos == ucstring::npos) if (pos == ucstring::npos)
newmsg = prefix + newmsg; newmsg = prefix + newmsg;
@ -667,7 +667,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
} }
//================================================================================= //=================================================================================
void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender) void CChatGroupWindow::displayTellMessage(const string &msg, NLMISC::CRGBA col, const string &sender)
{ {
// If we are here with a tell message this is because the teller doesn't belong to any people list // If we are here with a tell message this is because the teller doesn't belong to any people list
CGroupContainer *gcChat = createFreeTeller(sender); CGroupContainer *gcChat = createFreeTeller(sender);
@ -876,7 +876,7 @@ void CChatGroupWindow::setActiveFreeTeller(const ucstring &winName, bool bActive
} }
//================================================================================= //=================================================================================
ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID) string CChatGroupWindow::getFreeTellerName(const std::string &containerID)
{ {
uint32 i; uint32 i;
for (i = 0; i < _FreeTellers.size(); ++i) for (i = 0; i < _FreeTellers.size(); ++i)
@ -886,8 +886,8 @@ ucstring CChatGroupWindow::getFreeTellerName(const std::string &containerID)
break; break;
} }
if (i == _FreeTellers.size()) if (i == _FreeTellers.size())
return ucstring(""); return string();
return _FreeTellers[i]->getUCTitle(); return _FreeTellers[i]->getTitle();
} }
//================================================================================= //=================================================================================
@ -1306,7 +1306,7 @@ public:
else else
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo (ucstring::makeFromUtf8(cmd) + ": " + CI18N::get ("uiCommandNotExists")); im->displaySystemInfo (cmd + ": " + CI18N::get ("uiCommandNotExists"));
} }
} }
else else
@ -1410,16 +1410,16 @@ class CHandlerInviteToRingSession : public IActionHandler
public: public:
void execute (CCtrlBase *pCaller, const std::string &/* sParams */) void execute (CCtrlBase *pCaller, const std::string &/* sParams */)
{ {
ucstring playerName = ::getFreeTellerName(pCaller); string playerName = ::getFreeTellerName(pCaller).toUtf8();
if (!playerName.empty()) if (!playerName.empty())
{ {
// ask the SBS to invite the character in the session // ask the SBS to invite the character in the session
CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName.toUtf8()); CSessionBrowserImpl::getInstance().inviteCharacterByName(CSessionBrowserImpl::getInstance().getCharId(), playerName);
// additionaly, send a tell to signal the player he has been invited to a ring session // additionaly, send a tell to signal the player he has been invited to a ring session
ChatMngr.tell(playerName.toUtf8(), CI18N::get("uiRingInviteNotification")); ChatMngr.tell(playerName, CI18N::get("uiRingInviteNotification"));
// //
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring("@{6F6F}") + playerName +ucstring(" @{FFFF}") + CI18N::get("uiRingInvitationSent"), "BC"); im->displaySystemInfo("@{6F6F}" + playerName +" @{FFFF}" + CI18N::get("uiRingInvitationSent"), "BC");
// force a refresh of the ui // force a refresh of the ui
CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()"); CLuaManager::getInstance().executeLuaScript("CharTracking:forceRefresh()");
} }

@ -47,7 +47,7 @@ class CChatWindow;
struct IChatWindowListener struct IChatWindowListener
{ {
// the user entered a msg in the given chat box // the user entered a msg in the given chat box
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) = 0; virtual void msgEntered(const std::string &msg, CChatWindow *chatWindow) = 0;
}; };
@ -98,8 +98,8 @@ public:
}; };
public: public:
// display a message in this chat box with the given color // display a message in this chat box with the given color
virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL);
virtual void displayTellMessage(const ucstring &/* msg */, NLMISC::CRGBA /* col */, const ucstring &/* sender */) {} virtual void displayTellMessage(const std::string &/* msg */, NLMISC::CRGBA /* col */, const std::string &/* sender */) {}
virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex);
// Test if the window is visible // Test if the window is visible
bool isVisible() const; bool isVisible() const;
@ -189,8 +189,8 @@ class CChatGroupWindow : public CChatWindow
public: public:
CChatGroupWindow() {} CChatGroupWindow() {}
// display a message in this chat box with the given color (callback from chat input filter) // display a message in this chat box with the given color (callback from chat input filter)
virtual void displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL); virtual void displayMessage(const std::string &msg, NLMISC::CRGBA col, CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex, uint numBlinks = 0, bool *windowVisible = NULL);
virtual void displayTellMessage(const ucstring &msg, NLMISC::CRGBA col, const ucstring &sender); virtual void displayTellMessage(const std::string &msg, NLMISC::CRGBA col, const std::string &sender);
virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex); virtual void clearMessages(CChatGroup::TGroupType gt, uint32 dynamicChatDbIndex);
sint32 getTabIndex(); sint32 getTabIndex();
void setTabIndex(sint32 n); void setTabIndex(sint32 n);
@ -198,7 +198,7 @@ public:
// Free Teller // Free Teller
NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor=""); NLGUI::CGroupContainer *createFreeTeller(const ucstring &winName, const std::string &winColor="");
void setActiveFreeTeller(const ucstring &winName, bool bActive=true); void setActiveFreeTeller(const ucstring &winName, bool bActive=true);
ucstring getFreeTellerName(const std::string &containerID); std::string getFreeTellerName(const std::string &containerID);
bool removeFreeTeller(const std::string &containerID); // Return true if free teller found bool removeFreeTeller(const std::string &containerID); // Return true if free teller found
void removeAllFreeTellers(); void removeAllFreeTellers();
void saveFreeTeller(NLMISC::IStream &f); void saveFreeTeller(NLMISC::IStream &f);

@ -370,8 +370,8 @@ void CGuildManager::update()
{ {
// See if we need to show any online/offline messages // See if we need to show any online/offline messages
static map<ucstring, SGuildMember> CachedGuildMembers; static map<ucstring, SGuildMember> CachedGuildMembers;
ucstring onlineMessage = CI18N::get("uiPlayerOnline"); const string &onlineMessage = CI18N::get("uiPlayerOnline");
ucstring offlineMessage = CI18N::get("uiPlayerOffline"); const string &offlineMessage = CI18N::get("uiPlayerOffline");
for (uint i = 0; i < _GuildMembers.size(); ++i) for (uint i = 0; i < _GuildMembers.size(); ++i)
{ {
@ -390,8 +390,8 @@ void CGuildManager::update()
continue; continue;
} }
ucstring msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage; string msg = (_GuildMembers[i].Online != ccs_offline) ? onlineMessage : offlineMessage;
strFindReplace(msg, "%s", _GuildMembers[i].Name); strFindReplace(msg, "%s", _GuildMembers[i].Name.toUtf8());
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
map<string, CClientConfig::SSysInfoParam>::const_iterator it; map<string, CClientConfig::SSysInfoParam>::const_iterator it;
NLMISC::CRGBA col = CRGBA::Yellow; NLMISC::CRGBA col = CRGBA::Yellow;
@ -1084,7 +1084,7 @@ public:
MemberIndexSelected= nLineNb; MemberIndexSelected= nLineNb;
MemberNameSelected = rGuildMembers[nLineNb].Name; MemberNameSelected = rGuildMembers[nLineNb].Name;
CPeopleInterraction::displayTellInMainChat(MemberNameSelected); CPeopleInterraction::displayTellInMainChat(MemberNameSelected.toUtf8());
} }
// Current selection // Current selection

@ -982,7 +982,7 @@ void CInterfaceManager::initInGame()
// flush system msg buffer // flush system msg buffer
for( uint i=0; i<PeopleInterraction.SystemMessageBuffer.size(); ++i ) for( uint i=0; i<PeopleInterraction.SystemMessageBuffer.size(); ++i )
{ {
displaySystemInfo(PeopleInterraction.SystemMessageBuffer[i].Str, PeopleInterraction.SystemMessageBuffer[i].Cat); displaySystemInfo(PeopleInterraction.SystemMessageBuffer[i].Str.toUtf8(), PeopleInterraction.SystemMessageBuffer[i].Cat);
} }
PeopleInterraction.SystemMessageBuffer.clear(); PeopleInterraction.SystemMessageBuffer.clear();
@ -2495,7 +2495,7 @@ bool CInterfaceManager::getCurrentValidMessageBoxOnOk(string &ahOnOk, const std:
// *************************************************************************** // ***************************************************************************
void CInterfaceManager::displayDebugInfo(const ucstring &str, TSystemInfoMode mode /*=InfoMsg*/) void CInterfaceManager::displayDebugInfo(const string &str, TSystemInfoMode mode /*=InfoMsg*/)
{ {
if (PeopleInterraction.DebugInfo) if (PeopleInterraction.DebugInfo)
PeopleInterraction.ChatInput.DebugInfo.displayMessage(str, getDebugInfoColor(mode), 2); PeopleInterraction.ChatInput.DebugInfo.displayMessage(str, getDebugInfoColor(mode), 2);
@ -2525,7 +2525,7 @@ NLMISC::CRGBA CInterfaceManager::getDebugInfoColor(TSystemInfoMode mode)
} }
// *************************************************************************** // ***************************************************************************
void CInterfaceManager::displaySystemInfo(const ucstring &str, const string &cat) void CInterfaceManager::displaySystemInfo(const string &str, const string &cat)
{ {
CClientConfig::SSysInfoParam::TMode mode = CClientConfig::SSysInfoParam::Normal; CClientConfig::SSysInfoParam::TMode mode = CClientConfig::SSysInfoParam::Normal;
CRGBA color = CRGBA::White; CRGBA color = CRGBA::White;
@ -3061,7 +3061,7 @@ NLMISC_COMMAND( localCounter, "Get value of local counter", "" )
{ {
if (args.size() != 0) return false; if (args.size() != 0) return false;
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(ucstring(toString(im->getLocalSyncActionCounter()))); im->displaySystemInfo(toString(im->getLocalSyncActionCounter()));
return true; return true;
} }

@ -292,12 +292,12 @@ public:
void drawViews (NL3D::UCamera camera); void drawViews (NL3D::UCamera camera);
// display a debug info // display a debug info
void displayDebugInfo(const ucstring &str, TSystemInfoMode mode = InfoMsg); void displayDebugInfo(const std::string &str, TSystemInfoMode mode = InfoMsg);
// get the color associated with the given system info mode // get the color associated with the given system info mode
NLMISC::CRGBA getDebugInfoColor(TSystemInfoMode mode); NLMISC::CRGBA getDebugInfoColor(TSystemInfoMode mode);
// display a system info string // display a system info string
void displaySystemInfo(const ucstring &str, const std::string &Category = "SYS"); void displaySystemInfo(const std::string &str, const std::string &Category = "SYS");
NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS"); NLMISC::CRGBA getSystemInfoColor(const std::string &Category = "SYS");
void setupOptions(); void setupOptions();

@ -3236,7 +3236,7 @@ class CHandlerInvTempToBag : public IActionHandler
// If we cant find place display a message and dont send the request to the server // If we cant find place display a message and dont send the request to the server
if (!getInventory().isSpaceInAllBagsForItem(pCSDst)) if (!getInventory().isSpaceInAllBagsForItem(pCSDst))
{ {
ucstring msg = CI18N::get("msgCantPutItemInBag"); string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
return; return;
@ -3322,7 +3322,7 @@ class CHandlerInvTempAll : public IActionHandler
if (!bPlaceFound) if (!bPlaceFound)
{ {
ucstring msg = CI18N::get("msgCantPutItemInBag"); string msg = CI18N::get("msgCantPutItemInBag");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
CInterfaceManager::getInstance()->displaySystemInfo(msg, cat); CInterfaceManager::getInstance()->displaySystemInfo(msg, cat);
return; return;

@ -1701,7 +1701,7 @@ int CLuaIHMRyzom::displaySystemInfo(CLuaState &ls)
ucstring msg; ucstring msg;
nlverify(CLuaIHM::getUCStringOnStack(ls, 1, msg)); nlverify(CLuaIHM::getUCStringOnStack(ls, 1, msg));
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
pIM->displaySystemInfo(msg, ls.toString(2)); pIM->displaySystemInfo(msg.toUtf8(), ls.toString(2));
return 0; return 0;
} }
@ -4247,27 +4247,27 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls)
if (input == "around") if (input == "around")
{ {
prop.readRGBA(std::string(dbPath + ":SAY").c_str(), " "); prop.readRGBA(std::string(dbPath + ":SAY").c_str(), " ");
ci.AroundMe.displayMessage(ucstring(msg), prop.getRGBA()); ci.AroundMe.displayMessage(msg, prop.getRGBA());
} }
else if (input == "region") else if (input == "region")
{ {
prop.readRGBA(std::string(dbPath + ":REGION").c_str(), " "); prop.readRGBA(std::string(dbPath + ":REGION").c_str(), " ");
ci.Region.displayMessage(ucstring(msg), prop.getRGBA()); ci.Region.displayMessage(msg, prop.getRGBA());
} }
else if (input == "universe") else if (input == "universe")
{ {
prop.readRGBA(std::string(dbPath + ":UNIVERSE_NEW").c_str(), " "); prop.readRGBA(std::string(dbPath + ":UNIVERSE_NEW").c_str(), " ");
ci.Universe.displayMessage(ucstring(msg), prop.getRGBA()); ci.Universe.displayMessage(msg, prop.getRGBA());
} }
else if (input == "guild") else if (input == "guild")
{ {
prop.readRGBA(std::string(dbPath + ":CLADE").c_str(), " "); prop.readRGBA(std::string(dbPath + ":CLADE").c_str(), " ");
ci.Guild.displayMessage(ucstring(msg), prop.getRGBA()); ci.Guild.displayMessage(msg, prop.getRGBA());
} }
else if (input == "team") else if (input == "team")
{ {
prop.readRGBA(std::string(dbPath + ":GROUP").c_str(), " "); prop.readRGBA(std::string(dbPath + ":GROUP").c_str(), " ");
ci.Team.displayMessage(ucstring(msg), prop.getRGBA()); ci.Team.displayMessage(msg, prop.getRGBA());
} }
} }
if (ls.type(2) == LUA_TNUMBER) if (ls.type(2) == LUA_TNUMBER)
@ -4275,7 +4275,7 @@ int CLuaIHMRyzom::displayChatMessage(CLuaState &ls)
sint64 id = ls.toInteger(2); sint64 id = ls.toInteger(2);
prop.readRGBA(toString("%s:DYN:%i", dbPath.c_str(), id).c_str(), " "); prop.readRGBA(toString("%s:DYN:%i", dbPath.c_str(), id).c_str(), " ");
if (id >= 0 && id < CChatGroup::MaxDynChanPerPlayer) if (id >= 0 && id < CChatGroup::MaxDynChanPerPlayer)
ci.DynamicChat[id].displayMessage(ucstring(msg), prop.getRGBA()); ci.DynamicChat[id].displayMessage(msg, prop.getRGBA());
} }
return 1; return 1;
} }

@ -623,9 +623,9 @@ void CMusicPlayer::createPlaylistFromMusic()
if (extensions.empty()) if (extensions.empty())
{ {
// in the very unlikely scenario // in the very unlikely scenario
const ucstring message("Sound driver has no support for music."); static const string message("Sound driver has no support for music.");
CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS"); CInterfaceManager::getInstance()->displaySystemInfo(message, "SYS");
nlinfo("%s", message.toUtf8().c_str()); nlinfo("%s", message.c_str());
return; return;
} }
std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true); std::string newPath = CPath::makePathAbsolute(CPath::standardizePath(ClientCfg.MediaPlayerDirectory), CPath::getCurrentPath(), true);
@ -635,7 +635,7 @@ void CMusicPlayer::createPlaylistFromMusic()
std::string msg(CI18N::get("uiMk_system6")); std::string msg(CI18N::get("uiMk_system6"));
msg += ": " + newPath + " (" + extlist + ")"; msg += ": " + newPath + " (" + extlist + ")";
CInterfaceManager::getInstance()->displaySystemInfo(ucstring::makeFromUtf8(msg), "SYS"); CInterfaceManager::getInstance()->displaySystemInfo(msg, "SYS");
nlinfo("%s", msg.c_str()); nlinfo("%s", msg.c_str());
// Recursive scan for files from media directory // Recursive scan for files from media directory

@ -91,7 +91,7 @@ static const sint PARTY_CHAT_SPAWN_DELTA = 20; // to avoid that all party chat a
/** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it) /** Display an error msg in the system info window, and also in the last window that triggered the command (so that the user is sure to see it)
*/ */
static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CHK"); static void displayVisibleSystemMsg(const std::string &msg, const string &cat = "CHK");
////////////////////////////// //////////////////////////////
@ -102,7 +102,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat = "CH
struct CPartyChatEntryHandler : public IChatWindowListener struct CPartyChatEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -120,7 +120,7 @@ struct CPartyChatEntryHandler : public IChatWindowListener
// handler to manage user entry in 'around me' window // handler to manage user entry in 'around me' window
struct CAroundMeEntryHandler : public IChatWindowListener struct CAroundMeEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -138,7 +138,7 @@ struct CAroundMeEntryHandler : public IChatWindowListener
// handler to manage user entry in 'region' window // handler to manage user entry in 'region' window
struct CRegionEntryHandler : public IChatWindowListener struct CRegionEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -156,7 +156,7 @@ struct CRegionEntryHandler : public IChatWindowListener
// handler to manage user entry in 'universe' window // handler to manage user entry in 'universe' window
struct CUniverseEntryHandler : public IChatWindowListener struct CUniverseEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -174,7 +174,7 @@ struct CUniverseEntryHandler : public IChatWindowListener
// handler to manage user entry in 'guild chat' window // handler to manage user entry in 'guild chat' window
struct CGuildChatEntryHandler : public IChatWindowListener struct CGuildChatEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -191,7 +191,7 @@ struct CGuildChatEntryHandler : public IChatWindowListener
// handler to manage user entry in 'team chat' window // handler to manage user entry in 'team chat' window
struct CTeamChatEntryHandler : public IChatWindowListener struct CTeamChatEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -208,7 +208,7 @@ struct CTeamChatEntryHandler : public IChatWindowListener
// handler to manage user entry in a 'talk with friend' window // handler to manage user entry in a 'talk with friend' window
struct CFriendTalkEntryHandler : public IChatWindowListener struct CFriendTalkEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -225,10 +225,9 @@ struct CFriendTalkEntryHandler : public IChatWindowListener
// handler to manage user entry in a debug console window // handler to manage user entry in a debug console window
struct CDebugConsoleEntryHandler : public IChatWindowListener struct CDebugConsoleEntryHandler : public IChatWindowListener
{ {
virtual void msgEntered(const ucstring &msg, CChatWindow * /* chatWindow */) virtual void msgEntered(const string &msg, CChatWindow * /* chatWindow */)
{ {
std::string str = msg.toString(); NLMISC::ICommand::execute( msg, g_log );
NLMISC::ICommand::execute( str, g_log );
} }
}; };
@ -242,7 +241,7 @@ public:
DbIndex= 0; DbIndex= 0;
} }
virtual void msgEntered(const ucstring &msg, CChatWindow *chatWindow) virtual void msgEntered(const string &msg, CChatWindow *chatWindow)
{ {
if (ClientCfg.Local) if (ClientCfg.Local)
{ {
@ -1410,8 +1409,8 @@ void CPeopleInterraction::updateContactInList(uint32 contactId, TCharConnectionS
// Player is not in my guild, and the status change is from offline to online/abroad online or vice versa. // Player is not in my guild, and the status change is from offline to online/abroad online or vice versa.
if (showMsg) if (showMsg)
{ {
ucstring msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline"); string msg = (online != ccs_offline) ? CI18N::get("uiPlayerOnline") : CI18N::get("uiPlayerOffline");
strFindReplace(msg, "%s", FriendList.getName(index)); strFindReplace(msg, "%s", FriendList.getName(index).toUtf8());
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
map<string, CClientConfig::SSysInfoParam>::const_iterator it; map<string, CClientConfig::SSysInfoParam>::const_iterator it;
NLMISC::CRGBA col = CRGBA::Yellow; NLMISC::CRGBA col = CRGBA::Yellow;
@ -1883,7 +1882,7 @@ void CPeopleInterraction::refreshActiveUserChats()
} }
//================================================================================================================= //=================================================================================================================
void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,ucstring sentence) void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,string sentence)
{ {
if(channelNb<CChatGroup::MaxDynChanPerPlayer) if(channelNb<CChatGroup::MaxDynChanPerPlayer)
{ {
@ -1892,7 +1891,7 @@ void CPeopleInterraction::talkInDynamicChannel(uint32 channelNb,ucstring sentenc
} }
//================================================================================================================= //=================================================================================================================
void CPeopleInterraction::displayTellInMainChat(const ucstring &playerName) void CPeopleInterraction::displayTellInMainChat(const string &playerName)
{ {
//CChatWindow *chat = PeopleInterraction.MainChat.Window; //CChatWindow *chat = PeopleInterraction.MainChat.Window;
CChatWindow *chat = PeopleInterraction.ChatGroup.Window; CChatWindow *chat = PeopleInterraction.ChatGroup.Window;
@ -2138,7 +2137,7 @@ public:
uint peopleIndex; uint peopleIndex;
if (PeopleInterraction.getPeopleFromCurrentMenu(list, peopleIndex)) if (PeopleInterraction.getPeopleFromCurrentMenu(list, peopleIndex))
{ {
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8());
} }
} }
}; };
@ -2160,7 +2159,7 @@ class CHandlerTellContact : public IActionHandler
uint peopleIndex; uint peopleIndex;
if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex)) if (PeopleInterraction.getPeopleFromContainerID(gc->getId(), list, peopleIndex))
{ {
CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex)); CPeopleInterraction::displayTellInMainChat(list->getName(peopleIndex).toUtf8());
} }
} }
@ -2416,7 +2415,7 @@ class CHandlerValidatePartyChatName : public IActionHandler
if (!gc) return; if (!gc) return;
CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb")); CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(gc->getGroup("eb"));
if (!eb) return; if (!eb) return;
ucstring title = eb->getInputStringAsUtf16(); string title = eb->getInputString();
// TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game // TODO GAMEDEV : create (or join ?) a new channel. Each channel (party chat) should have a unique name in the game
// moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me') // moreover, it should not have the name of another available chat window (for example, it shouldn't be named 'Around Me')
@ -2425,7 +2424,7 @@ class CHandlerValidatePartyChatName : public IActionHandler
if (!PeopleInterraction.testValidPartyChatName(title)) if (!PeopleInterraction.testValidPartyChatName(title))
{ {
displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiInvalidPartyChatName")); displayVisibleSystemMsg(title + " : " + CI18N::get("uiInvalidPartyChatName"));
return; return;
} }
@ -3315,7 +3314,7 @@ REGISTER_INTERFACE_USER_FCT("getNumUserChatLeft", getNumUserChatLeft)
// STATIC FUNCTIONS IMPLEMENTATIONS // // STATIC FUNCTIONS IMPLEMENTATIONS //
////////////////////////////////////// //////////////////////////////////////
static void displayVisibleSystemMsg(const ucstring &msg, const string &cat) static void displayVisibleSystemMsg(const string &msg, const string &cat)
{ {
CInterfaceManager *im = CInterfaceManager::getInstance(); CInterfaceManager *im = CInterfaceManager::getInstance();
im->displaySystemInfo(msg, cat); im->displaySystemInfo(msg, cat);
@ -3328,7 +3327,7 @@ static void displayVisibleSystemMsg(const ucstring &msg, const string &cat)
#if !FINAL_VERSION #if !FINAL_VERSION
NLMISC_COMMAND(testSI, "tmp", "tmp") NLMISC_COMMAND(testSI, "tmp", "tmp")
{ {
PeopleInterraction.ChatInput.DebugInfo.displayMessage(ucstring("test"), CRGBA::Red); PeopleInterraction.ChatInput.DebugInfo.displayMessage("test", CRGBA::Red);
return true; return true;
} }
#endif #endif

@ -250,14 +250,14 @@ public:
// Test if the given chat is a user chat (this includes the main chat) // Test if the given chat is a user chat (this includes the main chat)
bool isUserChat(CChatWindow *cw) const; bool isUserChat(CChatWindow *cw) const;
void talkInDynamicChannel(uint32 channelNb,ucstring sentence); void talkInDynamicChannel(uint32 channelNb,std::string sentence);
CChatGroupWindow *getChatGroupWindow() const; CChatGroupWindow *getChatGroupWindow() const;
void updateAllFreeTellerHeaders(); void updateAllFreeTellerHeaders();
void removeAllFreeTellers(); void removeAllFreeTellers();
static void displayTellInMainChat(const ucstring &playerName); static void displayTellInMainChat(const std::string &playerName);
private: private:
// create various chat & people lists // create various chat & people lists
void createTeamChat(); void createTeamChat();

@ -449,7 +449,7 @@ void CPeopleList::setContactId(uint index, uint32 contactId)
} }
//================================================================== //==================================================================
void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg,uint numBlinks /*=0*/) void CPeopleList::displayLocalPlayerTell(const string &receiver, uint index, const string &msg,uint numBlinks /*=0*/)
{ {
if (_ContactType == CPeopleListDesc::Ignore) if (_ContactType == CPeopleListDesc::Ignore)
{ {
@ -473,13 +473,13 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c
} }
string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""; string csr = CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : "";
string finalMsg = csr + CI18N::get("youTell") + ": " + msg.toUtf8(); string finalMsg = csr + CI18N::get("youTell") + ": " + msg;
// display msg with good color // display msg with good color
CInterfaceProperty prop; CInterfaceProperty prop;
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
string s = CI18N::get("youTellPlayer"); string s = CI18N::get("youTellPlayer");
strFindReplace(s, "%name", receiver.toUtf8()); strFindReplace(s, "%name", receiver);
strFindReplace(finalMsg, CI18N::get("youTell"), s); strFindReplace(finalMsg, CI18N::get("youTell"), s);
gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA())); gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA()));
CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell)); CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell));
@ -497,7 +497,7 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c
//================================================================== //==================================================================
void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/) void CPeopleList::displayMessage(uint index, const string &msg, NLMISC::CRGBA col, uint /* numBlinks */ /*= 0*/)
{ {
if (_ContactType == CPeopleListDesc::Ignore) if (_ContactType == CPeopleListDesc::Ignore)
{ {
@ -951,7 +951,7 @@ class CHandlerContactEntry : public IActionHandler
pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str)); pWin->displayTellMessage(final, prop.getRGBA(), pWin->getFreeTellerName(str));
string s = CI18N::get("youTellPlayer"); string s = CI18N::get("youTellPlayer");
strFindReplace(s, "%name", pWin->getFreeTellerName(str).toUtf8()); strFindReplace(s, "%name", pWin->getFreeTellerName(str));
strFindReplace(final, CI18N::get("youTell"), s); strFindReplace(final, CI18N::get("youTell"), s);
CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell)); CInterfaceManager::getInstance()->log(final, CChatGroup::groupTypeToString(CChatGroup::tell));
} }

@ -113,8 +113,8 @@ public:
/** Display a message for the given people /** Display a message for the given people
* If the window is closed, it causes it to blink (and also the parent window) * If the window is closed, it causes it to blink (and also the parent window)
*/ */
void displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA col, uint numBlinks = 0); void displayMessage(uint index, const std::string &msg, NLMISC::CRGBA col, uint numBlinks = 0);
void displayLocalPlayerTell(const ucstring &receiver, uint index, const ucstring &msg, uint numBlinks = 0); void displayLocalPlayerTell(const std::string &receiver, uint index, const std::string &msg, uint numBlinks = 0);
// Is the given people window visible ? // Is the given people window visible ?
bool isPeopleChatVisible(uint index) const; bool isPeopleChatVisible(uint index) const;
// reset remove everything from the interface // reset remove everything from the interface

@ -697,10 +697,9 @@ void CItemGroupManager::listGroup()
for(int i=0;i<_Groups.size();i++) for(int i=0;i<_Groups.size();i++)
{ {
CItemGroup group = _Groups[i]; CItemGroup group = _Groups[i];
ucstring msg = NLMISC::CI18N::get("cmdListGroupLine"); string msg = NLMISC::CI18N::get("cmdListGroupLine");
//Use ucstring because group name can contain accentued characters (and stuff like that) //Use ucstring because group name can contain accentued characters (and stuff like that)
ucstring nameUC; string nameUC = group.name;
nameUC.fromUtf8(group.name);
NLMISC::strFindReplace(msg, "%name", nameUC); NLMISC::strFindReplace(msg, "%name", nameUC);
NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size())); NLMISC::strFindReplace(msg, "%size", NLMISC::toString(group.Items.size()));
pIM->displaySystemInfo(msg); pIM->displaySystemInfo(msg);

@ -1165,7 +1165,7 @@ bool mainLoop()
if (BanMsgCountdown < 0.f) if (BanMsgCountdown < 0.f)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgPermanentlyBanned"); string msg = CI18N::get("msgPermanentlyBanned");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
BanMsgCountdown = BanMsgRepeatTime; BanMsgCountdown = BanMsgRepeatTime;
@ -3448,11 +3448,11 @@ NLMISC_COMMAND(dumpFontTexture, "Write font texture to file", "")
{ {
std::string fname = CFile::findNewFile("font-texture.tga"); std::string fname = CFile::findNewFile("font-texture.tga");
TextContext->dumpCacheTexture(fname.c_str()); TextContext->dumpCacheTexture(fname.c_str());
im->displaySystemInfo(ucstring(fname + " created"), "SYS"); im->displaySystemInfo(fname + " created", "SYS");
} }
else else
{ {
im->displaySystemInfo(ucstring("Error: TextContext == NULL"), "SYS"); im->displaySystemInfo("Error: TextContext == NULL", "SYS");
} }
return true; return true;
} }

@ -871,14 +871,14 @@ bool setVect(CVector &vectToChange, const CVector &vect, bool compute, bool chec
return true; return true;
}// setVect // }// setVect //
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest) NLMISC::CRGBA interpClientCfgColor(const string &src, string &dest)
{ {
CRGBA color = CRGBA::White; CRGBA color = CRGBA::White;
if (src.size() >= 3) if (src.size() >= 3)
{ {
if (src[0] == (ucchar) '&') if (src[0] == '&')
{ {
ucstring::size_type nextPos = src.find((ucchar) '&', 1); string::size_type nextPos = src.find('&', 1);
if (nextPos != ucstring::npos) if (nextPos != ucstring::npos)
{ {
std::string colorCode; std::string colorCode;
@ -911,7 +911,7 @@ NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest)
return color; return color;
} }
std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault) std::string getStringCategory(const string &src, string &dest, bool alwaysAddSysByDefault)
{ {
std::string str = getStringCategoryIfAny(src, dest); std::string str = getStringCategoryIfAny(src, dest);
if (alwaysAddSysByDefault) if (alwaysAddSysByDefault)
@ -921,41 +921,41 @@ std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAd
} }
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest) std::string getStringCategoryIfAny(const string &src, string &dest)
{ {
std::string colorCode; std::string colorCode;
if (src.size() >= 3) if (src.size() >= 3)
{ {
uint startPos = 0; size_t startPos = 0;
// Skip <NEW> or <CHG> if present at beginning // Skip <NEW> or <CHG> if present at beginning
ucstring preTag; string preTag;
const uint PreTagSize = 5; const size_t PreTagSize = 5;
const ucstring newTag("<NEW>"); static const string newTag = "<NEW>";
if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) ) if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == newTag) )
{ {
startPos = PreTagSize; startPos = PreTagSize;
preTag = newTag; preTag = newTag;
} }
const ucstring chgTag("<CHG>"); static const string chgTag = "<CHG>";
if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) ) if ( (src.size() >= PreTagSize) && (src.substr( 0, PreTagSize ) == chgTag) )
{ {
startPos = PreTagSize; startPos = PreTagSize;
preTag = chgTag; preTag = chgTag;
} }
if (src[startPos] == (ucchar) '&') if (src[startPos] == '&')
{ {
ucstring::size_type nextPos = src.find((ucchar) '&', startPos+1); string::size_type nextPos = src.find('&', startPos+1);
if (nextPos != ucstring::npos) if (nextPos != string::npos)
{ {
uint codeSize = (uint)nextPos - startPos - 1; size_t codeSize = nextPos - startPos - 1;
colorCode.resize( codeSize ); colorCode.resize( codeSize );
for(uint k = 0; k < codeSize; ++k) for(ptrdiff_t k = 0; k < (ptrdiff_t)codeSize; ++k)
{ {
colorCode[k] = tolower((char) src[k + startPos + 1]); colorCode[k] = tolower((char) src[k + startPos + 1]);
} }
ucstring destTmp; string destTmp;
if ( startPos != 0 ) if ( startPos != 0 )
destTmp = preTag; // leave <NEW> or <CHG> in the dest string destTmp = preTag; // leave <NEW> or <CHG> in the dest string
destTmp += src.substr(nextPos + 1); destTmp += src.substr(nextPos + 1);

@ -165,11 +165,11 @@ bool setVect(NLMISC::CVector &vectToChange, const NLMISC::CVector &vect, bool co
// read color from client cfg system info colors // read color from client cfg system info colors
NLMISC::CRGBA interpClientCfgColor(const ucstring &src, ucstring &dest); NLMISC::CRGBA interpClientCfgColor(const std::string &src, std::string &dest);
// Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS" // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "SYS"
std::string getStringCategory(const ucstring &src, ucstring &dest, bool alwaysAddSysByDefault = true); std::string getStringCategory(const std::string &src, std::string &dest, bool alwaysAddSysByDefault = true);
// Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return "" // Get the category from the string (src="&SYS&Who are you?" and dest="Who are you?" and return "SYS"), if no category, return ""
std::string getStringCategoryIfAny(const ucstring &src, ucstring &dest); std::string getStringCategoryIfAny(const std::string &src, std::string &dest);
bool getRelativeFloatFromString(const std::string src, float &dst); bool getRelativeFloatFromString(const std::string src, float &dst);
void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false); void updateVector(const std::string part, NLMISC::CVector &dst, float value, bool add = false);

@ -600,21 +600,21 @@ void impulsePermanentUnban(NLMISC::CBitMemStream &impulse)
class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer class CInterfaceChatDisplayer : public CClientChatManager::IChatDisplayer
{ {
public: public:
virtual void displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer=0); virtual void displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer=0);
virtual void displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName); virtual void displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName);
virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex); virtual void clearChannel(CChatGroup::TGroupType mode, uint32 dynChatDbIndex);
private: private:
// Add colorization tag for sender name // Add colorization tag for sender name
void colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor); void colorizeSender(string &text, const string &senderName, CRGBA baseColor);
}; };
static CInterfaceChatDisplayer InterfaceChatDisplayer; static CInterfaceChatDisplayer InterfaceChatDisplayer;
void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &senderName, CRGBA baseColor) void CInterfaceChatDisplayer::colorizeSender(string &text, const string &senderName, CRGBA baseColor)
{ {
// find the sender/text separator to put color tags // find the sender/text separator to put color tags
ucstring::size_type pos = senderName.toUtf8().length() - 1; ucstring::size_type pos = senderName.length() - 1;
if (pos != ucstring::npos) if (pos != ucstring::npos)
{ {
string str; string str;
@ -624,36 +624,36 @@ void CInterfaceChatDisplayer::colorizeSender(ucstring &text, const ucstring &sen
CChatWindow::encodeColorTag(prop.getRGBA(), str, false); CChatWindow::encodeColorTag(prop.getRGBA(), str, false);
str += text.toUtf8().substr(0, pos+1); str += text.substr(0, pos+1);
CChatWindow::encodeColorTag(baseColor, str, true); CChatWindow::encodeColorTag(baseColor, str, true);
str += text.toUtf8().substr(pos+1); str += text.substr(pos+1);
text.fromUtf8(str); text = str;
} }
} }
// display a chat from network to interface // display a chat from network to interface
void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const ucstring &ucstr, const ucstring &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, ucstring &senderName, uint bubbleTimer) void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, const std::string &ucstr, const std::string &rawMessage, CChatGroup::TGroupType mode, NLMISC::CEntityId dynChatId, std::string &senderName, uint bubbleTimer)
{ {
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager *pIM = CInterfaceManager::getInstance();
ucstring finalString; string finalString;
string stringCategory = getStringCategory(ucstr, finalString); string stringCategory = getStringCategory(ucstr, finalString);
bool bubbleWanted = true; bool bubbleWanted = true;
// Subtract rawMessage from ucstr so that the 'sender' part remains. // Subtract rawMessage from ucstr so that the 'sender' part remains.
ucstring senderPart = ucstr.luabind_substr(0, ucstr.length() - rawMessage.length()); string senderPart = ucstr.substr(0, ucstr.length() - rawMessage.length());
// search a "{no_bubble}" tag // search a "{no_bubble}" tag
{ {
ucstring::size_type index = finalString.find(ucstring("{no_bubble}")); string::size_type index = finalString.find("{no_bubble}");
const size_t tokenSize= 11; // length of "{no_bubble}" const size_t tokenSize= 11; // length of "{no_bubble}"
if (index != ucstring::npos) if (index != string::npos)
{ {
bubbleWanted = false; bubbleWanted = false;
finalString = finalString.luabind_substr(0, index) + finalString.substr(index+tokenSize,finalString.size()); finalString = finalString.substr(0, index) + finalString.substr(index+tokenSize,finalString.size());
} }
} }
@ -665,9 +665,9 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// Remove all {break} // Remove all {break}
for(;;) for(;;)
{ {
ucstring::size_type index = finalString.find(ucstring("{break}")); string::size_type index = finalString.find("{break}");
if (index == ucstring::npos) break; if (index == ucstring::npos) break;
finalString = finalString.luabind_substr(0, index) + finalString.luabind_substr(index+7,finalString.size()); finalString = finalString.substr(0, index) + finalString.substr(index+7,finalString.size());
} }
// select DB // select DB
@ -716,10 +716,10 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// find the sender/text separator to put color tags // find the sender/text separator to put color tags
if (senderPart.empty() && stringCategory == "emt") if (senderPart.empty() && stringCategory == "emt")
{ {
size_t pos = finalString.find(ucstring(": "), 0); size_t pos = finalString.find(": ", 0);
if (pos != ucstring::npos) if (pos != string::npos)
{ {
senderPart = finalString.luabind_substr(0, pos + 2); senderPart = finalString.substr(0, pos + 2);
} }
} }
colorizeSender(finalString, senderPart, col); colorizeSender(finalString, senderPart, col);
@ -786,16 +786,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
if (pIM->getLogState()) if (pIM->getLogState())
{ {
// Add dyn chan number before string // Add dyn chan number before string
ucstring prefix("[" + NLMISC::toString(dbIndex) + "]"); string prefix = "[" + NLMISC::toString(dbIndex) + "]";
// Find position to put the new string // Find position to put the new string
// After timestamp? // After timestamp?
size_t pos = finalString.find(ucstring("]")); size_t pos = finalString.find("]");
size_t colonpos = finalString.find(ucstring(": @{")); size_t colonpos = finalString.find(": @{");
// If no ] found or if found but after the colon (so part of the user chat) // If no ] found or if found but after the colon (so part of the user chat)
if (pos == ucstring::npos || (colonpos < pos)) if (pos == string::npos || (colonpos < pos))
{ {
// No timestamp, so put it right after the color and add a space // No timestamp, so put it right after the color and add a space
pos = finalString.find(ucstring("}"));; pos = finalString.find("}");;
prefix += " "; prefix += " ";
} }
finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1); finalString = finalString.substr(0, pos + 1) + prefix + finalString.substr(pos + 1);
@ -803,28 +803,28 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
if (node && node->getValueBool()) if (node && node->getValueBool())
{ {
uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex); uint32 textId = ChatMngr.getDynamicChannelNameFromDbIndex(dbIndex);
ucstring title; string title;
STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title); STRING_MANAGER::CStringManagerClient::instance()->getDynString(textId, title);
prefix = title.empty() ? ucstring("") : ucstring(" ") + title; prefix = (title.empty() ? "" : " ") + title;
pos = finalString.find(ucstring("] ")); pos = finalString.find("] ");
finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos); finalString = finalString.substr(0, pos) + prefix + finalString.substr(pos);
} }
} }
} }
else else
{ {
nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.toString().c_str()); nlwarning("Dynamic chat %s not found for message: %s", dynChatId.toString().c_str(), finalString.c_str());
} }
} }
else else
{ {
ucstring::size_type index = finalString.find(ucstring("<BPFX>")); string::size_type index = finalString.find("<BPFX>");
if (index != ucstring::npos) if (index != ucstring::npos)
{ {
bubbleWanted = false; bubbleWanted = false;
finalString = finalString.substr(index+6,finalString.size()); finalString = finalString.substr(index+6,finalString.size());
ucstring::size_type index2 = finalString.find(ucstring(" ")); string::size_type index2 = finalString.find(string(" "));
ucstring playerName; string playerName;
if (index2 < (finalString.size()-3)) if (index2 < (finalString.size()-3))
{ {
playerName = finalString.substr(0,index2); playerName = finalString.substr(0,index2);
@ -832,7 +832,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
} }
if (!senderName.empty()) if (!senderName.empty())
{ {
CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()), true, true); CEntityCL *senderEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(senderName), true, true);
if (senderEntity) if (senderEntity)
{ {
if (senderEntity->Type != CEntityCL::Player) if (senderEntity->Type != CEntityCL::Player)
@ -840,16 +840,16 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
if (playerName.empty()) if (playerName.empty())
{ {
senderEntity->removeStateFx(); senderEntity->removeStateFx();
senderEntity->setStateFx(finalString.toString()); senderEntity->setStateFx(finalString);
nlinfo("empty"); nlinfo("empty");
} }
else else
{ {
CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName.toUtf8()), false, true); CEntityCL *destEntity = EntitiesMngr.getEntityByName (CEntityCL::removeTitleAndShardFromName(playerName), false, true);
if (destEntity) if (destEntity)
{ {
destEntity->removeStateFx(); destEntity->removeStateFx();
destEntity->setStateFx(finalString.toString()); destEntity->setStateFx(finalString);
nlinfo("no empty"); nlinfo("no empty");
} }
} }
@ -866,7 +866,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// if tell, bkup sendername // if tell, bkup sendername
if (mode == CChatGroup::tell && windowVisible && !senderName.empty()) if (mode == CChatGroup::tell && windowVisible && !senderName.empty())
{ {
PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); PeopleInterraction.LastSenderName = CEntityCL::removeTitleAndShardFromName(senderName);
} }
} }
@ -876,7 +876,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// **** Process chat entry for the bubbles // **** Process chat entry for the bubbles
// todo hulud : registering a chat callback would be better than calling this hardcoded action handler // todo hulud : registering a chat callback would be better than calling this hardcoded action handler
ucstring finalRawMessage; string finalRawMessage;
// remove color qualifier from raw string // remove color qualifier from raw string
getStringCategory(rawMessage, finalRawMessage); getStringCategory(rawMessage, finalRawMessage);
if (bubbleWanted) if (bubbleWanted)
@ -902,7 +902,7 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
channel = "#" + toString((uint32)mode); channel = "#" + toString((uint32)mode);
} }
} }
if (!stringCategory.empty() && NLMISC::toUpper(stringCategory) != "SYS") if (!stringCategory.empty() && NLMISC::compareCaseInsensitive(stringCategory.c_str(), "SYS")) // Not empty and not 'SYS'
{ {
channel = channel + "/" + stringCategory; channel = channel + "/" + stringCategory;
} }
@ -912,13 +912,13 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
// display a tell from network to interface // display a tell from network to interface
void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const ucstring &ucstr, const ucstring &senderName) void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const std::string &ucstr, const std::string &senderName)
{ {
ucstring finalString = ucstr; string finalString = ucstr;
// for now, '&' are removed by server so use another format until a special msg is made // for now, '&' are removed by server so use another format until a special msg is made
if (strFindReplace(finalString, ucstring("<R2_INVITE>"), ucstring())) if (strFindReplace(finalString, "<R2_INVITE>", string()))
{ {
CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()"); CLuaManager::getInstance().executeLuaScript("RingAccessPoint:forceRefresh()");
} }
@ -928,13 +928,13 @@ void CInterfaceChatDisplayer::displayTell(/*TDataSetIndex senderIndex, */const u
prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," ");
bool windowVisible; bool windowVisible;
ucstring goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName.toUtf8()); string goodSenderName = CEntityCL::removeTitleAndShardFromName(senderName);
// The sender part is up to and including the first ":" after the goodSenderName // The sender part is up to and including the first ":" after the goodSenderName
ucstring::size_type pos = finalString.find(goodSenderName); string::size_type pos = finalString.find(goodSenderName);
pos = finalString.find(':', pos); pos = finalString.find(':', pos);
pos = finalString.find(' ', pos); pos = finalString.find(' ', pos);
ucstring senderPart = finalString.substr(0, pos+1); string senderPart = finalString.substr(0, pos+1);
colorizeSender(finalString, senderPart, prop.getRGBA()); colorizeSender(finalString, senderPart, prop.getRGBA());
PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible); PeopleInterraction.ChatInput.Tell.displayTellMessage(/*senderIndex, */finalString, goodSenderName, prop.getRGBA(), 2, &windowVisible);
@ -2125,7 +2125,7 @@ void impulseWhere(NLMISC::CBitMemStream &impulse)
sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf); sprintf(buf,"Your server position is : X= %g Y= %g Z= %g",xf,yf,zf);
nlinfo(buf); nlinfo(buf);
CInterfaceManager::getInstance()->displaySystemInfo(ucstring(buf)); CInterfaceManager::getInstance()->displaySystemInfo(buf);
}// impulseWhere // }// impulseWhere //
//----------------------------------------------- //-----------------------------------------------
@ -4204,7 +4204,7 @@ std::string WebServer;
NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_name> <msg>") NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_name> <msg>")
{ {
if (args.empty()) return false; if (args.empty()) return false;
ucstring player = args[0]; string player = args[0];
std::string msg; std::string msg;
if (args.size() >= 2) if (args.size() >= 2)
{ {
@ -4215,7 +4215,7 @@ NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_n
} }
} }
TDataSetIndex dsi = INVALID_DATASET_INDEX; TDataSetIndex dsi = INVALID_DATASET_INDEX;
InterfaceChatDisplayer.displayChat(dsi, ucstring(msg), ucstring(msg), CChatGroup::team, NLMISC::CEntityId::Unknown, player); InterfaceChatDisplayer.displayChat(dsi, msg, msg, CChatGroup::team, NLMISC::CEntityId::Unknown, player);
return true; return true;
} }
@ -4223,7 +4223,7 @@ NLMISC_COMMAND(localTellTeam, "Temp : simulate a tell in local mode", "<people_n
NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", "<people_name> <msg>") NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", "<people_name> <msg>")
{ {
if (args.empty()) return false; if (args.empty()) return false;
ucstring player = args[0]; string player = args[0];
std::string msg; std::string msg;
if (args.size() >= 2) if (args.size() >= 2)
{ {
@ -4234,7 +4234,7 @@ NLMISC_COMMAND(localTell, "Temp : simulate a tell in local mode", "<people_name>
} }
} }
// TDataSetIndex dsi = INVALID_DATASET_ROW; // TDataSetIndex dsi = INVALID_DATASET_ROW;
InterfaceChatDisplayer.displayTell(/*dsi, */ucstring(msg), player); InterfaceChatDisplayer.displayTell(/*dsi, */msg, player);
return true; return true;
} }

@ -2948,7 +2948,7 @@ bool CUserEntity::sit(bool s)
// autowalk disabled // autowalk disabled
UserControls.autowalkState(false); UserControls.autowalkState(false);
const string msgName = "COMMAND:SIT"; static const string msgName = "COMMAND:SIT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -2963,7 +2963,7 @@ bool CUserEntity::sit(bool s)
// display sit msg // display sit msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserIsSitting"); string msg = CI18N::get("msgUserIsSitting");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -2976,7 +2976,7 @@ bool CUserEntity::sit(bool s)
{ {
if(mode(MBEHAV::NORMAL)) if(mode(MBEHAV::NORMAL))
{ {
const string msgName = "COMMAND:SIT"; static const string msgName = "COMMAND:SIT";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -2991,7 +2991,7 @@ bool CUserEntity::sit(bool s)
// display stand msg // display stand msg
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgUserIsStanding"); string msg = CI18N::get("msgUserIsStanding");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
} }
@ -3067,7 +3067,7 @@ void CUserEntity::setAFK(bool b, string afkTxt)
} }
// send afk state // send afk state
string msgName = "COMMAND:AFK"; static const string msgName = "COMMAND:AFK";
CBitMemStream out; CBitMemStream out;
if(GenericMsgHeaderMngr.pushNameToStream(msgName, out)) if(GenericMsgHeaderMngr.pushNameToStream(msgName, out))
{ {
@ -3081,15 +3081,15 @@ void CUserEntity::setAFK(bool b, string afkTxt)
ucstring ucstr; ucstring ucstr;
ucstr.fromUtf8( afkTxt ); ucstr.fromUtf8( afkTxt );
CBitMemStream outTxt; CBitMemStream outTxt;
msgName = "STRING:AFK_TXT"; static const string msgNameTxt = "STRING:AFK_TXT";
if( GenericMsgHeaderMngr.pushNameToStream(msgName,outTxt) ) if( GenericMsgHeaderMngr.pushNameToStream(msgNameTxt,outTxt) )
{ {
outTxt.serial( ucstr ); outTxt.serial( ucstr );
NetMngr.push( outTxt ); NetMngr.push( outTxt );
} }
else else
{ {
nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgName.c_str()); nlwarning("CUserEntity:setAFK: unknown message named '%s'.", msgNameTxt.c_str());
} }
@ -3111,7 +3111,7 @@ void CUserEntity::rollDice(sint16 min, sint16 max, bool local)
} }
sint16 roll = min + (sint16)dice->rand(max-min); sint16 roll = min + (sint16)dice->rand(max-min);
ucstring msg = CI18N::get("msgRollDiceLocal"); string msg = CI18N::get("msgRollDiceLocal");
strFindReplace(msg, "%min", toString(min)); strFindReplace(msg, "%min", toString(min));
strFindReplace(msg, "%max", toString(max)); strFindReplace(msg, "%max", toString(max));
strFindReplace(msg, "%roll", toString(roll)); strFindReplace(msg, "%roll", toString(roll));
@ -3143,7 +3143,7 @@ bool CUserEntity::canEngageCombat()
{ {
// display "you can't fight while sitting" message) // display "you can't fight while sitting" message)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCantFightSit"); string msg = CI18N::get("msgCantFightSit");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
@ -3154,7 +3154,7 @@ bool CUserEntity::canEngageCombat()
{ {
// display "you can't fight while swiming" message) // display "you can't fight while swiming" message)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCantFightSwim"); string msg = CI18N::get("msgCantFightSwim");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
@ -3165,7 +3165,7 @@ bool CUserEntity::canEngageCombat()
{ {
// display "you can't fight while swimming" message) // display "you can't fight while swimming" message)
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg = CI18N::get("msgCantFightRide"); string msg = CI18N::get("msgCantFightRide");
string cat = getStringCategory(msg, msg); string cat = getStringCategory(msg, msg);
pIM->displaySystemInfo(msg, cat); pIM->displaySystemInfo(msg, cat);
@ -4140,7 +4140,7 @@ void CUserEntity::switchVelocity(bool userRequest)
// display message : your are running, you are walking // display message : your are running, you are walking
CInterfaceManager *pIM= CInterfaceManager::getInstance(); CInterfaceManager *pIM= CInterfaceManager::getInstance();
ucstring msg; string msg;
if( _Run ) if( _Run )
msg = CI18N::get("msgUserIsRunning"); msg = CI18N::get("msgUserIsRunning");
else else

@ -633,7 +633,7 @@ public:
uint8 ChatMode; uint8 ChatMode;
// uint32 DynChatChanID; // uint32 DynChatChanID;
NLMISC::CEntityId DynChatChanID; NLMISC::CEntityId DynChatChanID;
ucstring Content; ucstring Content; // FIXME: UTF-8 (serial)
CChatMsg() CChatMsg()
{ {
@ -650,7 +650,7 @@ public:
f.serial( ChatMode ); f.serial( ChatMode );
if(ChatMode==CChatGroup::dyn_chat) if(ChatMode==CChatGroup::dyn_chat)
f.serial(DynChatChanID); f.serial(DynChatChanID);
f.serial( Content ); f.serial( Content ); // FIXME: UTF-8 (serial)
} }
}; };
@ -669,7 +669,7 @@ public:
uint32 SenderNameId; uint32 SenderNameId;
uint8 ChatMode; uint8 ChatMode;
uint32 PhraseId; uint32 PhraseId;
ucstring CustomTxt; ucstring CustomTxt; // FIXME: UTF-8 (serial)
CChatMsg2() CChatMsg2()
{ {
@ -685,7 +685,7 @@ public:
f.serial( SenderNameId ); f.serial( SenderNameId );
f.serial( ChatMode ); f.serial( ChatMode );
f.serial( PhraseId ); f.serial( PhraseId );
f.serial( CustomTxt ); f.serial( CustomTxt ); // FIXME: UTF-8 (serial)
} }
}; };
@ -700,8 +700,8 @@ public:
class CFarTellMsg class CFarTellMsg
{ {
public: public:
ucstring SenderName; ucstring SenderName; // FIXME: UTF-8 (serial)
ucstring Text; ucstring Text; // FIXME: UTF-8 (serial)
void serial(NLMISC::CBitMemStream &f) void serial(NLMISC::CBitMemStream &f)
{ {

Loading…
Cancel
Save