#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
42
Scripts/Engines/MLQuests/QuesterNameAttribute.cs
Normal file
42
Scripts/Engines/MLQuests/QuesterNameAttribute.cs
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.MLQuests
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class QuesterNameAttribute : Attribute
|
||||
{
|
||||
private string m_QuesterName;
|
||||
|
||||
public string QuesterName { get { return m_QuesterName; } }
|
||||
|
||||
public QuesterNameAttribute( string questerName )
|
||||
{
|
||||
m_QuesterName = questerName;
|
||||
}
|
||||
|
||||
private static readonly Type m_Type = typeof( QuesterNameAttribute );
|
||||
private static readonly Dictionary<Type, string> m_Cache = new Dictionary<Type, string>();
|
||||
|
||||
public static string GetQuesterNameFor( Type t )
|
||||
{
|
||||
if ( t == null )
|
||||
return "";
|
||||
|
||||
string result;
|
||||
|
||||
if ( m_Cache.TryGetValue( t, out result ) )
|
||||
return result;
|
||||
|
||||
object[] attributes = t.GetCustomAttributes( m_Type, false );
|
||||
|
||||
if ( attributes.Length != 0 )
|
||||
result = ( (QuesterNameAttribute)attributes[0] ).QuesterName;
|
||||
else
|
||||
result = t.Name;
|
||||
|
||||
return ( m_Cache[t] = result );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue