DarkEmu_GameServer.Systems.HandlePotion C# (CSharp) Метод

HandlePotion() приватный Метод

private HandlePotion ( byte type, int ItemID ) : void
type byte
ItemID int
Результат void
        void HandlePotion(byte type, int ItemID)
        {
            try
            {
                if (type == 1) // hp
                {
                    long Total = (Character.Stat.Hp * Character.Information.Level * (long)Data.ItemBase[ItemID].Use_Time) / HandlePotionLevel(Character.Stat.Hp);
                    byte pslot = Getfreepotslot(Character.Information.Item.Potion);
                    StartPotionTimer(920, new int[] { (int)Total, type, pslot }, pslot);
                }
                else if (type == 2)//mp
                {
                    long Total = (Character.Stat.Mp * Character.Information.Level * (long)Data.ItemBase[ItemID].Use_Time2) / HandlePotionLevel(Character.Stat.Mp);
                    byte pslot = Getfreepotslot(Character.Information.Item.Potion);
                    StartPotionTimer(920, new int[] { (int)Total, type, pslot }, pslot);
                }
                else if (type == 3) //hp %25
                {
                    long Total = (Character.Stat.Hp * 25) / 100;
                    byte pslot = Getfreepotslot(Character.Information.Item.Potion);
                    Character.Information.Item.Potion[pslot] = 4;
                    StartPotionTimer(920, new int[] { (int)Total, type, pslot }, pslot);
                }
                else if (type == 4) //mp %25
                {
                    long Total = (Character.Stat.Mp * 25) / 100;
                    byte pslot = Getfreepotslot(Character.Information.Item.Potion);
                    Character.Information.Item.Potion[pslot] = 4;
                    StartPotionTimer(920, new int[] { (int)Total, type, pslot }, pslot);
                }
                else if (type == 5)// Vigor potions
                {
                    //This will be the definitions so they cannot be edited in pk2
                    //Hard coded wont allow exploitations.
                    int hprecovery = 0;
                    int mprecovery = 0;

                    switch (Data.ItemBase[ItemID].Name)
                    {
                        case "ITEM_ETC_ALL_POTION_01":
                            hprecovery = 120;
                            mprecovery = 120;
                            break;
                        case "ITEM_ETC_ALL_POTION_02":
                            hprecovery = 220;
                            mprecovery = 220;
                            break;
                        case "ITEM_ETC_ALL_POTION_03":
                            hprecovery = 370;
                            mprecovery = 370;
                            break;
                        case "ITEM_ETC_ALL_POTION_04":
                            hprecovery = 570;
                            mprecovery = 570;
                            break;
                        case "ITEM_ETC_ALL_POTION_05":
                            hprecovery = 820;
                            mprecovery = 820;
                            break;
                    }

                    long Total = (Character.Stat.Hp * Character.Information.Level * (long)Data.ItemBase[ItemID].Use_Time) / HandlePotionLevel(Character.Stat.Hp);
                    byte pslot = Getfreepotslot(Character.Information.Item.Potion);
                    StartPotionTimer(920, new int[] { (int)Total, type, pslot }, pslot);
                }
            }
            catch (Exception ex)
            {
                Systems.Debugger.Write(ex);
            }
        }
Systems