예제 #1
0
        private static bool Item_IsTheSameAs(On.Terraria.Item.orig_IsTheSameAs orig, Item self, Item compareItem)
        {
            bool b = orig(self, compareItem) && (self.color == compareItem.color || self.color == default || compareItem.color == default);

#if DEBUG
            if (self.netID == ItemID.Gel && compareItem.netID == ItemID.Gel)
            {
                if (!ColorfulGel.TryGetGelItemColorName(self, out string color1))
                {
                    color1 = "unknown";
                }
                if (!ColorfulGel.TryGetGelItemColorName(compareItem, out string color2))
                {
                    color2 = "unknown";
                }

                Main.NewText(new List <TextSnippet>()
                {
                    new TextSnippet("Comparing gel: "),
                    new TextSnippet(color1, self.color),
                    new TextSnippet(" and "),
                    new TextSnippet(color2, compareItem.color),
                    new TextSnippet($": {b}"),
                });
            }
#endif
            return(b);
        }
예제 #2
0
 private static string Item_AffixName(On.Terraria.Item.orig_AffixName orig, Item self)
 {
     if (ColorfulGel.TryGetGelItemColorName(self, out string c))
     {
         return(orig(self) + " (" + c + ")");
     }
     return(orig(self));
 }
예제 #3
0
        internal static void AddRecipes(Mod mod)
        {
            RecipeFinder rf = new RecipeFinder();

            rf.SetResult(ItemID.Torch, 3);
            rf.AddIngredient(ItemID.Gel);

            new RecipeEditor(rf.SearchRecipes()[0]).DeleteRecipe();

            ModRecipe r           = new ModRecipe(mod);
            bool      overhaulMod = ModLoader.GetMod("TerrariaOverhaul") != null;

            foreach (Tuple <string, short, int> rc in GelMakeTorchesCount)
            {
                if (rc.Item1 == "Blue" && overhaulMod)
                {
                    continue;
                }
                r.AddGelIngredient(rc.Item1);
                r.AddRecipeGroup(RecipeGroupID.Wood);
                r.SetResult(rc.Item2, Math.Max(overhaulMod? rc.Item3 / 2 : rc.Item3, 1));
                r.AddRecipe();
                r = new ModRecipe(mod);
            }

            foreach (Tuple <short, string, int> rc in ItemRecipesAddGel)
            {
                RecipeFinder finder = new RecipeFinder();
                finder.SetResult(rc.Item1);
                foreach (Recipe recipe in finder.SearchRecipes())
                {
                    recipe.AddIngredient(ColorfulGel.GetGelItem(rc.Item2, rc.Item3));
                }
            }

            r.AddGelIngredient("Ice");
            r.AddRecipeGroup("Wood");
            r.SetResult(ItemID.IceTorch, 3);
            r.AddRecipe();
        }