-
Automatic alert For all r63B emuloators ;p
Hi Ragezone,
Many peaple are asking can someone code the automatic alert.
So Here it is :D
By the way this release is for plus R2 But it works other emulators too but some class names are not the same.
Oke lets start with supportticket.cs
Search inside it for:
message.AppendInt32(TabId);
and edit the NEXT line to:
Code:
message.AppendInt32(Type);
Ok after you done that do you need to replace the last int of the strucute it looks like this:
message.AppendInt32(0);//Relations.Count);
replace it with:
Code:
string str = this.Message;
Dictionary<Point, string> dictionay = new Dictionary<Point, string>();
List<string> word = LanguageLocale.AutoFilter;
if ((word != null) && (word.Count > 0))
{
foreach (string str2 in word)
{
if (str.ToLower().IndexOf(str2.ToLower()) != -1)
{
dictionay.Add(new Point(str.ToLower().IndexOf(str2.ToLower()), str.ToLower().IndexOf(str2.ToLower()) + str2.Length), "Banned word");
}
}
}
message.AppendInt32(dictionay.Count);
foreach (KeyValuePair<Point, string> pair in dictionay)
{
Point key = pair.Key;
string s = pair.Value;
message.AppendString(s);
message.AppendInt32(key.X);
message.AppendInt32(key.Y);
}
(thanks to 2habbo)
OK now you get some errors because of LanguageLocale.AutoFilter;
so lets add it to your languageLocale.cs
add
Code:
internal static List<string> AutoFilter;
after: internal static List<string> AutoFilter;
search: internal static void InitSwearWord(IQueryAdapter dbClient)
and add at the start of the void
Code:
AutoFilter = new List<string>();
search:
DataTable sTable = dbClient.getTable();
and add after it:
Code:
dbClient.setQuery("SELECT * FROM wordfilter WHERE automaticalert = '1' ORDER BY word ASC");
DataTable aTable = dbClient.getTable();
and add at the end of the void:
Code:
foreach (DataRow aRow in aTable.Rows)
{
if (!AutoFilter.Contains(aRow[0].ToString()))
AutoFilter.Add(aRow[0].ToString());
}
Ok now you need to run this in your database:
Code:
ALTER TABLE `wordfilter`
ADD COLUMN `automaticalert` enum('0','1') CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '0';
Lets add the trigger checks to the languagelocale
search:
internal static bool CheckForBannedPhrases(string Message)
And add after that void:
Code:
internal static bool CheckForModAlert(string Message)
{
Message = Message.Replace(" ", "").ToLower();
foreach (String Word in AutoFilter)
{
if (Message.Contains(Word.ToLower()))
{
return true;
}
}
return false;
}
internal static bool CheckSpaceLetterSequence(string Message)
{
int count = 0;
bool isSpace = (Message[0] == ' ');
for (int x = 1; x < Message.ToCharArray().Length; x++)
{
bool curSpace = (Message[x] == ' ');
if (curSpace == isSpace)
return false;
isSpace = !isSpace;
count++;
if (count == 10)
break;
}
if ( count < 10)
{
return false;
}
return true ;
}
(2 checks the wordfilter check and the H O T E L check :D )
OK your done in this class lets go to ModerationTool.cs and search
internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, String Message)
Change the void structure to:
Code:
internal void SendNewTicket(GameClient Session, int Category, uint ReportedUser, String Message , int type)
search also (you need to edit this 2 times)
Ticket = new SupportTicket(TicketId, 1, 7, Session.GetHabbo().Id, ReportedUser, Message, 0, "", SilverwaveEnvironment.GetUnixTimestamp());
and replace it (2 times) to:
Code:
Ticket = new SupportTicket(TicketId, 1, type, Session.GetHabbo().Id, ReportedUser, Message, 0, "", SilverwaveEnvironment.GetUnixTimestamp() );
ok after you done that do you get a error in Help.cs
So replace
SilverwaveEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, Type, ReportedUser, Message);
to:
Code:
SilverwaveEnvironment.GetGame().GetModerationTool().SendNewTicket(Session, Type, ReportedUser, Message,7);
Ok lets go back to the moderationtool.cs
and add after:
Response.AppendString(Preset); }
this:
Code:
using (IQueryAdapter dbClient = SilverwaveEnvironment.GetDatabaseManager().getQueryreactor())
{
dbClient.setQuery("SELECT * from moderation_templates where category = '1' ");
DataTable PII = dbClient.getTable();
dbClient.setQuery("SELECT * from moderation_templates where category = '2' ");
DataTable sex = dbClient.getTable();
Response.AppendInt32(2);
Response.AppendString("PII");
Response.AppendBoolean(true);
Response.AppendInt32(PII.Rows.Count); //array count
foreach (DataRow PIIRow in PII.Rows)
{
Response.AppendString(Convert.ToString(PIIRow["name"])); //type
Response.AppendString(Convert.ToString(PIIRow["banmessage"])); //ban message
Response.AppendInt32(Convert.ToInt32(PIIRow["Banhours"]));
Response.AppendInt32(Convert.ToInt32(PIIRow["AvatarBan"]));
Response.AppendInt32(Convert.ToInt32(PIIRow["Mute"]));
Response.AppendInt32(Convert.ToInt32(PIIRow["TradeLock"]));/// REMOVE THIS LINE IF YOUR NOT USING THE NEW_UI
Response.AppendString(Convert.ToString(PIIRow["Warningmessage"])); // warning message
}
Response.AppendString("Sexually Explicit");
Response.AppendBoolean(false);
Response.AppendInt32(sex.Rows.Count); //array count
foreach (DataRow Sex in sex.Rows)
{
Response.AppendString(Convert.ToString(Sex["name"])); //type
Response.AppendString(Convert.ToString(Sex["banmessage"])); //ban message
Response.AppendInt32(Convert.ToInt32(Sex["Banhours"]));
Response.AppendInt32(Convert.ToInt32(Sex["AvatarBan"]));
Response.AppendInt32(Convert.ToInt32(Sex["Mute"]));
Response.AppendInt32(Convert.ToInt32(Sex["TradeLock"])); /// REMOVE THIS LINE IF YOUR NOT USING THE NEW_UI
Response.AppendString(Convert.ToString(Sex["Warningmessage"])); // warning message
}
}
The sql is at the end of the theard :$
So lets add the triggers.
go to RoomUser.cs and search:
if (LanguageLocale.CheckForBannedPhrases(Message) && GetClient().GetHabbo().Rank < 4)
and add after that:
Code:
if (LanguageLocale.CheckSpaceLetterSequence(Message) && !GetClient().GetHabbo().AutomaticAlertSended)
{
SilverwaveEnvironment.GetGame().GetModerationTool().SendNewTicket(GetClient(), 3, GetClient().GetHabbo().Id, Message + " - Letter space letter", 4);
}
if (LanguageLocale.CheckForModAlert(Message) && GetClient().GetHabbo().Rank < 4 && !GetClient().GetHabbo().AutomaticAlertSended)
{
GetClient().GetHabbo().AlertFilterCount++;
if (GetClient().GetHabbo().AlertFilterCount >= Convert.ToInt32(SilverwaveEnvironment.GetDBConfig().DBData["AlertFilter.limit"]))
{
if (GetClient() != null && !string.IsNullOrWhiteSpace(Message))
{
try
{
GetClient().GetHabbo().AutomaticAlertSended = true;
GetClient().GetHabbo().AlertFilterCount = 0;
SilverwaveEnvironment.GetGame().GetModerationTool().SendNewTicket(GetClient(), 3, GetClient().GetHabbo().Id, Message + " - AutomaticAlertWord", 4);
}
catch (Exception e) { Console.WriteLine(e); }
}
}
}
Ok you get now 2 errors so go to Habbo.cs and search
internal int BannedPhraseCount;
and add after it:
Code:
internal int AlertFilterCount;
internal bool AutomaticAlertSended;
Ok the last thing what you need to do is adding moderation_templates to your database:
Code:
DROP TABLE IF EXISTS `moderation_templates`;
CREATE TABLE `moderation_templates` (
`Name` varchar(100) DEFAULT NULL,
`Banmessage` varchar(100) DEFAULT NULL,
`Banhours` int(30) DEFAULT NULL,
`AvatarBan` int(30) DEFAULT NULL,
`Mute` int(30) DEFAULT NULL,
`TradeLock` int(30) DEFAULT NULL,
`Warningmessage` varchar(30) DEFAULT NULL,
`category` int(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `moderation_templates` VALUES ('1 day ban', 'You got banned', '24', '0', '0', '0', 'You got banned', '1');
And you are done :D
------------------ UPDATED ---------------------------------------------------
sorry forgot something go to supportTicket.cs and add at the start of the class:
Code:
using System.Drawing;
And i forgot to remove this line:
Response.AppendInt32(0); // Thing presets
Here is a screen:
http://i.imgur.com/giTonc6.png
forgot this sql:
Code:
INSERT INTO `server_settings` (`variable`, `value`, `description`) VALUES ('AlertFilter.limit', '4', 'Automatic alert filter :)');
http://forum.ragezone.com/dbtech/tha...ages/likes.png and http://forum.ragezone.com/images/sty...tation-40b.png buttons are there to be clicked
-
Re: Automatic alert For all r63B emuloators ;p
-
Re: Automatic alert For all r63B emuloators ;p
-
Re: Automatic alert For all r63B emuloators ;p
Awesome Fix thank you very much! :)
-
Re: Automatic alert For all r63B emuloators ;p
i got error in supportticket.cs in line 193, the point is wrong or something.. help please
-
Re: Automatic alert For all r63B emuloators ;p
-
Re: Automatic alert For all r63B emuloators ;p
Quote:
Originally Posted by
HotelMaker
i got error in supportticket.cs in line 193, the point is wrong or something.. help please
Updated the theard xd
-
Re: Automatic alert For all r63B emuloators ;p
Does this work for Plus R1?
-
Re: Automatic alert For all r63B emuloators ;p
Quote:
Originally Posted by
Receiver
Does this work for Plus R1?
No, Swfs are not updated for that.
-
Re: Automatic alert For all r63B emuloators ;p
Quote:
Originally Posted by
maartenvn
No, Swfs are not updated for that.
What is this Automatic Alert even used for?
-
Re: Automatic alert For all r63B emuloators ;p
Quote:
Originally Posted by
maartenvn
No, Swfs are not updated for that.
Do you know how to update swfs for Plus R1?
Quote:
Originally Posted by
Receiver
What is this Automatic Alert even used for?
If a user says a word that is in the wordfilter that you have selected 1 for automatic alert it will send a CFH to the moderators. Id add words like Fresh or Tardis ETC For if someone is advertising.
-
Re: Automatic alert For all r63B emuloators ;p
Does it works with plus r5? I can't see the Automatic alert.
-
Re: Automatic alert For all r63B emuloators ;p
bug update: If you say h o t e l with an normal user and dc it and go in with your *staff* character you dont can get in for you got an ticket.... I get dc out after i make it.... need fix please?
-
Re: Automatic alert For all r63B emuloators ;p
Can't show automatic alert also with revision 5, any fixes?
-
Re: Automatic alert For all r63B emuloators ;p
Quote:
Originally Posted by
Evansino
Can't show automatic alert also with revision 5, any fixes?
Yeah its possible but you need to esit some codes more . but you can pm me your skype if its to hard
-
Re: Automatic alert For all r63B emuloators ;p
I've did this tut 8 times, not working. Also spaced letter wordfilter replace don't work.
-
Re: Automatic alert For all r63B emuloators ;p
-
Re: Automatic alert For all r63B emuloators ;p
Yeah, it works but there's a wrong way to cache the chatlogs and they don't display in the automatic alert. I hope someone that someone can post a fix.
-
Re: Automatic alert For all r63B emuloators ;p
Yep, have a little glitch in their code.
In the <string> Autofilter, if have in the picked ticket only numbers, give a little disconnect.
Can change to Convert.ToChar(...)? Tried but no really sucefully.
I tried to put
Autofilter = Convert.ToString(@new List);
Worked fine.
-
Re: Automatic alert For all r63B emuloators ;p
Quote:
Originally Posted by
Claudi0
Yep, have a little glitch in their code.
In the <string> Autofilter, if have in the picked ticket only numbers, give a little disconnect.
Can change to Convert.ToChar(...)? Tried but no really sucefully.
I tried to put
Autofilter = Convert.ToString(@new List);
Worked fine.
Lol the code that i released worked fine for me so idk... And for others..
-
Re: Automatic alert For all r63B emuloators ;p
Here too but if the message is only composed by numbers have a error, remember different of php the c# doesn't make automatically the conversion of types! putting that I say explicit to he convert to a string. Only with <string> says is a string type.
-
Re: Automatic alert For all r63B emuloators ;p
http://i.imgur.com/LIq90m6.png
Make it so after clicking something it doesnt send the alert:
http://i.imgur.com/kNMTjJg.png
Also,
Follow me on facebook for my development in retros: http://on.fb.me/1gULJcN
-
Re: Automatic alert For all r63B emuloators ;p
Woops indeed forgot to give a fix for that :P
Open ModerationTool.cs and search:
internal void CloseTicket(GameClient Session, uint TicketId, int Result)
and just edit this line:
Code:
if (Client != null)
to:
Code:
Client != null && (Ticket.Type != 3 && Ticket.Type != 4)
-
Re: Automatic alert For all r63B emuloators ;p
Oke this is freaking wierd..
Why its working by everyone.. lol
I got all the time that i can't talk in te client..
Can someone make i screen or something to help me where i set that filter wrong..
-
Re: Automatic alert For all r63B emuloators ;p
Yeah, it works but there's a wrong way to cache the chatlogs and they don't display immediatly the chatlog of the automatic alert. I hope someone that someone can post a fix.