public void SetEfficiencyData(int planetID, string biomeName, HarvestTypes harvestType, string modifierName, float modifierValue)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            //Create a new entry if needed.
            if (!efficiencyDataMap.ContainsKey(key))
            {
                createNewEfficencyEntry(planetID, biomeName, harvestType);
            }

            //If we already have the efficiency data then just update the value
            efficiencyData = efficiencyDataMap[key];
            if (efficiencyData.modifiers.ContainsKey(modifierName))
            {
                efficiencyData.modifiers[modifierName] = modifierValue;
            }
            else
            {
                efficiencyData.modifiers.Add(modifierName, modifierValue);
            }

            //Update interested parties
            if (onEfficiencyUpdate != null)
            {
                onEfficiencyUpdate(planetID, biomeName, harvestType, modifierName, modifierValue);
            }
        }
Esempio n. 2
0
        public float GetEfficiencyModifier(int planetID, string biomeName, HarvestTypes harvestType, string modifierName)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                if (efficiencyData.modifiers.ContainsKey(modifierName))
                {
                    return(efficiencyData.modifiers[modifierName]);
                }
                else
                {
                    return(1.0f);
                }
            }

            else
            {
                //Create a new entry.
                createNewEfficencyEntry(planetID, biomeName, harvestType);
            }

            return(1.0f);
        }
Esempio n. 3
0
        public void ResetEfficiencyData(int planetID, string biomeName, HarvestTypes harvestType)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                efficiencyData.efficiencyModifier = 1.0f;
                efficiencyData.attemptsRemaining  = kMaxCoreSamples;
            }

            else
            {
                //Create a new entry.
                efficiencyData                    = new EfficiencyData();
                efficiencyData.planetID           = planetID;
                efficiencyData.biomeName          = biomeName;
                efficiencyData.harvestType        = harvestType;
                efficiencyData.efficiencyModifier = 1.0f;
                efficiencyData.attemptsRemaining  = kMaxCoreSamples;

                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }
        }
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            ConfigNode[] toolTipsShown = node.GetNodes(kToolTip);
            string value = node.GetValue("reputationIndex");

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

            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("name") == false)
                    continue;
                value = toolTipNode.GetValue("name");

                if (toolTips.ContainsKey(value))
                    toolTips[value] = toolTipNode;
                else
                    toolTips.Add(value, toolTipNode);
            }
        }
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            ConfigNode[] toolTipsShown   = node.GetNodes(kToolTip);
            string       value           = node.GetValue(kReputationIndex);

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

            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);
                }
            }

            //Backwards compatibility for GoldStrike
            Dictionary <string, ConfigNode[]> goldStrikeNodes = new Dictionary <string, ConfigNode[]>();

            if (node.HasNode(WBIGoldStrikeScenario.kGoldStrikeLodeNode))
            {
                goldStrikeNodes.Add(WBIGoldStrikeScenario.kGoldStrikeLodeNode, node.GetNodes(WBIGoldStrikeScenario.kGoldStrikeLodeNode));
            }
            if (node.HasNode(WBIGoldStrikeScenario.kAsteroidsSearched))
            {
                goldStrikeNodes.Add(WBIGoldStrikeScenario.kAsteroidsSearched, node.GetNodes(WBIGoldStrikeScenario.kAsteroidsSearched));
            }
            if (node.HasNode(WBIGoldStrikeScenario.kAsteroidNodeName))
            {
                goldStrikeNodes.Add(WBIGoldStrikeScenario.kAsteroidNodeName, node.GetNodes(WBIGoldStrikeScenario.kAsteroidNodeName));
            }
            if (goldStrikeNodes.Keys.Count > 0)
            {
                WBIGoldStrikeScenario.goldStrikeNodes = goldStrikeNodes;
            }
        }
Esempio n. 6
0
        public void SetCoreSamplesRemaining(int planetID, string biomeName, HarvestTypes harvestType, int attemptsRemaining)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                efficiencyData.attemptsRemaining = attemptsRemaining;
            }
        }
        protected void createNewEfficencyEntry(int planetID, string biomeName, HarvestTypes harvestType)
        {
            EfficiencyData efficiencyData = new EfficiencyData();

            efficiencyData.planetID          = planetID;
            efficiencyData.biomeName         = biomeName;
            efficiencyData.harvestType       = harvestType;
            efficiencyData.attemptsRemaining = kMaxCoreSamples;

            //Standard modifiers
            efficiencyData.modifiers.Add(EfficiencyData.kExtractionMod, 1.0f);
            efficiencyData.modifiers.Add(EfficiencyData.kIndustryMod, 1.0f);
            efficiencyData.modifiers.Add(EfficiencyData.kHabitationMod, 1.0f);
            efficiencyData.modifiers.Add(EfficiencyData.kScienceMod, 1.0f);

            efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
        }
        public void ResetEfficiencyData(int planetID, string biomeName, HarvestTypes harvestType)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            //Create a new entry if needed.
            if (!efficiencyDataMap.ContainsKey(key))
            {
                createNewEfficencyEntry(planetID, biomeName, harvestType);
            }

            efficiencyData = efficiencyDataMap[key];
            foreach (string modifierKey in efficiencyData.modifiers.Keys)
            {
                efficiencyData.modifiers[modifierKey] = 1.0f;
            }
            efficiencyData.attemptsRemaining = kMaxCoreSamples;
        }
        public int GetCoreSamplesRemaining(int planetID, string biomeName, HarvestTypes harvestType)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                return(efficiencyData.attemptsRemaining);
            }

            else
            {
                //Create a new entry.
                createNewEfficencyEntry(planetID, biomeName, harvestType);
            }

            return(kMaxCoreSamples);
        }
Esempio n. 10
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            string value = node.GetValue("reputationIndex");

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

            value = node.GetValue("drillToolTipShown");
            if (string.IsNullOrEmpty(value) == false)
                drillToolTipShown = bool.Parse(value);

            foreach (ConfigNode efficiencyNode in efficiencyNodes)
            {
                EfficiencyData efficiencyData = new EfficiencyData();
                efficiencyData.Load(efficiencyNode);
                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }
        }
Esempio n. 11
0
        public void SetEfficiencyData(int planetID, string biomeName, HarvestTypes harvestType, float efficiencyModifier)
        {
            string         key            = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            //If we already have the efficiency data then just update the value
            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                efficiencyData.efficiencyModifier = efficiencyModifier;
                return;
            }

            //Create a new entry.
            efficiencyData                    = new EfficiencyData();
            efficiencyData.planetID           = planetID;
            efficiencyData.biomeName          = biomeName;
            efficiencyData.harvestType        = harvestType;
            efficiencyData.efficiencyModifier = efficiencyModifier;
            efficiencyData.attemptsRemaining  = kMaxCoreSamples;

            efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
        }
Esempio n. 12
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            ConfigNode[] toolTipsShown   = node.GetNodes(kToolTip);
            string       value           = node.GetValue("reputationIndex");

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

            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("name") == false)
                {
                    continue;
                }
                value = toolTipNode.GetValue("name");

                if (toolTips.ContainsKey(value))
                {
                    toolTips[value] = toolTipNode;
                }
                else
                {
                    toolTips.Add(value, toolTipNode);
                }
            }
        }
Esempio n. 13
0
        public override void OnLoad(ConfigNode node)
        {
            base.OnLoad(node);
            ConfigNode[] efficiencyNodes = node.GetNodes(kEfficiencyData);
            string       value           = node.GetValue("reputationIndex");

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

            value = node.GetValue("drillToolTipShown");
            if (string.IsNullOrEmpty(value) == false)
            {
                drillToolTipShown = bool.Parse(value);
            }

            foreach (ConfigNode efficiencyNode in efficiencyNodes)
            {
                EfficiencyData efficiencyData = new EfficiencyData();
                efficiencyData.Load(efficiencyNode);
                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }
        }
Esempio n. 14
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);
                }
            }
        }
Esempio n. 15
0
        protected void createNewEfficencyEntry(int planetID, string biomeName, HarvestTypes harvestType)
        {
            EfficiencyData efficiencyData = new EfficiencyData();
            efficiencyData.planetID = planetID;
            efficiencyData.biomeName = biomeName;
            efficiencyData.harvestType = harvestType;
            efficiencyData.attemptsRemaining = kMaxCoreSamples;

            //Standard modifiers
            efficiencyData.modifiers.Add(EfficiencyData.kExtractionMod, 1.0f);
            efficiencyData.modifiers.Add(EfficiencyData.kIndustryMod, 1.0f);
            efficiencyData.modifiers.Add(EfficiencyData.kHabitationMod, 1.0f);
            efficiencyData.modifiers.Add(EfficiencyData.kScienceMod, 1.0f);

            efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
        }
Esempio n. 16
0
        public void ResetEfficiencyData(int planetID, string biomeName, HarvestTypes harvestType)
        {
            string key = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                efficiencyData.efficiencyModifier = 1.0f;
                efficiencyData.attemptsRemaining = kMaxCoreSamples;
            }

            else
            {
                //Create a new entry.
                efficiencyData = new EfficiencyData();
                efficiencyData.planetID = planetID;
                efficiencyData.biomeName = biomeName;
                efficiencyData.harvestType = harvestType;
                efficiencyData.efficiencyModifier = 1.0f;
                efficiencyData.attemptsRemaining = kMaxCoreSamples;

                efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
            }
        }
Esempio n. 17
0
        public void SetEfficiencyData(int planetID, string biomeName, HarvestTypes harvestType, float efficiencyModifier)
        {
            string key = planetID.ToString() + biomeName + harvestType.ToString();
            EfficiencyData efficiencyData = null;

            //If we already have the efficiency data then just update the value
            if (efficiencyDataMap.ContainsKey(key))
            {
                efficiencyData = efficiencyDataMap[key];
                efficiencyData.efficiencyModifier = efficiencyModifier;
                return;
            }

            //Create a new entry.
            efficiencyData = new EfficiencyData();
            efficiencyData.planetID = planetID;
            efficiencyData.biomeName = biomeName;
            efficiencyData.harvestType = harvestType;
            efficiencyData.efficiencyModifier = efficiencyModifier;
            efficiencyData.attemptsRemaining = kMaxCoreSamples;

            efficiencyDataMap.Add(efficiencyData.Key, efficiencyData);
        }