ModernUO/Scripts/Engines/MLQuests/QuesterNameAttribute.cs
eos 71a9e054de - Modified the quest system to allow non-BaseCreature quest givers, now requires IQuestGiver.
- Added base quest giver items, both timed and untimed.
- Added BatteredBucket and Lost and Found quest.
- Moved quester 'friendly names' to a class attribute. If left unspecified, the type name is used.
- Misc quest corrections.
- The bag of sending will now reject nontransferable items.
- Fixed quest items generating error messages when StackWith was attempted on them. (StackWith is not supposed to produce feedback.)
- Quest items can now be dropped onto the player's backpack.
2013-02-24 00:31:44 +00:00

42 lines
1,006 B
C#

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 );
}
}
}