示例#1
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;
            }

            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;
                rune.Hue         = RecallRune.CalculateHue(e.Map, e.House, true);

                from.AddToBackpack(rune);
            }

            from.SendLocalizedMessage(502421); // You have removed the rune.
        }
示例#2
0
文件: Runebook.cs 项目: UODOC/MyShard
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is RecallRune || dropped is ShipRune)
            {
                if (this.IsLockedDown && from.AccessLevel < AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
                }
                else if (this.IsOpen(from))
                {
                    from.SendLocalizedMessage(1005571); // You cannot place objects in the book while viewing the contents.
                }
                else if (this.m_Entries.Count < MaxEntries)
                {
                    if (dropped is RecallRune)
                    {
                        RecallRune rune = (RecallRune)dropped;

                        if (rune.Marked && rune.TargetMap != null)
                        {
                            this.m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House));

                            dropped.Delete();

                            from.Send(new PlaySound(0x42, this.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.
                        }
                    }
                    else if (dropped is ShipRune)
                    {
                        ShipRune rune = (ShipRune)dropped;

                        if (rune.Galleon != null && !rune.Galleon.Deleted)
                        {
                            m_Entries.Add(new RunebookEntry(Point3D.Zero, null, rune.Galleon.ShipName, null, rune.Galleon));

                            dropped.Delete();

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

                            string desc = rune.Galleon.ShipName;

                            if (desc == null || (desc = desc.Trim()).Length == 0)
                            {
                                desc = "an unnamed ship";
                            }

                            from.SendMessage(desc);

                            return(true);
                        }
                        else
                        {
                            if (rune.DockedBoat != null)
                            {
                                from.SendMessage("You cannot place a rune to a docked boat in the runebook.");
                            }
                            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 (this.m_CurCharges < this.m_MaxCharges)
                {
                    from.Send(new PlaySound(0x249, this.GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (this.m_MaxCharges - this.m_CurCharges))
                    {
                        dropped.Consume(this.m_MaxCharges - this.m_CurCharges);
                        this.m_CurCharges = this.m_MaxCharges;
                    }
                    else
                    {
                        this.m_CurCharges += amount;
                        dropped.Delete();

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

            return(false);
        }
示例#3
0
        public void MarkRunes()
        {
            Direction d = Facing;
            string name = this.Name;

            if (Owner == null || !(Owner is PlayerMobile))
                return;

            ShipRune rune1 = new ShipRune(this);
            DistributeRune(rune1, false);

            ShipRune rune2 = new ShipRune(this);
            DistributeRune(rune2, true);

            rune1.InvalidateProperties();
            rune2.InvalidateProperties();
        }
示例#4
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.
        }
示例#5
0
        public bool TryMarkRune(RecallRune rune, Mobile from)
        {
            ShipRune newRune = new ShipRune(this);
            Container c = rune.Parent as Container;
            newRune.Location = rune.Location;

            if (c != null)
                c.AddItem(newRune);
            else
                c.MoveToWorld(from.Location, from.Map);

            rune.Delete();
            return true;
        }