Пример #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            m_From.CloseGump(typeof(ShardTravelGump));
            int     id = info.ButtonID;
            Point3D p;
            Map     map;

            if (id < 100)
            {
                if (id == 2)
                {
                    m_From.SendGump(new ShardTravelGump(m_From, m_Page - 1, X, Y, m_TravelMap));
                }
                if (id == 3)
                {
                    m_From.SendGump(new ShardTravelGump(m_From, m_Page + 1, X, Y, m_TravelMap));
                }
                if (id == 4)
                {
                    m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap));
                    m_From.SendGump(new MapTravelHelp(X, Y));
                }
            }
            else if (id < 10000)
            {
                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, id));
            }
            else if (id < 20000)
            {
                // Here begins the teleport

                string message = "";

                try
                {
                    id -= 10000;
                    bool             NonGM = m_From.AccessLevel < AccessLevel.GameMaster;
                    ShardTravelEntry entry = m_TravelMap.GetEntry(id);
                    if (entry == null)
                    {
                        return;
                    }

                    p   = entry.Destination;
                    map = entry.Map;

                    if (NonGM && Factions.Sigil.ExistsOn(m_From))
                    {
                        m_From.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
                    }
                    else if (NonGM && map == Map.Felucca && m_From is PlayerMobile && ((PlayerMobile)m_From).Young)
                    {
                        m_From.SendLocalizedMessage(1049543);
                        // You decide against traveling to Felucca while you are still young.
                    }
                    else if (NonGM && m_From.Kills >= 5 && map != Map.Felucca)
                    {
                        m_From.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                    }
                    else if (NonGM && m_From.Criminal)
                    {
                        m_From.SendLocalizedMessage(1005561, "", 0x22);
                        // Thou'rt a criminal and cannot escape so easily.
                    }
                    else if (NonGM && SpellHelper.CheckCombat(m_From))
                    {
                        m_From.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                    }
                    else if (NonGM && Misc.WeightOverloading.IsOverloaded(m_From))
                    {
                        m_From.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
                    }
                    else if (!map.CanSpawnMobile(p.X, p.Y, p.Z))
                    {
                        m_From.SendLocalizedMessage(501942); // That location is blocked.
                    }
                    else if (m_From.Holding != null)
                    {
                        m_From.SendLocalizedMessage(1071955); // You cannot teleport while dragging an object.
                    }
                    else if (entry.Unlocked || !NonGM)
                    {
                        if (NonGM && CHARGE)                         // Do not charge GMs - they might complain...
                        {
                            Container pack = m_From.Backpack;
                            if (pack == null || (pack.ConsumeTotal(payTypes, payAmounts) > 0))
                            {
                                if (pack == null)
                                {
                                    message = "Your pack is null???";
                                }
                                else
                                {
                                    message = string.Format("Using the map to teleport costs {0}.", PAYTHIS);
                                }
                                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, m_Detail, message));
                                return;
                            }
                            // Payment was successful if we reach here ...
                        }
                        m_From.MoveToWorld(p, map);
                        message = string.Format("{0} have been moved to X:{1}, Y:{2}, Z:{3}, Map: {4}",
                                                CHARGE ? "You paid " + PAYTHIS + " and" : "You", p.X, p.Y, p.Z, map);
                    }
                }
                catch
                {
                    message = string.Format("Teleport failed.");
                }

                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, m_Detail, message));
            }
            else if (id >= 30000 && id < 40000)
            {
                id -= 30000;

                ShardTravelEntry entry = m_TravelMap.GetEntry(id);
                if (entry == null)
                {
                    return;
                }

                p   = entry.Destination;
                map = entry.Map;

                string message = "";
                if (map != m_From.Map)
                {
                    message = "You must be on the same map to Explore there.";
                }
                else
                {
                    if (m_From.InRange(p, 7))
                    {
                        entry.Unlocked   = true;
                        entry.Discovered = true; // We do this in case a GM unlocked the location before it was discovered.
                        message          = string.Format("You have unlocked a new location: {0}.", entry.Name);
                    }
                    else
                    {
                        int distance = (int)m_From.GetDistanceToSqrt(p);
                        message = string.Format("That location is still approximately {0} paces to the {1}.",
                                                distance, MapTravelHelp.GetDirection(m_From, p));
                    }
                }
                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, m_Detail, message));
            }
        }
Пример #2
0
        public ShardTravelGump(Mobile from, int page, int x, int y, ShardTravelMap travelmap, int detail, string message)
            : base(x, y)
        {
            m_Page      = page;
            m_From      = from;
            m_TravelMap = travelmap;
            m_Detail    = detail;

            bool           GM    = m_From.AccessLevel >= AccessLevel.GameMaster;
            GumpButtonType Reply = GumpButtonType.Reply;

            if (m_TravelMap == null)
            {
                return;
            }

            if (m_TravelMap.Entries == null || m_TravelMap.Entries.Count <= 0)
            {
                m_TravelMap.Entries = m_TravelMap.GetDefaultEntries();
            }

            if (m_TravelMap.Entries == null || m_TravelMap.Entries.Count <= 0)
            {
                from.SendMessage("No entries were found on this map.");
                m_From.CloseGump(typeof(ShardTravelGump));
                return;
            }

            AddPage(0);
            AddBackground(0, 0, 600, 460, 3600);   // Grey Stone Background
            AddBackground(20, 20, 560, 420, 3000); // Paper Background
            AddBackground(36, 28, 387, 387, 2620); // Black Background behind map

            switch (m_Page)
            {
            case 1:     // Trammel Cities
            case 2:     // Trammel Dungeons
            case 3:     // Trammel Moongates
            case 4:     // Trammel Shrines
                AddImage(38, 30, 0x15DA);
                break;

            case 5:     // Felucca Cities
            case 6:     // Felucca Dungeons
            case 7:     // Felucca Moongates
            case 8:     // Felucca Shrines
                AddImage(38, 30, 0x15D9);
                break;

            case 9:     // Ilshenar Cities
            case 10:    // Ilshenar Dungeons
            case 11:    // Ilshenar Shrines
                AddImage(38, 30, 0x15DB);
                break;

            case 12:     // Malas Locations
                AddImage(38, 30, 0x15DC);
                break;

            case 13:     // Tokuno Moongates
            case 14:     // Tokuno Locations
                AddImage(38, 30, 0x15DD);
                break;

            case 15:     // TerMur Locations
                AddImage(38, 30, 0x15DE);
                break;
            }

            AddImage(34, 26, 0x15DF); // Border around the map

            AddLabel(206, 417, 0, MapPages[m_Page]);
            if (m_Page > 1)
            {
                AddButton(21, 29, 0x15E3, 0x15E7, 2, Reply, 0); // Previous Page
            }
            if (m_Page < 15)
            {
                AddButton(427, 29, 0x15E1, 0x15E5, 3, Reply, 0); // Next Page
            }
            foreach (ShardTravelEntry entry in m_TravelMap.Entries)
            {
                bool found = entry.Discovered;
                bool open  = entry.Unlocked;
                if (entry.MapIndex == m_Page && (found || GM))
                {
                    AddButton(entry.XposButton, entry.YposButton, 1210, 1209, entry.Index, Reply, 0);
                    AddLabel(entry.XposLabel, entry.YposLabel, open ? 0x480: found? 0x40 : 0x20, entry.Name);
                }
            }

            if (m_Detail > 0)
            {
                ShardTravelEntry entry = m_TravelMap.GetEntry(m_Detail);
                AddLabel(433, 64, 0, entry.Name);
                AddLabel(433, 84, 0, string.Format("X: {0}", entry.Destination.X));
                AddLabel(433, 104, 0, string.Format("Y: {0}", entry.Destination.Y));
                AddLabel(433, 124, 0, string.Format("Z: {0}", entry.Destination.Z));
                AddLabel(433, 144, 0, string.Format("Map: {0}", entry.Map));
                AddLabel(433, 164, entry.Unlocked ? 0x2A5 : 0x14D,
                         string.Format("Status: {0}", entry.Unlocked ? "Unlocked" : "Locked"));
                if (entry.Unlocked || GM)
                {
                    AddButton(434, 204, 4006, 4007, entry.Index + 10000, Reply, 0); // Teleport Now
                    AddLabel(480, 204, 0x2A5, "Teleport Now");
                }
                if (!entry.Unlocked && (entry.Discovered || GM))
                {
                    if (m_From.Map == entry.Map)
                    {
                        AddButton(434, 244, 4027, 4028, entry.Index + 30000, Reply, 0); // Explore This
                        AddLabel(480, 244, 0x2A5, "Explore This");
                    }
                }
            }
            if (message.Length > 0)
            {
                AddHtml(434, 284, 120, 170, message, false, false);
            }
            AddButton(561, 21, 22153, 22155, 4, Reply, 0); // Help Button
        }
Пример #3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            m_From.CloseGump(typeof(ShardTravelGump));
            int     id = info.ButtonID;
            Point3D p;
            Map     map;

            if (id < 100)
            {
                if (id == 2)
                {
                    m_From.SendGump(new ShardTravelGump(m_From, m_Page - 1, X, Y, m_TravelMap));
                }
                if (id == 3)
                {
                    m_From.SendGump(new ShardTravelGump(m_From, m_Page + 1, X, Y, m_TravelMap));
                }
                if (id == 4)
                {
                    m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap));
                    m_From.SendGump(new MapTravelHelp(X, Y));
                }
            }
            else if (id < 10000)
            {
                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, id));
            }
            else if (id < 20000)
            {
                // Here begins the teleport

                string message = "";

                try
                {
                    id -= 10000;
                    bool             NonGM = m_From.AccessLevel < AccessLevel.GameMaster;
                    ShardTravelEntry entry = m_TravelMap.GetEntry(id);
                    if (entry == null)
                    {
                        return;
                    }

                    p   = entry.Destination;
                    map = entry.Map;

                    if (MapTravelHelp.CanTravel(m_From, map, p) && (entry.Unlocked || !NonGM) && m_TravelMap.Parent == m_From.Backpack)
                    {
                        if (NonGM && CHARGE)                         // Do not charge GMs - they might complain...
                        {
                            Container pack = m_From.Backpack;
                            if (pack == null || (pack.ConsumeTotal(payTypes, payAmounts) > 0))
                            {
                                if (pack == null)
                                {
                                    message = "Your pack is null???";
                                }
                                else
                                {
                                    message = string.Format("Using the map to teleport costs {0}.", PAYTHIS);
                                }
                                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, m_Detail, message));
                                return;
                            }
                            // Payment was successful if we reach here ...
                        }
                        m_From.MoveToWorld(p, map);
                        message = string.Format("{0} have been moved to X:{1}, Y:{2}, Z:{3}, Map: {4}",
                                                CHARGE ? "You paid " + PAYTHIS + " and" : "You", p.X, p.Y, p.Z, map);
                    }
                }
                catch
                {
                    message = string.Format("Teleport failed.");
                }

                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, m_Detail, message));
            }
            else if (id >= 30000 && id < 40000)
            {
                id -= 30000;

                ShardTravelEntry entry = m_TravelMap.GetEntry(id);
                if (entry == null)
                {
                    return;
                }

                p   = entry.Destination;
                map = entry.Map;

                string message = "";
                if (map != m_From.Map)
                {
                    message = "You must be on the same map to Explore there.";
                }
                else
                {
                    if (m_From.InRange(p, 7))
                    {
                        entry.Unlocked   = true;
                        entry.Discovered = true; // We do this in case a GM unlocked the location before it was discovered.
                        message          = string.Format("You have unlocked a new location: {0}.", entry.Name);
                    }
                    else
                    {
                        int distance = (int)m_From.GetDistanceToSqrt(p);
                        message = string.Format("That location is still approximately {0} paces to the {1}.",
                                                distance, MapTravelHelp.GetDirection(m_From, p));
                    }
                }
                m_From.SendGump(new ShardTravelGump(m_From, m_Page, X, Y, m_TravelMap, m_Detail, message));
            }
        }