Beispiel #1
0
        public void RegisterOffense(CheatingOffense offense, string param)
        {
            var chrhardref = (MapleCharacter)m_chr.Target;

            if (chrhardref == null || !offense.Enabled)
            {
                return;
            }

            CheatingOffenseEntry entry;

            if (Offenses.TryGetValue(offense, out entry) && entry.IsExpired())
            {
                ExpireEntry(entry);
                entry = null;
            }
            if (entry == null)
            {
                entry = new CheatingOffenseEntry(offense, chrhardref);
            }
            if (param != null)
            {
                entry.Param = param;
            }
            entry.IncrementCount();
            if (offense.ShouldAutoban(entry.Count))
            {
                AutobanManager.Instance.Autoban(chrhardref.Client, nameof(offense));
            }

            if (Offenses.ContainsKey(offense))
            {
                Offenses[offense] = entry;
            }
            else
            {
                Offenses.Add(offense, entry);
            }

            CheatingOffensePersister.Instance.PersistEntry(entry);
        }
Beispiel #2
0
 public CheatingOffenseEntry(CheatingOffense offense, MapleCharacter chrfor)
 {
     Offense         = offense;
     ToCharacter     = chrfor;
     m_mFirstOffense = DateTime.Now.GetTimeMilliseconds();
 }
Beispiel #3
0
 public void RegisterOffense(CheatingOffense offense)
 {
     RegisterOffense(offense, null);
 }