develop
kaetemi 4 years ago
parent 47c0c8cc07
commit ff49b89b73

@ -335,97 +335,134 @@ public:
{ {
++it; ++it;
if (it == inputString.end()) if (it == inputString.end())
{
formatedResult += '$';
--it;
break; break;
}
switch(*it) switch(*it)
{ {
case 't': // add text ID case 't': // add text ID
{
formatedResult += paramString; formatedResult += paramString;
break; break;
}
case 'P': case 'P':
case 'p': // add player name case 'p': // add player name
if (ClientCfg.Local) {
if (ClientCfg.Local || !UserEntity)
{ {
if (*it == 'P') formatedResult += "PLAYER"; if (*it == 'P') formatedResult += "PLAYER";
else formatedResult += "Player"; else formatedResult += "Player";
} }
else else
{ {
if(UserEntity) std::string name = UserEntity->getEntityName().toUtf8();
{ if (*it == 'P') name = toUpper(name);
std::string name = UserEntity->getEntityName().toUtf8(); formatedResult += name;
if (*it == 'P') name = toUpper(name);
formatedResult += name;
}
} }
break; break;
// }
case 's': case 's':
case 'b': // add bot name case 'b': // add bot name
{
string botName;
bool womanTitle = false;
if (ClientCfg.Local)
{ {
string botName; botName = "NPC";
bool womanTitle = false; }
if (ClientCfg.Local) else
{ {
botName = "NPC"; CLFECOMMON::TCLEntityId trader = CLFECOMMON::INVALID_SLOT;
} if(UserEntity)
else trader = UserEntity->trader();
if (trader != CLFECOMMON::INVALID_SLOT)
{ {
CLFECOMMON::TCLEntityId trader = CLFECOMMON::INVALID_SLOT; CEntityCL *entity = EntitiesMngr.entity(trader);
if(UserEntity) if (entity != NULL)
trader = UserEntity->trader();
if (trader != CLFECOMMON::INVALID_SLOT)
{ {
CEntityCL *entity = EntitiesMngr.entity(trader); uint32 nDBid = entity->getNameId();
if (entity != NULL) if (nDBid != 0)
{
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
pSMC->getString(nDBid, botName);
}
else
{ {
uint32 nDBid = entity->getNameId(); botName = entity->getDisplayName().toUtf8();
if (nDBid != 0)
{
STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();
pSMC->getString(nDBid, botName);
}
else
{
botName = entity->getDisplayName().toUtf8();
}
CCharacterCL *pChar = dynamic_cast<CCharacterCL*>(entity);
if (pChar != NULL)
womanTitle = pChar->getGender() == GSGENDER::female;
} }
CCharacterCL *pChar = dynamic_cast<CCharacterCL*>(entity);
if (pChar != NULL)
womanTitle = pChar->getGender() == GSGENDER::female;
} }
} }
// get the title translated }
ucstring sTitleTranslated = botName; // FIXME: UTF-8 // get the title translated
CStringPostProcessRemoveName spprn; ucstring sTitleTranslated = botName; // FIXME: UTF-8
spprn.Woman = womanTitle; CStringPostProcessRemoveName spprn;
spprn.cbIDStringReceived(sTitleTranslated); spprn.Woman = womanTitle;
spprn.cbIDStringReceived(sTitleTranslated);
botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8(); botName = CEntityCL::removeTitleAndShardFromName(botName).toUtf8();
// short name (with no title such as 'guard', 'merchant' ...) // short name (with no title such as 'guard', 'merchant' ...)
if (*it == 's') if (*it == 's')
{
// But if there is no name, display only the title
if (botName.empty())
botName = sTitleTranslated.toUtf8();
}
else
{
// Else we want the title !
if (!botName.empty())
botName += " ";
botName += sTitleTranslated.toUtf8();
}
formatedResult += botName;
break;
}
case '\'': // 's and 'S -> Potatos Identity and TOMATOES IDENTITY
{
std::string::const_iterator it2 = it;
++it2;
if (it2 == inputString.end())
{
formatedResult += "$'";
}
else
{
it = it2;
if (*it == 's' || *it == 'S')
{ {
// But if there is no name, display only the title if (formatedResult.size() && (formatedResult[formatedResult.size() - 1] == 's' || formatedResult[formatedResult.size() - 1] == 'S'))
if (botName.empty()) {
botName = sTitleTranslated.toUtf8(); formatedResult += "\xE2\x80\x99"; // RIGHT SINGLE QUOTATION MARK
}
else
{
formatedResult += "\xE2\x80\x99"; // RIGHT SINGLE QUOTATION MARK
formatedResult += *it;
}
} }
else else
{ {
// Else we want the title ! --it;
if (!botName.empty()) formatedResult += "$'";
botName += " ";
botName += sTitleTranslated.toUtf8();
} }
formatedResult += botName;
} }
break; break;
default: }
formatedResult += '$'; default:
{
formatedResult += '$';
--it;
break; break;
} }
}
++it; ++it;
} }
else else

Loading…
Cancel
Save