Ejemplo n.º 1
0
        private int GetFacet(DaviesLockerEntry entry)
        {
            Map map = entry.Map;

            if (map == Map.Felucca)
            {
                return(1012001); // Felucca
            }
            else if (map == Map.Trammel)
            {
                return(1012000); // Trammel
            }
            else if (map == Map.Ilshenar)
            {
                return(1012002); // Ilshenar
            }
            else if (map == Map.Malas)
            {
                return(1060643); // Malas
            }
            else if (map == Map.Tokuno)
            {
                return(1063258); // Tokuno Islands
            }
            else if (map == Map.TerMur)
            {
                return(1112178); // Ter Mur
            }
            else
            {
                return(1074235); // Unknown
            }
        }
Ejemplo n.º 2
0
        private int GetStatus(DaviesLockerEntry entry)
        {
            if (entry is SOSEntry sosEntry)
            {
                if (!sosEntry.Opened)
                {
                    return(1153570); // Unopened
                }
                if (sosEntry.IsAncient)
                {
                    return(1153572); // Ancient
                }
                return(1153571);     // Opened
            }
            else if (entry is TreasureMapEntry mapEntry)
            {
                if (mapEntry.Completed)
                {
                    return(1153582); // Completed
                }
                else if (mapEntry.Decoder != null)
                {
                    return(1153581); // Decoded
                }
                else
                {
                    return(1153580); // Not Decoded
                }
            }

            return(1153569); // Unknown
        }
Ejemplo n.º 3
0
        private void ConstructEntry(Mobile from, DaviesLockerEntry entry)
        {
            Item item = null;

            if (entry is SOSEntry)
            {
                item = Construct((SOSEntry)entry);
            }
            else if (entry is TreasureMapEntry)
            {
                item = Construct((TreasureMapEntry)entry);
            }

            if (item != null)
            {
                Container pack = from.Backpack;

                if (pack == null || !pack.TryDropItem(from, item, false))
                {
                    item.Delete();
                }
                else
                {
                    if (m_List.Contains(entry))
                    {
                        m_List.Remove(entry);
                        m_Addon.UpdateProperties();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0); // Version

            writer.Write(South);

            writer.Write(Entries.Count);
            for (var index = 0; index < Entries.Count; index++)
            {
                DaviesLockerEntry entry = Entries[index];
                if (entry is SOSEntry)
                {
                    writer.Write(0);
                }
                else if (entry is TreasureMapEntry)
                {
                    writer.Write(1);
                }
                else
                {
                    writer.Write(2);
                    continue;
                }

                entry.Serialize(writer);
            }
        }
Ejemplo n.º 5
0
        private string GetFacet(DaviesLockerEntry entry)
        {
            if (entry is TreasureMapEntry && Server.Spells.SpellHelper.IsEodon(entry.Map, entry.Location))
            {
                return("Eodon");
            }

            return(entry.Map.ToString());
        }
Ejemplo n.º 6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!m_Addon.CanUse(from))
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 0: return;

            case 1:     // PAGE BACK
                m_Page--;
                break;

            case 2:     // PAGE FORWARD
                m_Page++;
                break;

            case 3:     // ADD MAPS
            {
                from.Target = new InternalTarget(from, m_Addon, m_Page);
                from.SendLocalizedMessage(1153563);         // Target maps in your backpack or a sub-container to add them to the Locker. When done, press ESC.
                return;
            }

            case 11:
                m_Page = m_Page - 11;
                break;

            case 12:
                m_Page = m_Page + 11;
                break;

            default:
            {
                int index = info.ButtonID - 1000;

                if (index >= 0 && index < m_List.Count)
                {
                    DaviesLockerEntry entry = m_List[index];

                    if (entry != null)
                    {
                        ConstructEntry(from, entry);
                    }
                }
            }
            break;
            }

            from.SendGump(new DaviesLockerGump(from, m_Addon, m_Page));
        }
Ejemplo n.º 7
0
        public void TryAddEntry(Item item, Mobile from)
        {
            if (!CanUse(from) || item == null)
            {
                return;
            }

            if (!CheckRange(from))
            {
                from.SendLocalizedMessage(3000268); // that is too far away.
            }
            else if (!(item is TreasureMap || item is SOS || item is MessageInABottle))
            {
                from.SendLocalizedMessage(1153564); // That is not a treasure map or message in a bottle.
            }
            else if (!item.IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1054107); // This item must be in your backpack.
            }
            else if (Entries.Count >= 500)
            {
                from.SendLocalizedMessage(1153565); // The locker is full
            }
            else
            {
                DaviesLockerEntry entry = null;

                if (item is TreasureMap)
                {
                    entry = new TreasureMapEntry((TreasureMap)item);
                }
                else if (item is SOS)
                {
                    entry = new SOSEntry((SOS)item);
                }
                else if (item is MessageInABottle)
                {
                    entry = new SOSEntry((MessageInABottle)item);
                }

                if (entry != null)
                {
                    Entries.Add(entry);
                    from.CloseGump(typeof(DaviesLockerGump));
                    from.SendGump(new DaviesLockerGump(from, this));

                    item.Delete();

                    UpdateProperties();
                }
            }
        }
Ejemplo n.º 8
0
        private int GetLevel(DaviesLockerEntry entry)
        {
            if (entry is SOSEntry)
            {
                return(1153568); // S-O-S
            }
            else if (entry is TreasureMapEntry)
            {
                return(1153572 + entry.Level);
            }

            return(1153569); // Unknown
        }
Ejemplo n.º 9
0
        public string GetLocation(DaviesLockerEntry e)
        {
            string loc;

            // Location labels
            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))
            {
                loc = string.Format("{0}@{1}", yLat + (ySouth ? "S" : "N"), xLong + (xEast ? "E" : "W"));
            }
            else
            {
                loc = string.Format("{0}@{1}", e.Location.X.ToString(), e.Location.Y.ToString());
            }

            return(loc);
        }
Ejemplo n.º 10
0
        public DaviesLockerGump(Mobile from, DaviesLockerAddon addon, int page)
            : base(100, 100)
        {
            if (addon == null || addon.Deleted)
            {
                return;
            }

            AddImage(0, 0, 0x5C1);
            m_List  = addon.Entries;
            m_Addon = addon;

            AddHtmlLocalized(10, 10, 580, 20, 1153552, AquaGreen, false, false); // <DIV ALIGN="CENTER">Davies' Locker</DIV>

            AddHtmlLocalized(35, 40, 35, 20, 1153554, Blue, false, false);       // <DIV ALIGN="CENTER">Get</DIV>
            AddHtmlLocalized(78, 40, 110, 20, 1153555, Blue, false, false);      // <DIV ALIGN="CENTER">Facet</DIV>
            AddHtmlLocalized(198, 40, 110, 20, 1153556, Blue, false, false);     // <DIV ALIGN="CENTER">Level</DIV>
            AddHtmlLocalized(373, 40, 90, 20, 1153557, Blue, false, false);      // <DIV ALIGN="CENTER">Coords</DIV>
            AddHtmlLocalized(473, 40, 110, 20, 1153558, Blue, false, false);     // <DIV ALIGN="CENTER">Status</DIV>

            int perPage    = 10;
            int totalPages = (int)Math.Ceiling(m_List.Count / 10.0);

            if (totalPages < 1)
            {
                totalPages = 1;
            }

            if (page < 0)
            {
                page = 0;
            }

            if (page + 1 > totalPages)
            {
                page = totalPages - 1;
            }

            m_Page = page;

            int start = page * perPage;

            AddHtmlLocalized(35, 430, 280, 20, 1153560, string.Format("{0}@{1}", m_List.Count, "500"), Blue, false, false);                            // Maps: ~1_NUM~ of ~2_MAX~
            AddHtmlLocalized(35, 450, 280, 20, 1153561, string.Format("{0}@{1}", (page + 1).ToString(), (totalPages).ToString()), Blue, false, false); // Page ~1_CUR~ of ~2_MAX~

            AddHtmlLocalized(390, 430, 100, 20, 1153553, Yellow, false, false);                                                                        // <DIV ALIGN="CENTER">ADD MAPS</DIV>
            AddButton(350, 430, 4011, 4013, 3, GumpButtonType.Reply, 0);

            AddHtmlLocalized(390, 450, 100, 20, 1153562, Yellow, false, false); // <DIV ALIGN="CENTER">PAGE</DIV>
            AddButton(350, 450, 4014, 4016, 1, GumpButtonType.Reply, 0);
            AddButton(500, 450, 4005, 4007, 2, GumpButtonType.Reply, 0);

            AddButton(330, 453, 5603, 5607, 11, GumpButtonType.Reply, 0);
            AddButton(534, 453, 5601, 5605, 12, GumpButtonType.Reply, 0);

            int y     = 73;
            int index = 0;

            for (int i = start; i >= 0 && i < m_List.Count && index < perPage; i++)
            {
                DaviesLockerEntry entry = m_List[i];

                if (entry == null)
                {
                    continue;
                }

                if (addon.CanUse(from))
                {
                    AddButton(45, y + 4, 1209, 1210, 1000 + i, GumpButtonType.Reply, 0);
                }

                AddHtmlLocalized(78, y, 110, 20, GetFacet(entry), Yellow, false, false);

                if (TreasureMapInfo.NewSystem && entry is TreasureMapEntry)
                {
                    AddHtmlLocalized(174, y, 110, 20, GetPackage((TreasureMapEntry)entry), Yellow, false, false);
                    AddHtmlLocalized(268, y, 110, 20, GetLevel((TreasureMapEntry)entry), Yellow, false, false);
                }
                else
                {
                    AddHtmlLocalized(268, y, 110, 20, GetLevel(entry), Yellow, false, false);
                }

                if ((entry is TreasureMapEntry && ((TreasureMapEntry)entry).Decoder == null) || (entry is SOSEntry && !((SOSEntry)entry).Opened))
                {
                    AddHtmlLocalized(373, y, 90, 20, 1153569, Yellow, false, false); // Unknown
                }
                else
                {
                    AddHtmlLocalized(373, y, 90, 20, 1060847, GetLocation(entry), Yellow, false, false); // ~1_val~ ~2_val~
                }
                AddHtmlLocalized(473, y, 100, 20, GetStatus(entry), Yellow, false, false);

                y += 35;
                index++;
            }
        }
Ejemplo n.º 11
0
        public DaviesLockerGump(Mobile from, DaviesLockerAddon addon, int page) : base(50, 50)
        {
            if (addon == null || addon.Deleted)
            {
                return;
            }

            AddImage(0, 0, 0x5C1);
            m_List  = addon.Entries;
            m_Addon = addon;

            AddHtmlLocalized(0, 10, 600, 20, 1153552, AquaGreen, false, false); // <DIV ALIGN="CENTER">Davies' Locker</DIV>

            AddHtmlLocalized(30, 35, 40, 20, 1153554, Blue, false, false);      // <DIV ALIGN="CENTER">Get</DIV>
            AddHtmlLocalized(75, 35, 120, 20, 1153555, Blue, false, false);     // <DIV ALIGN="CENTER">Facet</DIV>
            AddHtmlLocalized(195, 35, 120, 20, 1153556, Blue, false, false);    // <DIV ALIGN="CENTER">Level</DIV>
            AddHtmlLocalized(315, 35, 120, 20, 1153557, Blue, false, false);    // <DIV ALIGN="CENTER">Coords</DIV>
            AddHtmlLocalized(435, 35, 120, 20, 1153558, Blue, false, false);    // <DIV ALIGN="CENTER">Status</DIV>

            int perPage    = 10;
            int totalPages = (int)Math.Ceiling((double)m_List.Count / 10.0);

            if (totalPages < 1)
            {
                totalPages = 1;
            }

            if (page < 0)
            {
                page = 0;
            }
            if (page + 1 > totalPages)
            {
                page = totalPages - 1;
            }
            m_Page = page;

            int start = page * perPage;

            AddHtmlLocalized(40, 428, 200, 20, 1153560, String.Format("{0}\t{1}", m_List.Count, "500"), Blue, false, false);                            // Maps: ~1_NUM~ of ~2_MAX~
            AddHtmlLocalized(40, 450, 200, 20, 1153561, String.Format("{0}\t{1}", (page + 1).ToString(), (totalPages).ToString()), Blue, false, false); // Page ~1_CUR~ of ~2_MAX~

            AddHtmlLocalized(380, 427, 72, 20, 1153553, Yellow, false, false);                                                                          // <DIV ALIGN="CENTER">ADD MAPS</DIV>
            AddButton(340, 428, 4011, 4013, 1, GumpButtonType.Reply, 0);

            AddHtmlLocalized(377, 450, 40, 20, 1153562, Yellow, false, false); // <DIV ALIGN="CENTER">PAGE</DIV>
            AddButton(340, 450, 4014, 4016, 2, GumpButtonType.Reply, 0);
            AddButton(502, 450, 4005, 4007, 3, GumpButtonType.Reply, 0);
            AddImage(320, 455, 5603);
            AddImage(537, 455, 5601);

            int y     = 72;
            int index = 0;

            for (int i = start; i >= 0 && i < m_List.Count && index < perPage; i++)
            {
                DaviesLockerEntry entry = m_List[i];

                if (entry == null)
                {
                    continue;
                }

                if (addon.CanUse(from))
                {
                    AddButton(45, y + 3, 1209, 1210, 5 + i, GumpButtonType.Reply, 0);
                }

                AddHtml(80, y, 100, 20, String.Format("<basefont color=yellow>{0}", entry.Map.ToString()), false, false);
                AddHtmlLocalized(205, y, 220, 20, GetLevel(entry), Yellow, false, false);

                if ((entry is TreasureMapEntry && ((TreasureMapEntry)entry).Decoder == null) || (entry is SOSEntry && !((SOSEntry)entry).Opened))
                {
                    AddHtmlLocalized(325, y, 100, 20, 1153569, Yellow, false, false); // Unknown
                }
                else
                {
                    AddHtmlLocalized(325, y, 100, 20, 1060847, String.Format("{0}\t{1}", entry.Location.X.ToString(), entry.Location.Y.ToString()), Yellow, false, false); // ~1_val~ ~2_val~
                }
                AddHtmlLocalized(440, y, 100, 20, GetStatus(entry), Yellow, false, false);

                y += 35;
                index++;
            }
        }