public static void DoGamble(Players.Player player) { if (player != null) { var priceItem = PickLoot(); ushort priceType; if (SPECIAL_SCIENCE.Equals(priceItem.Typename)) { Chat.Send(player, "Jackpot! Just found the solution to your current research"); ScienceManager.GetPlayerManager(player).AddActiveResearchProgress(1000000); } else if (SPECIAL_DEATH.Equals(priceItem.Typename)) { Chat.Send(player, "Fatal! Something inside killed you"); Players.TakeHit(player, 1000000); } else if (!ItemTypes.IndexLookup.TryGetIndex(priceItem.Typename, out priceType)) { Log.WriteError($"Unknown gambling price {priceItem.Typename} won by {player}"); Chat.Send(player, "I have bad feelings about this"); } else if (priceType == BuiltinBlocks.Air) { Chat.Send(player, "You found an empty box :-("); } else { Chat.Send(player, $"You found {priceItem.Amount} x {priceItem.Typename} as loot!"); if (!Inventory.GetInventory(player).TryAdd(priceType, priceItem.Amount)) { Stockpile.GetStockPile(player).Add(priceType, priceItem.Amount); } } } }
/// <summary> /// Registers this research with the server. /// </summary> public void Register() { if (enabled) { // Convert shell items to real items. foreach (ItemShell I in IterationRequirements) { if (Variables.itemsMaster == null) { Pipliz.Log.WriteError("{0} CRITICAL ERROR: SimpleResearchable {1} cannot register properly because 'Variables.itemsMaster' is still null.", NAMESPACE == null ? "" : NAMESPACE, this.Name); } else { Pipliz.Log.Write("{0}: Converting shell references in researchable {1} to InventoryItem objects.", NAMESPACE == null ? "" : NAMESPACE, this.Name); if (Variables.itemsMaster.ContainsKey(I.strItemkey)) { Requirements.Add(new InventoryItem(I.strItemkey, I.intAmount)); } else { Pipliz.Log.Write("{0} Researchable {1} was given an item key '{2}' as an iteration requirement which was not found by the server.", NAMESPACE == null ? "" : NAMESPACE, this.Name, I.strItemkey); } } } ScienceManager.RegisterResearchable(this); Pipliz.Log.Write("{0}: Researchable {1} has been registered with the ScienceManager.", NAMESPACE == null ? "" : NAMESPACE, this.Name); } else { Pipliz.Log.Write("{0}: Research {1} has been disabled, and will NOT be registered.", NAMESPACE == null ? "" : NAMESPACE, this.Name); } }
public override void OnNPCAtStockpile(ref NPCBase.NPCState state) { if (state.Inventory.IsEmpty) { Assert.IsTrue(shouldTakeItems); } else { state.Inventory.Dump(usedNPC.Colony.UsedStockpile); } state.SetCooldown(0.5); state.JobIsDone = true; if (shouldTakeItems) { shouldTakeItems = false; ScienceManagerPlayer scienceManager; if (!ScienceManager.TryGetPlayerManager(owner, out scienceManager)) { return; } ResearchProgress active = scienceManager.ActiveResearch; if (active.research != null && !active.IsCompleted) { var requirements = active.research.GetScienceRequirements(); if (Stockpile.GetStockPile(owner).TryRemove(requirements)) { state.Inventory.Add(requirements); } } } }
public static void Postfix(ScienceManagerPlayer __instance) { //Not is fake_player if (__instance.Player.ID.type != NetworkID.IDType.Steam || __instance.Player.ID.steamID.GetEAccountType() != Steamworks.EAccountType.k_EAccountTypeAnonUser) { return; } ResolvedResearchable research = ScienceManager.GetResearchable(__instance.ActiveResearch.research.GetKey()); if (__instance.HasCompleted(research)) { foreach (Players.Player plr in TeamManager.GetTeamManager().GetTeamOfFakePlayer(__instance.Player).GetPlayers()) { ScienceManagerPlayer SMP = ScienceManager.GetPlayerManager(plr); if (null == SMP || SMP.HasCompleted(research)) { continue; } int addProgress = __instance.ActiveResearch.progress - SMP.ActiveResearch.progress; if (addProgress > 0) { if (__instance.ActiveResearch.research != SMP.ActiveResearch.research) { SMP.Select(research); } SMP.AddActiveResearchProgress(addProgress); } } } }
public static bool Prefix(ScienceManagerPlayer __instance, int progress) { Team team = TeamManager.GetTeamManager().GetTeam(__instance.Player); if (null == team) { return(true); } ScienceManagerPlayer fake_player_ScienceManager = ScienceManager.GetPlayerManager(team.fake_player); ResolvedResearchable research = ScienceManager.GetResearchable(__instance.ActiveResearch.research.GetKey()); if (fake_player_ScienceManager.HasCompleted(research)) { return(true); } if (fake_player_ScienceManager.ActiveResearch.research == __instance.ActiveResearch.research) { fake_player_ScienceManager.AddActiveResearchProgress(progress); } else { fake_player_ScienceManager.Select(research); fake_player_ScienceManager.AddActiveResearchProgress(progress); } return(true); }
private static void AddMerchantTraining(Dictionary <ushort, int> researchDic) { _defaultValues[nameof(ShopJob)] = ShopJob.StaticCraftingCooldown; researchDic.Clear(); researchDic.Add(SCIENCEBAG, BAG_COST); researchDic.Add(COIN, COIN_COST); var requirements = new List <string>() { SCIENCEBAGREQ }; var research = new PandaResearch(researchDic, 1, MerchantTraining, .05f, requirements); research.ResearchComplete += TrainedMerchant_ResearchComplete; ScienceManager.RegisterResearchable(research); for (int i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, MerchantTraining, .05f); research.ResearchComplete += TrainedMerchant_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
private static void AddTailorTraining(Dictionary <ushort, int> researchDic) { _defaultValues[nameof(TailorJob)] = TailorJob.StaticCraftingCooldown; researchDic.Clear(); researchDic.Add(BuiltinBlocks.LinenBag, 3); researchDic.Add(BuiltinBlocks.ScienceBagBasic, BAG_COST); researchDic.Add(BuiltinBlocks.BronzeCoin, COIN_COST); var requirements = new List <string> { SCIENCEBAGREQ, ColonyBuiltIn.CoinMinting }; var research = new PandaResearch(researchDic, 1, TailorTraining, .05f, requirements); research.ResearchComplete += TrainedTailor_ResearchComplete; ScienceManager.RegisterResearchable(research); for (var i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, TailorTraining, .05f); research.ResearchComplete += TrainedTailor_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
private static void AddIncreasedCapacity(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.IronBlock, 1); researchDic.Add(BuiltinBlocks.Planks, 5); researchDic.Add(BuiltinBlocks.SteelIngot, 2); researchDic.Add(BuiltinBlocks.GoldCoin, 10); var requirements = new List <string>() { GetResearchKey(Machines + "1") }; var research = new PandaResearch(researchDic, 1, IncreasedCapacity, .2f, requirements); research.ResearchComplete += IncreasedCapacity_ResearchComplete; ScienceManager.RegisterResearchable(research); for (int i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, IncreasedCapacity, .2f); research.ResearchComplete += IncreasedCapacity_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
public static void Register(Dictionary <ushort, int> researchDic, int level, List <string> requirements = null) { var research = new Research(researchDic, level, CarpentryTraining, 1f, requirements, 12, false); research.ResearchComplete += Carpentry_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddReducedWaste(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 2); researchDic.Add(BuiltinBlocks.ScienceBagLife, 1); researchDic.Add(BuiltinBlocks.Berry, 2); researchDic.Add(BuiltinBlocks.Bread, 2); researchDic.Add(BuiltinBlocks.GoldCoin, 10); var requirements = new List <string>() { ColonyBuiltIn.ScienceBagLife }; var research = new PandaResearch(researchDic, 1, ReducedWaste, 0.05f, requirements); research.ResearchComplete += ReducedWaste_ResearchComplete; ScienceManager.RegisterResearchable(research); for (int i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, ReducedWaste, 0.05f, requirements); research.ResearchComplete += ReducedWaste_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
private static void RegisterSwordmithng(Dictionary <ushort, int> researchDic, int level, List <string> requirements = null) { var research = new PandaResearch(researchDic, level, SwordSmithing, 1f, requirements); research.ResearchComplete += SwordResearch_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddColonistHealth(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 2); researchDic.Add(BuiltinBlocks.ScienceBagLife, 2); researchDic.Add(BuiltinBlocks.Linen, 5); researchDic.Add(BuiltinBlocks.BronzeCoin, 10); var requirements = new List <string>() { ColonyBuiltIn.ScienceBagLife }; var research = new PandaResearch(researchDic, 1, ColonistHealth, 10f, requirements); research.ResearchComplete += Research_ResearchComplete1; ScienceManager.RegisterResearchable(research); for (int i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, ColonistHealth, 10f); research.ResearchComplete += Research_ResearchComplete1; ScienceManager.RegisterResearchable(research); } }
private static void AddBetterBuildersWandResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(Aether.Item.ItemIndex, 2); researchDic.Add(BuiltinBlocks.SteelIngot, 10); researchDic.Add(BuiltinBlocks.GoldIngot, 10); researchDic.Add(BuiltinBlocks.SilverIngot, 10); researchDic.Add(BuiltinBlocks.Planks, 10); var requirements = new List <string> { GetResearchKey(BuildersWand + "1") }; var research = new PandaResearch(researchDic, 1, BetterBuildersWand, 250f, requirements, 50); research.ResearchComplete += BetterBuildersWand_ResearchComplete; ScienceManager.RegisterResearchable(research); for (var i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, BetterBuildersWand, 250f, requirements, 50); research.ResearchComplete += BetterBuildersWand_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
private static void AddGunSmithTraining(Dictionary <ushort, int> researchDic) { _defaultValues[nameof(GunSmithJob)] = GunSmithJob.StaticCraftingCooldown; researchDic.Clear(); researchDic.Add(BuiltinBlocks.LeadBullet, 5); researchDic.Add(SCIENCEBAG, BAG_COST); researchDic.Add(COIN, COIN_COST); var requirements = new List <string>() { SCIENCEBAGREQ }; var research = new PandaResearch(researchDic, 1, GunSmithTraining, .05f, requirements); research.ResearchComplete += GunSmithTraining_ResearchComplete; ScienceManager.RegisterResearchable(research); for (int i = 2; i <= 5; i++) { research = new PandaResearch(researchDic, i, GunSmithTraining, .05f); research.ResearchComplete += GunSmithTraining_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
public static void Register() { for (int i = 0; i < toRegister.Count; i++) { var researchable = Activator.CreateInstance(toRegister[i]) as IResearchable; if (researchable != null) { ScienceManager.RegisterResearchable(researchable); } } }
private static void AddImprovedSlings(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.Sling, 1); researchDic.Add(BuiltinBlocks.SlingBullet, 5); for (int i = 1; i <= 5; i++) { var research = new PandaResearch(researchDic, i, ImprovedSling, .05f); research.ResearchComplete += ImprovedSlings_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
private static void AddAdvanceApocthResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagLife, 4); researchDic.Add(BuiltinBlocks.ScienceBagAdvanced, 2); var requirements = new List <string>() { GetResearchKey(Apothecary + "1") }; var research = new PandaResearch(researchDic, 1, AdvancedApothecary, 1f, requirements); research.ResearchComplete += AdvanceApocth_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddHerbResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagLife, 2); researchDic.Add(BuiltinBlocks.ScienceBagAdvanced, 2); var requirements = new List <string>() { ColonyBuiltIn.ScienceBagAdvanced }; var research = new PandaResearch(researchDic, 1, Herbalists, 1f, requirements); research.ResearchComplete += Herbs_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddKnightResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.CopperTools, 2); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 2); researchDic.Add(BuiltinBlocks.Linen, 2); researchDic.Add(BuiltinBlocks.BronzeCoin, 10); var requirements = new List <string>() { GetResearchKey(SwordSmithing + "1") }; var research = new PandaResearch(researchDic, 1, Knights, 1f, requirements); research.ResearchComplete += Knights_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddMachines(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.IronWrought, 1); researchDic.Add(BuiltinBlocks.CopperTools, 1); researchDic.Add(BuiltinBlocks.Planks, 5); researchDic.Add(BuiltinBlocks.Linen, 2); var requirements = new List <string>() { ColonyBuiltIn.Bloomery }; var research = new PandaResearch(researchDic, 1, Machines, 1f, requirements, 20, false); research.ResearchComplete += Machiness_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddBuildersWandResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(Aether.Item.ItemIndex, 2); researchDic.Add(BuiltinBlocks.SteelIngot, 10); researchDic.Add(BuiltinBlocks.GoldIngot, 10); researchDic.Add(BuiltinBlocks.SilverIngot, 10); researchDic.Add(Items.Elementium.Item.ItemIndex, 1); var requirements = new List <string> { GetResearchKey(Elementium + "1") }; var research = new PandaResearch(researchDic, 1, BuildersWand, 1f, requirements, 50); research.ResearchComplete += BuildersWand_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddManaResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.Alkanet, 10); researchDic.Add(BuiltinBlocks.Wolfsbane, 10); researchDic.Add(BuiltinBlocks.Hollyhock, 10); researchDic.Add(BuiltinBlocks.LinseedOil, 10); researchDic.Add(BuiltinBlocks.Crystal, 10); var requirements = new List <string> { GetResearchKey(Apothecary + "1") }; var research = new PandaResearch(researchDic, 1, Mana, 1f, requirements, 50); research.ResearchComplete += Mana_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private void Start() { RessourcesSecondaireCard = new List <GameObject>(); RessourcesPrimairesCard = new List <GameObject>(); InitializeArgent(); InitializeImage(); PlayerManager = GameObject.FindGameObjectWithTag("PlayerManager").GetComponent <PlayerManager>(); PlayerAdverse = PlayerNumber == 0 ? PlayerManager.GetComponent <PlayerManager>().Player2.GetComponent <Player>() : PlayerManager.GetComponent <PlayerManager>().Player1.GetComponent <Player>(); _scienceManager = GameObject.Find("ScienceManager").GetComponent <ScienceManager>(); pieceMilitaire = GameObject.Find("MilitaryManager").GetComponent <MilitaryManager>(); _playerNameTxt.GetComponent <Text>().text = PlayerName; }
private static void AddMasterOfAll(Dictionary <ushort, int> researchDic) { _defaultValues[nameof(WorkBenchJob)] = WorkBenchJob.StaticCraftingCooldown; researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 1); researchDic.Add(BuiltinBlocks.ScienceBagLife, 1); researchDic.Add(BuiltinBlocks.ScienceBagAdvanced, 1); researchDic.Add(BuiltinBlocks.ScienceBagColony, 1); researchDic.Add(BuiltinBlocks.ScienceBagMilitary, 1); researchDic.Add(BuiltinBlocks.GoldCoin, 10); researchDic.Add(BuiltinBlocks.BronzeCoin, 10); var requirements = new List <string> { PandaResearch.GetResearchKey(MerchantTraining + "5"), PandaResearch.GetResearchKey(TailorTraining + "5"), PandaResearch.GetResearchKey(BloomeryTraining + "5"), PandaResearch.GetResearchKey(FineryForgeTraining + "5"), PandaResearch.GetResearchKey(FurnaceTraining + "5"), PandaResearch.GetResearchKey(GrinderTraining + "5"), PandaResearch.GetResearchKey(GunSmithTraining + "5"), PandaResearch.GetResearchKey(KilnTraining + "5"), PandaResearch.GetResearchKey(MetalSmithTraining + "5"), PandaResearch.GetResearchKey(MintTraining + "5"), PandaResearch.GetResearchKey(OvenTraining + "5"), PandaResearch.GetResearchKey(WoodcutterTraining + "5"), PandaResearch.GetResearchKey(WorkBenchTraining + "5") }; var research = new PandaResearch(researchDic, 1, MasterOfAll, .03f, requirements, 200); research.ResearchComplete += MasterOfAll_ResearchComplete; ScienceManager.RegisterResearchable(research); for (var i = 2; i <= 10; i++) { research = new PandaResearch(researchDic, i, MasterOfAll, .03f, null, 200); research.ResearchComplete += MasterOfAll_ResearchComplete; ScienceManager.RegisterResearchable(research); } }
private static void AddElementiumResearch(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(Aether.Item.ItemIndex, 1); researchDic.Add(BuiltinBlocks.Copper, 20); researchDic.Add(BuiltinBlocks.IronOre, 20); researchDic.Add(BuiltinBlocks.Tin, 20); researchDic.Add(BuiltinBlocks.GoldOre, 20); researchDic.Add(BuiltinBlocks.GalenaSilver, 20); researchDic.Add(BuiltinBlocks.GalenaLead, 20); var requirements = new List <string> { GetResearchKey(Mana + "1") }; var research = new PandaResearch(researchDic, 1, Elementium, 1f, requirements, 50); research.ResearchComplete += Elementium_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddTeleporters(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(Items.Mana.Item.ItemIndex, 10); researchDic.Add(BuiltinBlocks.ScienceBagColony, 10); researchDic.Add(BuiltinBlocks.ScienceBagAdvanced, 10); researchDic.Add(BuiltinBlocks.StoneBricks, 20); researchDic.Add(BuiltinBlocks.Crystal, 20); researchDic.Add(BuiltinBlocks.GoldCoin, 20); var requirements = new List <string> { GetResearchKey(Mana + "1"), GetResearchKey(Machines + "1") }; var research = new PandaResearch(researchDic, 1, Teleporters, 1f, requirements, 100, false); research.ResearchComplete += Teleporters_ResearchComplete; ScienceManager.RegisterResearchable(research); }
private static void AddBanner(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 2); researchDic.Add(BuiltinBlocks.ScienceBagLife, 2); researchDic.Add(BuiltinBlocks.ScienceBagAdvanced, 2); researchDic.Add(BuiltinBlocks.ScienceBagColony, 2); researchDic.Add(BuiltinBlocks.ScienceBagMilitary, 2); researchDic.Add(BuiltinBlocks.GoldCoin, 10); var requirements = new List <string>() { ColonyBuiltIn.BannerRadius3 }; ScienceManager.RegisterResearchable(new PandaResearch(researchDic, 1, Settlement, 1f, requirements, 20, false)); for (int i = 2; i <= 20; i++) { ScienceManager.RegisterResearchable(new PandaResearch(researchDic, i, Settlement, 1f, null, 20, false)); } }
private static void AddMaxSettlers(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 2); researchDic.Add(BuiltinBlocks.ScienceBagLife, 1); researchDic.Add(BuiltinBlocks.PlasterBlock, 5); researchDic.Add(BuiltinBlocks.IronIngot, 5); researchDic.Add(BuiltinBlocks.Bed, 10); researchDic.Add(BuiltinBlocks.GoldCoin, 20); var requirements = new List <string> { GetResearchKey(SettlerChance) + "1" }; ScienceManager.RegisterResearchable(new PandaResearch(researchDic, 1, MaxSettlers, 1f, requirements)); for (var i = 2; i <= 10; i++) { ScienceManager.RegisterResearchable(new PandaResearch(researchDic, i, MaxSettlers, 1f)); } }
private static void AddMinSettlers(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 2); researchDic.Add(BuiltinBlocks.ScienceBagLife, 1); researchDic.Add(BuiltinBlocks.Bricks, 5); researchDic.Add(BuiltinBlocks.CoatedPlanks, 5); researchDic.Add(BuiltinBlocks.Clothing, 5); researchDic.Add(BuiltinBlocks.GoldCoin, 20); var requirements = new List <string> { GetResearchKey(MaxSettlers) + "3" }; ScienceManager.RegisterResearchable(new PandaResearch(researchDic, 1, MinSettlers, 1f, requirements)); for (var i = 2; i <= 10; i++) { ScienceManager.RegisterResearchable(new PandaResearch(researchDic, i, MinSettlers, 1f)); } }
private static void AddSettlerChance(Dictionary <ushort, int> researchDic) { researchDic.Clear(); researchDic.Add(BuiltinBlocks.ScienceBagBasic, 1); researchDic.Add(BuiltinBlocks.ScienceBagLife, 2); researchDic.Add(BuiltinBlocks.Torch, 5); researchDic.Add(BuiltinBlocks.StoneBricks, 10); researchDic.Add(BuiltinBlocks.Bed, 5); researchDic.Add(BuiltinBlocks.GoldCoin, 20); var requirements = new List <string> { ColonyBuiltIn.BannerRadius2 }; ScienceManager.RegisterResearchable(new PandaResearch(researchDic, 1, SettlerChance, 0.1f, requirements)); for (var i = 2; i <= 5; i++) { ScienceManager.RegisterResearchable(new PandaResearch(researchDic, i, SettlerChance, 0.1f)); } }