예제 #1
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;
                    }
                    }
                }
            }
        }
예제 #2
0
            public override void OnResponse(Mobile from, string text)
            {
                if (m_Book.Deleted)
                {
                    return;
                }

                if (!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 (m_Book.CheckAccess(from))
                {
                    m_Book.Description = Utility.FixHtml(text.Trim());

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

                    from.SendMessage("The book's title has been changed.");
                }
                else
                {
                    from.SendLocalizedMessage(502416);                       // That cannot be done while the book is locked down.
                }
            }