public override void OnLoad(ConfigNode node)
        {
            ConfigNode[] goldStrikeNodes     = GameDatabase.Instance.GetConfigNodes(kGoldStrikeDataNode);
            ConfigNode[] goldStrikeLodeNodes = node.GetNodes(kGoldStrikeLodeNode);
            ConfigNode[] asteroidsSearched   = node.GetNodes(kAsteroidsSearched);

            debugLog("OnLoad: there are " + goldStrikeNodes.Length + " GOLDSTRIKE items to load.");
            foreach (ConfigNode goldStrikeDataNode in goldStrikeNodes)
            {
                GoldStrikeData strikeData = new GoldStrikeData();
                strikeData.Load(goldStrikeDataNode);
                if (string.IsNullOrEmpty(strikeData.resourceName) == false)
                {
                    goldStrikeResources.Add(strikeData.resourceName, strikeData);
                }
            }

            debugLog("OnLoad: there are " + goldStrikeLodeNodes.Length + " GoldStrikeLode items to load.");
            foreach (ConfigNode goldStrikeLodeNode in goldStrikeLodeNodes)
            {
                GoldStrikeLode lode = new GoldStrikeLode();
                Dictionary <string, GoldStrikeLode> lodeMap = null;
                string planetBiomeKey, lodeKey;

                lode.Load(goldStrikeLodeNode);
                planetBiomeKey = lode.planetID.ToString() + lode.biome;

                if (goldStrikeLodes.ContainsKey(planetBiomeKey) == false)
                {
                    lodeMap = new Dictionary <string, GoldStrikeLode>();
                    goldStrikeLodes.Add(planetBiomeKey, lodeMap);
                }
                lodeMap = goldStrikeLodes[planetBiomeKey];

                //Add the new lode
                lodeKey = lode.longitude.ToString() + lode.lattitude.ToString() + lode.resourceName;
                lodeMap.Add(lodeKey, lode);
            }

            debugLog("OnLoad: there are " + asteroidsSearched.Length + " asteroids that have been prospected.");
            foreach (ConfigNode asteroidNode in asteroidsSearched)
            {
                prospectedAsteroids.Add(asteroidNode.GetValue(kName));
            }
        }
示例#2
0
        protected void loadGoldStrokeLodes(ConfigNode[] goldStrikeLodeNodes)
        {
            debugLog("OnLoad: there are " + goldStrikeLodeNodes.Length + " GoldStrikeLode items to load.");
            foreach (ConfigNode goldStrikeLodeNode in goldStrikeLodeNodes)
            {
                GoldStrikeLode lode = new GoldStrikeLode();
                Dictionary <string, GoldStrikeLode> lodeMap = null;
                string planetBiomeKey, lodeKey;

                lode.Load(goldStrikeLodeNode);
                planetBiomeKey = lode.planetID.ToString() + lode.biome;

                if (goldStrikeLodes.ContainsKey(planetBiomeKey) == false)
                {
                    lodeMap = new Dictionary <string, GoldStrikeLode>();
                    goldStrikeLodes.Add(planetBiomeKey, lodeMap);
                }
                lodeMap = goldStrikeLodes[planetBiomeKey];

                //Add the new lode
                lodeKey = lode.longitude.ToString() + lode.lattitude.ToString() + lode.resourceName;
                lodeMap.Add(lodeKey, lode);
            }
        }
示例#3
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[]     efficiencyNodes     = node.GetNodes(kEfficiencyData);
            ConfigNode[]     toolTipsShown       = node.GetNodes(kToolTip);
            ConfigNode[]     goldStrikeNodes     = GameDatabase.Instance.GetConfigNodes(kGoldStrikeDataNode);
            ConfigNode[]     goldStrikeLodeNodes = node.GetNodes(kGoldStrikeLodeNode);
            ConfigNode[]     strikeChances       = node.GetNodes(kGoldStrikeChance);
            string           value  = node.GetValue(kReputationIndex);
            GoldStrikeChance chance = null;

            if (string.IsNullOrEmpty(value) == false)
            {
                reputationIndex = int.Parse(value);
            }

            debugLog("OnLoad: there are " + goldStrikeNodes.Length + " GOLDSTRIKE items to load.");
            foreach (ConfigNode goldStrikeDataNode in goldStrikeNodes)
            {
                GoldStrikeData strikeData = new GoldStrikeData();
                strikeData.Load(goldStrikeDataNode);
                if (string.IsNullOrEmpty(strikeData.resourceName) == false)
                {
                    goldStrikeResources.Add(strikeData.resourceName, strikeData);
                }
            }

            debugLog("OnLoad: there are " + goldStrikeLodeNodes.Length + " GoldStrikeLode items to load.");
            foreach (ConfigNode goldStrikeLodeNode in goldStrikeLodeNodes)
            {
                GoldStrikeLode lode = new GoldStrikeLode();
                Dictionary <string, GoldStrikeLode> lodeMap = null;
                string planetBiomeKey, lodeKey;

                lode.Load(goldStrikeLodeNode);
                planetBiomeKey = lode.planetID.ToString() + lode.biome;

                if (goldStrikeLodes.ContainsKey(planetBiomeKey) == false)
                {
                    lodeMap = new Dictionary <string, GoldStrikeLode>();
                    goldStrikeLodes.Add(planetBiomeKey, lodeMap);
                }
                lodeMap = goldStrikeLodes[planetBiomeKey];

                //Add the new lode
                lodeKey = lode.longitude.ToString() + lode.lattitude.ToString() + lode.resourceName;
                lodeMap.Add(lodeKey, lode);
            }

            debugLog("OnLoad: there are " + strikeChances.Length + " GoldStrikeChance items to load.");
            foreach (ConfigNode chanceNode in strikeChances)
            {
                chance = new GoldStrikeChance();
                chance.Load(chanceNode);
                string planetBiomeKey = chance.planetID.ToString() + chance.biome;
                goldStrikeChances.Add(planetBiomeKey, chance);
            }

            foreach (ConfigNode efficiencyNode in efficiencyNodes)
            {
                EfficiencyData efficiencyData = new EfficiencyData();
                efficiencyData.Load(efficiencyNode);
                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }

            foreach (ConfigNode toolTipNode in toolTipsShown)
            {
                if (toolTipNode.HasValue(kName) == false)
                {
                    continue;
                }
                value = toolTipNode.GetValue(kName);

                if (toolTips.ContainsKey(value))
                {
                    toolTips[value] = toolTipNode;
                }
                else
                {
                    toolTips.Add(value, toolTipNode);
                }
            }
        }