Exemplo n.º 1
0
 public override void Confirm(Mobile from)
 {
     if (m_Scroll != null && m_Binder != null)
     {
         m_Binder.GiveItem(from, new ScrollofTranscendence(m_Scroll.Skill, m_Needed));
         m_Scroll.Delete();
         m_Binder.Delete();
         from.PlaySound(0x249);
         from.SendLocalizedMessage(1113145); //You've completed your binding and received an upgraded version of your scroll!
     }
 }
Exemplo n.º 2
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (targeted is Item && !((Item)targeted).IsChildOf(from.Backpack))
            {
                from.SendMessage("The scroll must be in your backpack to bind.");
                return;
            }

            switch (m_BinderType)
            {
            case BinderType.None:
            {
                if (targeted is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)targeted;

                    if (ps.Value >= 120)
                    {
                        from.SendLocalizedMessage(1113144);                                     //This scroll is already the highest of its type and cannot be bound.
                    }
                    else
                    {
                        double value  = ps.Value;
                        int    needed = 0;
                        if (value == 105)
                        {
                            needed = 8;
                        }
                        else if (value == 110)
                        {
                            needed = 12;
                        }
                        else if (value == 115)
                        {
                            needed = 10;
                        }
                        else
                        {
                            return;
                        }

                        m_Value      = value;
                        m_Needed     = needed;
                        m_Has        = 1;
                        m_Skill      = ps.Skill;
                        m_BinderType = BinderType.PowerScroll;
                        ps.Delete();
                        from.SendMessage("Binding Powerscroll.");
                        from.PlaySound(0x249);
                    }
                }
                else if (targeted is StatCapScroll)
                {
                    StatCapScroll ps = (StatCapScroll)targeted;

                    if (ps.Value >= 250)
                    {
                        from.SendLocalizedMessage(1113144);                                     //This scroll is already the highest of its type and cannot be bound.
                    }
                    else
                    {
                        double value  = ps.Value;
                        int    needed = 0;
                        if (value == 230)
                        {
                            needed = 6;
                        }
                        else if (value == 235)
                        {
                            needed = 8;
                        }
                        else if (value == 240)
                        {
                            needed = 8;
                        }
                        else if (value == 245)
                        {
                            needed = 5;
                        }
                        else
                        {
                            return;
                        }

                        m_Value      = value;
                        m_Needed     = needed;
                        m_Has        = 1;
                        m_BinderType = BinderType.StatScroll;
                        ps.Delete();
                        from.SendMessage("Binding Stat Scroll.");
                        from.PlaySound(0x249);
                    }
                }
                else if (targeted is ScrollofTranscendence)
                {
                    ScrollofTranscendence sot = (ScrollofTranscendence)targeted;

                    m_Skill      = sot.Skill;
                    m_BinderType = BinderType.SOT;
                    m_Needed     = 5;
                    m_Has        = sot.Value;
                    sot.Delete();
                    from.SendLocalizedMessage(1113146);         //Binding Scrolls of Transcendence
                    from.PlaySound(0x249);
                }
                else
                {
                    from.SendLocalizedMessage(1113142);                                     //You may only bind powerscrolls, stats scrolls or scrolls of transcendence.
                }
                break;
            }

            case BinderType.PowerScroll:
            {
                if (targeted is PowerScroll)
                {
                    PowerScroll ps = (PowerScroll)targeted;

                    if (ps.Value == m_Value)
                    {
                        if (ps.Skill == m_Skill)
                        {
                            m_Has++;

                            if (m_Has >= m_Needed)
                            {
                                GiveItem(from, new PowerScroll(m_Skill, m_Value + 5));
                                from.SendLocalizedMessage(1113145);                                                 //You've completed your binding and received an upgraded version of your scroll!
                                ps.Delete();
                                Delete();
                            }
                            else
                            {
                                ps.Delete();
                                from.PlaySound(0x249);
                                from.SendMessage("Binding Powerscroll.");
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(1113143);         //This scroll does not match the type currently being bound.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113143);                                         //This scroll does not match the type currently being bound.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1113143);                                     //This scroll does not match the type currently being bound.
                }
                break;
            }

            case BinderType.StatScroll:
            {
                if (targeted is StatCapScroll)
                {
                    StatCapScroll stat = (StatCapScroll)targeted;

                    if (stat.Value == m_Value)
                    {
                        m_Has++;

                        if (m_Has >= m_Needed)
                        {
                            GiveItem(from, new StatCapScroll((int)m_Value + 5));
                            from.SendLocalizedMessage(1113145);                                             //You've completed your binding and received an upgraded version of your scroll!
                            stat.Delete();
                            Delete();
                        }
                        else
                        {
                            from.SendMessage("Binding Stat Scroll.");
                            from.PlaySound(0x249);
                            stat.Delete();
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113143);                                         //This scroll does not match the type currently being bound.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1113143);                                 //This scroll does not match the type currently being bound.
                }
                break;
            }

            case BinderType.SOT:
            {
                if (targeted is ScrollofTranscendence)
                {
                    ScrollofTranscendence sot = (ScrollofTranscendence)targeted;

                    if (sot.Skill == m_Skill)
                    {
                        double newValue = sot.Value + m_Has;

                        if (newValue == m_Needed)
                        {
                            GiveItem(from, new ScrollofTranscendence(m_Skill, m_Needed));
                            from.SendLocalizedMessage(1113145);                                             //You've completed your binding and received an upgraded version of your scroll!
                            Delete();
                        }
                        else if (newValue > m_Needed)
                        {
                            from.SendGump(new BinderWarningGump(newValue, this, sot, m_Needed));
                        }
                        else
                        {
                            m_Has += sot.Value;
                            sot.Delete();
                            from.PlaySound(0x249);
                            from.SendLocalizedMessage(1113146);         //Binding Scrolls of Transcendence
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1113143);                                         //This scroll does not match the type currently being bound.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1113143);         //This scroll does not match the type currently being bound.
                }
                break;
            }
            }

            InvalidateProperties();
        }