/// <summary>
		/// Constructs a new Style object based on a database Style object
		/// </summary>
		/// <param name="style">The database style object this object is based on</param>
		public Style(DBStyle style)
			: base(style.Name, style.ID, (ushort)style.Icon, style.SpecLevelRequirement, style.StyleID)
		{
			baseStyle = style;
		}
Exemple #2
0
		/// <summary>
		/// Add a new style to a specialization.  If the specialization does not exist it will be created.
		/// After adding all styles call SortStyles to sort the list by level
		/// </summary>
		/// <param name="style"></param>
		public static void AddScriptedStyle(Specialization spec, DBStyle style)
		{
			m_syncLockUpdates.EnterWriteLock();
			try
			{
				if (!m_specsStyles.ContainsKey(spec.KeyName))
					m_specsStyles.Add(spec.KeyName, new Dictionary<int, List<Tuple<Style, byte>>>());
				
				if (!m_specsStyles[spec.KeyName].ContainsKey(style.ClassId))
					m_specsStyles[spec.KeyName].Add(style.ClassId, new List<Tuple<Style, byte>>());
			
				Style st = new Style(style);
				
				m_specsStyles[spec.KeyName][style.ClassId].Add(new Tuple<Style, byte>(st, (byte)style.SpecLevelRequirement));
	
				KeyValuePair<int, int> styleKey = new KeyValuePair<int, int>(st.ID, style.ClassId);
				if (!m_styleIndex.ContainsKey(styleKey))
					m_styleIndex.Add(styleKey, st);
	
				if (!m_specsByName.ContainsKey(spec.KeyName))
					RegisterSpec(spec);
			}
			finally
			{
				m_syncLockUpdates.ExitWriteLock();
			}
		}
Exemple #3
0
		/// <summary>
		/// Constructs a new Style object based on a database Style object
		/// </summary>
		/// <param name="style">The database style object this object is based on</param>
		public Style(DBStyle style)
			: base(style.Name, (ushort)style.ID, style.SpecLevelRequirement)
		{
			baseStyle = style;
			m_Procs = new List<DBStyleXSpell>();
		}
Exemple #4
0
		/// <summary>
		/// Add a new style to a specialization.  If the specialization does not exist it will be created.
		/// After adding all styles call SortStyles to sort the list by level
		/// </summary>
		/// <param name="style"></param>
		public static void AddScriptedStyle(Specialization spec, DBStyle style)
		{
			string hashKey = string.Format("{0}|{1}", style.SpecKeyName, style.ClassId);
			List<Style> styleList;
			if (!m_styleLists.TryGetValue(hashKey, out styleList))
			{
				styleList = new List<Style>();
				m_styleLists.Add(hashKey, styleList);
			}

			Style st = new Style(style);

			//(procs) Add procs to the style, 0 is used for normal style
			if (m_styleSpells.ContainsKey(st.ID))
			{
				// now we add every proc to the style (even if ClassID != 0)
				foreach (byte classID in Enum.GetValues(typeof(eCharacterClass)))
				{
					if (m_styleSpells[st.ID].ContainsKey(classID))
					{
						foreach (DBStyleXSpell styleSpells in m_styleSpells[st.ID][classID])
							st.Procs.Add(styleSpells);
					}
				}
			}
			styleList.Add(st);

			KeyValuePair<int, int> styleKey = new KeyValuePair<int, int>(st.ID, style.ClassId);
			if (!m_stylesByIDClass.ContainsKey(styleKey))
				m_stylesByIDClass.Add(styleKey, st);

			if (!m_specsByName.ContainsKey(spec.KeyName))
				RegisterSpec(spec);
		}