develop
kaetemi 4 years ago
parent 47c0c8cc07
commit ff49b89b73

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

Loading…
Cancel
Save