@@ -53,7 +53,8 @@ void BetterChat::onLoad()
5353 cvarManager->registerCvar (" betterchat_antispam" , " 1" , " Enable AntiSpam" , true , true , 0 , true , 1 );
5454 cvarManager->registerCvar (" betterchat_chatfilter" , " 1" , " Enable ChatFilter" , true , true , 0 , true , 1 );
5555 cvarManager->registerCvar (" betterchat_delay" , " 5" , " Delay between two same messages from the same player" , true , true , 0 , true , 10 );
56- cvarManager->registerCvar (" betterchat_writtenmsg" , " 0" , " Disable written messages" , true , true , 0 , true , 1 );
56+ cvarManager->registerCvar (" betterchat_nowrittenmsg" , " 0" , " Disable written messages" , true , true , 0 , true , 1 );
57+ cvarManager->registerCvar (" betterchat_writtenmsgastoxic" , " 0" , " Consider written messages as toxic" , true , true , 0 , true , 1 );
5758 cvarManager->registerCvar (" betterchat_aftersavetime" , " 5" , " Time the 'After save' messages are allowed after a save" , true , true , 0 , true , 20 );
5859 cvarManager->registerCvar (" betterchat_owngoal" , " 0" , " Do not count the goal if it is an owngoal" , true , true , 0 , true , 1 );
5960 cvarManager->registerCvar (" betterchat_unwanted_pass" , " 0" , " Do not count the pass if an opponent touch it before the goal" , true , true , 0 , true , 1 );
@@ -80,10 +81,15 @@ void BetterChat::onLoad()
8081void BetterChat::onUnload ()
8182{
8283 LOG (" Plugin Off" );
83- gameWrapper->UnhookEvent (" Function TAGame.HUDBase_TA.OnChatMessage" );
84- gameWrapper->UnhookEvent (" Function TAGame.GFxData_Chat_TA.OnChatMessage" );
8584 gameWrapper->UnhookEvent (" Function GameEvent_TA.Countdown.BeginState" );
8685 gameWrapper->UnhookEvent (" Function TAGame.GFxHUD_TA.HandleStatTickerMessage" );
86+ gameWrapper->UnhookEvent (" Function TAGame.HUDBase_TA.OnChatMessage" );
87+ gameWrapper->UnhookEvent (" Function TAGame.Replay_TA.StopPlayback" );
88+ gameWrapper->UnhookEvent (" Function TAGame.Car_TA.EventHitBall" );
89+ gameWrapper->UnhookEvent (" Function TAGame.GameEvent_Soccar_TA.OnGameTimeUpdated" );
90+ gameWrapper->UnhookEvent (" Function TAGame.Ball_TA.OnHitGoal" );
91+ gameWrapper->UnhookEvent (" Function TAGame.GameEvent_TA.Destroyed" );
92+ gameWrapper->UnhookEvent (" Function TAGame.GameEvent_Soccar_TA.OnMatchWinnerSet" );
8793}
8894
8995// / <summary>
@@ -568,13 +574,12 @@ void BetterChat::chatMessageEvent(ActorWrapper caller, void* params) {
568574 delay = std::chrono::seconds (0 );
569575 }
570576
571- playerInfo[playerName].numMsg += 1 ;
572-
573577 bool cancel = false ;
574578
575579 regex quickchat_pattern (" ^Group\\ dMessage\\ d\\ d?$" );
576580 if (regex_match (msgID, quickchat_pattern)) // If it is a quickchat
577581 {
582+ playerInfo[playerName].numMsg += 1 ;
578583 if (msgID != playerInfo[playerName].previousMsg ) { // Different message
579584 playerInfo[playerName].previousMsg = msgID;
580585 playerInfo[playerName].previousTime = chrono::system_clock::now ();
@@ -599,9 +604,12 @@ void BetterChat::chatMessageEvent(ActorWrapper caller, void* params) {
599604 }
600605 }
601606 else {
602- if (cvarManager->getCvar (" betterchat_writtenmsg " ).getBoolValue ()) {
607+ if (cvarManager->getCvar (" betterchat_nowrittenmsg " ).getBoolValue ()) {
603608 cancel = true ;
604- playerInfo[playerName].blockedMsg += 1 ;
609+ }
610+ if (cvarManager->getCvar (" betterchat_writtenmsgastoxic" ).getBoolValue ()) {
611+ if (cancel) playerInfo[playerName].blockedMsg += 1 ;
612+ playerInfo[playerName].numMsg += 1 ;
605613 }
606614 }
607615 handleMsg (cancel, playerName);
0 commit comments