예제 #1
0
            public override void OnResponse(GameClient sender, RelayInfo info)
            {
                if (info.ButtonID == 1 && !m_Binder.Deleted && !m_ToBound.Deleted && m_ToBound.IsChildOf(sender.Mobile.Backpack))
                {
                    m_Binder.Total += (int)(m_ToBound.Value * 10);
                    m_ToBound.Delete();

                    m_Binder.CheckCompleted(sender.Mobile);
                }
            }
예제 #2
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!
     }
 }
예제 #3
0
            public override void OnResponse(NetState sender, RelayInfo info)
            {
                Mobile from = sender.Mobile;

                if (info.ButtonID == 1 && m_Scroll != null && m_Binder != null)
                {
                    m_Binder.GiveItem(from, new ScrollOfTranscendence(m_Scroll.Skill, m_Needed));
                    m_Scroll.Delete();
                    m_Binder.Delete();
                    from.SendLocalizedMessage(1113145); // You've completed your binding and received an upgraded version of your scroll!
                }
            }
예제 #4
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (targeted is Item && !((Item)targeted).IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
                return;
            }

            switch (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.
                        return;
                    }

                    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;
                    }

                    Value      = value;
                    Needed     = needed;
                    Has        = 1;
                    Skill      = ps.Skill;
                    BinderType = BinderType.PowerScroll;
                    ps.Delete();
                }
                else if (targeted is StatCapScroll)
                {
                    StatCapScroll ss = (StatCapScroll)targeted;

                    if (ss.Value >= 250)
                    {
                        from.SendLocalizedMessage(1113144);         //This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    double value  = ss.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;
                    }

                    Value      = value;
                    Needed     = needed;
                    Has        = 1;
                    BinderType = BinderType.StatScroll;
                    ss.Delete();
                }
                else if (targeted is ScrollOfTranscendence)
                {
                    ScrollOfTranscendence sot = (ScrollOfTranscendence)targeted;

                    if (sot.Value >= 5.0)
                    {
                        from.SendLocalizedMessage(1113144);         //This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    Skill      = sot.Skill;
                    BinderType = BinderType.SOT;
                    Needed     = 2;
                    Has        = sot.Value;
                    sot.Delete();
                }
                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.Skill != Skill || ps.Value != Value)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has++;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new PowerScroll(Skill, Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        ps.Delete();
                        Delete();
                    }
                    else
                    {
                        ps.Delete();
                    }
                }
                else if (targeted is ScrollBinderDeed)
                {
                    ScrollBinderDeed sb = (ScrollBinderDeed)targeted;

                    if (sb == this)
                    {
                        return;
                    }

                    if (sb.BinderType != BinderType || sb.Value != Value || sb.Skill != Skill)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has += sb.Has;

                    double rest = Has - Needed;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new PowerScroll(Skill, Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }

                    if (rest > 0)
                    {
                        sb.Has = rest;
                    }
                    else
                    {
                        sb.Delete();
                    }
                }
                break;
            }

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

                    if (ss.Value != Value)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has++;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new StatCapScroll((int)Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        ss.Delete();
                        Delete();
                    }
                    else
                    {
                        ss.Delete();
                    }
                }
                else if (targeted is ScrollBinderDeed)
                {
                    ScrollBinderDeed sb = (ScrollBinderDeed)targeted;

                    if (sb == this)
                    {
                        return;
                    }

                    if (sb.BinderType != BinderType || sb.Value != Value)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    Has += sb.Has;

                    double rest = Has - Needed;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new StatCapScroll((int)Value + 5));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }

                    if (rest > 0)
                    {
                        sb.Has = rest;
                    }
                    else
                    {
                        sb.Delete();
                    }
                }
                break;
            }

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

                    if (sot.Skill != Skill)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    if (sot.Value >= 5.0)
                    {
                        from.SendLocalizedMessage(1113144);         // This scroll is already the highest of its type and cannot be bound.
                        return;
                    }

                    double newValue = sot.Value + Has;

                    if (newValue > 2 && Needed == 2)
                    {
                        Needed = 5;
                    }

                    if (newValue == Needed)
                    {
                        GiveItem(from, new ScrollOfTranscendence(Skill, Needed));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }
                    else if (newValue > Needed)
                    {
                        from.SendGump(new BinderWarningGump(newValue, this, sot, Needed));
                    }
                    else
                    {
                        Has += sot.Value;
                        sot.Delete();
                    }
                }
                else if (targeted is ScrollBinderDeed)
                {
                    ScrollBinderDeed sb = (ScrollBinderDeed)targeted;

                    if (sb == this)
                    {
                        return;
                    }

                    if (sb.BinderType != BinderType || sb.Skill != Skill)
                    {
                        from.SendLocalizedMessage(1113143);         // This scroll does not match the type currently being bound.
                        return;
                    }

                    double newValue = sb.Has + Has;

                    if (newValue > 2 && Needed == 2)
                    {
                        Needed = 5;
                    }

                    Has = newValue;

                    double rest = Has - Needed;

                    if (Has >= Needed)
                    {
                        GiveItem(from, new ScrollOfTranscendence(Skill, Needed));
                        from.SendLocalizedMessage(1113145);         // You've completed your binding and received an upgraded version of your scroll!
                        Delete();
                    }

                    if (rest > 0)
                    {
                        sb.Has = rest;
                    }
                    else
                    {
                        sb.Delete();
                    }
                }
                break;
            }
            }
        }
예제 #5
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();
        }