Exemplo n.º 1
0
        void c_ClientAcceptImbueItemInfo(object sender, ClientAcceptImbueItemEventArgs e)
        {
            Client c = (Client)sender;
            AcceptImbueItem i = e.Info;
            Equipment Item = null;
            BaseItem item = null;
            BaseItem imbueItem1 = null;
            ImbueError error;
            ImbueStat stat = ImbueStat.CriticalHit;

            try
            {
                item = c.MyCharacter.Bags[i.ToImbueItemBag - 1].Items.Single(x => (x.ItemID == i.ToImbueItemID && x.Slot == i.ToImbueItemSlot));
                if(item is Equipment)
                   Item = item as Equipment;

                imbueItem1 = c.MyCharacter.Bags[i.ImbueItem1Bag - 1].Items.Single(x => (x.ItemID == i.ImbueItem1ID));

                double SuccessChance = 33.3f; // flat 1/3 chance as there chance to success, fail, and drop so :/

                if (Item.Plus == 0 && imbueItem1 is Black)
                    SuccessChance = 100;

                if (imbueItem1 is ImbueItem)
                {
                    ImbueItem imbueitem = imbueItem1 as ImbueItem;
                    SuccessChance += (double)imbueitem.ImbueChance;
                }

                // ADD UBER LEET REMOVE FROM BAG & SAVE DATABASE YOU LOST THE ITEM PLXO

                int value = 0;

                if (itemDataManager.PercentSuccess(SuccessChance))
                {

                    value = 1; // just - value to decrease xd
                    Item.Damage += (short)value;
                    Item.Plus++;
                    error = ImbueError.Success;
                    stat = ImbueStat.Damage;

                }
                else
                {
                    if (Item.Plus >= 4 && itemDataManager.PercentSuccess(30))
                    {
                        // I DROP YO STATS
                    }
                    error = ImbueError.FailedToRemake;
                    stat = ImbueStat.None;
                    value = 0;
                }

                c.Send(PacketManager.SendImbueMessage(error, stat, value, Item));

                c.Send(PacketManager.SendRemoveItem(i.ImbueItem1Bag, i.ImbueItem1Slot));

                Item.ImbueTries++;
                c.Send(PacketManager.SendImbuedItem((BaseItem)Item));
                itemDataManager.UpdateItem((BaseItem)Item);
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        void c_ClientAcceptImbueItemInfo(object sender, ClientAcceptImbueItemEventArgs e)
        {
            Client          c          = (Client)sender;
            AcceptImbueItem i          = e.Info;
            Equipment       Item       = null;
            BaseItem        item       = null;
            BaseItem        imbueItem1 = null;
            ImbueError      error;
            ImbueStat       stat = ImbueStat.CriticalHit;

            try
            {
                item = c.MyCharacter.Bags[i.ToImbueItemBag - 1].Items.Single(x => (x.ItemID == i.ToImbueItemID && x.Slot == i.ToImbueItemSlot));
                if (item is Equipment)
                {
                    Item = item as Equipment;
                }

                imbueItem1 = c.MyCharacter.Bags[i.ImbueItem1Bag - 1].Items.Single(x => (x.ItemID == i.ImbueItem1ID));

                double SuccessChance = 33.3f; // flat 1/3 chance as there chance to success, fail, and drop so :/


                if (Item.Plus == 0 && imbueItem1 is Black)
                {
                    SuccessChance = 100;
                }

                if (imbueItem1 is ImbueItem)
                {
                    ImbueItem imbueitem = imbueItem1 as ImbueItem;
                    SuccessChance += (double)imbueitem.ImbueChance;
                }

                // ADD UBER LEET REMOVE FROM BAG & SAVE DATABASE YOU LOST THE ITEM PLXO

                int value = 0;

                if (itemDataManager.PercentSuccess(SuccessChance))
                {
                    value        = 1; // just - value to decrease xd
                    Item.Damage += (short)value;
                    Item.Plus++;
                    error = ImbueError.Success;
                    stat  = ImbueStat.Damage;
                }
                else
                {
                    if (Item.Plus >= 4 && itemDataManager.PercentSuccess(30))
                    {
                        // I DROP YO STATS
                    }
                    error = ImbueError.FailedToRemake;
                    stat  = ImbueStat.None;
                    value = 0;
                }

                c.Send(PacketManager.SendImbueMessage(error, stat, value, Item));

                c.Send(PacketManager.SendRemoveItem(i.ImbueItem1Bag, i.ImbueItem1Slot));

                Item.ImbueTries++;
                c.Send(PacketManager.SendImbuedItem((BaseItem)Item));
                itemDataManager.UpdateItem((BaseItem)Item);
            }
            catch
            {
            }
        }
Exemplo n.º 3
0
        void c_ClientAcceptImbueItemInfo(object sender, ClientAcceptImbueItemEventArgs e)
        {
            Client c = (Client)sender;
            AcceptImbueItem i = e.Info;
            int itemCount = 1;
            BaseItem item = null;
            BaseItem imbueItem = null, imbueItem2 = null, imbueItem3 = null;  // Stone\Crystal\Jewel
            ImbueError error = ImbueError.FailedToRemake;   // Default error = fail
            ImbueStat stat = ImbueStat.CriticalHit;     // Default stat to imbue = critical
            List<ImbueStat> WhiteStats = null;      // List of possible stats to imbue
            List<ImbueStat> RedStats = null;

            try
            {
                imbueItem = c.MyCharacter.Bags[i.ImbueItem1Bag - 1].Items.Single(x => (x.ItemID == i.ImbueItem1ID));
                if (!(imbueItem is ImbueItem))      // If not using imbue item
                {
                    // Output error - not imbue item
                    return;
                }
                ImbueItem imbueitem = imbueItem as ImbueItem;

                item = c.MyCharacter.Bags[i.ToImbueItemBag - 1].Items.Single(x => (x.ItemID == i.ToImbueItemID && x.Slot == i.ToImbueItemSlot));
                if (!(item is Equipment))      // See if item can be imbued
                {
                    // Output error - not imbuable item
                    return;
                }
                Equipment Item = item as Equipment;

                int SuccessChance = 75;     // Success rate offset
                int increaseAbility = 0;

                if (i.ImbueItem2ID != 0)
                {
                    imbueItem2 = c.MyCharacter.Bags[i.ImbueItem2Bag - 1].Items.Single(x => (x.ItemID == i.ImbueItem2ID));
                    itemCount++;
                    if (i.ImbueItem3ID != 0)
                    {
                        imbueItem3 = c.MyCharacter.Bags[i.ImbueItem3Bag - 1].Items.Single(x => (x.ItemID == i.ImbueItem3ID));
                        itemCount++;
                    }
                }

                SuccessChance += imbueitem.ImbueChance * itemCount;
                increaseAbility += imbueitem.IncreaseValue;

                int value = (int)(Item.RequiredLevel) + increaseAbility;        // Base increase value is req level

                if (imbueItem is Black)     // Using a black imbue item
                {
                    // Increase value increases according to plus and type of rock
                    value += (int)(((value * 0.1) * Item.Plus) + ((imbueitem.ImbueChance / 5) * Item.Plus));
                    if(Item is Feet)
                        value = (int)(Math.Round((double)(value / 50))) + 1;

                    if (XiahRandom.PercentSuccess(SuccessChance - Item.Plus * 4))      // Attempt imbue
                    {
                        gameEngine.BlackImbue(Item, ref stat, imbueitem, 1);        // Imbue the item
                        if (!(Item is Feet))
                            if(Item.RebirthHole == (short)(RebirthHoleItems.BlackImbueTier1) ||
                                Item.RebirthHole == (short)(RebirthHoleItems.BlackImbueTier2) ||
                                Item.RebirthHole == (short)(RebirthHoleItems.BlackImbueTier3))
                            {
                                value += Item.RebirthHoleStat;
                            }
                        Item.Plus++;        // Increase plus by 1
                        error = ImbueError.Success;     // Return success message
                    }
                    else   // Failed to imbue
                    {
                        error = ImbueError.FailedToRemake;      // Error failed to imbue
                        stat = ImbueStat.None;      // No stat imbued
                        if (Item.Plus >= 4 && XiahRandom.PercentSuccess(Item.Plus * 2))    // Drop?
                        {
                            value = gameEngine.BlackImbue(Item, ref stat, imbueitem, -1);       // Lose value
                            Item.Plus--;        // Reduce plus by 1
                        }
                        value *= -1;
                    }
                }
                else if (imbueItem is White)
                {
                    if (Item is Cape)
                    {
                        byte[] cannotbeImbued = PacketManager.SendImbueMessage(ImbueError.ImbueImpossible, ImbueStat.None, 0, Item);
                        c.Send(cannotbeImbued);
                        return;
                    }

                    value += (int)(((value * 0.1) * Item.Slvl) + ((imbueitem.ImbueChance / 5) * Item.Slvl));
                    WhiteStats = new List<ImbueStat>();
                    WhiteStats.Add(ImbueStat.Damage);
                    WhiteStats.Add(ImbueStat.Defense);
                    WhiteStats.Add(ImbueStat.AttackRating);
                    WhiteStats.Add(ImbueStat.MaxLife);
                    WhiteStats.Add(ImbueStat.MaxMana);
                    WhiteStats.Add(ImbueStat.LifeReg);
                    WhiteStats.Add(ImbueStat.ManaReg);
                    WhiteStats.Add(ImbueStat.CriticalHit);

                    if (XiahRandom.PercentSuccess(SuccessChance - Item.Slvl * 4))
                    {
                        value = gameEngine.WhiteImbue(Item, ref stat, imbueitem);
                        Item.Slvl++;
                        error = ImbueError.Success;
                    }
                    else
                    {
                        error = ImbueError.FailedToRemake;
                        stat = ImbueStat.None;

                        if (Item.Slvl >= 4 && XiahRandom.PercentSuccess(Item.Slvl * 2))
                        {
                            Item.Slvl--;
                            if (Item is Cape)
                            {
                                WhiteStats.Remove(ImbueStat.Damage);
                                WhiteStats.Remove(ImbueStat.Defense);

                                if (Item.AttackRating == 0)
                                    WhiteStats.Remove(ImbueStat.AttackRating);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }
                            if (Item is Hand)
                            {
                                WhiteStats.Remove(ImbueStat.Damage);

                                if (Item.Defence == 0)
                                    WhiteStats.Remove(ImbueStat.Defense);
                                if (Item.AttackRating == 0)
                                    WhiteStats.Remove(ImbueStat.AttackRating);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }
                            if (Item is Head)
                            {
                                WhiteStats.Remove(ImbueStat.AttackRating);

                                if (Item.Damage == 0)
                                    WhiteStats.Remove(ImbueStat.Damage);
                                if (Item.Defence == 0)
                                    WhiteStats.Remove(ImbueStat.Defense);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }
                            if (Item is Body)
                            {
                                WhiteStats.Remove(ImbueStat.Defense);

                                if (Item.Damage == 0)
                                    WhiteStats.Remove(ImbueStat.Damage);
                                if (Item.AttackRating == 0)
                                    WhiteStats.Remove(ImbueStat.AttackRating);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }
                            if (Item is Feet)
                            {
                                WhiteStats.Remove(ImbueStat.CriticalHit);

                                if (Item.Defence == 0)
                                    WhiteStats.Remove(ImbueStat.Defense);
                                if (Item.Damage == 0)
                                    WhiteStats.Remove(ImbueStat.Damage);
                                if (Item.AttackRating == 0)
                                    WhiteStats.Remove(ImbueStat.AttackRating);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }
                            if (Item is Ring)
                            {
                                WhiteStats.Remove(ImbueStat.MaxLife);

                                if (Item.Defence == 0)
                                    WhiteStats.Remove(ImbueStat.Defense);
                                if (Item.Damage == 0)
                                    WhiteStats.Remove(ImbueStat.Damage);
                                if (Item.AttackRating == 0)
                                    WhiteStats.Remove(ImbueStat.AttackRating);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }
                            if (Item is Necklace)
                            {
                                WhiteStats.Remove(ImbueStat.MaxMana);

                                if (Item.Defence == 0)
                                    WhiteStats.Remove(ImbueStat.Defense);
                                if (Item.Damage == 0)
                                    WhiteStats.Remove(ImbueStat.Damage);
                                if (Item.AttackRating == 0)
                                    WhiteStats.Remove(ImbueStat.AttackRating);
                                if (Item.IncMaxLife == 0)
                                    WhiteStats.Remove(ImbueStat.MaxLife);
                                if (Item.IncMaxMana == 0)
                                    WhiteStats.Remove(ImbueStat.MaxMana);
                                if (Item.IncLifeRegen == 0)
                                    WhiteStats.Remove(ImbueStat.LifeReg);
                                if (Item.IncManaRegen == 0)
                                    WhiteStats.Remove(ImbueStat.ManaReg);
                                if (Item.Critical == 0)
                                    WhiteStats.Remove(ImbueStat.CriticalHit);
                            }

                            int randomStat = XiahRandom.Next(0, WhiteStats.Count);
                            stat = WhiteStats[randomStat];

                            switch (stat)
                            {
                                case ImbueStat.Damage:
                                    value = Item.Damage;
                                    Item.Damage = 0;
                                    break;

                                case ImbueStat.Defense:
                                    value = Item.Defence;
                                    Item.Defence = 0;
                                    break;

                                case ImbueStat.AttackRating:
                                    value = Item.AttackRating;
                                    Item.AttackRating = 0;
                                    break;

                                case ImbueStat.MaxLife:
                                    value = Item.IncMaxLife;
                                    Item.IncMaxLife = 0;
                                    break;

                                case ImbueStat.MaxMana:
                                    value = Item.IncMaxMana;
                                    Item.IncMaxMana = 0;
                                    break;

                                case ImbueStat.LifeReg:
                                    value = Item.IncLifeRegen;
                                    Item.IncLifeRegen = 0;
                                    break;

                                case ImbueStat.ManaReg:
                                    value = Item.IncManaRegen;
                                    Item.IncManaRegen = 0;
                                    break;

                                case ImbueStat.CriticalHit:
                                    value = Item.Critical;
                                    Item.Critical = 0;
                                    break;
                            }

                            #region drop less than all stats
                            //else THIS IS IF WE WANNA DROP LIKE 30 FROM WHITE FAILURE BUT F**K THAT ITS ALL OR NOTHING MANG (H)
                            //{
                            //    switch (stat)
                            //    {
                            //        case ImbueStat.Damage:
                            //            Item.Damage -= (Item.Damage < (short)value) ? Item.Damage : (short)value;
                            //            break;

                            //        case ImbueStat.Defense:
                            //            Item.Defence -= (Item.Defence < (short)value) ? Item.Defence : (short)value;
                            //            break;

                            //        case ImbueStat.AttackRating:
                            //            Item.AttackRating -= (Item.AttackRating < (short)value) ? Item.AttackRating : (short)value;
                            //            break;

                            //        case ImbueStat.MaxLife:
                            //            Item.IncMaxLife -= (Item.IncMaxLife < (short)value) ? Item.IncMaxLife : (short)value;
                            //            break;

                            //        case ImbueStat.MaxMana:
                            //            Item.IncMaxMana -= (Item.IncMaxMana < (short)value) ? Item.IncMaxMana : (short)value;
                            //            break;

                            //        case ImbueStat.LifeReg:
                            //            Item.IncLifeRegen -= (Item.IncLifeRegen < (short)value) ? Item.IncLifeRegen : (short)value;
                            //            break;

                            //        case ImbueStat.ManaReg:
                            //            Item.IncManaRegen -= (Item.IncManaRegen < (short)value) ? Item.IncManaRegen : (short)value;
                            //            break;

                            //        case ImbueStat.CriticalHit:
                            //            value = (int)(Math.Round((double)(value / 50))) + 1;
                            //            Item.Critical -= (Item.Critical < (short)value) ? Item.Critical : (short)value;
                            //            break;
                            //    }
                            //}
                            #endregion

                            value *= -1;
                        }
                    }
                }
                if (imbueItem is Red)
                {
                    value = -imbueitem.IncreaseValue;
                    int randStat = 0;
                    BaseItem temp = itemDataManager.GetItemByReferenceID(item.ReferenceID);
                    Equipment Temp = temp as Equipment;
                    stat = ImbueStat.None;

                    RedStats = new List<ImbueStat>();
                    RedStats.Add(ImbueStat.RequiredLevel);
                    RedStats.Add(ImbueStat.RequiredEnergy);
                    RedStats.Add(ImbueStat.RequiredDexterity);
                    RedStats.Add(ImbueStat.RequiredStamina);
                    RedStats.Add(ImbueStat.RequiredStrength);

                    if (Item.RequiredLevel == 0)
                        RedStats.Remove(ImbueStat.RequiredLevel);
                    if (Item.RequiredEnergy == 0)
                        RedStats.Remove(ImbueStat.RequiredEnergy);
                    if (Item.RequiredDexterity == 0)
                        RedStats.Remove(ImbueStat.RequiredDexterity);
                    if (Item.RequiredStamina == 0)
                        RedStats.Remove(ImbueStat.RequiredStamina);
                    if (Item.RequiredStrength == 0)
                        RedStats.Remove(ImbueStat.RequiredStrength);

                    if (RedStats.Count == 0) // no stats left blabla
                        error = ImbueError.ImbueImpossible;
                    else // theres one stat to remove :)
                    {
                        if (imbueitem.ImbueData == 0)
                        {
                            if (RedStats.Count == 1)
                                stat = RedStats[0];
                            else
                            {
                                randStat = XiahRandom.Next(0, RedStats.Count);
                                stat = RedStats[randStat];
                            }
                        }
                        else
                        {
                            switch (imbueitem.ImbueData)
                            {
                                case 2:
                                    stat = ImbueStat.RequiredLevel;
                                    break;
                                case 3:
                                    stat = ImbueStat.RequiredStrength;
                                    break;
                                case 4:
                                    stat = ImbueStat.RequiredStamina;
                                    break;
                                case 5:
                                    stat = ImbueStat.RequiredDexterity;
                                    break;
                                case 6:
                                    stat = ImbueStat.RequiredEnergy;
                                    break;
                                default:
                                    stat = ImbueStat.RequiredLevel;
                                    break;
                            }
                        }

                        if (stat == ImbueStat.RequiredLevel)
                        {

                            if (XiahRandom.PercentSuccess(SuccessChance - (Temp.RequiredLevel - Item.RequiredLevel) * 4))
                                gameEngine.RedImbue(Item, stat, ref value, true, ref error); //if succeeded, pass the success value as 1, as well as pass the error
                            else
                                gameEngine.RedImbue(Item, stat, ref value, false, ref error); //if failed, random between -1 and 0, as well as pass the error
                        }
                        else if (stat == ImbueStat.RequiredStrength)
                        {
                            if (XiahRandom.PercentSuccess(SuccessChance - (Temp.RequiredStrength - Item.RequiredStrength) * 4))

                                gameEngine.RedImbue(Item, stat, ref value, true, ref error);
                            else
                                gameEngine.RedImbue(Item, stat, ref value, false, ref error);
                        }
                        else if (stat == ImbueStat.RequiredStamina)
                        {
                            if (XiahRandom.PercentSuccess(SuccessChance - (Temp.RequiredStamina - Item.RequiredStamina) * 4))
                                gameEngine.RedImbue(Item, stat, ref value, true, ref error);
                            else
                                gameEngine.RedImbue(Item, stat, ref value, false, ref error);
                        }
                        else if (stat == ImbueStat.RequiredDexterity)
                        {
                            if (XiahRandom.PercentSuccess(SuccessChance - (Temp.RequiredDexterity - Item.RequiredDexterity) * 4))
                                gameEngine.RedImbue(Item, stat, ref value, true, ref error);
                            else
                                gameEngine.RedImbue(Item, stat, ref value, false, ref error);
                        }
                        else if (stat == ImbueStat.RequiredEnergy)
                        {
                            if (XiahRandom.PercentSuccess(SuccessChance - (Temp.RequiredEnergy - Item.RequiredEnergy) * 4))
                                gameEngine.RedImbue(Item, stat, ref value, true, ref error);
                            else
                                gameEngine.RedImbue(Item, stat, ref value, false, ref error);
                        }
                    }
                }
                if (imbueitem is RbHoleItem)
                {
                    if (Item.RebirthHole == 1)
                    {
                        if (c.MyCharacter.Money >= (imbueitem.Price * 10))
                        {
                            c.MyCharacter.Money -= (imbueitem.Price * 10);
                            Item.RebirthHole = imbueitem.ImbueChance;
                            Item.RebirthHoleStat = imbueitem.IncreaseValue;

                            if (imbueitem.ImbueChance == (short)RebirthHoleItems.Durability ||
                                imbueitem.ImbueChance == (short)RebirthHoleItems.LevelReq)
                            {
                                if (imbueitem.ImbueChance == (short)RebirthHoleItems.Durability)
                                {
                                    float curdur = (float)Item.MaxDurability;
                                    float incDur = curdur * 0.20f;
                                    Item.MaxDurability += (short)incDur;
                                    Item.Durability = Item.MaxDurability;
                                }
                                else
                                {
                                    Item.RequiredLevel -= 5;
                                }
                            }

                            c.Send(PacketManager.SendMoneyLeft(c.MyCharacter.Money));

                            stat = (ImbueStat)255;
                            value = 0;
                            error = ImbueError.Success;
                        }
                        else
                        {
                            c.Send(PacketManager.SendImbueMessage(ImbueError.NotEnoughtMoney, 0, 0, Item));
                            return;
                        }
                    }
                    else
                    {
                        c.Send(PacketManager.SendImbueMessage(ImbueError.ImbueImpossible, 0, 0, Item));
                        return;
                    }
                }

                if (imbueitem is Red && error == ImbueError.FailedToRemake && value == 0)
                {
                    stat = ImbueStat.None;
                    // just send failed to remake blabla
                }
                else if (imbueitem is Red && error == ImbueError.FailedToRemake && value < 0)
                {
                    value = -value; // so it shows increasement
                }

                c.Send(PacketManager.SendImbueMessage(error, stat, value, Item));

                c.Send(PacketManager.SendRemoveItem(i.ImbueItem1Bag, i.ImbueItem1Slot));

                itemDataManager.DeleteItem(imbueItem.ItemID);
                c.MyCharacter.Bags[i.ImbueItem1Bag - 1].RemoveItem(imbueItem);

                if (imbueItem2 != null)
                {
                    c.Send(PacketManager.SendRemoveItem(i.ImbueItem2Bag, i.ImbueItem2Slot));
                    itemDataManager.DeleteItem(imbueItem2.ItemID);
                    c.MyCharacter.Bags[i.ImbueItem2Bag - 1].RemoveItem(imbueItem2);
                    if (imbueItem3 != null)
                    {
                        c.Send(PacketManager.SendRemoveItem(i.ImbueItem3Bag, i.ImbueItem3Slot));
                        itemDataManager.DeleteItem(imbueItem3.ItemID);
                        c.MyCharacter.Bags[i.ImbueItem3Bag - 1].RemoveItem(imbueItem3);
                    }
                }

                Item.ImbueTries++;
                c.Send(PacketManager.SendImbuedItem(Item));

                itemDataManager.UpdateItem(Item);
            }
            catch
            {
            }
        }