Files
test/extracted_func_v2.txt
T
2026-03-24 12:28:56 +07:00

213 lines
7.3 KiB
Plaintext

3289: void CECGameUIMan::AddChatMessage(const ACHAR *pszMsg,
3290: char cChannel, int idPlayer, const ACHAR *pszPlayer, char byFlag, char cEmotion, CECIvtrItem *pItem,const ACHAR *pszMsgOrigion)
3291: {
3292: auto_delete<CECIvtrItem> tmp(pItem);
3293:
3294: bool bIsKing = false;
3295: if( cChannel == GP_CHAT_COUNTRY && (cEmotion & 0x80) )
3296: {
3297: cEmotion &= ~0x80;
3298: bIsKing = true;
3299: }
3300:
3301: // 修正表情
3302: ACString strModified = FilterEmotionSet(pszMsg, cEmotion);
3303:
3304: // 修正给GM的额外信息
3305: ACString GM_MsgShow;
3306: ACHAR GM_MsgType(0);
3307: bool GM_MsgValid(false);
3308: if (g_pGame->GetGameRun()->GetHostPlayer()->IsGM() &&
3309: GP_CHAT_WHISPER == cChannel)
3310: {
3311: int nSymbolPos = strModified.Find(GM_HELP_MSG_TYPE_BASE);
3312: if (nSymbolPos >= 0 && nSymbolPos+1 < strModified.GetLength())
3313: {
3314: ACHAR type = strModified[nSymbolPos + 1];
3315: if (TheGMHelpMsgArray::Instance()->FindByType(type, NULL))
3316: {
3317: GM_MsgValid = true;
3318: GM_MsgType = type;
3319: GM_MsgShow = strModified;
3320: GM_MsgShow.CutLeft(nSymbolPos + 2);
3321:
3322: strModified = strModified.Left(nSymbolPos) + strModified.Right(strModified.GetLength() - (nSymbolPos+2));
3323: }
3324: }
3325: }
3326:
3327: // 考虑本地化对某些内容不显示的要求,当ingame.stf找不到相关字符串、并导致此处字符中为空时,隐藏显示
3328: if (strModified.IsEmpty())
3329: return;
3330:
3331: // 标明来自GT频道的消息
3332: if (byFlag == CHANNEL_GAMETALK)
3333: strModified += GetStringFromTable(9312);
3334:
3335: pszMsg = strModified;
3336:
3337: if( PlayerIsBlack(idPlayer) )
3338: return;
3339: if( cChannel == GP_CHAT_SYSTEM && a_stricmp(pszMsg, GetStringFromTable(809)) == 0 )
3340: return;
3341:
3342: if( byFlag == CHANNEL_FRIEND || byFlag == CHANNEL_FRIEND_RE || byFlag == CHANNEL_GAMETALK)
3343: {
3344: AddFriendMessage(pszMsg, idPlayer, pszPlayer, byFlag, cEmotion, pItem ? pItem->Clone() : NULL,pszMsgOrigion);
3345: return;
3346: }
3347: else if( byFlag == CHANNEL_USERINFO )
3348: {
3349: if( pszMsg[0] == 'R' )
3350: {
3351: CECFriendMan *pMan = g_pGame->GetGameRun()->GetHostPlayer()->GetFriendMan();
3352: if (!pMan)
3353: return;
3354: if( pMan->GetFriendByID(idPlayer) )
3355: FriendAction(idPlayer, -1, CDlgFriendList::FRIEND_ACTION_INFO_REFRESH, 0);
3356: }
3357: else if( pszMsg[0] == 'L' )
3358: FriendAction(idPlayer, -1, CDlgFriendList::FRIEND_ACTION_INFO_LEVEL, a_atoi(pszMsg + 1));
3359: else if( pszMsg[0] == 'A' )
3360: FriendAction(idPlayer, -1, CDlgFriendList::FRIEND_ACTION_INFO_AREA, a_atoi(pszMsg + 1));
3361: return;
3362: }
3363:
3364: ACHAR *pszText;
3365: CDlgChat::CHAT_MSG msg;
3366: ACHAR szText[512], szMsg[512];
3367: CDlgChat *pChat1 = m_pDlgChat;
3368: CDlgChat *pChat2 = m_pDlgChat2;
3369: CDlgChat *pChat3 = m_pDlgChat3;
3370: EC_GAME_SETTING gs = g_pGame->GetConfigs()->GetGameSettings();
3371: PAUITEXTAREA pShow1 = dynamic_cast<PAUITEXTAREA>(pChat1->GetDlgItem("Txt_Content"));
3372: PAUITEXTAREA pShow2 = dynamic_cast<PAUITEXTAREA>(pChat2->GetDlgItem("Txt_Content"));
3373: PAUITEXTAREA pShow3 = dynamic_cast<PAUITEXTAREA>(pChat3->GetDlgItem("Txt_Content"));
3374: abase::vector<CDlgChat::CHAT_MSG> &vecChatMsg = m_pDlgChat->GetAllChatMsgs();
3375: abase::vector<CDlgChat::CHAT_MSG> &superFarCryMsg = m_pDlgChat->GetSuperFarCryMsgs();
3376: abase::vector<CDlgChat::LINKED_MSG> &whisperMsg = m_pDlgChat->GetWhisperChatMsgs();
3377:
3378: msg.idPlayer = idPlayer;
3379: msg.strMsg = pszMsg;
3380: msg.cChannel = cChannel;
3381: msg.cEmotion = cEmotion;
3382: msg.strMsgOrigion = pszMsgOrigion;
3383: if( cChannel == GP_CHAT_LOCAL ||
3384: cChannel == GP_CHAT_FARCRY ||
3385: cChannel == GP_CHAT_TEAM ||
3386: cChannel == GP_CHAT_FACTION ||
3387: cChannel == GP_CHAT_WHISPER ||
3388: cChannel == GP_CHAT_TRADE ||
3389: cChannel == GP_CHAT_SUPERFARCRY ||
3390: cChannel == GP_CHAT_BATTLE ||
3391: cChannel == GP_CHAT_COUNTRY)
3392: {
3393: if (ISPLAYERID(idPlayer)){
3394: g_pGame->GetGameRun()->GetUIManager()->FilterBadWords(msg.strMsg);
3395: }
3396: }
3397:
3398: int nMsgLen = a_strlen(pszMsg);
3399: // Booth Message
3400: if( cChannel == GP_CHAT_WHISPER &&
3401: pszMsg[nMsgLen - 2] == '!' &&
3402: pszMsg[nMsgLen - 1] == '#' )
3403: {
3404: if( m_pDlgBooth1->IsShow() )
3405: m_pDlgBooth1->AddBoothMessage(pszMsg);
3406: return;
3407: }
3408:
3409: ACString strName;
3410: A3DCOLOR clrName;
3411: TransformNameColor(pItem, strName, clrName);
3412: AWString msgWithColor = _AL("");
3413: if( ISNPCID(idPlayer) )
3414: msgWithColor += _AL("^C8FF64");
3415: else
3416: {
3417: if( cChannel == GP_CHAT_COUNTRY && bIsKing )
3418: msgWithColor += CDlgChat::m_pszKingColor;
3419: else
3420: msgWithColor += CDlgChat::GetChatColor(cChannel, idPlayer);
3421: }
3422:
3423: msgWithColor += GetChatChannelImage(cChannel);
3424: if( cChannel == GP_CHAT_COUNTRY && bIsKing )
3425: msgWithColor += GetStringFromTable(10310);
3426: msgWithColor += msg.strMsg;
3427:
3428: if( cChannel == GP_CHAT_WHISPER &&
3429: (int)m_pDlgChatWhisper->GetData() == idPlayer )
3430: {
3431: pShow1 = dynamic_cast<PAUITEXTAREA>(m_pDlgChatWhisper->GetDlgItem("Txt_Chat"));
3432: pszText = (ACHAR *)pShow1->GetText();
3433:
3434: if( a_strlen(pShow1->GetText()) > 0 )
3435: pShow1->AppendText(_AL("\r"));
3436:
3437: pShow1->AppendText(msgWithColor, pItem ? CDlgChat::m_nMsgIndex : 0, strName, clrName);
3438:
3439: if( !m_pDlgChat->IsLocked() )
3440: {
3441: pShow1->ScrollToTop();
3442: pShow1->ScrollToBottom();
3443: }
3444: if( !m_pDlgChatWhisper->IsShow() )
3445: m_pMiniBarMgr->FlashDialog(m_pDlgChatWhisper);
3446:
3447: // 将可点击的消息,保存起来供点击查询
3448: if (pItem)
3449: {
3450: CDlgChat::LINKED_MSG linkedMsg;
3451: linkedMsg.pItem = pItem;
3452: tmp._ptr = NULL;
3453: linkedMsg.nMsgIndex = CDlgChat::m_nMsgIndex++;
3454:
3455: whisperMsg.push_back(linkedMsg);
3456: if( (int)whisperMsg.size() >= CECGAMEUIMAN_MAX_MSGS )
3457: {
3458: CDlgChat::LINKED_MSG &msgDelete = *(whisperMsg.begin());
3459: delete msgDelete.pItem;
3460: msgDelete.pItem = NULL;
3461: whisperMsg.erase(whisperMsg.begin());
3462: }
3463: }
3464: }
3465: else
3466: {
3467: msg.pItem = pItem;
3468: msg.nMsgIndex = CDlgChat::m_nMsgIndex++;
3469: tmp._ptr = NULL;
3470: msg.strMsg = msgWithColor;
3471:
3472: int nActiveChannelSet = m_pDlgChat->GetActiveChannelSet();
3473: if( gs.bChannel[nActiveChannelSet][cChannel] )
3474: {
3475: pszText = (ACHAR *)pShow1->GetText();
3476:
3477: /*
3478: if( m_pDlgChat->GetMsgCount(1) >= CECGAMEUIMAN_MAX_MSGS )
3479: {
3480: pch = a_strstr(pszText, _AL("\r"));
3481: if( pch )
3482: {
3483: ACString strText = pszText;
3484: strText.CutLeft(pch - pszText + 1);
3485: pShow1->SetText(strText);
3486: }
3487: }
3488: */
3489:
3490: if( glb_IsTextNotEmpty(pShow1))
3491: pShow1->AppendText(_AL("\r"));
3492:
3493: pShow1->AppendText(msgWithColor, msg.nMsgIndex, strName, clrName);
3494:
3495: if( !pChat1->IsLocked() )
3496: {
3497: pShow1->ScrollToTop();
3498: pShow1->ScrollToBottom();
3499: }
3500: