예제 #1
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    from.SendMessage("This scroll cannot be applied to that!");
                }
                else if (target is Item)
                {
                    Item item = (Item)target;

                    if (item.RootParent != from || !item.IsChildOf(from.Backpack)) // Make sure its in their pack or they are wearing it
                    {
                        from.SendMessage("The item must be in your pack to level it up.");
                    }
                    else
                    {
                        XmlLevelItem levitem = XmlAttach.FindAttachment(item, typeof(XmlLevelItem)) as XmlLevelItem;

                        //if (target is ILevelable)
                        if (levitem != null)
                        {
                            //ILevelable b = (ILevelable)target;

                            //if ((b.MaxLevel + m_Scroll.Value) > LevelItems.MaxLevelsCap)
                            if ((levitem.MaxLevel + m_Scroll.Value) > LevelItems.MaxLevelsCap)
                            {
                                from.SendMessage("The level on this item is already too high to use this scroll!");
                            }
                            else
                            {
                                //b.MaxLevel += m_Scroll.Value;
                                levitem.MaxLevel += m_Scroll.Value;
                                from.SendMessage("Your item has leveled up by " + m_Scroll.Value + " levels.");
                                m_Scroll.Delete();
                            }
                        }
                        else
                        {
                            from.SendMessage("Invalid Target Type.  Levelable Weapons, Armor, Jewelery and Clothing only!");
                        }
                    }
                }
                else
                {
                    from.SendMessage("Invalid Target Type.  Levelable Weapons, Armor, Jewelery and Clothing only!");
                }
            }
예제 #2
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    from.SendMessage("This rune cannot enhance that!");
                }
                else if (target is Item)
                {
                    Item item = (Item)target;

                    if (item.RootParent != from || !item.IsChildOf(from.Backpack)) // Make sure its in their pack or they are wearing it
                    {
                        from.SendMessage("The legendary artifact must be in your pack to enhance.");
                    }
                    else
                    {
                        if (target is ILevelable)
                        {
                            ILevelable b = (ILevelable)target;

                            if ((b.MaxLevel + m_Scroll.Value) > LevelItems.MaxLevelsCap)
                            {
                                from.SendMessage("The level on this legendary artifact is already too high to use this rune!");
                            }
                            else
                            {
                                b.MaxLevel += m_Scroll.Value;
                                from.SendMessage("Your legendary artifact has been enhanced by " + m_Scroll.Value + " levels.");
                                m_Scroll.Delete();
                            }
                        }
                        else
                        {
                            from.SendMessage("This rune cannot enhance that!");
                        }
                    }
                }
                else
                {
                    from.SendMessage("This rune cannot enhance that!");
                }
            }