| 142 | } |
| 143 | |
| 144 | void SendConsoleText(wstr_t text, uint16_t defaultColor) |
| 145 | { |
| 146 | const size_t len = text.length(); |
| 147 | if (len == 0) |
| 148 | return; |
| 149 | |
| 150 | SPEECH_TYPE speechType = ST_NORMAL; |
| 151 | uint16_t sendColor = g_ConfigManager.SpeechColor; |
| 152 | int offset = 0; |
| 153 | int member = -1; |
| 154 | GAME_CONSOLE_TEXT_TYPE type = GCTT_NORMAL; |
| 155 | (void)GetConsolePrefixAndType(text, member, type); |
| 156 | if (len == 1 && type != GCTT_NORMAL) |
| 157 | return; |
| 158 | |
| 159 | if (len > 1) |
| 160 | { |
| 161 | offset = (int)strlen(s_ConsolePrefix[type]); |
| 162 | if ((type != GCTT_NORMAL && len > 2) || type == GCTT_PARTY) |
| 163 | { |
| 164 | if (type == GCTT_YELL) |
| 165 | { |
| 166 | speechType = ST_YELL; |
| 167 | } |
| 168 | else if (type == GCTT_WHISPER) |
| 169 | { |
| 170 | speechType = ST_WHISPER; |
| 171 | } |
| 172 | else if (type == GCTT_EMOTE) |
| 173 | { |
| 174 | text = text.replace(0, offset, L": *").append(L"*"); |
| 175 | speechType = ST_EMOTE; |
| 176 | sendColor = g_ConfigManager.EmoteColor; |
| 177 | } |
| 178 | else if (type == GCTT_GUILD) |
| 179 | { |
| 180 | speechType = ST_GUILD_CHAT; |
| 181 | sendColor = g_ConfigManager.GuildMessageColor; |
| 182 | } |
| 183 | else if (type == GCTT_ALLIANCE) |
| 184 | { |
| 185 | sendColor = g_ConfigManager.AllianceMessageColor; |
| 186 | speechType = ST_ALLIANCE_CHAT; |
| 187 | } |
| 188 | else if (type == GCTT_PARTY) |
| 189 | { |
| 190 | uint32_t serial = 0; |
| 191 | sendColor = g_ConfigManager.PartyMessageColor; |
| 192 | if (member != -1) |
| 193 | { |
| 194 | serial = g_Party.Member[member].Serial; |
| 195 | } |
| 196 | |
| 197 | text.erase(0, offset); |
| 198 | if (g_Party.Leader != 0) |
| 199 | { |
| 200 | CPacketPartyMessage(text.c_str(), len - offset, serial).Send(); |
| 201 | } |
no test coverage detected