public static void HandleStatsUpgradeRequestMessage(WorldClient client, StatsUpgradeRequestMessage message)
        {
            StatsBoostTypeEnum statId = (StatsBoostTypeEnum)message.statId;

            if (statId < StatsBoostTypeEnum.Strength || statId > StatsBoostTypeEnum.Intelligence)
            {
                throw new System.Exception("Wrong statsid");
            }
            if (message.boostPoint > 0)
            {
                Breed breed = client.Character.Breed;
                int   num   = client.Character.Stats[ContextRoleplayHandler.m_statsEnumRelations[statId]].Base;
                short num2  = (short)message.boostPoint;
                if (num2 >= 1 && message.boostPoint <= (short)client.Character.StatsPoints)
                {
                    uint[][] thresholds     = breed.GetThresholds(statId);
                    int      thresholdIndex = breed.GetThresholdIndex(num, thresholds);
                    while ((long)num2 >= (long)((ulong)thresholds[thresholdIndex][1]))
                    {
                        short num3;
                        short num4;
                        if (thresholdIndex < thresholds.Length - 1 && (double)num2 / thresholds[thresholdIndex][1] > (double)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num)))
                        {
                            num3 = (short)((ulong)thresholds[thresholdIndex + 1][0] - (ulong)((long)num));
                            num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1]));
                            if (thresholds[thresholdIndex].Length > 2)
                            {
                                num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2]));
                            }
                        }
                        else
                        {
                            num3 = (short)System.Math.Floor((double)num2 / thresholds[thresholdIndex][1]);
                            num4 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][1]));
                            if (thresholds[thresholdIndex].Length > 2)
                            {
                                num3 = (short)((long)num3 * (long)((ulong)thresholds[thresholdIndex][2]));
                            }
                        }
                        num           += (int)num3;
                        num2          -= num4;
                        thresholdIndex = breed.GetThresholdIndex(num, thresholds);
                    }
                    client.Character.Stats[ContextRoleplayHandler.m_statsEnumRelations[statId]].Base = num;
                    Character expr_1A0 = client.Character;
                    expr_1A0.StatsPoints -= (ushort)(message.boostPoint - num2);
                    ContextRoleplayHandler.SendStatsUpgradeResultMessage(client, (short)message.boostPoint);
                    client.Character.RefreshStats();
                }
            }
        }