Exemple #1
0
        public void TestBlueprintFromEdNameAndGrade()
        {
            string    blueprintName = "WakeScanner_Fast Scan_3";
            int       grade         = 3;
            Blueprint blueprint     = Blueprint.FromEDNameAndGrade(blueprintName, grade);

            Assert.IsNotNull(blueprint);
            Assert.AreEqual(grade, blueprint.grade);
            Assert.AreEqual("SensorFastScan", blueprint.blueprintTemplate?.edname);
            Assert.AreEqual(3, blueprint.materials.Count);
            Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("phosphorus"));
            Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("uncutfocuscrystals"));
            Assert.IsTrue(blueprint.materials.Select(m => m.edname).Contains("symmetrickeys"));
        }
Exemple #2
0
        public void TestBlueprintFromTemplateEdNameAndGrade()
        {
            // We should also be able to handle receiving a template name rather than a blueprint name while still providing essential info.
            string    blueprintTemplate     = "Sensor_FastScan";
            int       grade                 = 3;
            Blueprint blueprintFromTemplate = Blueprint.FromEDNameAndGrade(blueprintTemplate, grade);

            Assert.IsNotNull(blueprintFromTemplate);
            Assert.AreEqual(grade, blueprintFromTemplate.grade);
            Assert.AreEqual("SensorFastScan", blueprintFromTemplate.blueprintTemplate.edname);
            Assert.AreEqual(3, blueprintFromTemplate.materials.Count);
            string[] materials = blueprintFromTemplate.materials.Select(m => m.edname).ToArray();
            Assert.IsTrue(materials.Contains("phosphorus"));
            Assert.IsTrue(materials.Contains("uncutfocuscrystals"));
            Assert.IsTrue(materials.Contains("symmetrickeys"));
        }
Exemple #3
0
        public static Module ModuleFromJson(string name, JObject json)
        {
            long   id     = (long)json["module"]["id"];
            string edName = (string)json["module"]["name"];

            Module module = new Module(Module.FromEliteID(id) ?? Module.FromEDName(edName) ?? new Module());

            if (module.invariantName == null)
            {
                // Unknown module; report the full object so that we can update the definitions
                Logging.Info("Module definition error: " + edName, JsonConvert.SerializeObject(json["module"]));

                // Create a basic module & supplement from the info available
                module = new Module(id, edName, -1, edName, -1, "", (long)json["module"]["value"]);
            }

            module.fallbackLocalizedName = (string)json["module"]["locName"];
            module.price    = (long)json["module"]["value"]; // How much we actually paid for it
            module.enabled  = (bool)json["module"]["on"];
            module.priority = (int)json["module"]["priority"];
            module.health   = (decimal)json["module"]["health"] / 10_000M;

            // Engineering modifications
            module.modified = json["engineer"] != null;
            if (module.modified)
            {
                var blueprintName  = (string)json["engineer"]["recipeName"];
                var blueprintGrade = (int)json["engineer"]["recipeLevel"];
                module.modificationEDName               = blueprintName;
                module.engineerlevel                    = blueprintGrade;
                module.engineermodification             = Blueprint.FromEDNameAndGrade(blueprintName, blueprintGrade);
                module.blueprintId                      = module.engineermodification?.blueprintId ?? 0;
                module.engineerExperimentalEffectEDName = json["specialModifications"].ToObject <KeyValuePair <string, string> >().Value;
            }
            return(module);
        }