#ifdef ENABLE_CHAT_COLOR_SYSTEM
static const char* colorbuf[] = {"|cFFffa200|H|h[Admin]|h|r", "|cFFff0000|H|h[Shinsoo]|h|r", "|cFFffc700|H|h[Chunjo]|h|r", "|cFF000bff|H|h[Jinno]|h|r"};
int len = snprintf(chatbuf, sizeof(chatbuf), "%s %s : %s", (ch->IsGM()?colorbuf[0]:colorbuf[MINMAX(0, ch->GetEmpire(), 3)]), ch->GetName(), buf);
#else
int len = snprintf(chatbuf, sizeof(chatbuf), "%s : %s", ch->GetName(), buf);
#endif
#if defined(__BL_CLIENT_LOCALE_STRING__)
int hyperlinks;
bool colored;
GetTextTagInfo(chatbuf, len, hyperlinks, colored);
if (hyperlinks)
{
const std::string formatStr = __FormatHyperLinkItemString(chatbuf);
strlcpy(chatbuf, formatStr.c_str(), sizeof(chatbuf));
len = strlen(chatbuf);
}
#endif
if (CHAT_TYPE_SHOUT == pinfo->type)
{
LogManager::instance().ShoutLog(g_bChannel, ch->GetEmpire(), chatbuf);
}
if (len < 0 || len >= (int) sizeof(chatbuf))
len = sizeof(chatbuf) - 1;
if (pinfo->type == CHAT_TYPE_SHOUT)
{
if (ch->GetLevel() < g_iShoutLimitLevel)
{
ch->ChatPacket(CHAT_TYPE_INFO, "[LS;654;%d]", g_iShoutLimitLevel);
return (iExtraLen);
}
if (thecore_heart->pulse - (int) ch->GetLastShoutPulse() < passes_per_sec * 15)
return (iExtraLen);
ch->SetLastShoutPulse(thecore_heart->pulse);
TPacketGGShout p;
p.bHeader = HEADER_GG_SHOUT;
p.bEmpire = ch->GetEmpire();
strlcpy(p.szText, chatbuf, sizeof(p.szText));
#if defined(__BL_MULTI_LANGUAGE_PREMIUM__)
strlcpy(p.szCountry, ch->GetDesc()->GetCountryName().c_str(), sizeof(p.szCountry));
p.hyperlinks = hyperlinks;
#endif
P2P_MANAGER::instance().Send(&p, sizeof(TPacketGGShout));
#if defined(__BL_MULTI_LANGUAGE_PREMIUM__)
SendShout(chatbuf, ch->GetEmpire(), p.szCountry, p.hyperlinks);
#else
SendShout(chatbuf, ch->GetEmpire());
#endif
return (iExtraLen);
}
TPacketGCChat pack_chat;
pack_chat.header = HEADER_GC_CHAT;
pack_chat.size = sizeof(TPacketGCChat) + len;
pack_chat.type = pinfo->type;
pack_chat.id = ch->GetVID();
#if defined(__BL_CLIENT_LOCALE_STRING__)
pack_chat.bCanFormat = (hyperlinks > 0);
#endif
//#if defined(__BL_MULTI_LANGUAGE_PREMIUM__)
// strlcpy(pack_chat.szCountry, ch->GetDesc()->GetCountryName().c_str(), sizeof(pack_chat.szCountry));
// pack_chat.bEmpire = ch->GetEmpire();
//#endif