public override void OnEnterWorld(Player player) { // switch this bool to log if (false) { // some random sheet to log armor recipes // cuz im lazy // poops out the wiki format for armor sets recipes // does not support 3 hat variants, or assumes all hats use the same recipes // (deviant hat recipes not allowed), put in 1 hat // WorkBenches => Work Bench // Anvils => Iron Anvil / Lead Anvil // MythrilAnvil => Mythril Anvil / Orihalcum Anvil var armors = new[] { new[] { mod.ItemType <InvarHat>(), mod.ItemType <InvarBreastplate>(), mod.ItemType <InvarGreaves>(), }, new[] { mod.ItemType <HarpyHelmet>(), mod.ItemType <HarpyChestplate>(), mod.ItemType <HarpyLeggings>(), }, new[] { mod.ItemType <ArgiteHelmet>(), mod.ItemType <ArgiteBreastplate>(), mod.ItemType <ArgiteGreaves>(), }, new[] { mod.ItemType <NightingaleHood>(), mod.ItemType <NightingaleChestplate>(), mod.ItemType <NightingaleGreaves>(), }, new[] { mod.ItemType <OrcishHelmet>(), mod.ItemType <OrcishBreastplate>(), mod.ItemType <OrcishGreaves>(), }, new[] { mod.ItemType <FungusHelmet>(), mod.ItemType <FungusBreastplate>(), mod.ItemType <FungusGreaves>(), }, new[] { mod.ItemType <FleshHelmet>(), mod.ItemType <FleshBreastplate>(), mod.ItemType <FleshGreaves>(), }, new[] { mod.ItemType <CrystalHelmet>(), mod.ItemType <CrystalChestplate>(), mod.ItemType <CrystalGreaves>(), }, new[] { mod.ItemType <LuxoriousHelmet>(), mod.ItemType <LuxoriousBreastplate>(), mod.ItemType <LuxoriousLeggings>(), }, new[] { mod.ItemType <AfterlifeHood>(), mod.ItemType <AfterlifeBreastplate>(), mod.ItemType <AfterlifeLeggings>(), }, new[] { mod.ItemType <NanoHelmet>(), mod.ItemType <NanoBreastplate>(), mod.ItemType <NanoGreaves>(), }, new[] { mod.ItemType <MagmoniumHelmet>(), mod.ItemType <MagmoniumBreastplate>(), mod.ItemType <MagmoniumGreaves>(), }, new[] { mod.ItemType <SandStoneHelmet>(), mod.ItemType <SandStoneBreastplate>(), mod.ItemType <SandStoneGreaves>(), }, new[] { mod.ItemType <ChaosHelmet>(), mod.ItemType <ChaosBreastplate>(), mod.ItemType <ChaosGreaves>(), }, new[] { mod.ItemType <BrassHelmet>(), mod.ItemType <BrassHeadgear>(), mod.ItemType <BrassMask>(), }, new[] { mod.ItemType <BerserkerHelmet>(), mod.ItemType <BerserkerChestplate>(), mod.ItemType <BerserkerGreaves>(), }, }; ErrorLogger.ClearLog(); foreach (var armor in armors) { Item item = new Item(); // item used for initializing ErrorLogger.Log("=========="); ErrorLogger.Log("Combined recipe for: " + string.Join(", ", armor.Select(x => { item.SetDefaults(x); return(item.Name); }))); ErrorLogger.Log("=========="); var reqItems = new List <Item>(); var reqTiles = new List <int>(); var reqTileNames = new List <string>(); // loop pieces foreach (int piece in armor) { var recipes = Main.recipe.Where(x => x.createItem.type == piece); foreach (Recipe recipe in recipes) { reqItems = reqItems.Concat(recipe.requiredItem).ToList(); reqTiles = reqTiles.Concat(recipe.requiredTile).ToList(); } } // combine stacks var duplicateItems = reqItems.GroupBy(x => x.type).Where(x => x.Count() > 1).Select(x => x); var combItems = TremorUtils.DistinctBy(reqItems, x => x.type).ToList(); foreach (var grouping in duplicateItems) { var reqItem = combItems.FirstOrDefault(x => x.type == grouping.Key); if (reqItem != null) { reqItem.stack = reqItems.Where(x => x.type == grouping.Key).Sum(x => x.stack); } } reqItems = new List <Item>(combItems); reqTiles = reqTiles.Distinct().ToList(); // get non empty entries reqItems = reqItems.Where(x => !x.IsAir).ToList(); reqTileNames = reqTiles.Where(x => x > 0).Select(x => typeof(TileID).FindNameByConstant((ushort)x)).ToList(); int i = reqTileNames.IndexOf("Anvils"); if (i != -1) { reqTileNames.RemoveAt(i); reqTileNames.Add("Iron Anvil"); reqTileNames.Add("Lead Anvil"); } i = reqTileNames.IndexOf("WorkBenches"); if (i != -1) { reqTileNames.RemoveAt(i); reqTileNames.Add("Work Bench"); } i = reqTileNames.IndexOf("OrichalcumAnvil"); if (i != -1) { reqTileNames.RemoveAt(i); reqTileNames.Add("Orichalcum Anvil"); } i = reqTileNames.IndexOf("MythrilAnvil"); if (i != -1) { reqTileNames.RemoveAt(i); reqTileNames.Add("Mythril Anvil"); reqTileNames.Add("Orichalcum Anvil"); } // make strings, log string items = "* " + string.Join(" + ", reqItems.Select(x => $"{x.stack} {{{{item link|{x.Name}}}}}")); string tiles = "* Crafted at " + string.Join(" / ", reqTileNames.Select(x => $"{{{{item link|{x}}}}}")); ErrorLogger.Log($"{items}\n{tiles}"); ErrorLogger.Log("==========\n"); } } }
public override void ModifyDrawLayers(List <PlayerLayer> layers) { Texture2D textureLegs; if (!player.armor[12].IsAir) { if (player.armor[12].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[12].type, out textureLegs)) //Vanity Legs { InsertAfterVanillaLayer(layers, "Legs", new PlayerLayer(mod.Name, "GlowMaskLegs", delegate(PlayerDrawInfo info) { TremorUtils.DrawArmorGlowMask(EquipType.Legs, textureLegs, info); })); } } else if (player.armor[2].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[2].type, out textureLegs)) //Legs { InsertAfterVanillaLayer(layers, "Legs", new PlayerLayer(mod.Name, "GlowMaskLegs", delegate(PlayerDrawInfo info) { TremorUtils.DrawArmorGlowMask(EquipType.Legs, textureLegs, info); })); } Texture2D textureBody; if (!player.armor[11].IsAir) { if (player.armor[11].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[11].type, out textureBody)) //Vanity Body { InsertAfterVanillaLayer(layers, "Body", new PlayerLayer(mod.Name, "GlowMaskBody", delegate(PlayerDrawInfo info) { TremorUtils.DrawArmorGlowMask(EquipType.Body, textureBody, info); })); } } else if (player.armor[1].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[1].type, out textureBody)) //Body { InsertAfterVanillaLayer(layers, "Body", new PlayerLayer(mod.Name, "GlowMaskBody", delegate(PlayerDrawInfo info) { TremorUtils.DrawArmorGlowMask(EquipType.Body, textureBody, info); })); } Texture2D textureHead; if (!player.armor[10].IsAir) { if (player.armor[10].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[10].type, out textureHead)) //Vanity Head { InsertAfterVanillaLayer(layers, "Head", new PlayerLayer(mod.Name, "GlowMaskHead", delegate(PlayerDrawInfo info) { TremorUtils.DrawArmorGlowMask(EquipType.Head, textureHead, info); })); } } else if (player.armor[0].type >= ItemID.Count && ItemGlowMask.TryGetValue(player.armor[0].type, out textureHead)) //Head { InsertAfterVanillaLayer(layers, "Head", new PlayerLayer(mod.Name, "GlowMaskHead", delegate(PlayerDrawInfo info) { TremorUtils.DrawArmorGlowMask(EquipType.Head, textureHead, info); })); } Texture2D textureItem; if (player.HeldItem.type >= ItemID.Count && ItemGlowMask.TryGetValue(player.HeldItem.type, out textureItem)) //Held ItemType { InsertAfterVanillaLayer(layers, "HeldItem", new PlayerLayer(mod.Name, "GlowMaskHeldItem", delegate(PlayerDrawInfo info) { TremorUtils.DrawItemGlowMask(textureItem, info); })); } }