Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -12,66 +12,66 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public int Graphic { get; }
|
||||
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
public SmallBulkEntry(Type type, int number, int graphic)
|
||||
{
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries("Blacksmith", "weapons");
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithArmor => GetEntries( "Blacksmith", "armor" );
|
||||
public static SmallBulkEntry[] BlacksmithArmor => GetEntries("Blacksmith", "armor");
|
||||
|
||||
public static SmallBulkEntry[] TailorCloth => GetEntries( "Tailoring", "cloth" );
|
||||
public static SmallBulkEntry[] TailorCloth => GetEntries("Tailoring", "cloth");
|
||||
|
||||
public static SmallBulkEntry[] TailorLeather => GetEntries( "Tailoring", "leather" );
|
||||
public static SmallBulkEntry[] TailorLeather => GetEntries("Tailoring", "leather");
|
||||
|
||||
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
if ( m_Cache == null )
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
if (!m_Cache.TryGetValue(type, out Dictionary<string, SmallBulkEntry[]> table))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
if (!table.TryGetValue(name, out SmallBulkEntry[] entries))
|
||||
table[name] = entries = LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string type, string name ) => LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
|
||||
public static SmallBulkEntry[] LoadEntries(string type, string name) => LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string path )
|
||||
public static SmallBulkEntry[] LoadEntries(string path)
|
||||
{
|
||||
path = Path.Combine( Core.BaseDirectory, path );
|
||||
path = Path.Combine(Core.BaseDirectory, path);
|
||||
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
|
||||
if ( File.Exists( path ) )
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using StreamReader ip = new StreamReader( path );
|
||||
using StreamReader ip = new StreamReader(path);
|
||||
string line;
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if ( line.Length == 0 || line.StartsWith( "#" ) )
|
||||
if (line.Length == 0 || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string[] split = line.Split( '\t' );
|
||||
string[] split = line.Split('\t');
|
||||
|
||||
if ( split.Length >= 2 )
|
||||
if (split.Length >= 2)
|
||||
{
|
||||
Type type = AssemblyHandler.FindFirstTypeForName( split[0] );
|
||||
int graphic = Utility.ToInt32( split[split.Length - 1] );
|
||||
Type type = AssemblyHandler.FindFirstTypeForName(split[0]);
|
||||
int graphic = Utility.ToInt32(split[split.Length - 1]);
|
||||
|
||||
if ( type != null && graphic > 0 )
|
||||
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
|
||||
if (type != null && graphic > 0)
|
||||
list.Add(new SmallBulkEntry(type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic));
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue