private static void Knights_ResearchComplete(object sender, ResearchCompleteEventArgs e) { PatrolTool.GivePlayerPatrolTool(e.Manager.Player); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(PatrolTool.PatrolFlag.name, true, ItemFactory.JOB_CRAFTER); }
private static void Apocth_ResearchComplete(object sender, ResearchCompleteEventArgs e) { RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(ApothecaryRegister.JOB_RECIPE, true, ItemFactory.JOB_CRAFTER); RecipePlayer.UnlockOptionalRecipe(e.Manager.Player, ApothecaryRegister.JOB_RECIPE); }
private static void SwordResearch_ResearchComplete(object sender, ResearchCompleteEventArgs e) { List <Items.WeaponMetadata> sword = new List <Items.WeaponMetadata>(); switch (e.Research.Level) { case 1: sword.AddRange(Items.ItemFactory.WeaponLookup.Values.Where(a => a.Metal == Items.MetalType.Copper)); break; case 2: sword.AddRange(Items.ItemFactory.WeaponLookup.Values.Where(a => a.Metal == Items.MetalType.Bronze)); break; case 3: sword.AddRange(Items.ItemFactory.WeaponLookup.Values.Where(a => a.Metal == Items.MetalType.Iron)); break; case 4: sword.AddRange(Items.ItemFactory.WeaponLookup.Values.Where(a => a.Metal == Items.MetalType.Steel)); break; } foreach (var item in sword) { RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(item.ItemType.name, true, Items.Armor.JOB_METALSMITH); } }
private static void Research_ResearchComplete(object sender, ResearchCompleteEventArgs e) { var armor = new List <Armor.ArmorMetadata>(); switch (e.Research.Level) { case 1: armor.AddRange(Armor.ArmorLookup.Values.Where(a => a.Metal == MetalType.Copper)); break; case 2: armor.AddRange(Armor.ArmorLookup.Values.Where(a => a.Metal == MetalType.Bronze)); break; case 3: armor.AddRange(Armor.ArmorLookup.Values.Where(a => a.Metal == MetalType.Iron)); break; case 4: armor.AddRange(Armor.ArmorLookup.Values.Where(a => a.Metal == MetalType.Steel)); break; } foreach (var item in armor) { RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(item.ItemType.name, true, Armor.JOB_METALSMITH); } }
public static void RegisterMiner() { var rivets = new InventoryItem(BuiltinBlocks.IronRivet, 6); var iron = new InventoryItem(BuiltinBlocks.IronWrought, 2); var copperParts = new InventoryItem(BuiltinBlocks.CopperParts, 6); var copperNails = new InventoryItem(BuiltinBlocks.CopperNails, 6); var tools = new InventoryItem(BuiltinBlocks.CopperTools, 1); var planks = new InventoryItem(BuiltinBlocks.Planks, 4); var pickaxe = new InventoryItem(BuiltinBlocks.BronzePickaxe, 2); var recipe = new Recipe(Item.name, new List <InventoryItem> { planks, iron, rivets, copperParts, copperNails, tools, planks, pickaxe }, new InventoryItem(Item.ItemIndex), 5); RecipeStorage.AddOptionalLimitTypeRecipe(AdvancedCrafterRegister.JOB_NAME, recipe); }
public override void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { var storage = RecipeStorage.GetPlayerStorage(manager.Player); storage.SetRecipeAvailability("pipliz.woodcutter2.quarterblockbrowndark", true, "Nach0WoodCutter2Job"); storage.SetRecipeAvailability("pipliz.woodcutter2.quarterblockbrownlight", true, "Nach0WoodCutter2Job"); }
public override void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { var storage = RecipeStorage.GetPlayerStorage(manager.Player); storage.SetRecipeAvailability("pipliz.dyer.quarterblockblack", true, "pipliz.dyer"); storage.SetRecipeAvailability("pipliz.dyer.quarterblockwhite", true, "pipliz.dyer"); }
private static void Machiness_ResearchComplete(object sender, ResearchCompleteEventArgs e) { RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Miner.Item.name, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(GateLever.Item.name, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(GateLever.GateItem.name, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Turret.BRONZEARROW_NAMESPACE, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Turret.STONE_NAMESPACE, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Turret.CROSSBOW_NAMESPACE, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Turret.MATCHLOCK_NAMESPACE, true, AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(AdvancedCrafterRegister.JOB_RECIPE, true, ItemFactory.JOB_CRAFTER); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(MachinistRegister.JOB_RECIPE, true, ItemFactory.JOB_CRAFTER); RecipePlayer.UnlockOptionalRecipe(e.Manager.Player, MachinistRegister.JOB_RECIPE); RecipePlayer.UnlockOptionalRecipe(e.Manager.Player, AdvancedCrafterRegister.JOB_RECIPE); }
/// <summary> /// Called by APIProvider ModEntries /// </summary> public static void RegisterRecipes() { for (int i = 0; i < LimitsProviders.Count; i++) { try { var recipeLimitsProvider = LimitsProviders[i].Value; var list = recipeLimitsProvider.GetCraftingLimitsRecipes(); if (list != null) { RecipeStorage.AddLimitTypeRecipes(recipeLimitsProvider.GetCraftingLimitsType(), list); var triggers = recipeLimitsProvider.GetCraftingLimitsTriggers(); if (triggers == null) { RecipeStorage.AddBlockToRecipeMapping(LimitsProviders[i].Key, recipeLimitsProvider.GetCraftingLimitsType()); } else { for (int i2 = 0; i2 < triggers.Count; i2++) { RecipeStorage.AddBlockToRecipeMapping(triggers[i2], recipeLimitsProvider.GetCraftingLimitsType()); } } } } catch (Exception e) { Log.WriteException("Error registering recipes for blockjob {0}:", e, LimitsProviders[i].ToString()); } } LimitsProviders = null; }
public void TestFixtureSetUp() { // Enable test mode ReflectionTool.TestMode = true; // This call is necessary for NUnit to load the type var someType = new WatchType(); Effort.Provider.EffortProviderConfiguration.RegisterProvider(); // prepare inmemory products db _factory = new UnitOfWorkFactory <ProductsContext>(new InMemoryDbContextManager("ProductStorageTest")); // prepare empty workplan var workplan = new Workplan { Name = "TestWorkplan" }; workplan.AddConnector("Start", NodeClassification.Start); workplan.AddConnector("End", NodeClassification.End); using (var uow = _factory.Create()) { var entity = RecipeStorage.SaveWorkplan(uow, workplan); uow.SaveChanges(); _workplanId = entity.Id; } }
public static void RegisterGateLever() { var rivets = new InventoryItem(BuiltinBlocks.IronRivet, 6); var iron = new InventoryItem(BuiltinBlocks.IronWrought, 2); var copperParts = new InventoryItem(BuiltinBlocks.CopperParts, 6); var copperNails = new InventoryItem(BuiltinBlocks.CopperNails, 6); var tools = new InventoryItem(BuiltinBlocks.CopperTools, 1); var planks = new InventoryItem(BuiltinBlocks.Planks, 4); var recipe = new Recipe(Item.name, new List <InventoryItem>() { planks, iron, rivets, copperParts, copperNails, tools, planks }, new InventoryItem(Item.ItemIndex), 5); RecipeStorage.AddOptionalLimitTypeRecipe(Jobs.AdvancedCrafterRegister.JOB_NAME, recipe); var gate = new Recipe(GateItem.name, new List <InventoryItem>() { iron, rivets, tools }, new InventoryItem(GateItem.ItemIndex), 24); RecipeStorage.AddOptionalLimitTypeRecipe(Jobs.AdvancedCrafterRegister.JOB_NAME, gate); }
public override void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter.bronzeanvil", true, "pipliz.crafter"); RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter.bow", true, "pipliz.crafter"); RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter.bowstring", true, "pipliz.crafter"); RecipePlayer.UnlockOptionalRecipe(manager.Player, "pipliz.player.bronzeanvil"); }
/// <summary> /// Called when this researchable is completed by a player. /// </summary> /// <param name="manager">Player's individual science manager.</param> /// <param name="reason">Will equal EResearchCompletionReason.ProgressCompleted when this research is completed by a player.</param> public void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { if (reason == EResearchCompletionReason.ProgressCompleted) { foreach (OptionalRecReference U in Unlocks) { if (U.limitType != null) { RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability(U.NPCCrafted, true, U.limitType); } if (U.PlayerCrafted != null) { RecipePlayer.UnlockOptionalRecipe(manager.Player, U.PlayerCrafted); } } foreach (OptionalRecReference L in Locks) { if (L.limitType != null) { RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability(L.NPCCrafted, false, L.limitType); } if (L.PlayerCrafted != null) { // need to figure out how to do this. } } } }
public override void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter.splittingstumptemperate", true, "pipliz.crafter"); RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter.splittingstumptaiga", true, "pipliz.crafter"); RecipePlayer.UnlockOptionalRecipe(manager.Player, "pipliz.player.splittingstumptaiga"); RecipePlayer.UnlockOptionalRecipe(manager.Player, "pipliz.player.splittingstumptemperate"); }
/// <summary> /// Attempts to remove an existing recipe from the server's database. /// </summary> /// <param name="recName">Name of recipe.</param> /// <returns>True if recipe was removed, False if recipe was not found or removal was not successful.</returns> public static bool tryRemoveRecipe(string recName, string NAMESPACE = null) { try { Recipe Rec; if (RecipeStorage.TryGetRecipe(recName, out Rec)) { Pipliz.Log.Write("{0}: Recipe {1} found, attempting to remove.", NAMESPACE == null ? "" : NAMESPACE, Rec.Name); RecipeStorage.Recipes.Remove(recName); Recipe Rec2; if (!RecipeStorage.TryGetRecipe(recName, out Rec2)) { Pipliz.Log.Write("{0}: Recipe {1} successfully removed", NAMESPACE == null ? "" : NAMESPACE, Rec.Name); return(true); } else { Pipliz.Log.Write("{0}: Recipe {1} removal failed for unknown reason.", NAMESPACE == null ? "" : NAMESPACE, Rec.Name); return(false); } } else { Pipliz.Log.Write("{0}: Recipe {1} not found.", NAMESPACE == null ? "" : NAMESPACE, recName); return(false); } } catch (Exception) { Pipliz.Log.Write("{0}: tryRemoveRecipe has reached an exception."); return(false); } }
public override void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter2.linseedoil", true, "Nach0Crafter2Job"); RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter2.coatedplanks", true, "Nach0Crafter2Job"); RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter2.adobe", true, "Nach0Crafter2Job"); RecipeStorage.GetPlayerStorage(manager.Player).SetRecipeAvailability("pipliz.crafter2.bowstring", true, "Nach0Crafter2Job"); }
private static void Mana_ResearchComplete(object sender, ResearchCompleteEventArgs e) { RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Items.Mana.Item.name, true, ApothecaryRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Aether.Item.name, true, ApothecaryRegister.JOB_NAME); }
private static void AdvanceApocth_ResearchComplete(object sender, ResearchCompleteEventArgs e) { RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(Anitbiotic.Item.name, true, ApothecaryRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player) .SetRecipeAvailability(TreatedBandage.Item.name, true, ApothecaryRegister.JOB_NAME); }
public static void LoadRecipes() { buildtoolRecipe = new Recipe(JOB_ITEM_KEY + ".recipe", new List <InventoryItem> () { new InventoryItem(BuiltinBlocks.IronIngot, 1), new InventoryItem(BuiltinBlocks.Planks, 1) }, new InventoryItem(JOB_ITEM_KEY, 1), 0); RecipeStorage.AddDefaultLimitTypeRecipe("pipliz.crafter", buildtoolRecipe); RecipePlayer.AddDefaultRecipe(buildtoolRecipe); }
public void FullCycle() { // Arrange var workplan = CreateWorkplan(); // Act Workplan loaded, loaded2; WorkplanEntity entity1, entity2; using (var uow = _factory.Create()) { entity1 = RecipeStorage.SaveWorkplan(uow, workplan); uow.SaveChanges(); loaded = RecipeStorage.LoadWorkplan(uow, entity1.Id); loaded.Name = "Modified"; entity2 = RecipeStorage.SaveWorkplan(uow, loaded); uow.SaveChanges(); loaded2 = RecipeStorage.LoadWorkplan(uow, entity2.Id); } // Assert Assert.AreNotEqual(entity1.Id, entity2.Id); Assert.AreEqual(workplan.Id, entity1.Id, "Id not assigned to original object!"); Assert.AreEqual(workplan.Name, entity1.Name, "Name not correctly stored and saved"); Assert.AreEqual(loaded.Name, entity2.Name, "Name not correctly stored and saved"); Assert.AreEqual(loaded.Name, loaded2.Name, "Name not correctly stored and saved"); Assert.AreEqual(workplan.State, loaded.State); Assert.AreEqual(workplan.MaxElementId, loaded.MaxElementId); // Compare workplans var steps = workplan.Steps.ToList(); var loadedSteps = loaded.Steps.ToList(); foreach (var step in steps) { var loadedStep = loadedSteps.FirstOrDefault(s => s.Id == step.Id); Assert.NotNull(loadedStep); Assert.AreEqual(step.GetType(), loadedStep.GetType()); for (int index = 0; index < step.Inputs.Length; index++) { Assert.AreEqual(step.Inputs[index].Id, loadedStep.Inputs[index].Id); Assert.AreEqual(step.Inputs[index].Name, loadedStep.Inputs[index].Name); } for (int index = 0; index < step.Outputs.Length; index++) { Assert.AreEqual(step.Outputs[index].Id, loadedStep.Outputs[index].Id); Assert.AreEqual(step.Outputs[index].Name, loadedStep.Outputs[index].Name); } } }
public override void OnResearchComplete(ScienceManagerPlayer manager, EResearchCompletionReason reason) { var storage = RecipeStorage.GetPlayerStorage(manager.Player); storage.SetRecipeAvailability("pipliz.metalsmith2.lanternyellow", true, "Nach0MetalSmith2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanternwhite", true, "Nach0Dyer2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanterngreen", true, "Nach0Dyer2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanternblue", true, "Nach0Dyer2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanternred", true, "Nach0Dyer2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanternorange", true, "Nach0Dyer2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanterncyan", true, "Nach0Dyer2Job"); storage.SetRecipeAvailability("pipliz.dyer2.lanternpink", true, "Nach0Dyer2Job"); }
public static void AfterWorldLoad() { var iron = new InventoryItem(BuiltinBlocks.BronzeIngot, 2); var tools = new InventoryItem(BuiltinBlocks.CopperTools, 1); var planks = new InventoryItem(BuiltinBlocks.Planks, 4); var recipe = new Recipe(JOB_RECIPE, new List<InventoryItem>() { iron, tools, planks }, new InventoryItem(JOB_ITEM_KEY, 1), 2); RecipePlayer.AddOptionalRecipe(recipe); RecipeStorage.AddOptionalLimitTypeRecipe(Items.ItemFactory.JOB_CRAFTER, recipe); }
public static void RegisterPatrolTool() { var planks = new InventoryItem(BuiltinBlocks.Planks, 2); var carpet = new InventoryItem(BuiltinBlocks.CarpetRed, 2); var recipe = new Recipe(PatrolFlag.name, new List <InventoryItem> { planks, carpet }, new InventoryItem(PatrolFlag.ItemIndex, 2), 5); RecipeStorage.AddOptionalLimitTypeRecipe(ItemFactory.JOB_CRAFTER, recipe); }
public static void Register() { var mana = new InventoryItem(Mana.Item.ItemIndex, 2); var cryastal = new InventoryItem(BuiltinBlocks.Crystal, 10); var recipe = new Recipe(Item.name, new List <InventoryItem> { mana, cryastal }, new InventoryItem(Item.ItemIndex, 1), 20); RecipeStorage.AddOptionalLimitTypeRecipe(ApothecaryRegister.JOB_NAME, recipe); }
public static void Register() { var bandage = new InventoryItem(Bandage.Item.ItemIndex, 1); var antibiotics = new InventoryItem(Anitbiotic.Item.ItemIndex, 1); var recipe = new Recipe(Item.name, new List <InventoryItem> { antibiotics, bandage }, new InventoryItem(Item.ItemIndex, 1), 50); RecipeStorage.AddOptionalLimitTypeRecipe(ApothecaryRegister.JOB_NAME, recipe); }
public static void Register() { var aether = new InventoryItem(Elementium.Item.ItemIndex, 2); var torch = new InventoryItem(Mana.Item.ItemIndex, 1); var recipe = new Recipe(Item.name, new List <InventoryItem> { aether, torch }, new InventoryItem(Item.ItemIndex, 1), 6); RecipeStorage.AddOptionalLimitTypeRecipe(ApothecaryRegister.JOB_NAME, recipe); }
public static void Register() { var oil = new InventoryItem(BuiltinBlocks.LinseedOil, 1); var linen = new InventoryItem(BuiltinBlocks.Linen, 1); var recipe = new Recipe(Item.name, new List <InventoryItem> { linen, oil }, new InventoryItem(Item.ItemIndex, 1), 50); RecipeStorage.AddDefaultLimitTypeRecipe(ApothecaryRegister.JOB_NAME, recipe); }
public static void AfterWorldLoad() { var flax = new InventoryItem(BuiltinBlocks.Flax, 1); var planks = new InventoryItem(BuiltinBlocks.Planks, 1); var linen = new InventoryItem(BuiltinBlocks.Linen, 1); var recipe = new Recipe(NAME, new List <InventoryItem>() { flax, planks, linen }, new InventoryItem(Item.ItemIndex, 1), 2); RecipeStorage.AddDefaultLimitTypeRecipe(Register.TALIOR_JOB, recipe); }
private static void Machiness_ResearchComplete(object sender, ResearchCompleteEventArgs e) { RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(Items.Machines.Miner.Item.name, true, Jobs.AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(Items.Machines.GateLever.Item.name, true, Jobs.AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(Items.Machines.GateLever.GateItem.name, true, Jobs.AdvancedCrafterRegister.JOB_NAME); RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(Jobs.AdvancedCrafterRegister.JOB_RECIPE, true, Items.ItemFactory.JOB_CRAFTER); RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(Jobs.MachinistRegister.JOB_RECIPE, true, Items.ItemFactory.JOB_CRAFTER); RecipePlayer.UnlockOptionalRecipe(e.Manager.Player, Jobs.MachinistRegister.JOB_RECIPE); RecipePlayer.UnlockOptionalRecipe(e.Manager.Player, Jobs.AdvancedCrafterRegister.JOB_RECIPE); foreach (var item in Items.Machines.Turret.TurretSettings) { RecipeStorage.GetPlayerStorage(e.Manager.Player).SetRecipeAvailability(item.Value.TurretItem.name, true, Jobs.AdvancedCrafterRegister.JOB_NAME); } }
public static void RegisterBerryPie() { var flour = new InventoryItem(BuiltinBlocks.Flour, 4); var Berries = new InventoryItem(BuiltinBlocks.Berry, 4); var firewood = new InventoryItem("firewood"); var recipe = new Recipe(Item.name, new List <InventoryItem> { flour, Berries, firewood }, new InventoryItem(Item.ItemIndex, 2), 50, false, 100); RecipeStorage.AddDefaultLimitTypeRecipe(ItemFactory.JOB_BAKER, recipe); }