| 1801 | |
| 1802 | |
| 1803 | void cClientHandle::SendChat(const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData) |
| 1804 | { |
| 1805 | bool ShouldAppendChatPrefixes = true; |
| 1806 | |
| 1807 | if (GetPlayer()->GetWorld() == NULL) |
| 1808 | { |
| 1809 | cWorld * World = cRoot::Get()->GetWorld(GetPlayer()->GetLoadedWorldName()); |
| 1810 | if (World == NULL) |
| 1811 | { |
| 1812 | World = cRoot::Get()->GetDefaultWorld(); |
| 1813 | } |
| 1814 | |
| 1815 | if (!World->ShouldUseChatPrefixes()) |
| 1816 | { |
| 1817 | ShouldAppendChatPrefixes = false; |
| 1818 | } |
| 1819 | } |
| 1820 | else if (!GetPlayer()->GetWorld()->ShouldUseChatPrefixes()) |
| 1821 | { |
| 1822 | ShouldAppendChatPrefixes = false; |
| 1823 | } |
| 1824 | |
| 1825 | AString Message; |
| 1826 | |
| 1827 | switch (a_ChatPrefix) |
| 1828 | { |
| 1829 | case mtCustom: break; |
| 1830 | case mtFailure: |
| 1831 | { |
| 1832 | if (ShouldAppendChatPrefixes) |
| 1833 | Message = Printf("%s[INFO] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str()); |
| 1834 | else |
| 1835 | Message = Printf("%s", cChatColor::Rose.c_str()); |
| 1836 | break; |
| 1837 | } |
| 1838 | case mtInformation: |
| 1839 | { |
| 1840 | if (ShouldAppendChatPrefixes) |
| 1841 | Message = Printf("%s[INFO] %s", cChatColor::Yellow.c_str(), cChatColor::White.c_str()); |
| 1842 | else |
| 1843 | Message = Printf("%s", cChatColor::Yellow.c_str()); |
| 1844 | break; |
| 1845 | } |
| 1846 | case mtSuccess: |
| 1847 | { |
| 1848 | if (ShouldAppendChatPrefixes) |
| 1849 | Message = Printf("%s[INFO] %s", cChatColor::Green.c_str(), cChatColor::White.c_str()); |
| 1850 | else |
| 1851 | Message = Printf("%s", cChatColor::Green.c_str()); |
| 1852 | break; |
| 1853 | } |
| 1854 | case mtWarning: |
| 1855 | { |
| 1856 | if (ShouldAppendChatPrefixes) |
| 1857 | Message = Printf("%s[WARN] %s", cChatColor::Rose.c_str(), cChatColor::White.c_str()); |
| 1858 | else |
| 1859 | Message = Printf("%s", cChatColor::Rose.c_str()); |
| 1860 | break; |
no test coverage detected