public static void InitStarterEquipment()
        {
            m_cachedClassEquipment.Clear();

            // Init Startup Collection.
            foreach (var equipclass in GameServer.Database.SelectAllObjects <StarterEquipment>())
            {
                if (equipclass.Template != null)
                {
                    foreach (var classID in equipclass.Class.SplitCSV(true))
                    {
                        int cId;
                        if (int.TryParse(classID, out cId))
                        {
                            try
                            {
                                eCharacterClass gameClass = (eCharacterClass)cId;
                                if (!m_cachedClassEquipment.ContainsKey(gameClass))
                                {
                                    m_cachedClassEquipment.Add(gameClass, new List <ItemTemplate>());
                                }

                                m_cachedClassEquipment[gameClass].Add(equipclass.Template);
                            }
                            catch (Exception e)
                            {
                                if (log.IsWarnEnabled)
                                {
                                    log.WarnFormat(
                                        "Could not Add Starter Equipement for Record - ID: {0}, ClassID(s): {1}, Itemtemplate: {2}, while parsing {3}\n{4}",
                                        equipclass.StarterEquipmentID, equipclass.Class, equipclass.TemplateID, classID, e);
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (log.IsWarnEnabled)
                    {
                        log.WarnFormat("Cannot Find Item Template for Record - ID: {0}, ClassID(s): {1}, Itemtemplate: {2}", equipclass.StarterEquipmentID, equipclass.Class, equipclass.TemplateID);
                    }
                }
            }
        }
Exemplo n.º 2
0
		/// <summary>
		/// Create a hashtable containing all item templates that are valid for
		/// this class.
		/// </summary>
		/// <param name="artifactID"></param>
		/// <param name="charClass"></param>
		/// <param name="realm"></param>
		/// <returns></returns>
		public static Dictionary<String, ItemTemplate> GetArtifactVersions(String artifactID, eCharacterClass charClass, eRealm realm)
		{
			if (artifactID == null)
				return null;

			List<ArtifactXItem> allVersions = GetArtifactVersions(artifactID, realm);
			Dictionary<String, ItemTemplate> classVersions = new Dictionary<String, ItemTemplate>();

			lock (allVersions)
			{
				ItemTemplate itemTemplate;
				foreach (ArtifactXItem version in allVersions)
				{
					itemTemplate = GameServer.Database.FindObjectByKey<ItemTemplate>(version.ItemID);

					if (itemTemplate == null)
					{
						log.Warn(String.Format("Artifact item template '{0}' is missing", version.ItemID));
					}
					else
					{
						foreach (String classID in  itemTemplate.AllowedClasses.SplitCSV(true))
						{
							try
							{
								if (Int32.Parse(classID) == (int)charClass)
								{
									classVersions.Add(version.Version, itemTemplate);
									break;
								}
							}
							catch (Exception ex)
							{
								log.Error(String.Format("Invalid class ID '{0}' for item template '{1}', checked by class '{2}'", classID, itemTemplate.Id_nb, (int)charClass));
								log.Error(ex.Message);
							}
						}
					}
				}
			}

			return classVersions;
		}
        /// <summary>
        /// Create a hashtable containing all item templates that are valid for
        /// this class.
        /// </summary>
        /// <param name="artifactID"></param>
        /// <param name="charClass"></param>
        /// <param name="realm"></param>
        /// <returns></returns>
        public static Dictionary <String, ItemTemplate> GetArtifactVersions(String artifactID, eCharacterClass charClass, eRealm realm)
        {
            if (artifactID == null)
            {
                return(null);
            }

            List <ArtifactXItem> allVersions = GetArtifactVersions(artifactID, realm);
            Dictionary <String, ItemTemplate> classVersions = new Dictionary <String, ItemTemplate>();

            lock (allVersions)
            {
                ItemTemplate itemTemplate;
                foreach (ArtifactXItem version in allVersions)
                {
                    itemTemplate = GameServer.Database.FindObjectByKey <ItemTemplate>(version.ItemID);

                    if (itemTemplate == null)
                    {
                        log.Warn(String.Format("Artifact item template '{0}' is missing", version.ItemID));
                    }
                    else
                    {
                        foreach (String classID in  itemTemplate.AllowedClasses.SplitCSV(true))
                        {
                            try
                            {
                                if (Int32.Parse(classID) == (int)charClass)
                                {
                                    classVersions.Add(version.Version, itemTemplate);
                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                                log.Error(String.Format("Invalid class ID '{0}' for item template '{1}', checked by class '{2}'", classID, itemTemplate.Id_nb, (int)charClass));
                                log.Error(ex.Message);
                            }
                        }
                    }
                }
            }

            return(classVersions);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new QuestRequirement and does some basich compativilite checks for the parameters
 /// </summary>
 /// <param name="defaultNPC">Parent defaultNPC of this Requirement</param>
 /// <param name="n">First Requirement Variable, meaning depends on RequirementType</param>
 public ClassRequirement(GameNPC defaultNPC, eCharacterClass c, bool notThisClass)
     : this(defaultNPC, (int)c, notThisClass, eComparator.None)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a new QuestRequirement and does some basich compativilite checks for the parameters
 /// </summary>
 /// <param name="defaultNPC">Parent defaultNPC of this Requirement</param>
 /// <param name="n">First Requirement Variable, meaning depends on RequirementType</param>
 public ClassRequirement(GameNPC defaultNPC, eCharacterClass c)
     : this(defaultNPC, (int)c, true, eComparator.None)
 {
 }