void execute (CCtrlBase *pCaller, const std::string &sParams) { string receiver = getParam (sParams, "player"); ucstring message; message.fromUtf8(getParam (sParams, "text")); // message = getParam (sParams, "text"); if (receiver.empty() || message.empty()) return; // Get the chat window (if any) CChatWindow *cw = NULL; CGroupEditBox *eb = pCaller?dynamic_cast<CGroupEditBox *>(pCaller):NULL; if (eb) cw = getChatWndMgr().getChatWindowFromCaller(eb); // Send the message. ChatMngr.tell(receiver, message); // display in the good window CInterfaceProperty prop; prop.readRGBA("UI:SAVE:CHAT:COLORS:SPEAKER"," "); ucstring finalMsg; CChatWindow::encodeColorTag(prop.getRGBA(), finalMsg, false); ucstring csr(CHARACTER_TITLE::isCsrTitle(UserEntity->getTitleRaw()) ? "(CSR) " : ""); finalMsg += csr + CI18N::get("youTell") + ": "; prop.readRGBA("UI:SAVE:CHAT:COLORS:TELL"," "); CChatWindow::encodeColorTag(prop.getRGBA(), finalMsg, true); finalMsg += message; // display msg with good color // TDataSetIndex dsi; // not used .... PeopleInterraction.ChatInput.Tell.displayTellMessage(/*dsi, */finalMsg, receiver, prop.getRGBA()); ucstring s = CI18N::get("youTellPlayer"); strFindReplace(s, "%name", receiver); strFindReplace(finalMsg, CI18N::get("youTell"), s); CInterfaceManager::getInstance()->log(finalMsg); }
//============================================================================================================= void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32 dynamicChannelDbIndex, bool allowUniverseWarning) { _TargetPlayer.resize(0); if (_TargetPartyChat) { _TargetPartyChat->removeObserver(this); _TargetPartyChat = NULL; } _TargetGroup = groupType; _TargetDynamicChannelDbIndex = dynamicChannelDbIndex; if (_Chat) { // set the prompt const ucstring prompt(""); _Chat->setPrompt(prompt + (ucchar) '>'); // set the color string entry="UI:SAVE:CHAT:COLORS:"; CInterfaceManager *pIM = CInterfaceManager::getInstance(); const bool teamActive = pIM->getDbProp("SERVER:GROUP:0:NAME")->getValueBool(); const bool guildActive = pIM->getDbProp("SERVER:GUILD:NAME")->getValueBool(); switch(groupType) { case CChatGroup::dyn_chat: entry+="DYN:" + NLMISC::toString(dynamicChannelDbIndex); break; case CChatGroup::say: entry+="SAY"; break; case CChatGroup::shout: entry+="SHOUT"; break; case CChatGroup::team: if(!teamActive) return; entry+="GROUP"; break; case CChatGroup::guild: entry+="CLADE"; break; case CChatGroup::civilization: entry+="CIVILIZATION"; break; case CChatGroup::territory: entry+="TERRITORY"; break; case CChatGroup::universe: { entry+="UNIVERSE_NEW"; if(allowUniverseWarning) pIM->getDbProp("UI:VARIABLES:UNIVERSE_CHANEL_WARNING_WANTED")->setValue64(1); } break; case CChatGroup::region: entry+="REGION"; break; case CChatGroup::tell: entry+="TELL"; break; case CChatGroup::system: return; // return with no warning default: nlwarning("unknown CChatGroup type"); return; } // read DB CInterfaceProperty prop; prop.readRGBA(entry.c_str()," "); _Chat->setPromptColor(prop.getRGBA()); } }