Esempio n. 1
0
        private static void EventSink_OpenSpellbookRequest(OpenSpellbookRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!DesignContext.Check(from))
            {
                return; // They are customizing
            }

            SpellbookType type;

            switch (e.Type)
            {
            default:
            case 1:
                type = SpellbookType.Regular;
                break;

            case 2:
                type = SpellbookType.Necromancer;
                break;

            case 3:
                type = SpellbookType.Paladin;
                break;

            case 4:
                type = SpellbookType.Ninja;
                break;

            case 5:
                type = SpellbookType.Samurai;
                break;

            case 6:
                type = SpellbookType.Arcanist;
                break;

            case 7:
                type = SpellbookType.Mystic;
                break;
            }

            Spellbook book = Find(from, -1, type);

            if (book != null)
            {
                book.DisplayTo(from);
            }
        }
Esempio n. 2
0
        public virtual bool Validate(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return(false);
            }
            else if (m_IsRewardItem && !Engines.VeteranRewards.RewardSystem.CheckIsUsableBy(from, this, null))
            {
                // CheckIsUsableBy sends the message
                return(false);
            }
            else if (!BaseMount.CheckMountAllowed(from, true))
            {
                // CheckMountAllowed sends the message
                return(false);
            }
            else if (from.Mounted)
            {
                from.SendLocalizedMessage(1005583);                   // Please dismount first.
                return(false);
            }
            else if (from.Race == Race.Gargoyle)
            {
                from.SendLocalizedMessage(1112281);                   // Gargoyles are unable to ride animals.
                return(false);
            }
            else if (from.IsBodyMod && !from.Body.IsHuman)
            {
                from.SendLocalizedMessage(1061628);                   // You can't do that while polymorphed.
                return(false);
            }
            else if (from.HasTrade)
            {
                from.SendLocalizedMessage(1042317, "", 0x41);                   // You may not ride at this time
                return(false);
            }
            else if ((from.Followers + FollowerSlots) > from.FollowersMax)
            {
                from.SendLocalizedMessage(1049679);                   // You have too many followers to summon your mount.
                return(false);
            }
            else if (!DesignContext.Check(from))
            {
                // Check sends the message
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                 // That must be in your pack for you to use it.
            }
            else
            {
                if (m_FactionState != null)
                {
                    if (from.Skills.Inscribe.Value >= 90.0)
                    {
                        PlayerState state = PlayerState.Find(from);

                        if (state != null && state.Faction == m_FactionState.Faction)
                        {
                            from.SendLocalizedMessage(1010378);                             // Select a gnarled faction staff to charge
                            from.Target = new SpellScrollTarget(this);
                        }
                        else
                        {
                            from.SendLocalizedMessage(1010377);                             // You may not use a scroll crafted by the other factions!
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1005420);                         // You cannot use this.
                    }
                }
                else
                {
                    Spell spell = SpellRegistry.NewSpell(m_SpellID, from, this);

                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else
                    {
                        from.SendLocalizedMessage(502345);                         // This spell has been temporarily disabled.
                    }
                }
            }
        }
Esempio n. 4
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!Sphere.CanUse(from, this))
            {
                return;
            }

            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return;
            }

            Spell spell = SpellRegistry.NewSpell(m_SpellID, from, this);

            if (spell != null)
            {
                int mana = ManaCost > 0 ? ManaCost : spell.ScaleMana(spell.GetMana());

                if (from.Mana < mana)
                {
                    from.SendAsciiMessage("You lack sufficient mana for this scroll.");
                    return;
                }

                if (from.Mana - PrecastManaCost < 0)
                {
                    from.Mana = 0;
                }
                else
                {
                    from.Mana -= PrecastManaCost;
                }

                spell.Cast();
            }
            else
            {
                from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
            }
        }
Esempio n. 5
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                if (move != null)
                {
                    SpecialMove.SetCurrentMove(from, move);
                }
                else
                {
                    Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else
                    {
                        from.SendLocalizedMessage(502345);                         // This spell has been temporarily disabled.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);                 // You do not have that spell!
            }
        }
Esempio n. 6
0
        public override bool CheckVendorAccess(Mobile m)
        {
            if (m == null || m.Deleted)
            {
                return(false);
            }

            if (m.AccessLevel >= AccessLevel.GameMaster)
            {
                return(true);
            }

            if (!Trading || !DesignContext.Check(m))
            {
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }

            var book    = e.Spellbook as Spellbook;
            int spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            // add check for pseudoseer controlled mob
            var bc = from as BaseCreature;

            if ((from is PlayerMobile || bc == null || bc.Deleted || bc.NetState == null || bc.Pseu_SpellBookRequired) &&
                (book == null || !book.HasSpell(spellID)))
            {
                from.SendLocalizedMessage(500015);                 // You do not have that spell!
                return;
            }

            Spell spell = SpellRegistry.NewSpell(spellID, from, null);

            if (spell != null)
            {
                spell.Cast();
            }
            else
            {
                from.SendLocalizedMessage(502345);                 // This spell has been temporarily disabled.
            }
        }
Esempio n. 8
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
                return;
            }

            Spell spell = SpellRegistry.NewSpell(m_SpellID, from, this);

            if (spell != null)
            {
                spell.Cast();
            }
            else
            {
                from.SendLocalizedMessage(502345);                   // This spell has been temporarily disabled.
            }
        }
Esempio n. 9
0
        public static void Cast_OnCommand(CommandEventArgs e)
        {
            if (e.Length == 1)
            {
                if (!DesignContext.Check(e.Mobile))
                {
                    return;                     // They are customizing
                }
                Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null);

                if (spell != null)
                {
                    spell.Cast();
                }
                else
                {
                    e.Mobile.SendMessage("That spell was not found.");
                }
            }
            else
            {
                e.Mobile.SendMessage("Format: Cast <name>");
            }
        }
Esempio n. 10
0
        public virtual bool Validate(Mobile from)
        {
            if (from.Race == Race.Gargoyle)
            {
                from.SendLocalizedMessage(1112281); // gargs can't mount
                return(false);
            }

            if (Parent == null)
            {
                from.SayTo(from, 1010095); // This must be on your person to use.
                return(false);
            }

            if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
            {
                // CheckIsUsableBy sends the message
                return(false);
            }

            if (!BaseMount.CheckMountAllowed(from, true))
            {
                // CheckMountAllowed sends the message
                return(false);
            }

            if (from.Mount is BaseBoat)
            {
                PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042146, from.NetState); // You cannot use this while mounted.
                return(false);
            }

            if (from.Mounted)
            {
                from.SendLocalizedMessage(1005583); // Please dismount first.
                return(false);
            }

            if (from.IsBodyMod && !from.Body.IsHuman)
            {
                from.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
                return(false);
            }

            if (from.HasTrade)
            {
                from.SendLocalizedMessage(1042317, "", 0x41); // You may not ride at this time
                return(false);
            }

            if ((from.Followers + FollowerSlots) > from.FollowersMax)
            {
                from.SendLocalizedMessage(1049679); // You have too many followers to summon your mount.
                return(false);
            }

            if (!DesignContext.Check(from))
            {
                // Check sends the message
                return(false);
            }

            return(true);
        }
Esempio n. 11
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (m_Book.Deleted || !from.InRange(m_Book.GetWorldLocation(), 1) || !DesignContext.Check(from))
            {
                return;
            }

            int buttonID = info.ButtonID;

            if (buttonID == 1)               // Rename book
            {
                if (m_Book.CheckAccess(from))
                {
                    from.Prompt = new InternalPrompt(m_Book);
                }
                else
                {
                    from.SendLocalizedMessage(502413);                       // That cannot be done while the book is locked down.
                }
            }
            else
            {
                int index = buttonID % 25;
                int type  = buttonID / 25;

                if (type == 0 || type == 1)
                {
                    index = buttonID - 10;
                }

                if (index >= 0 && index < m_Book.Entries.Count)
                {
                    RunebookEntry e = (RunebookEntry)m_Book.Entries[index];

                    switch (type)
                    {
                    case 0:
                    case 1:                             // Use charges
                    {
                        if (m_Book.CurCharges <= 0)
                        {
                            from.CloseGump <RunebookGump>();
                            from.SendGump(new RunebookGump(from, m_Book));

                            from.SendLocalizedMessage(502412);                                               // There are no charges left on that item.
                        }
                        else
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}� {1}'{2}, {3}� {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            //m_Book.OnTravel();

                            new RecallSpell(from, m_Book, e, m_Book).Cast();
                        }

                        break;
                    }

                    case 8:                             // Drop rune
                    {
                        if (m_Book.CheckAccess(from))
                        {
                            m_Book.DropRune(from, e, index);

                            from.CloseGump <RunebookGump>();
                            from.SendGump(new RunebookGump(from, m_Book));
                        }
                        else
                        {
                            from.SendLocalizedMessage(502413);                                               // That cannot be done while the book is locked down.
                        }

                        break;
                    }

                    case 12:                             // Set default
                    {
                        if (m_Book.CheckAccess(from))
                        {
                            m_Book.Default = e;

                            from.CloseGump <RunebookGump>();
                            from.SendGump(new RunebookGump(from, m_Book));

                            from.SendLocalizedMessage(502417);                                               // New default location set.
                        }
                        else
                        {
                            from.SendLocalizedMessage(502413);                                               // That cannot be done while the book is locked down.
                        }

                        break;
                    }

                    case 2:                             // Recall
                    {
                        if (HasSpell(from, 31))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}� {1}'{2}, {3}� {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            //m_Book.OnTravel();
                            new RecallSpell(from, null, e, null).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);                                               // You do not have that spell!
                        }

                        break;
                    }

                    case 4:                             // Gate
                    {
                        if (HasSpell(from, 51))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}� {1}'{2}, {3}� {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            //m_Book.OnTravel();
                            new GateTravelSpell(from, null, e).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);                                               // You do not have that spell!
                        }

                        break;
                    }

                    case 3:                             // Sacred Journey
                    {
                        if (HasSpell(from, 209))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}� {1}'{2}, {3}� {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                from.SendMessage(location);
                            }

                            //m_Book.OnTravel();
                            new SacredJourneySpell(from, null, e, null).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);                                               // You do not have that spell!
                        }

                        break;
                    }

                    default:
                        break;
                    }
                }
            }
        }
Esempio n. 12
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsDeadPet)
            {
                return;
            }

            if (from.IsBodyMod && !from.Body.IsHuman)
            {
                if (Core.AOS) // You cannot ride a mount in your current form.
                {
                    PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1062061, from.NetState);
                }
                else
                {
                    from.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
                }
                return;
            }

            if (!CheckMountAllowed(from, true))
            {
                return;
            }

            if (from.Mounted)
            {
                from.SendLocalizedMessage(1005583); // Please dismount first.
                return;
            }

            if (from.Race == Race.Gargoyle && from.IsPlayer())
            {
                from.SendLocalizedMessage(1112281);
                OnDisallowedRider(from);
                return;
            }

            if (from.Female ? !AllowFemaleRider : !AllowMaleRider)
            {
                OnDisallowedRider(from);
                return;
            }

            if (!DesignContext.Check(from))
            {
                return;
            }

            if (from.HasTrade)
            {
                from.SendLocalizedMessage(1042317, "", 0x41); // You may not ride at this time
                return;
            }

            if (from.InRange(this, 1))
            {
                var canAccess = (from.AccessLevel >= AccessLevel.GameMaster) ||
                                (Controlled && ControlMaster == from) ||
                                (Summoned && SummonMaster == from);

                if (canAccess)
                {
                    if (Poisoned)
                    {
                        PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049692, from.NetState);
                    }
                    // This mount is too ill to ride.
                    else
                    {
                        Rider = from;
                    }
                }
                else if (!Controlled && !Summoned)
                {
                    // That mount does not look broken! You would have to tame it to ride it.
                    PrivateOverheadMessage(MessageType.Regular, 0x3B2, 501263, from.NetState);
                }
                else
                {
                    // This isn't your mount; it refuses to let you ride.
                    PrivateOverheadMessage(MessageType.Regular, 0x3B2, 501264, from.NetState);
                }
            }
            else
            {
                from.SendLocalizedMessage(500206); // That is too far away to ride.
            }
        }
Esempio n. 13
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsDeadPet)
            {
                return;
            }

            if (from.Race == Race.Gargoyle)
            {
                from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1112281);                   // Gargoyles are unable to ride animals.
                return;
            }

            if (from.IsBodyMod && !from.Body.IsHuman)
            {
                // You cannot ride a mount in your current form.
                PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1062061, from.NetState);

                return;
            }

            if (!CheckMountAllowed(from, true))
            {
                return;
            }

            if (!CheckMountAllowed(this, true))
            {
                return;
            }

            if (this is LesserHiryu)
            {
                if (from.Skills[SkillName.Bushido].Value < 90.0 && from.Skills[SkillName.AnimalTaming].Value <= 90.0)
                {
                    from.SendLocalizedMessage(1063021);                       // That creature can only be ridden by Bushido masters and master Tamers.
                    return;
                }
            }

            if (from.Mounted)
            {
                from.SendLocalizedMessage(1005583);                   // Please dismount first.
                return;
            }

            if (from.Female ? !AllowFemaleRider : !AllowMaleRider)
            {
                OnDisallowedRider(from);
                return;
            }

            if (!DesignContext.Check(from))
            {
                return;
            }

            if (from.HasTrade)
            {
                from.SendLocalizedMessage(1042317, "", 0x41);                   // You may not ride at this time
                return;
            }

            if (from.InRange(this, 1))
            {
                bool canAccess = (from.AccessLevel >= AccessLevel.GameMaster) ||
                                 (Controlled && ControlMaster == from) ||
                                 (Summoned && SummonMaster == from);

                if (canAccess)
                {
                    if (this.Poisoned)
                    {
                        PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1049692, from.NetState);                           // This mount is too ill to ride.
                    }
                    else if (this.Frozen || this.Paralyzed)
                    {
                        PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1094791, from.NetState);                           // You are unable to mount a paralyzed pet.
                    }
                    else
                    {
                        Rider = from;
                    }
                }
                else if (!Controlled && !Summoned)
                {
                    // That mount does not look broken! You would have to tame it to ride it.
                    PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 501263, from.NetState);
                }
                else
                {
                    // This isn't your mount; it refuses to let you ride.
                    PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 501264, from.NetState);
                }
            }
            else
            {
                from.SendLocalizedMessage(500206);                   // That is too far away to ride.
            }
        }
Esempio n. 14
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (m_Book.Deleted || !DesignContext.Check(from))
            {
                return;
            }

            int buttonID = info.ButtonID;

            if (buttonID > 0 && (!m_Book.Dictionary.ContainsKey(from) || (m_Book.Dictionary[from] != from.Location && !m_Book.IsChildOf(from.Backpack))))
            {
                from.SendAsciiMessage("You cannot do this since you moved after using the runebook");
                return;
            }

            if (buttonID == 1)               // Rename book
            {
                if (m_Book.CheckAccess(from))
                {
                    from.SendLocalizedMessage(502414);                       // Please enter a title for the runebook:
                    from.Prompt = new InternalPrompt(m_Book);
                }
                else
                {
                    from.SendLocalizedMessage(502413);                       // That cannot be done while the book is locked down.
                }
            }
            else
            {
                buttonID -= 2;

                int index = buttonID / 6;
                int type  = buttonID % 6;

                if (index >= 0 && index < m_Book.Entries.Count)
                {
                    RunebookEntry e = m_Book.Entries[index];

                    switch (type)
                    {
                    case 0:                             // Use charges
                    {
                        if (m_Book.CurCharges <= 0)
                        {
                            if (HasSpell(from, 31))
                            {
                                int  xLong = 0, yLat = 0;
                                int  xMins = 0, yMins = 0;
                                bool xEast = false, ySouth = false;

                                if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                                {
                                    string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                    //from.SendMessage( location );
                                }

                                m_Book.OnTravel();
                                new RecallSpell(from, null, e, m_Book).Cast();
                            }
                            else
                            {
                                from.CloseGump(typeof(RunebookGump));
                                from.SendGump(new RunebookGump(from, m_Book));

                                from.SendLocalizedMessage(502412);     // There are no charges left on that item.
                            }
                        }
                        else
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                //from.SendMessage( location );
                            }

                            m_Book.OnTravel();

                            new RecallSpell(from, m_Book, e, m_Book).Cast();
                        }

                        break;
                    }

                    case 1:                             // Drop rune
                    {
                        if (m_Book.CheckAccess(from))
                        {
                            m_Book.DropRune(from, e, index);

                            from.CloseGump(typeof(RunebookGump));
                            if (!Core.ML)
                            {
                                from.SendGump(new RunebookGump(from, m_Book));
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(502413);                                       // That cannot be done while the book is locked down.
                        }

                        break;
                    }

                    case 2:                             // Set default
                    {
                        if (m_Book.CheckAccess(from))
                        {
                            m_Book.Default = e;

                            from.CloseGump(typeof(RunebookGump));
                            from.SendGump(new RunebookGump(from, m_Book));

                            from.SendLocalizedMessage(502417);                                       // New default location set.
                        }
                        else
                        {
                            from.SendLocalizedMessage(502413);                                       // That cannot be done while the book is locked down.
                        }

                        break;
                    }

                    case 3:                             // Recall
                    {
                        if (HasSpell(from, 31))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                //from.SendMessage( location );
                            }

                            m_Book.OnTravel();
                            new RecallSpell(from, null, e, m_Book).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);                                       // You do not have that spell!
                        }

                        break;
                    }

                    case 4:                             // Gate
                    {
                        if (HasSpell(from, 51))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                            {
                                string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                //from.SendMessage( location );
                            }

                            m_Book.OnTravel();
                            new GateTravelSpell(from, null, e, m_Book).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);                                       // You do not have that spell!
                        }

                        break;
                    }

                    case 5:                             // Sacred Journey
                    {
                        if (Core.AOS)
                        {
                            if (HasSpell(from, 209))
                            {
                                int  xLong = 0, yLat = 0;
                                int  xMins = 0, yMins = 0;
                                bool xEast = false, ySouth = false;

                                if (Sextant.Format(e.Location, e.Map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth))
                                {
                                    string location = String.Format("{0}° {1}'{2}, {3}° {4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W");
                                    from.SendMessage(location);
                                }

                                m_Book.OnTravel();
                                new SacredJourneySpell(from, null, e, null).Cast();
                            }
                            else
                            {
                                from.SendLocalizedMessage(500015);                                           // You do not have that spell!
                            }
                        }

                        break;
                    }
                    }
                }
            }
        }
Esempio n. 15
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            var from = state.Mobile;

            if (Book.Deleted || !from.InRange(Book.GetWorldLocation(), Core.ML ? 3 : 1) || !DesignContext.Check(from))
            {
                Book.Openers.Remove(from);
                return;
            }

            var buttonID = info.ButtonID;

            if (buttonID == 1) // Rename book
            {
                if (!Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
                {
                    from.SendLocalizedMessage(502414); // Please enter a title for the runebook:
                    from.Prompt = new InternalPrompt(Book);
                }
                else
                {
                    Book.Openers.Remove(from);

                    from.SendLocalizedMessage(502413, null, 0x35); // That cannot be done while the book is locked down.
                }
            }
            else
            {
                buttonID -= 2;

                var index = buttonID / 6;
                var type  = buttonID % 6;

                if (index >= 0 && index < Book.Entries.Count)
                {
                    var e = Book.Entries[index];

                    switch (type)
                    {
                    case 0:     // Use charges
                    {
                        if (Book.CurCharges <= 0)
                        {
                            from.CloseGump <RunebookGump>();
                            from.SendGump(new RunebookGump(from, Book));

                            from.SendLocalizedMessage(502412);         // There are no charges left on that item.
                        }
                        else
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(
                                    e.Location,
                                    e.Map,
                                    ref xLong,
                                    ref yLat,
                                    ref xMins,
                                    ref yMins,
                                    ref xEast,
                                    ref ySouth
                                    ))
                            {
                                var location =
                                    $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}' {xMins}'{(xEast ? "E" : "W")}";
                                from.SendMessage(location);
                            }

                            Book.OnTravel();
                            new RecallSpell(from, e, Book, Book).Cast();

                            Book.Openers.Remove(from);
                        }

                        break;
                    }

                    case 1:     // Drop rune
                    {
                        if (!Book.IsLockedDown || from.AccessLevel >= AccessLevel.GameMaster)
                        {
                            Book.DropRune(from, e, index);

                            from.CloseGump <RunebookGump>();
                            if (!Core.ML)
                            {
                                from.SendGump(new RunebookGump(from, Book));
                            }
                        }
                        else
                        {
                            Book.Openers.Remove(from);

                            from.SendLocalizedMessage(
                                502413,
                                null,
                                0x35
                                );     // That cannot be done while the book is locked down.
                        }

                        break;
                    }

                    case 2:     // Set default
                    {
                        if (Book.CheckAccess(from))
                        {
                            Book.Default = e;

                            from.CloseGump <RunebookGump>();
                            from.SendGump(new RunebookGump(from, Book));

                            from.SendLocalizedMessage(502417);         // New default location set.
                        }

                        break;
                    }

                    case 3:     // Recall
                    {
                        if (HasSpell(from, 31))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(
                                    e.Location,
                                    e.Map,
                                    ref xLong,
                                    ref yLat,
                                    ref xMins,
                                    ref yMins,
                                    ref xEast,
                                    ref ySouth
                                    ))
                            {
                                var location =
                                    $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}' {xMins}'{(xEast ? "E" : "W")}";
                                from.SendMessage(location);
                            }

                            Book.OnTravel();
                            new RecallSpell(from, e).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);         // You do not have that spell!
                        }

                        Book.Openers.Remove(from);

                        break;
                    }

                    case 4:     // Gate
                    {
                        if (HasSpell(from, 51))
                        {
                            int  xLong = 0, yLat = 0;
                            int  xMins = 0, yMins = 0;
                            bool xEast = false, ySouth = false;

                            if (Sextant.Format(
                                    e.Location,
                                    e.Map,
                                    ref xLong,
                                    ref yLat,
                                    ref xMins,
                                    ref yMins,
                                    ref xEast,
                                    ref ySouth
                                    ))
                            {
                                var location =
                                    $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}' {xMins}'{(xEast ? "E" : "W")}";
                                from.SendMessage(location);
                            }

                            Book.OnTravel();
                            new GateTravelSpell(from, e).Cast();
                        }
                        else
                        {
                            from.SendLocalizedMessage(500015);         // You do not have that spell!
                        }

                        Book.Openers.Remove(from);

                        break;
                    }

                    case 5:     // Sacred Journey
                    {
                        if (Core.AOS)
                        {
                            if (HasSpell(from, 209))
                            {
                                int  xLong = 0, yLat = 0;
                                int  xMins = 0, yMins = 0;
                                bool xEast = false, ySouth = false;

                                if (Sextant.Format(
                                        e.Location,
                                        e.Map,
                                        ref xLong,
                                        ref yLat,
                                        ref xMins,
                                        ref yMins,
                                        ref xEast,
                                        ref ySouth
                                        ))
                                {
                                    var location =
                                        $"{yLat}° {yMins}'{(ySouth ? "S" : "N")}, {xLong}' {xMins}'{(xEast ? "E" : "W")}";
                                    from.SendMessage(location);
                                }

                                Book.OnTravel();
                                new SacredJourneySpell(from, e).Cast();
                            }
                            else
                            {
                                from.SendLocalizedMessage(500015);         // You do not have that spell!
                            }
                        }

                        Book.Openers.Remove(from);

                        break;
                    }
                    }
                }
                else
                {
                    Book.Openers.Remove(from);
                }
            }
        }
Esempio n. 16
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsDeadPet)
            {
                return;
            }

            if (from.IsBodyMod && !from.Body.IsHuman)
            {
                from.SendLocalizedMessage(1061628); // You can't do that while polymorphed.
                return;
            }

            if (!CheckMountAllowed(from, true))
            {
                return;
            }


            if (from.Female ? !AllowFemaleRider : !AllowMaleRider)
            {
                OnDisallowedRider(from);
                return;
            }

            if (!DesignContext.Check(from))
            {
                return;
            }

            if (from.HasTrade)
            {
                from.SendLocalizedMessage(1042317, "", 0x41); // You may not ride at this time
                return;
            }

            if (from.InRange(this, 5) && from.InLOS(this))
            {
                bool canAccess = (from.AccessLevel >= AccessLevel.GameMaster) ||
                                 (Controlled && ControlMaster == from) ||
                                 (Summoned && SummonMaster == from);

                if (canAccess)
                {
                    if (from.Mounted)
                    {
                        return;
                    }

                    Effects.PlaySound(this, Map, 168);
                    Rider = from;
                }
                else
                {
                    from.SendAsciiMessage("You dont own that mount.");
                }
            }
            else
            {
                from.SendLocalizedMessage(500206); // That is too far away to ride.
            }
        }
Esempio n. 17
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsDeadPet)
            {
                return;
            }

            if (from.IsBodyMod && !from.Body.IsHuman)
            {
                if (Core.AOS)                   // You cannot ride a mount in your current form.
                {
                    PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1062061, from.NetState);
                }
                else
                {
                    from.SendLocalizedMessage(1061628);                       // You can't do that while polymorphed.
                }
                return;
            }

            if (!CheckMountAllowed(from, true))
            {
                return;
            }


            if (from.Female ? !AllowFemaleRider : !AllowMaleRider)
            {
                OnDisallowedRider(from);
                return;
            }

            if (!DesignContext.Check(from))
            {
                return;
            }

            if (from.HasTrade)
            {
                from.SendLocalizedMessage(1042317, "", 0x41);                   // You may not ride at this time
                return;
            }

            if (from.InRange(this, 5) && from.InLOS(this))
            {
                var canAccess = (from.AccessLevel >= AccessLevel.GameMaster) ||
                                (Controlled && (ControlMaster == from || (Friends != null && Friends.Contains(from)))) ||
                                (Summoned && SummonMaster == from);

                if (canAccess)
                {
                    if (from.Mounted)
                    {
                        from.Mount.Rider = null;
                    }

                    //if ( this.Poisoned )
                    //	PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1049692, from.NetState ); // This mount is too ill to ride.
                    //else
                    if (this is Horse || this is Mustang)
                    {
                        Effects.PlaySound(this, Map, 168);
                    }
                    else if (this is Zostrich)
                    {
                        Effects.PlaySound(this, Map, 629);
                    }
                    else if (this is Orn || this is Oclock)
                    {
                        Effects.PlaySound(this, Map, 624);
                    }
                    else if (this is Llama)
                    {
                        Effects.PlaySound(this, Map, 184);
                    }

                    Rider = from;
                }

                /*else if ( !Controlled && !Summoned )
                 * {
                 *  // That mount does not look broken! You would have to tame it to ride it.
                 *  //PrivateOverheadMessage( MessageType.Regular, 0x3B2, 501263, from.NetState );
                 * }*/
                else
                {
                    // This isn't your mount; it refuses to let you ride.
                    from.SendAsciiMessage("You dont own that mount.");
                    //PrivateOverheadMessage( MessageType.Regular, 0x3B2, 501264, from.NetState );
                }
            }
            else
            {
                from.SendLocalizedMessage(500206);                   // That is too far away to ride.
            }
        }