Пример #1
0
 public GateTravelSpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book)
     : base(caster, scroll, m_Info)
 {
     m_Entry = entry;
     m_Book = book;
     m_Scroll = scroll;
 }
Пример #2
0
        private static void CustomRunebookTravel(NetState state, PacketReader pvSrc)
        {
            int RuneBookSerial = pvSrc.ReadInt32();

            byte recall = pvSrc.ReadByte();

            var X = pvSrc.ReadInt16();

            var Y = pvSrc.ReadInt16();

            var mapbyte = Convert.ToInt16(pvSrc.ReadByte());

            var runebook = World.FindItem(RuneBookSerial) as Runebook;

            var map = Map.Maps[mapbyte];

            if (runebook != null && runebook.RootParentEntity == state.Mobile && runebook.Entries != null)
            {
                var findentry = runebook.Entries.FirstOrDefault(x => x.Location.X == X && x.Location.Y == Y);
                if (findentry != null)
                {
                    var portentry = findentry.Location;
                    var entry = new RunebookEntry(portentry, findentry.Map, "", null);
                    if (recall == 0)
                    {
                        new RecallSpell(state.Mobile, null, entry, null).Cast();
                    }
                    else
                    {
                        new GateTravelSpell(state.Mobile, null, entry).Cast();
                    }
                }
            }
        }
Пример #3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallScroll)
            {
                Item scrolls = dropped as Item;
                int  amount  = scrolls.Amount;

                if (amount <= 0)
                {
                    return(false); //amount should not be zero, but better safe than sorry.
                }
                int count = 0;     //this keeps track of the count of scrolls added to each runebook
                int total = 0;     //this keeps track of the total added to all runebooks
                for (int x = 0; x < 51; x++)
                {
                    if (Books[x].Entries.Count < 16)                   //check each runebook
                    {
                        if (Books[x].CurCharges < Books[x].MaxCharges) //if there is space for more charges...
                        {
                            from.Send(new PlaySound(0x249, from.Location));

                            if (amount > (Books[x].MaxCharges - Books[x].CurCharges))  //if the amount of scrolls is > than space free
                            {
                                count = Books[x].MaxCharges - Books[x].CurCharges;
                                scrolls.Consume(count);
                                Books[x].CurCharges = Books[x].MaxCharges;
                                total  += count;
                                amount -= count;
                            }
                            else  //otherwise we just add/delete whatever scrolls are left
                            {
                                Books[x].CurCharges += amount;
                                scrolls.Delete();
                                total += amount;
                                amount = 0;
                            }
                        }
                    }
                    if (amount <= 0)
                    {
                        from.SendMessage("{0} Recall Scrolls were added.", total.ToString());
                        return(true);
                    }
                }
            }
            else
            if (dropped is RecallRune)
            {
                for (int x = 0; x < 51; x++)
                {
                    if (Books[x].Entries.Count < 16)
                    {
                        RecallRune rune = (RecallRune)dropped;

                        if (rune.Marked && rune.TargetMap != null)
                        {
                            Books[x].Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                            dropped.Delete();

                            from.Send(new PlaySound(0x42, GetWorldLocation()));

                            string desc = rune.Description;

                            if (desc == null || (desc = desc.Trim()).Length == 0)
                            {
                                desc = "(indescript)";
                            }

                            from.SendMessage(desc);

                            return(true);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502409);     // This rune does not have a marked location.
                        }
                    }
                }
                from.SendLocalizedMessage(502401);     // This runebook is full.
            }
            else
            if (dropped is Runebook)
            {
                if (((Runebook)dropped).Entries.Count > 0)
                {
                    for (int x = 0; x < 51; x++)
                    {
                        if (Books[x].Entries.Count == 0)
                        {
                            Runebook rb = dropped as Runebook;
                            for (int y = 0; y < rb.Entries.Count; y++)
                            {
                                RunebookEntry rune = rb.Entries[y] as RunebookEntry;
                                Books[x].Entries.Add(new RunebookEntry(rune.Location, rune.Map, rune.Description, rune.House));
                            }
                            Books[x].Name = rb.Name;
                            dropped.Delete();
                            return(true);
                        }
                    }
                    from.SendLocalizedMessage(502401);         // This runebook is full.
                }
                else
                {
                    from.SendMessage("Unable to add a blank runebook.");
                }
            }

            return(false);
        }
Пример #4
0
 public AvatarHeavensGateSpell( Mobile caster, Item scroll, RunebookEntry entry )
     : base(caster, scroll, m_Info)
 {
     m_Entry = entry;
 }
Пример #5
0
        public void DropRune(Mobile from, RunebookEntry e, int index)
        {
            if (this.m_DefaultIndex > index)
                this.m_DefaultIndex -= 1;
            else if (this.m_DefaultIndex == index)
                this.m_DefaultIndex = -1;

            this.m_Entries.RemoveAt(index);

            RecallRune rune = new RecallRune();

            rune.Target = e.Location;
            rune.TargetMap = e.Map;
            rune.Description = e.Description;
            rune.House = e.House;
            rune.Marked = true;

            from.AddToBackpack(rune);

            from.SendLocalizedMessage(502421); // You have removed the rune.
        }
Пример #6
0
 public SacredJourneySpell(Mobile caster, Item scroll, RunebookEntry entry, Runebook book)
     : base(caster, scroll, m_Info)
 {
     this.m_Entry = entry;
     this.m_Book = book;
 }
        public static void RemoveRunebook_Callback(Mobile from, bool okay, MasterRunebook master, InternalRunebook book, int id)
        {
            if (okay)
            {
                Container pack = from.Backpack;
                if (pack == null || pack.Deleted)
                {
                    from.SendMessage("Unable to find a backpack in which to place a new Runebook.");
                    return;
                }
                int count = book.Entries.Count;
                if (count > 0)
                {
                    if (from.AccessLevel < AccessLevel.GameMaster)
                    {
                        if (from.Backpack.ConsumeTotal(new Type[] { typeof(BlankScroll), typeof(RecallScroll), typeof(GateTravelScroll) },
                            new int[] { 10, 1, 1 }) >= 0)
                        {
                            from.SendMessage("You do not have the materials needed to create the runebook.");
                            return;
                        }
                        if (from.CheckSkill(SkillName.Inscribe, 100, 120))
                        {
                            from.SendMessage("You failed to extract the book. Some materials were lost.");
                            return;
                        }
                    }

                    Runebook runebook = new Runebook(book.MaxCharges);
                    for (int x = 0; x < count; x++)
                    {
                        RunebookEntry rbe = new RunebookEntry(
                            ((RunebookEntry)book.Entries[0]).Location, ((RunebookEntry)book.Entries[0]).Map,
                            ((RunebookEntry)book.Entries[0]).Description, ((RunebookEntry)book.Entries[0]).House);
                        runebook.Entries.Add(rbe);
                        book.Entries.RemoveAt(0);
                    }
                    runebook.CurCharges = book.CurCharges;
                    runebook.Name = book.Name;
                    book.Name = string.Format("Book #{0}", ((int)(id + 1)).ToString());
                    pack.DropItem(runebook);
                    from.SendMessage("Runebook extracted. Some materials were used.");
                }
                else
                {
                    from.SendMessage("You cannot remove an empty Runebook.");
                }
                from.CloseGump(typeof(InternalRunebookGump));
                from.SendGump(new InternalRunebookGump(from, book, master, id));
            }
            else
            {
                from.CloseGump(typeof(InternalRunebookGump));
                from.SendGump(new InternalRunebookGump(from, book, master, id));
            }
        }
Пример #8
0
		public void DropRune( Mobile from, RunebookEntry e, int index )
		{
			if ( m_DefaultIndex == index )
				m_DefaultIndex = -1;

			m_Entries.RemoveAt( index );

			RecallRune rune = new RecallRune();

			rune.Target = e.Location;
			rune.TargetMap = e.Map;
			rune.Description = e.Description;
			rune.House = e.House;
			rune.Marked = true;

			from.AddToBackpack( rune );

            //al: fix for default rune changing
            if (index == m_DefaultIndex)
            {
                //case 1: default rune removed => disable default rune.
                m_DefaultIndex = -1;
            }
            else if (index < m_DefaultIndex)
            {
                //case 2: index of removed rune < m_DefaultIndex => fix m_DefaultIndex
                m_DefaultIndex--;
            }
            //--
			from.SendLocalizedMessage( 502421 ); // You have removed the rune.
		}
Пример #9
0
 public UndeadTravelByPoisonSpell( Mobile caster, Item scroll, RunebookEntry entry, Runebook book )
     : base(caster, scroll, m_Info)
 {
     m_Entry = entry;
     m_Book = book;
 }
Пример #10
0
        public void DropRune( Mobile from, RunebookEntry e, int index )
        {
            if ( m_DefaultIndex == index )
                m_DefaultIndex = -1;

            m_Entries.RemoveAt( index );

            RecallRune rune = new RecallRune();

            rune.Target = e.Location;
            rune.TargetMap = e.Map;
            rune.Description = e.Description;
            rune.House = e.House;
            rune.Marked = true;

            from.AddToBackpack( rune );

            from.SendAsciiMessage( "You have removed the rune." );
        }
Пример #11
0
 public UndeadGraveyardGatewaySpell( Mobile caster, Item scroll, RunebookEntry entry )
     : base(caster, scroll, m_Info)
 {
     m_Entry = entry;
 }
Пример #12
0
 public void AddEntry(RunebookEntry entry)
 {
     m_Entries.Add(entry);
 }
Пример #13
0
		public void DropRune(Mobile from, RunebookEntry e, int index)
		{
			if (m_DefaultIndex > index)
			{
				m_DefaultIndex -= 1;
			}
			else if (m_DefaultIndex == index)
			{
				m_DefaultIndex = -1;
			}

			Entries.RemoveAt(index);

			from.AddToBackpack(
				new RecallRune
				{
					Target = e.Location,
					TargetMap = e.Map,
					Description = e.Description,
					House = e.House,
					Marked = true,
                    Hue = e.Hue
				});

			from.SendLocalizedMessage(502421); // You have removed the rune.
		}
Пример #14
0
        public void AddGumpLayout()
        {
            AddImage(0, 0, 39923);

            AddHtmlLocalized(60, 8, 180, 16, 1060728, String.Format("{0}\t{1}", Atlas.CurCharges, Atlas.MaxCharges), 1, false, false); //charges: ~1_val~ / ~2_val~

            AddHtmlLocalized(265, 8, 150, 16, 1011299, false, false);                                                                  // rename book
            AddButton(250, 12, 2103, 2103, 1, GumpButtonType.Reply, 0);

            int startIndex = Page * 16;
            int index      = 0;

            for (int i = startIndex; i < startIndex + 16; i++)
            {
                string desc;
                int    hue;

                if (i < Atlas.Entries.Count)
                {
                    desc = RunebookGump.GetName(Atlas.Entries[i].Description);
                    hue  = Selected == i ? 0x90 : RunebookGump.GetMapHue(Atlas.Entries[i].Map);
                }
                else
                {
                    desc = "Empty";
                    hue  = 0;
                }

                // Select Button
                AddButton(45 + ((index / 8) * 205), 64 + ((index % 8) * 20), 2103, 2104, i + 100, GumpButtonType.Reply, 0);

                // Description label
                AddLabelCropped(60 + ((index / 8) * 205), 60 + ((index % 8) * 20), 115, 17, hue, desc);

                index++;
            }

            if (Selected >= 0 && Selected < Atlas.Entries.Count)
            {
                RunebookEntry entry = Atlas.Entries[Selected];

                if (entry != null)
                {
                    string coords = ToCoordinates(entry.Location, entry.Map);

                    if (coords != "unknown")
                    {
                        AddHtml(40, 250, 155, 16, String.Format("<center>{0}</center>", coords), false, false);
                    }

                    AddHtmlLocalized(70, 291, 150, 16, 1011300, false, false); // Set default

                    if (Atlas.DefaultIndex != Selected)
                    {
                        AddButton(45, 295, 2103, 2103, 2, GumpButtonType.Reply, 0);
                    }

                    AddHtmlLocalized(70, 311, 150, 16, 1011298, false, false); // drop rune
                    AddButton(45, 315, 2103, 2103, 3, GumpButtonType.Reply, 0);

                    AddHtml(25, 345, 180, 16, String.Format("<center>{0}</center>", entry.Description), false, false);

                    AddHtmlLocalized(280, 286, 100, 16, 1077595, false, false); // Recall (Spell)
                    AddButton(265, 290, 2103, 2103, 4, GumpButtonType.Reply, 0);

                    AddHtmlLocalized(280, 303, 100, 16, 1077594, false, false); // Recall (Charge)
                    AddButton(265, 307, 2103, 2103, 5, GumpButtonType.Reply, 0);

                    AddHtmlLocalized(280, 320, 100, 16, 1015214, false, false); // Gate Travel
                    AddButton(265, 324, 2103, 2103, 6, GumpButtonType.Reply, 0);

                    AddHtmlLocalized(280, 337, 100, 16, 1060502, false, false); // Sacred Journey
                    AddButton(265, 341, 2103, 2103, 7, GumpButtonType.Reply, 0);
                }
            }

            if (Page < 2)
            {
                AddButton(374, 3, 2206, 2206, 1150, GumpButtonType.Reply, 0);
            }

            if (Page > 0)
            {
                AddButton(23, 5, 2205, 2205, 1151, GumpButtonType.Reply, 0);
            }
        }
Пример #15
0
			public static bool REMOVERUNEBOOKENTRY(TriggerObject trigObject, Runebook book, RunebookEntry entry)
			{
				return book != null && entry != null && book.Entries.Remove(entry);
			}
Пример #16
0
 public RangerPhoenixFlightSpell( Mobile caster, Item scroll, RunebookEntry entry, Runebook book )
     : base(caster, scroll, m_Info)
 {
     m_Entry = entry;
     m_Book = book;
 }
Пример #17
0
		public MushroomGatewaySpell( Mobile caster, Item scroll, RunebookEntry entry ) : base( caster, scroll, m_Info )
		{
			m_Entry = entry;
		}
Пример #18
0
        public override void AddGumpLayout()
        {
            AddImage(0, 0, 39923);

            AddHtmlLocalized(60, 9, 147, 22, 1011296, false, false); //Charges:
            AddHtml(110, 9, 97, 22, string.Format("{0} / {1}", Atlas.CurCharges, Atlas.MaxCharges), false, false);

            AddHtmlLocalized(264, 9, 144, 18, 1011299, false, false); // rename book
            AddButton(248, 14, 2103, 2103, 1, GumpButtonType.Reply, 0);

            int startIndex = Page * 16;
            int index      = 0;

            for (int i = startIndex; i < startIndex + 16; i++)
            {
                string desc;
                int    hue;

                if (i < Atlas.Entries.Count)
                {
                    desc = RunebookGump.GetName(Atlas.Entries[i].Description);
                    hue  = Selected == i ? 0x14B : GetMapHue(Atlas.Entries[i].Map);
                }
                else
                {
                    desc = "Empty";
                    hue  = 0;
                }

                // Select Button
                AddButton(46 + ((index / 8) * 205), 55 + ((index % 8) * 20), 2103, 2104, i + 100, GumpButtonType.Reply, 0);

                // Description label
                AddLabelCropped(62 + ((index / 8) * 205), 50 + ((index % 8) * 20), 144, 18, hue, desc);

                index++;
            }

            RunebookEntry entry = null;

            if (Selected >= 0 && Selected < Atlas.Entries.Count)
            {
                entry = Atlas.Entries[Selected];
            }

            string coords = entry != null?RunebookGump.GetLocation(entry) : "Nowhere";

            AddHtml(25, 254, 182, 18, string.Format("<center>{0}</center>", coords), false, false);

            AddHtmlLocalized(62, 290, 144, 18, 1011300, false, false); // Set default
            AddButton(46, 295, 2103, 2103, 2, GumpButtonType.Reply, 0);

            AddHtmlLocalized(62, 310, 144, 18, 1011298, false, false); // Drop rune
            AddButton(46, 315, 2103, 2103, 3, GumpButtonType.Reply, 0);

            AddHtml(25, 348, 182, 18, string.Format("<center>{0}</center>", entry != null ? entry.Description : "Empty"), false, false);

            int hy = 284;
            int by = 289;

            AddHtmlLocalized(280, hy, 128, 18, 1077595, false, false); // Recall (Spell)
            AddButton(264, by, 2103, 2103, 4, GumpButtonType.Reply, 0);

            hy += 18;
            by += 18;

            if (Atlas.CurCharges != 0)
            {
                AddHtmlLocalized(280, hy, 128, 18, 1077594, false, false); // Recall (Charge)
                AddButton(264, by, 2103, 2103, 5, GumpButtonType.Reply, 0);

                hy += 18;
                by += 18;
            }

            if (User.Skills[SkillName.Magery].Value >= 66.0)
            {
                AddHtmlLocalized(280, hy, 128, 18, 1015214, false, false); // Gate Travel
                AddButton(264, by, 2103, 2103, 6, GumpButtonType.Reply, 0);

                hy += 18;
                by += 18;
            }

            AddHtmlLocalized(280, hy, 128, 18, 1060502, false, false); // Sacred Journey
            AddButton(264, by, 2103, 2103, 7, GumpButtonType.Reply, 0);

            if (Page < 2)
            {
                AddButton(374, 3, 2206, 2206, 1150, GumpButtonType.Reply, 0);
            }

            if (Page > 0)
            {
                AddButton(23, 5, 2205, 2205, 1151, GumpButtonType.Reply, 0);
            }
        }
Пример #19
0
		public void DropRune( Mobile from, RunebookEntry e, int index )
		{
            if (CheckAccess(from))
            {
                if (m_DefaultIndex > index)
                    m_DefaultIndex -= 1;
                else if (m_DefaultIndex == index)
                    m_DefaultIndex = -1;

                m_Entries.RemoveAt(index);

                RecallRune rune = new RecallRune();

                rune.Target = e.Location;
                rune.TargetMap = e.Map;
                rune.Description = e.Description;
                rune.House = e.House;
                rune.Marked = true;
                rune.ChargesLeft = e.ChargesLeft;

                from.AddToBackpack(rune);

                from.SendLocalizedMessage(502421); // You have removed the rune.
            }

            else
            {
                from.SendLocalizedMessage(502413); // That cannot be done while the book is locked down.
            }
		}
Пример #20
0
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID >= 100 && info.ButtonID < 1000)
            {
                SelectEntry(info.ButtonID - 100);
            }
            else
            {
                RunebookEntry entry = null;

                if (Selected >= 0 && Selected < Atlas.Entries.Count)
                {
                    entry = Atlas.Entries[Selected];
                }

                switch (info.ButtonID)
                {
                case 0: Atlas.Openers.Remove(User); break;

                case 1: RenameBook(); break;

                case 2:
                {
                    if (entry != null)
                    {
                        SetDefault();
                    }
                    else
                    {
                        Atlas.Openers.Remove(User);
                    }
                    break;
                }

                case 3:
                {
                    if (entry != null)
                    {
                        DropRune(); break;
                    }
                    else
                    {
                        User.SendLocalizedMessage(502422);         // There is no rune to be dropped.
                        Atlas.Openers.Remove(User);
                    }
                    break;
                }

                case 4:
                {
                    if (entry != null)
                    {
                        RecallSpell();
                    }
                    else
                    {
                        User.SendLocalizedMessage(502423);         // This place in the book is empty.
                        Atlas.Openers.Remove(User);
                    }
                    break;
                }

                case 5:
                {
                    if (entry != null)
                    {
                        RecallCharge();
                    }
                    else
                    {
                        User.SendLocalizedMessage(502423);         // This place in the book is empty.
                        Atlas.Openers.Remove(User);
                    }
                    break;
                }

                case 6:
                {
                    if (entry != null)
                    {
                        GateTravel();
                    }
                    else
                    {
                        User.SendLocalizedMessage(502423);         // This place in the book is empty.
                        Atlas.Openers.Remove(User);
                    }
                    break;
                }

                case 7:
                {
                    if (entry != null)
                    {
                        SacredJourney();
                    }
                    else
                    {
                        User.SendLocalizedMessage(502423);         // This place in the book is empty.
                        Atlas.Openers.Remove(User);
                    }
                    break;
                }

                case 1150:
                    Page++;
                    Refresh();
                    break;

                case 1151:
                    Page--;
                    Refresh();
                    break;
                }
            }
        }
		public NaturesPassageSpell( Mobile caster, Item scroll, RunebookEntry entry, Runebook book ) : base( caster, scroll, m_Info )
		{
			m_Entry = entry;
			m_Book = book;
		}
Пример #22
0
        public void DropRune(Mobile from, RunebookEntry e, int index)
        {
            if (this.m_DefaultIndex > index)
                this.m_DefaultIndex -= 1;
            else if (this.m_DefaultIndex == index)
                this.m_DefaultIndex = -1;

            this.m_Entries.RemoveAt(index);

            if (e.Galleon != null)
            {
                if (e.Galleon.Deleted)
                {
                    from.SendMessage("You discard the rune as the galleon is no longer available.");
                    return;
                }
                else
                {
                    ShipRune rune = new ShipRune(e.Galleon);
                    from.AddToBackpack(rune);
                }
            }
            else
            {
                RecallRune rune = new RecallRune();

                rune.Target = e.Location;
                rune.TargetMap = e.Map;
                rune.Description = e.Description;
                rune.House = e.House;
                rune.Marked = true;

                from.AddToBackpack(rune);
            }

            from.SendLocalizedMessage(502421); // You have removed the rune.
        }
Пример #23
0
		public GateTravelSpell( Mobile caster, Item scroll, RunebookEntry entry ) : base( caster, scroll, m_Info )
		{
			m_Entry = entry;
		}
Пример #24
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune)
            {
                if (IsLockedDown && from.AccessLevel < AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
                }
                else if (IsOpen(from))
                {
                    from.SendLocalizedMessage(1005571); // You cannot place objects in the book while viewing the contents.
                }
                else if (m_Entries.Count < MaxEntries)
                {
                    if (dropped is RecallRune)
                    {
                        RecallRune rune = (RecallRune)dropped;

                        if (rune.Marked)
                        {
                            if (rune.Type == RecallRuneType.Ship)
                            {
                                RunebookEntry entry = new RunebookEntry(Point3D.Zero, null, null, null, rune.Type, rune.Galleon);
                                m_Entries.Add(entry);

                                dropped.Delete();

                                from.Send(new PlaySound(0x42, GetWorldLocation()));

                                from.SendAsciiMessage(entry.Description);

                                return(true);
                            }
                            else if (rune.TargetMap != null)
                            {
                                m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House, rune.Type));

                                dropped.Delete();

                                from.Send(new PlaySound(0x42, GetWorldLocation()));

                                string desc = rune.Description;

                                if (desc == null || (desc = desc.Trim()).Length == 0)
                                {
                                    desc = "(indescript)";
                                }

                                from.SendAsciiMessage(desc);

                                return(true);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(502409); // This rune does not have a marked location.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401); // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (CurCharges < MaxCharges)
                {
                    from.Send(new PlaySound(0x249, GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (MaxCharges - CurCharges))
                    {
                        dropped.Consume(MaxCharges - CurCharges);
                        CurCharges = MaxCharges;
                    }
                    else
                    {
                        CurCharges += amount;
                        dropped.Delete();

                        return(true);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410); // This book already has the maximum amount of charges.
                }
            }

            return(false);
        }
Пример #25
0
		public RecallSpell( Mobile caster, Item scroll, RunebookEntry entry, Runebook book ) : base( caster, scroll, m_Info )
		{
			m_Entry = entry;
			m_Book = book;
		}
Пример #26
0
		public RiftSpell( Mobile caster, Item scroll, RunebookEntry entry )
			: base( caster, scroll, m_Info )
		{
			_entry = entry;
		}