示例#1
0
        private static void PostProcess(object obj)
        {
            if (obj is RecallRune)
            {
                RecallRune rune = (RecallRune)obj;

                if (Spells.SpellHelper.IsAnyT2A(rune.TargetMap, rune.Target))
                {
                    rune.Delete();
                }
                else if (Spells.SpellHelper.IsFeluccaDungeon(rune.TargetMap, rune.Target))
                {
                    Regions.DungeonRegion reg = Region.Find(rune.Target, rune.TargetMap) as Regions.DungeonRegion;

                    if (reg != null)
                    {
                        if (reg.Name == "Fire" || reg.Name == "Ice" || reg.Name == "Orc Cave" || reg.Name == "Terathan Keep")
                        {
                            rune.Delete();
                        }
                    }
                }
            }
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is RecallRune)
                {
                    if (m_RuneBook.Entries.Count < 16)
                    {
                        RecallRune rune = (RecallRune)targeted;

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

                            rune.Delete();

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

                            string desc = rune.Description;

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

                            from.SendMessage(desc);
                        }
                        else
                        {
                            from.SendLocalizedMessage(502409); // This rune does not have a marked location.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502401); // This runebook is full.
                    }
                }
                else
                if (targeted == from && from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.SendGump(new OKTargetGump("No Recall Rune?", 16777215,
                                                   "Do you want to Target your location instead of a Recall Rune?",
                                                   16777215, 300, 300, new GenericOKCallback(TargetPoint3D_Callback), m_Master, m_RuneBook, m_Booknum));
                    return;
                }
                from.SendMessage("That is not a Recall Rune.");
                from.CloseGump(typeof(InternalRunebookGump));
                from.SendGump(new InternalRunebookGump(from, m_RuneBook, m_Master, m_Booknum));
            }
示例#3
0
        public bool AddRune(Mobile m, RecallRune rune, bool message)
        {
            if (m == null || m.Deleted || rune == null || rune.Deleted)
            {
                return(false);
            }

            if (!rune.Marked || rune.Target == Point3D.Zero || rune.TargetMap == Map.Internal)
            {
                if (message)
                {
                    m.SendMessage("That rune is blank.");
                }

                return(false);
            }

            if (Entries.Count >= Entries.Capacity)
            {
                if (message)
                {
                    m.SendMessage("The category \"{0}\" can't hold more runes.", _Name);
                }

                return(false);
            }

            Entries.ForEach(
                (x, y, e) =>
            {
                if (e != null || rune.Deleted)
                {
                    return;
                }

                Entries.SetContent(x, y, new RuneCodexEntry(rune.Name, rune.Description, rune.Target.ToMapPoint(rune.TargetMap)));
                rune.Delete();
            });

            if (message)
            {
                m.SendMessage("You add the rune to the rune codex category \"{0}\".", _Name);
            }

            return(true);
        }