public override void run()
        {
            L2Player player = Client.CurrentPlayer;

            if (player._recipeBook == null)
            {
                //The recipe is incorrect.
                player.sendSystemMessage(852);
                player.sendActionFailed();
                return;
            }

            L2Recipe rec = null;

            foreach (L2Recipe r in player._recipeBook)
            {
                if (r.RecipeID == _id)
                {
                    rec = r;
                    break;
                }
            }

            if (rec == null)
            {
                //The recipe is incorrect.
                player.sendSystemMessage(852);
                player.sendActionFailed();
                return;
            }

            player.unregisterRecipe(rec, true);
        }
Esempio n. 2
0
 public RecipeItemMakeInfo(L2Player player, L2Recipe rec, int result)
 {
     RecipeID     = rec.RecipeID;
     Type         = rec._iscommonrecipe;
     CurrentMP    = (int)player.CurMP;
     MaxMP        = (int)player.CharacterStat.getStat(model.skills2.TEffectType.b_max_mp);
     MakingResult = result;
 }
Esempio n. 3
0
 public RecipeItemMakeInfo(L2Player player, L2Recipe rec, int result)
 {
     _recipeId     = rec.RecipeId;
     _type         = rec.Iscommonrecipe;
     _currentMp    = (int)player.CurMp;
     _maxMp        = (int)player.CharacterStat.GetStat(EffectType.BMaxMp);
     _makingResult = result;
 }
Esempio n. 4
0
        public override void RunImpl()
        {
            L2Player player = _client.CurrentPlayer;

            if (player.RecipeBook == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect);
                player.SendActionFailed();
                return;
            }

            L2Recipe rec = player.RecipeBook.FirstOrDefault(r => r.RecipeId == _id);

            if (rec == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect);
                player.SendActionFailed();
                return;
            }

            player.UnregisterRecipe(rec, true);
        }
        public override void RunImpl()
        {
            L2Player player = _client.CurrentPlayer;

            if (player.RecipeBook == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect);
                player.SendActionFailed();
                return;
            }

            L2Recipe rec = player.RecipeBook.FirstOrDefault(r => r.RecipeId == _id);

            if (rec == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect);
                player.SendActionFailed();
                return;
            }

            player.SendPacket(new RecipeItemMakeInfo(player, rec, 2));
        }
        public override void run()
        {
            L2Player player = Client.CurrentPlayer;

            if (player._recipeBook == null)
            {
                //The recipe is incorrect.
                player.sendSystemMessage(852);
                player.sendActionFailed();
                return;
            }

            L2Recipe rec = null;

            foreach (L2Recipe r in player._recipeBook)
            {
                if (r.RecipeID == _id)
                {
                    rec = r;
                    break;
                }
            }

            if (rec == null)
            {
                //The recipe is incorrect.
                player.sendSystemMessage(852);
                player.sendActionFailed();
                return;
            }

            if (player.CurMP < rec._mp_consume)
            {
                player.sendSystemMessage(24); //Not enough MP.
                player.sendActionFailed();
                return;
            }

            bool next = true;

            if (rec._iscommonrecipe == 0)
            {
                next = player.p_create_item >= rec._level;
            }
            else
            {
                next = player.p_create_common_item >= rec._level;
            }

            if (!next)
            {
                player.sendSystemMessage(404); //Your Create Item level is too low to register this recipe.
                player.sendActionFailed();
                return;
            }

            foreach (recipe_item_entry material in rec._materials)
            {
                long count = player.Inventory.getItemCount(material.item.ItemID);
                if (count < material.count)
                {
                    //You are missing $s2 $s1 required to create that.
                    SystemMessage sm = new SystemMessage(854);
                    sm.addItemName(material.item.ItemID);
                    sm.addItemCount(material.count - count);
                    player.sendPacket(sm);
                    player.sendActionFailed();
                    return;
                }
            }

            player.CurMP -= rec._mp_consume;
            StatusUpdate su = new StatusUpdate(player.ObjID);

            su.add(StatusUpdate.CUR_MP, (int)player.CurMP);
            player.sendPacket(su);

            foreach (recipe_item_entry material in rec._materials)
            {
                player.Inventory.destroyItem(material.item.ItemID, material.count, true, true);
            }

            if (rec._success_rate < 100)
            {
                if (new Random().Next(0, 100) > rec._success_rate)
                {
                    player.sendPacket(new RecipeItemMakeInfo(player, rec, 0));
                    player.sendActionFailed();
                    return;
                }
            }

            foreach (recipe_item_entry prod in rec._products)
            {
                // if(prod.rate == 100)
                player.Inventory.addItem(prod.item, prod.count, 0, true, true);
                // else
            }

            player.sendPacket(new RecipeItemMakeInfo(player, rec, 1));
        }
Esempio n. 7
0
        public override void RunImpl()
        {
            L2Player player = _client.CurrentPlayer;

            if (player.RecipeBook == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect);
                player.SendActionFailed();
                return;
            }

            L2Recipe rec = player.RecipeBook.FirstOrDefault(r => r.RecipeId == _id);

            if (rec == null)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.RecipeIncorrect);
                player.SendActionFailed();
                return;
            }

            if (player.CurMp < rec.MpConsume)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.NotEnoughMp);
                player.SendActionFailed();
                return;
            }

            bool next;

            if (rec.Iscommonrecipe == 0)
            {
                next = player.PCreateItem >= rec.Level;
            }
            else
            {
                next = player.PCreateCommonItem >= rec.Level;
            }

            if (!next)
            {
                player.SendSystemMessage(SystemMessage.SystemMessageId.CreateLvlTooLowToRegister);
                player.SendActionFailed();
                return;
            }

            player.CurMp -= rec.MpConsume;
            StatusUpdate su = new StatusUpdate(player);

            su.Add(StatusUpdate.CurMp, (int)player.CurMp);
            player.SendPacket(su);

            rec.Materials.ForEach(material => player.DestroyItemById(material.Item.ItemId, material.Count));

            if (rec.SuccessRate < 100)
            {
                if (new Random().Next(0, 100) > rec.SuccessRate)
                {
                    player.SendPacket(new RecipeItemMakeInfo(player, rec, 0));
                    player.SendActionFailed();
                    return;
                }
            }

            rec.Products.ForEach(prod => player.SendPacket(new RecipeItemMakeInfo(player, rec, 1)));
        }