示例#1
0
        public ConstellationInfo(GenericReader reader)
        {
            reader.ReadInt();

            Identifier     = reader.ReadInt();
            TimeCoordinate = (TimeCoordinate)reader.ReadInt();

            Name         = reader.ReadString();
            DiscoveredBy = reader.ReadMobile();
            DiscoveredOn = reader.ReadDateTime();
            CoordRA      = reader.ReadInt();
            CoordDEC     = reader.ReadDouble();

            int count = reader.ReadInt();

            StarPositions = new StarPosition[count];

            for (int i = 0; i < count; i++)
            {
                StarPosition pos = new StarPosition
                {
                    ImageID = reader.ReadInt(),
                    X       = reader.ReadInt(),
                    Y       = reader.ReadInt()
                };

                StarPositions[i] = pos;
            }

            if (HasBeenDiscovered)
            {
                AstronomySystem.AddDiscovery(this);
            }
        }
示例#2
0
        public override bool OnDragDrop(Mobile m, Item dropped)
        {
            if (dropped is StarChart)
            {
                StarChart chart = (StarChart)dropped;

                if (chart.Constellation >= 0 && chart.Constellation < AstronomySystem.MaxConstellations)
                {
                    if (String.IsNullOrEmpty(chart.ConstellationName))
                    {
                        m.SendLocalizedMessage(1158751); // You must name your constellation before submitting it.
                    }
                    else
                    {
                        ConstellationInfo info = AstronomySystem.GetConstellation(chart.Constellation);

                        if (info != null)
                        {
                            Gump gump = new Gump(100, 100);
                            gump.AddBackground(0, 0, 720, 270, 0x2454);
                            gump.AddImage(0, 0, 0x69D);
                            gump.AddHtmlLocalized(290, 14, 418, 18, 1114513, "#1158517", 0xC63, false, false); // Willebrord the Astronomer

                            if (info.HasBeenDiscovered)
                            {
                                m.SendLocalizedMessage(1158764); // That constellation name has already been chosen, please choose another and resubmit your star chart.
                                gump.AddHtmlLocalized(290, 51, 418, 209, 1158530, 0xC63, false, true);
                                // Sorry to say that constellation has already been discovered! Fix your eyes to the heavens and keep up the searc
                            }
                            else
                            {
                                gump.AddHtmlLocalized(290, 51, 418, 209, 1158519, 0xC63, false, true);
                                // Wow! Would you look at that! Always amazes me how even an amateur can make such profound discoveries!
                                // I've recorded your discovery in the ledger. Here's some items I think you have more than earned! Well done!

                                info.DiscoveredBy = chart.ChartedBy;
                                info.Name         = chart.ConstellationName;
                                info.DiscoveredOn = chart.ChartedOn;
                                AstronomySystem.AddDiscovery(info);

                                m.AddToBackpack(new RecipeScroll(465));
                                m.AddToBackpack(new AstronomerTitleDeed());
                            }

                            m.SendGump(gump);
                        }
                    }
                }
            }
            else
            {
                SayTo(m, 1158529, 1163); // What's this? I haven't time for this! Star Charts only please!
            }

            return(false);
        }
示例#3
0
            public override void AddGumpLayout()
            {
                AddPage(0);

                AddBackground(0, 0, 820, 620, 0x2454);
                AddHtmlLocalized(10, 28, 800, 18, 1114513, "#1158520", 0x0, false, false);                                                                                                    // Constellation Ledger
                AddHtmlLocalized(295, 55, 515, 36, 1158521, String.Format("{0}\t{1}", AstronomySystem.DiscoveredConstellations.Count, AstronomySystem.MaxConstellations), 0x0, false, false); // Constellations Discovered: ~1_VAL~ / ~2_VAL~

                AddHtmlLocalized(55, 100, 100, 36, 1114513, "#1158522", 0x0, false, false);                                                                                                   // Constellation Name
                AddHtmlLocalized(245, 100, 80, 36, 1114513, "#1158523", 0x0, false, false);                                                                                                   // Astronomer
                AddHtmlLocalized(375, 100, 80, 36, 1114513, "#1158524", 0x0, false, false);                                                                                                   // Discovery Date
                AddHtmlLocalized(505, 100, 80, 36, 1114513, "#1158525", 0x0, false, false);                                                                                                   // Night Period
                AddHtmlLocalized(635, 100, 80, 36, 1114513, "#1158526", 0x0, false, false);                                                                                                   // Coordinates

                int start = Page * 20;
                int y     = 145;

                for (int i = start; i < AstronomySystem.DiscoveredConstellations.Count && i <= start + 20; i++)
                {
                    ConstellationInfo info = AstronomySystem.GetConstellation(AstronomySystem.DiscoveredConstellations[i]);

                    AddHtml(15, y, 200, 18, Color("#0040FF", info.Name), false, false);
                    AddHtml(240, y, 112, 18, Color("#0040FF", info.DiscoveredBy != null ? info.DiscoveredBy.Name : "Unknown"), false, false);
                    AddHtml(380, y, 112, 18, Color("#0040FF", info.DiscoveredOn.ToShortDateString()), false, false);
                    AddHtmlLocalized(492, y, 130, 18, AstronomySystem.TimeCoordinateLocalization(info.TimeCoordinate), 0x1F, false, false);
                    AddHtmlLocalized(632, y, 150, 18, 1158527, String.Format("{0}\t{1}", info.CoordRA, info.CoordDEC), 0x1F, false, false); // RA ~1_VAL~  DEC ~2_VAL~

                    y += 18;
                }

                AddButton(340, 540, 0x605, 0x606, 1, GumpButtonType.Reply, 0);
                AddButton(370, 540, 0x609, 0x60A, 2, GumpButtonType.Reply, 0);
                AddButton(460, 540, 0x607, 0x608, 3, GumpButtonType.Reply, 0);
                AddButton(484, 540, 0x603, 0x604, 4, GumpButtonType.Reply, 0);

                AddLabel(415, 570, 0, String.Format("{0}/{1}", Page + 1, Pages.ToString()));
            }