Esempio n. 1
0
        private void GenerateMapListing(int page)
        {
            if (m_Page == 0)
            {
                m_Page = page;
            }
            else if (page != m_Page)
            {
                return;
            }

            string name = m_Entries[page - 1];

            TAEntry[] me = (TAEntry[])TravelAtlas.GlobalEntries[name];
            if (me == null)
            {
                return;
            }

            int  offset = m_Page * 100;
            bool gates  = name == "Custom Areas";

            for (int i = 0, l = 0; i < me.Length; i++)
            {
                TAEntry entry = me[i];

                if (((gates || name == "Felucca") && entry.Map == Map.Felucca && !m_TravelAtlas.Felucca))
                {
                    continue;
                }
                else if ((gates || name == "Trammel") && entry.Map == Map.Trammel && (!m_TravelAtlas.Trammel || !m_Reds))
                {
                    continue;
                }
                else if (entry.Map == Map.Ilshenar && (!m_TravelAtlas.Ilshenar || !m_HasLBR || !m_Reds))
                {
                    continue;
                }
                else if (entry.Map == Map.Malas && (!Core.AOS || !m_HasAOS || !m_TravelAtlas.Malas || !m_Reds))
                {
                    continue;
                }
                else if (entry.Map == Map.Tokuno && (!Core.SE || !m_HasSE || !m_TravelAtlas.Tokuno || !m_Reds))
                {
                    continue;
                }
                else
                {
                    string label = String.Format("<basefont color=#{0}>{1}</basefont>", MapHue(entry.Map), entry.Name);
                    AddHtml(180, 20 + (l * 20), 150, 20, label, false, false);
                    AddButton(145, 20 + (l * 20), 4015, 4016, (i + offset), GumpButtonType.Reply, 0);
                    l++;
                }
            }
        }
Esempio n. 2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID <= 0 || from == null || from.Deleted || m_TravelAtlas == null || m_TravelAtlas.Deleted)
            {
                return;
            }

            int id    = info.ButtonID / 100;
            int count = info.ButtonID % 100;

            if (id == 0 && count < 12)
            {
                from.SendGump(new TravelAtlasGump(from, m_TravelAtlas, count));
                return;
            }

            //Invalid checks
            if (id < 1 || id > 11 || (id == 10 && from.AccessLevel < AccessLevel.GameMaster))
            {
                id = 1;
            }

            string name = m_Entries[id - 1];

            TAEntry entry = GetEntry(name, count);

            bool gates = name == "Custom Areas";

            if (entry == null)
            {
                from.SendMessage("Error: Invalid Button Response - No Map Entries");
            }
            else if (((gates || name == "Felucca") && entry.Map == Map.Felucca && !m_TravelAtlas.Felucca))
            {
                from.SendMessage("Error: Invalid Button Response - Felucca Disabled");
            }
            else if ((gates || name == "Trammel") && entry.Map == Map.Trammel && (!m_TravelAtlas.Trammel || !m_Reds))
            {
                from.SendMessage("Error: Invalid Button Response - Trammel Disabled");
            }
            else if ((name == "Ilshenar") && entry.Map == Map.Ilshenar && (!m_TravelAtlas.Ilshenar || !m_HasLBR || !m_Reds))
            {
                from.SendMessage("Error: Invalid Button Response - Ilshenar Disabled");
            }
            else if (entry.Map == Map.Malas && (!Core.AOS || !m_HasAOS || !m_TravelAtlas.Malas || !m_Reds))
            {
                from.SendMessage("Error: Invalid Button Response - Malas Disabled");
            }
            else if (entry.Map == Map.Tokuno && (!Core.SE || !m_HasSE || !m_TravelAtlas.Tokuno || !m_Reds))
            {
                from.SendMessage("Error: Invalid Button Response - Tokuno Disabled");
            }
            else if (!from.InRange(m_TravelAtlas.GetWorldLocation(), 1) || from.Map != m_TravelAtlas.Map)
            {
                from.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (from.Criminal)
            {
                from.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (Server.Spells.SpellHelper.CheckCombat(from))
            {
                from.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (from.Spell != null)
            {
                from.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (from.Map == entry.Map && from.InRange(entry.Destination, 1))
            {
                from.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                BaseCreature.TeleportPets(from, entry.Destination, entry.Map);

                from.Combatant = null;

                from.MoveToWorld(entry.Destination, entry.Map);

                if (!from.Hidden || from.AccessLevel == AccessLevel.Player)
                {
                    Effects.PlaySound(entry.Destination, entry.Map, 0x1FE);
                }
            }
        }