mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-12 11:51:42 +00:00
[General] Implement CleanChat()
This commit is contained in:
parent
7b98f9f7ff
commit
3803535bd5
3 changed files with 29 additions and 5 deletions
|
@ -22,12 +22,25 @@ void ScriptFunctions::SendMessage(unsigned short pid, const char *message, bool
|
||||||
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(true);
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFunctions::CleanChat(unsigned short pid)
|
void ScriptFunctions::CleanChatByPid(unsigned short pid)
|
||||||
{
|
{
|
||||||
|
Player *player;
|
||||||
|
GET_PLAYER(pid, player,);
|
||||||
|
|
||||||
|
player->chatMessage.clear();
|
||||||
|
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player);
|
||||||
|
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptFunctions::CleanChat()
|
void ScriptFunctions::CleanChat()
|
||||||
{
|
{
|
||||||
|
for (auto player : *Players::getPlayers())
|
||||||
|
{
|
||||||
|
player.second->chatMessage.clear();
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->setPlayer(player.second);
|
||||||
|
|
||||||
|
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_CHAT_MESSAGE)->Send(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
static boost::any CallPublic(const char *name, ...) noexcept;
|
static boost::any CallPublic(const char *name, ...) noexcept;
|
||||||
|
|
||||||
static void SendMessage(unsigned short pid, const char *message, bool broadcast) noexcept;
|
static void SendMessage(unsigned short pid, const char *message, bool broadcast) noexcept;
|
||||||
static void CleanChat(unsigned short pid);
|
static void CleanChatByPid(unsigned short pid);
|
||||||
static void CleanChat();
|
static void CleanChat();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,6 +100,8 @@ public:
|
||||||
{"SetServerPassword", ScriptFunctions::SetServerPassword},
|
{"SetServerPassword", ScriptFunctions::SetServerPassword},
|
||||||
{"SetRuleString", ScriptFunctions::SetRuleString},
|
{"SetRuleString", ScriptFunctions::SetRuleString},
|
||||||
{"SetRuleValue", ScriptFunctions::SetRuleValue},
|
{"SetRuleValue", ScriptFunctions::SetRuleValue},
|
||||||
|
{"CleanChatByPid", ScriptFunctions::CleanChatByPid},
|
||||||
|
{"CleanChat", ScriptFunctions::CleanChat},
|
||||||
|
|
||||||
POSITIONAPI,
|
POSITIONAPI,
|
||||||
CELLAPI,
|
CELLAPI,
|
||||||
|
|
|
@ -114,8 +114,17 @@ namespace mwmp
|
||||||
{
|
{
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
}
|
}
|
||||||
mHistory->addText(color+msg);
|
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, msg.c_str());
|
if(msg.size() == 0)
|
||||||
|
{
|
||||||
|
clean();
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Chat cleaned");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mHistory->addText(color + msg);
|
||||||
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, msg.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::printOK(const std::string &msg)
|
void GUIChat::printOK(const std::string &msg)
|
||||||
|
@ -142,7 +151,7 @@ namespace mwmp
|
||||||
|
|
||||||
void GUIChat::clean()
|
void GUIChat::clean()
|
||||||
{
|
{
|
||||||
mHistory->clearUserStrings();
|
mHistory->setCaption("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::pressedChatMode()
|
void GUIChat::pressedChatMode()
|
||||||
|
|
Loading…
Reference in a new issue