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));
            }
        }
Exemplo n.º 2
0
        public override void OnLoad(ConfigNode node)
        {
            ConfigNode[] goldStrikeDataNodes = GameDatabase.Instance.GetConfigNodes(kGoldStrikeDataNode);
            ConfigNode[] goldStrikeLodeNodes = node.GetNodes(kGoldStrikeLodeNode);
            ConfigNode[] asteroidsSearched   = node.GetNodes(kAsteroidsSearched);

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

            //Load our data
            loadGoldStrokeLodes(goldStrikeLodeNodes);
            loadAsteroidNodes(asteroidsSearched);

            //Backwards compatibility: Load from Pathfinder
            if (goldStrikeNodes != null)
            {
                ConfigNode[] nodes = null;
                if (goldStrikeNodes.ContainsKey(WBIGoldStrikeScenario.kGoldStrikeLodeNode))
                {
                    nodes = goldStrikeNodes[WBIGoldStrikeScenario.kGoldStrikeLodeNode];
                    loadGoldStrokeLodes(nodes);
                }

                if (goldStrikeNodes.ContainsKey(WBIGoldStrikeScenario.kAsteroidsSearched))
                {
                    nodes = goldStrikeNodes[WBIGoldStrikeScenario.kAsteroidsSearched];
                    loadAsteroidNodes(nodes);
                }

                //Cleanup
                goldStrikeNodes = null;
            }
        }
Exemplo n.º 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);
                }
            }
        }