Пример #1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if ((from == null) || (m_skb.Deleted))
            {
                return;
            }

            m_skb.GumpOpen = false;

            if (info.ButtonID > 0)
            {
                m_Skill = from.Skills[(info.ButtonID - 1)];

                if (m_Skill == null)
                {
                    return;
                }

                double count = 0;
                for (int i = 0; i < from.Skills.Length; ++i)
                {
                    count += from.Skills[i].Base;
                }

                if ((count + m_skb.SkillBonus) > (from.SkillsCap / 10))
                {
                    from.SendMessage("You cannot exceed the skill cap.");
                    return;
                }

                if (m_Skill.Base + m_skb.SkillBonus <= 100)
                {
                    m_Skill.Base += m_skb.SkillBonus;
                    m_skb.Delete();
                }
                else
                {
                    from.SendMessage("You have to choose another skill.");
                }
            }
        }
Пример #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if ((from == null) || (m_skb.Deleted))
            {
                return;
            }

            m_skb.GumpOpen = false;

            if (info.ButtonID > 0)
            {
                m_Skill = from.Skills[(info.ButtonID - 1)];

                if (m_Skill == null)
                {
                    return;
                }

                double    count          = from.Skills.Total / 10;
                double    cap            = from.SkillsCap / 10;
                ArrayList decreased      = new ArrayList();
                double    decreaseamount = 0.0;
                double    bonuscopy      = (50.0 - m_Skill.Base);
                if ((count + bonuscopy) > cap)
                {
                    for (int i = 0; i < from.Skills.Length; i++)
                    {
                        if (from.Skills[i].Lock == SkillLock.Down)
                        {
                            decreased.Add(from.Skills[i]);
                            decreaseamount += from.Skills[i].Base;
                            break;
                        }
                    }
                    if (decreased.Count == 0)
                    {
                        from.SendMessage("You have exceeded the skill cap and do not have a skill set to be decreased.");
                        return;
                    }
                }

                if (m_Skill.Base + bonuscopy <= 100)                 // Show skills that are level
                {
                    if ((cap - count) + decreaseamount >= bonuscopy)
                    {
                        if (cap - count >= bonuscopy)
                        {
                            m_Skill.Base += bonuscopy;
                            bonuscopy     = 0;
                        }
                        else
                        {
                            m_Skill.Base += bonuscopy;
                            bonuscopy    -= cap - count;

                            foreach (Skill s in decreased)
                            {
                                if (s.Base >= bonuscopy)
                                {
                                    s.Base   -= bonuscopy;
                                    bonuscopy = 0;
                                }
                                else
                                {
                                    bonuscopy -= s.Base;
                                    s.Base     = 0;
                                }

                                if (bonuscopy == 0)
                                {
                                    break;
                                }
                            }
                        }
                        m_skb.Delete();
                    }
                    else
                    {
                        from.SendMessage("You must have enough skill set down to compensate for the skill gain.");
                    }
                }
                else
                {
                    from.SendMessage("You have to choose another skill.");
                }
            }
        }
Пример #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null || m_SkillBall.Deleted)
            {
                return;
            }

            if (m_SkillBall.Expires && DateTime.UtcNow >= m_SkillBall.ExpireDate)
            {
                m_SkillBall.SendLocalizedMessageTo(from, 1042544);                   // This item is out of charges.
            }
            else if (!m_SkillBall.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else if (info.ButtonID > 0)
            {
                SkillName skillname = (m_SkillBall.GetAllowedSkills())[info.ButtonID - 1];
                m_Skill = m_Target.Skills[skillname];

                if (m_Skill == null)
                {
                    return;
                }

                double count = m_Target.Skills.Total / 10;
                double cap   = m_Target.SkillsCap / 10;
                double decreaseamount;
                int    bonus = m_SkillBall.SkillBonus;

                List <Skill> decreased = m_SkillBall.GetDecreasableSkills(from, m_Target, count, cap, out decreaseamount);

                if (decreased.Count > 0 && decreaseamount <= 0)
                {
                    from.SendMessage("You have exceeded the skill cap and do not have a skill set to be decreased.");
                }
                else if (m_SkillBall.NewbieBall && m_Skill.Base > 0)
                {
                    from.SendMessage("You may only choose skills which are at zero.");
                }
                else if ((m_Skill.Base + bonus) > m_Skill.Cap)
                {
                    from.SendMessage("Your skill is too high to raise it further.");
                }
                else if (m_Skill.Lock != SkillLock.Up)
                {
                    from.SendMessage("You must set the skill to be increased in order to raise it further.");
                }
                else
                {
                    if ((cap - count + decreaseamount) >= bonus)
                    {
                        m_SkillBall.DecreaseSkills(from, m_Target, decreased, count, cap, decreaseamount);
                        m_SkillBall.IncreaseSkill(from, m_Target, m_Skill);

                        if (!m_SkillBall.Rechargable)
                        {
                            m_SkillBall.Delete();
                        }
                    }
                    else
                    {
                        from.SendMessage("You have exceeded the skill cap and do not have enough skill set to be decreased.");
                    }
                }
            }
        }