Пример #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!
     }
 }
Пример #2
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!
                }
            }
Пример #3
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;
            }
            }
        }