/*
* Date: 24.08.2004
* Time: 14:00
* Not: hakaret.txt ç ş ı gibi türkçe harfleri görmüyor.
*
*/
using System;
using System.Text;
using System.IO;
using Server;
using Server.Accounting;
using System.Collections;
using Server.Mobiles;
using Server.Network;
using Server.Items;
namespace Rugzo.Hakaret
{
public class Kontrol
{
public static string RHS="Curse System";
private static ArrayList m_Lines = new ArrayList();
private static string path = "Data/hakaret.txt";
public static void Initialize()
{
EventSink.Speech += new SpeechEventHandler( EventSink_Speech );
if ( File.Exists( path ) )
{
using ( StreamReader ip = new StreamReader( path ) )
{
string line;
while ( (line = ip.ReadLine()) != null )
{
if ( line.Length > 0 )
m_Lines.Add( line );
}
}
}
if ( m_Lines.Count == 0 )
{
Console.WriteLine("Hakaret.cs - data dosyası (hakaret.txt) bulunamadı.");
}
}
public static void EventSink_Speech( SpeechEventArgs args )
{
if ((((Account)args.Mobile.Account).AccessLevel < AccessLevel.Counselor) && (args.Mobile.Squelched == false))
{
string s = args.Speech.ToLower();
string sep = " ";
char[] a = sep.ToCharArray();
PlayerMobile pm = args.Mobile as PlayerMobile;
foreach( string str in s.Split( a ) )
{
if( m_Lines.Contains( str ) )
{
((Account)pm.Account).Comments.Add(new AccountComment(Kontrol.RHS, DateTime.Now + " tarihinde '" + s + "' dediği için squelch almıştır."));
pm.Squelched = true;
pm.Say("*Kufur Size Yakismiyor!*");
HakaretKitabi kitab = new HakaretKitabi();
kitab.RHSKufur = s;
pm.AddToBackpack( kitab );
pm.SendMessage(0x25, "Lutfen Sayginizi Takinin..");
pm.SendMessage(0x25, "Yeniden konusabilmek icin cantanizdaki kitaba tiklayin.");
}
}
}
}
}
}