Пример #1
0
        /// <summary>
        /// Initialize static items.
        /// </summary>
        internal static void Load()
        {
            if (MarketGroups != null)
            {
                return;
            }

            // Create the implants slots
            for (int i = 0; i < s_implantSlots.Length; i++)
            {
                s_implantSlots[i] = new ImplantCollection((ImplantSlots)i);
            }

            // Deserialize the items datafile
            ItemsDatafile datafile = Util.DeserializeDatafile <ItemsDatafile>(DatafileConstants.ItemsDatafile,
                                                                              Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            MarketGroups = new MarketGroupCollection(null, datafile.MarketGroups);

            // Gather the items into a by-ID dictionary
            foreach (MarketGroup marketGroup in MarketGroups)
            {
                InitializeDictionaries(marketGroup);
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #2
0
        /// <summary>
        /// Initialize static skills.
        /// </summary>
        internal static void Load()
        {
            SkillsDatafile datafile = Util.DeserializeDatafile <SkillsDatafile>(DatafileConstants.SkillsDatafile,
                                                                                Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            // Fetch deserialized data
            s_arrayIndicesCount = 0;
            List <Collection <SerializableSkillPrerequisite> > prereqs = new List <Collection <SerializableSkillPrerequisite> >();

            foreach (SerializableSkillGroup srcGroup in datafile.SkillGroups)
            {
                StaticSkillGroup group = new StaticSkillGroup(srcGroup, ref s_arrayIndicesCount);
                s_skillGroupsByID[@group.ID] = @group;

                // Store skills
                foreach (StaticSkill skill in @group)
                {
                    s_skillsByID[skill.ID]     = skill;
                    s_skillsByName[skill.Name] = skill;
                }

                // Store prereqs
                prereqs.AddRange(srcGroup.Skills.Select(serialSkill => serialSkill.SkillPrerequisites));
            }

            // Complete initialization
            s_skills = new StaticSkill[s_arrayIndicesCount];
            foreach (StaticSkill staticSkill in s_skillsByID.Values)
            {
                staticSkill.CompleteInitialization(prereqs[staticSkill.ArrayIndex]);
                s_skills[staticSkill.ArrayIndex] = staticSkill;
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #3
0
        /// <summary>
        /// Initialize static certificates.
        /// </summary>
        internal static void Load()
        {
            CertificatesDatafile datafile = Util.DeserializeDatafile <CertificatesDatafile>(DatafileConstants.CertificatesDatafile,
                                                                                            Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            AllGroups = new Collection <StaticCertificateGroup>();

            foreach (SerializableCertificateGroup srcGroup in datafile.Groups)
            {
                AllGroups.Add(new StaticCertificateGroup(srcGroup));
            }

            // Build inner collections
            foreach (StaticCertificateClass certClass in AllGroups.SelectMany(certClass => certClass))
            {
                s_classesByName[certClass.Name] = certClass;
                s_certificatesByID[certClass.Certificate.ID] = certClass.Certificate;
            }

            // Completes intialization
            foreach (SerializableCertificateClass srcClass in datafile.Groups.SelectMany(srcGroup => srcGroup.Classes))
            {
                s_classesByName[srcClass.Name].Certificate.CompleteInitialization(srcClass.Certificate.Prerequisites);
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #4
0
        /// <summary>
        /// Initialize static geography.
        /// </summary>
        internal static void Load()
        {
            GeoDatafile datafile = LoadGeoData();

            LoadFactions();

            CompleteInitialization(datafile);

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #5
0
        /// <summary>
        /// Initialize static reprocssing information.
        /// </summary>
        internal static void Load()
        {
            ReprocessingDatafile datafile = Util.DeserializeDatafile <ReprocessingDatafile>(
                DatafileConstants.ReprocessingDatafile, Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            foreach (SerializableItemMaterials item in datafile.Items)
            {
                MaterialCollection materials = new MaterialCollection(item.Materials.Select(itemMaterial => new Material(itemMaterial)).ToList());
                s_itemMaterialsByID[item.ID] = materials;
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #6
0
        /// <summary>
        /// Initialize static masteries.
        /// </summary>
        internal static void Load()
        {
            MasteriesDatafile datafile = Util.DeserializeDatafile <MasteriesDatafile>(
                DatafileConstants.MasteriesDatafile);

            foreach (SerializableMasteryShip srcShip in datafile.MasteryShips)
            {
                Ship ship = StaticItems.GetItemByID(srcShip.ID) as Ship;
                if (ship != null)
                {
                    s_masteryShipsByID[ship.ID] = new MasteryShip(srcShip, ship);
                }
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #7
0
        /// <summary>
        /// Initialize static blueprints.
        /// </summary>
        internal static void Load()
        {
            if (BlueprintMarketGroups != null)
            {
                return;
            }

            BlueprintsDatafile datafile = Util.DeserializeDatafile <BlueprintsDatafile>(DatafileConstants.BlueprintsDatafile,
                                                                                        Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            BlueprintMarketGroups = new BlueprintMarketGroupCollection(null, datafile.MarketGroups);

            foreach (BlueprintMarketGroup srcGroup in BlueprintMarketGroups)
            {
                InitializeDictionaries(srcGroup);
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #8
0
        /// <summary>
        /// Initialize static geography.
        /// </summary>
        internal static void Load()
        {
            GeoDatafile datafile = Util.DeserializeDatafile <GeoDatafile>(DatafileConstants.GeographyDatafile,
                                                                          Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            // Generate the nodes
            foreach (SerializableRegion srcRegion in datafile.Regions)
            {
                Region region = new Region(srcRegion);
                s_regionsByID[srcRegion.ID] = region;

                // Store the children into their dictionaries
                foreach (Constellation constellation in region)
                {
                    s_constellationsByID[constellation.ID] = constellation;

                    foreach (SolarSystem solarSystem in constellation)
                    {
                        s_solarSystemsByID[solarSystem.ID] = solarSystem;

                        foreach (Station station in solarSystem)
                        {
                            s_stationsByID[station.ID] = station;

                            s_corporationsByID[station.CorporationID] = new NPCCorporation(station);

                            foreach (Agent agent in station)
                            {
                                s_agentsByID[agent.ID] = agent;
                            }
                        }
                    }
                }
            }

            CompleteInitialization(datafile);

            GlobalDatafileCollection.OnDatafileLoaded();
        }
Пример #9
0
        /// <summary>
        /// Initialize static properties.
        /// </summary>
        internal static void Load()
        {
            PropertiesDatafile datafile =
                Util.DeserializeDatafile <PropertiesDatafile>(DatafileConstants.PropertiesDatafile,
                                                              Util.LoadXslt(Properties.Resources.DatafilesXSLT));

            // Fetch deserialized data
            foreach (EvePropertyCategory category in datafile.Categories.Select(
                         srcCategory => new EvePropertyCategory(srcCategory)))
            {
                s_categoriesByID[category.ID]     = category;
                s_categoriesByName[category.Name] = category;

                // Store properties
                foreach (EveProperty property in category)
                {
                    s_propertiesByID[property.ID]     = property;
                    s_propertiesByName[property.Name] = property;
                }
            }

            // Set visibility in ships browser
            foreach (int propertyID in DBConstants.AlwaysVisibleForShipPropertyIDs.Where(
                         propertyID => s_propertiesByID.ContainsKey(propertyID)))
            {
                s_propertiesByID[propertyID].AlwaysVisibleForShips = true;
            }

            // Set hide if default for properties
            // we want to hide in browser if they just show their default value
            foreach (int propertyID in DBConstants.HideIfDefaultPropertyIDs.Where(
                         propertyID => s_propertiesByID.ContainsKey(propertyID)))
            {
                s_propertiesByID[propertyID].HideIfDefault = true;
            }

            GlobalDatafileCollection.OnDatafileLoaded();
        }