| 3950 | } |
| 3951 | |
| 3952 | void SendChat(const char* text, const std::vector<uint8_t>& playerIds) |
| 3953 | { |
| 3954 | auto& network = GetContext()->GetNetwork(); |
| 3955 | if (network.GetMode() == Mode::client) |
| 3956 | { |
| 3957 | network.Client_Send_CHAT(text); |
| 3958 | } |
| 3959 | else if (network.GetMode() == Mode::server) |
| 3960 | { |
| 3961 | std::string message = text; |
| 3962 | if (ProcessChatMessagePluginHooks(network.GetPlayerID(), message)) |
| 3963 | { |
| 3964 | auto player = network.GetPlayerByID(network.GetPlayerID()); |
| 3965 | if (player != nullptr) |
| 3966 | { |
| 3967 | auto formatted = network.FormatChat(player, message.c_str()); |
| 3968 | if (playerIds.empty() |
| 3969 | || std::find(playerIds.begin(), playerIds.end(), network.GetPlayerID()) != playerIds.end()) |
| 3970 | { |
| 3971 | // Server is one of the recipients |
| 3972 | ChatAddHistory(formatted); |
| 3973 | } |
| 3974 | network.ServerSendChat(formatted, playerIds); |
| 3975 | } |
| 3976 | } |
| 3977 | } |
| 3978 | } |
| 3979 | |
| 3980 | void SendGameAction(const GameActions::GameAction* action) |
| 3981 | { |
no test coverage detected