fix: Cleans up core code (#1187)

**Only one functional change**
* Fixes a bug in LogFactory where `Warning` is being logged as `Information`

Non-functional changes:
* Updates/Fixes copyright headers
* Removes namespace scopes for core files.

View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
This commit is contained in:
Kamron Batman 2022-10-10 21:47:08 -07:00 committed by GitHub
parent 0138d40bda
commit f268d5d4e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
262 changed files with 28527 additions and 28646 deletions

View file

@ -1,80 +1,79 @@
using System;
using System.Collections.Generic;
namespace Server
namespace Server;
[Parsable]
public abstract class Poison
{
[Parsable]
public abstract class Poison
/*public abstract TimeSpan Interval{ get; }
public abstract TimeSpan Duration{ get; }*/
public abstract string Name { get; }
public abstract int Level { get; }
public static Poison Lesser => GetPoison("Lesser");
public static Poison Regular => GetPoison("Regular");
public static Poison Greater => GetPoison("Greater");
public static Poison Deadly => GetPoison("Deadly");
public static Poison Lethal => GetPoison("Lethal");
public static List<Poison> Poisons { get; } = new();
public abstract Timer ConstructTimer(Mobile m);
/*public abstract void OnDamage( Mobile m, ref object state );*/
public override string ToString() => Name;
public static void Register(Poison reg)
{
/*public abstract TimeSpan Interval{ get; }
public abstract TimeSpan Duration{ get; }*/
public abstract string Name { get; }
public abstract int Level { get; }
var regName = reg.Name.ToLower();
public static Poison Lesser => GetPoison("Lesser");
public static Poison Regular => GetPoison("Regular");
public static Poison Greater => GetPoison("Greater");
public static Poison Deadly => GetPoison("Deadly");
public static Poison Lethal => GetPoison("Lethal");
public static List<Poison> Poisons { get; } = new();
public abstract Timer ConstructTimer(Mobile m);
/*public abstract void OnDamage( Mobile m, ref object state );*/
public override string ToString() => Name;
public static void Register(Poison reg)
for (var i = 0; i < Poisons.Count; i++)
{
var regName = reg.Name.ToLower();
for (var i = 0; i < Poisons.Count; i++)
if (reg.Level == Poisons[i].Level)
{
if (reg.Level == Poisons[i].Level)
{
throw new Exception("A poison with that level already exists.");
}
if (regName == Poisons[i].Name.ToLower())
{
throw new Exception("A poison with that name already exists.");
}
throw new Exception("A poison with that level already exists.");
}
Poisons.Add(reg);
}
public static Poison Parse(string value) =>
(int.TryParse(value, out var plevel) ? GetPoison(plevel) : null) ?? GetPoison(value);
public static Poison GetPoison(int level)
{
for (var i = 0; i < Poisons.Count; ++i)
if (regName == Poisons[i].Name.ToLower())
{
var p = Poisons[i];
if (p.Level == level)
{
return p;
}
throw new Exception("A poison with that name already exists.");
}
return null;
}
public static Poison GetPoison(string name)
Poisons.Add(reg);
}
public static Poison Parse(string value) =>
(int.TryParse(value, out var plevel) ? GetPoison(plevel) : null) ?? GetPoison(value);
public static Poison GetPoison(int level)
{
for (var i = 0; i < Poisons.Count; ++i)
{
for (var i = 0; i < Poisons.Count; ++i)
var p = Poisons[i];
if (p.Level == level)
{
var p = Poisons[i];
if (Utility.InsensitiveCompare(p.Name, name) == 0)
{
return p;
}
return p;
}
return null;
}
return null;
}
public static Poison GetPoison(string name)
{
for (var i = 0; i < Poisons.Count; ++i)
{
var p = Poisons[i];
if (Utility.InsensitiveCompare(p.Name, name) == 0)
{
return p;
}
}
return null;
}
}