Ejemplo n.º 1
0
        public static void patch()
        {
            LanguageHelper.init();

            HarmonyHelper.patchAll();
            CraftHelper.patchAll();
        }
Ejemplo n.º 2
0
        public static void patch()
        {
            Mod.init();

            HarmonyHelper.patchAll();
            CraftHelper.patchAll();
        }
Ejemplo n.º 3
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            LanguageHelper.init();
            CraftHelper.patchAll();

            PersistentConsoleCommands.register <ConsoleCommands>();
        }
Ejemplo n.º 4
0
        public static void patch()
        {
            HarmonyHelper.patchAll(true);
            CraftHelper.patchAll();

            LanguageHelper.init();             // after CraftHelper

            DebrisPatcher.init(Mod.loadConfig <PrefabsConfig>(prefabsConfigName, Config.LoadOptions.ProcessAttributes));
        }
Ejemplo n.º 5
0
        public static void patch()
        {
            LanguageHelper.init();
            PersistentConsoleCommands.register <ConsoleCommands>();

            HarmonyHelper.patchAll(true);
            CraftHelper.patchAll();

            GravTrapObjectsType.init(typesConfig);
        }
Ejemplo n.º 6
0
        public async Task CraftAsync([Name("recipe_id")] Recipe recipe)
        {
            /*
             * if (!ItemHelper.RecipeExists(recipeId))
             * {
             *  await Context.Channel.WarnAsync("Could not find the specified recipe.");
             *  return;
             * }*/

            if (!CraftHelper.CanCraft(Context.Account, recipe))
            {
                var notice = new StringBuilder();

                notice.AppendLine(Format.Warning("You are unable to craft this recipe."));
                notice.AppendLine("\n> **Missing Components**");

                foreach ((string itemId, int amount) in CraftHelper.GetMissingFromRecipe(Context.Account, recipe))
                {
                    notice.AppendLine(RecipeViewer.WriteRecipeComponent(itemId, amount));
                }

                await Context.Channel.SendMessageAsync(notice.ToString());

                return;
            }


            if (CraftHelper.Craft(Context.Account, recipe))
            {
                var result = new StringBuilder();

                result.AppendLine($"> 📑 **{ItemHelper.NameOf(recipe.Result.ItemId)}**{(recipe.Result.Amount > 1 ? $" (x**{recipe.Result.Amount:##,0}**)" : "")}");
                result.AppendLine("> Successfully crafted an item!");

                result.AppendLine("\n> **Losses**");

                foreach ((string itemId, int amount) in recipe.Components)
                {
                    string icon = ItemHelper.IconOf(itemId);

                    if (!Check.NotNull(icon))
                    {
                        icon = "•";
                    }

                    result.AppendLine($"{icon} **{ItemHelper.NameOf(itemId)}**{(amount > 1 ? $" (x**{amount:##,0}**)" : "")}");
                }

                await Context.Channel.SendMessageAsync(result.ToString());

                return;
            }

            await Context.Channel.SendMessageAsync(Format.Warning("An unknown error has occured when crafting this recipe."));
        }
Ejemplo n.º 7
0
        public static void patch()
        {
            LanguageHelper.init();

            HarmonyHelper.patchAll();
            CraftHelper.patchAll();

            if (config.mk2Enabled)
            {
                HarmonyHelper.patch(typeof(GravTrapMK2Patches));
            }

            GravTrapObjectsType.init(Mod.loadConfig <TypesConfig>("types_config.json", Config.LoadOptions.ReadOnly));
        }
Ejemplo n.º 8
0
        private static string WriteRecipeText(ArcadeUser user, Recipe recipe)
        {
            var text = new StringBuilder();

            string recipeName = ItemHelper.GetItem(recipe.Result.ItemId)?.Name;

            if (!Check.NotNull(recipeName))
            {
                recipeName = "Unknown Item";
            }

            text.AppendLine($"\n> `{CraftHelper.GetBaseRecipeId(recipe)}`")
            .Append($"> {(CraftHelper.CanCraft(user, recipe) ? "📑" : "📄")} **Recipe: {recipeName}**");

            return(text.ToString());
        }
Ejemplo n.º 9
0
        public static string View(ArcadeUser user)
        {
            CraftHelper.UpdateKnownRecipes(user);
            var recipes = new StringBuilder();

            recipes.AppendLine(Locale.GetHeader(Headers.Recipe));

            IEnumerable <Recipe> known = CraftHelper.GetKnownRecipes(user).ToList();

            if (!Check.NotNullOrEmpty(known))
            {
                recipes.AppendLine("> You don't know any recipes.");
                return(recipes.ToString());
            }

            // Group recipes by: Var.GetKey(id).StartsWith(itemId)
            foreach (Recipe recipe in known)
            {
                recipes.AppendLine(WriteRecipeText(user, recipe));
            }

            return(recipes.ToString());
        }
Ejemplo n.º 10
0
        protected override void Read(PacketStream stream)
        {
            var parameter = stream.ReadUInt16();

            stream.ReadUInt16();
            var quantity = stream.ReadUInt32();
            var unk      = stream.ReadUInt32();

            if (parameter > 79)
            {
                CraftHelper.AnvilCraft(Connection, parameter, quantity);
            }
            else
            {
                var slot = parameter;
                // dismantle
                // TODO - NEED FIND WHERE ARE THE VALUES OF DISMANTLE
            }

            // unk = 1 = dismantle
            // 0 = anvil craft
            // return 0x302e
        }
Ejemplo n.º 11
0
        // Group all recipes with the same result ID
        // Paginate all variations
        public static string ViewRecipeInfo(ArcadeUser user, Recipe recipe)
        {
            var info = new StringBuilder();

            string resultName = ItemHelper.GetItem(recipe.Result.ItemId)?.Name ?? "Unknown Item";
            bool   craft      = CraftHelper.CanCraft(user, recipe);

            if (craft)
            {
                CraftHelper.SetRecipeStatus(user, recipe, RecipeStatus.Known);
            }
            else if (CraftHelper.GetRecipeStatus(user, recipe) == RecipeStatus.Unknown)
            {
                return(Format.Warning("Unknown recipe specified."));
            }


            info.AppendLine($"> {(craft ? "📑" : "📄")} **Recipe: {resultName}**");

            if (craft)
            {
                info.AppendLine("> You can craft this recipe.");
            }

            info.AppendLine($"\n> **Components**");

            foreach ((string itemId, int amount) in recipe.Components)
            {
                info.AppendLine(WriteRecipeComponent(itemId, amount));
            }

            info.AppendLine($"\n> **Result**");
            info.AppendLine(WriteRecipeComponent(recipe.Result.ItemId, recipe.Result.Amount));

            return(info.ToString());
        }
Ejemplo n.º 12
0
 public static void patch()
 {
     HarmonyHelper.patchAll();
     CraftHelper.patchAll();
 }