예제 #1
0
        public static void LoadRecipe(string recipeName)
        {
            int recipeindex = 0;

            recipeindex = GetRecipeIndex(recipeName);

            if (recipeindex <= 0)
            {
                return;
            }

            PicProductindex      = Types.Item[Recipe[recipeindex].MakeItemNum].Pic;
            LblProductNameText   = Types.Item[Recipe[recipeindex].MakeItemNum].Name;
            LblProductAmountText = "X 1";

            for (var i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                if (Recipe[recipeindex].Ingredients[(int)i].ItemNum > 0)
                {
                    PicMaterialIndex[(int)i]  = Types.Item[Recipe[recipeindex].Ingredients[(int)i].ItemNum].Pic;
                    LblMaterialName[(int)i]   = Types.Item[Recipe[recipeindex].Ingredients[(int)i].ItemNum].Name;
                    LblMaterialAmount[(int)i] = "X " + System.Convert.ToString(C_Quest.HasItem(C_Variables.Myindex, Recipe[recipeindex].Ingredients[(int)i].ItemNum)) + "/" + System.Convert.ToString(Recipe[recipeindex].Ingredients[(int)i].Value);
                }
                else
                {
                    PicMaterialIndex[(int)i]  = 0;
                    LblMaterialName[(int)i]   = "";
                    LblMaterialAmount[(int)i] = "";
                }
            }
        }
예제 #2
0
        internal static void SendCraftIt(string recipeName, int amount)
        {
            ByteStream buffer      = new ByteStream(4);
            int        i           = 0;
            int        recipeindex = 0;

            recipeindex = GetRecipeIndex(recipeName);

            if (recipeindex <= 0)
            {
                return;
            }

            //check,check, double check

            //we dont even know the damn recipe xD
            if (C_Types.Player[C_Variables.Myindex].RecipeLearned[recipeindex] == 0)
            {
                return;
            }

            //enough ingredients
            for (i = 1; i <= Constants.MAX_INGREDIENT; i++)
            {
                if (Recipe[recipeindex].Ingredients[i].ItemNum > 0 && C_Quest.HasItem(C_Variables.Myindex, Recipe[recipeindex].Ingredients[i].ItemNum) < (amount * Recipe[recipeindex].Ingredients[i].Value))
                {
                    C_Text.AddText(Strings.Get("crafting", "notenough"), (System.Int32)Enums.ColorType.Red);
                    return;
                }
            }

            //all seems fine...

            buffer.WriteInt32((System.Int32)Packets.ClientPackets.CStartCraft);

            buffer.WriteInt32(recipeindex);
            buffer.WriteInt32(amount);

            C_NetworkConfig.Socket.SendData(buffer.Data, buffer.Head);

            buffer.Dispose();

            CraftTimer        = C_General.GetTickCount();
            CraftTimerEnabled = true;

            BtnCraftEnabled       = false;
            BtnCraftStopEnabled   = false;
            BtnCraftStopEnabled   = false;
            NudCraftAmountEnabled = false;
            LstRecipeEnabled      = false;
            ChkKnownOnlyEnabled   = false;
        }