private static string GetDescription(this NPCBelief value) { var fieldInfo = value.GetType().GetField(value.ToString()); var attributes = (DescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Any() ? attributes.First().Description : value.ToString()); }
/// <summary> /// Get the description attribute of an enum. /// </summary> internal static string Description(this NPCBelief belief) { return(BeliefDescriptionCache[belief]); }
/// <summary> /// Update the stored information to match what is passed here or add if it doesn't already exist /// </summary> internal void UpdateSingleBelief(NPCBelief name, object value = null, params object[] param) { UpdateSingleBelief(string.Format(name.Description(), param), value); }
/// <summary> /// Loaded stored information /// </summary> internal string LoadBelief(NPCBelief belief, params object[] param) { return(LoadBelief(string.Format(belief.Description(), param))); }