Beispiel #1
0
        public void SendTarget(Mobile m)
        {
            m.SendLocalizedMessage(1158494); // Which telescope do you wish to create the star chart from?
            m.BeginTarget(10, false, TargetFlags.None, (from, targeted) =>
            {
                if (!Deleted && IsChildOf(from.Backpack) && targeted is PersonalTelescope)
                {
                    var tele = (PersonalTelescope)targeted;

                    var constellation = AstronomySystem.GetConstellation(tele.TimeCoordinate, tele.RA, tele.DEC);

                    if (constellation != null)
                    {
                        from.SendLocalizedMessage(1158496);     // You successfully map the time-coordinate of the constellation.

                        ChartedBy     = from;
                        ChartedOn     = DateTime.Now;
                        Constellation = constellation.Identifier;
                        from.PlaySound(0x249);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1158495);     // There is nothing to chart at these coordinates at this time.
                    }
                }
            });
        }
Beispiel #2
0
            public override void OnResponse(RelayInfo info)
            {
                if (info.ButtonID == 1 && Chart != null && !Chart.Deleted && Chart.Constellation >= 0)
                {
                    TextRelay relay = info.GetTextEntry(1);

                    if (relay != null && relay.Text != null)
                    {
                        var text = relay.Text;

                        if (Server.Guilds.BaseGuildGump.CheckProfanity(text) &&
                            !AstronomySystem.CheckNameExists(text) &&
                            text.Length > 0 &&
                            text.Length < 37)
                        {
                            Chart.ConstellationName = text;
                            User.SendLocalizedMessage(1158512); // You record the name of the constellation.
                        }
                        else
                        {
                            User.SendLocalizedMessage(1158511); // You have entered an invalid name. Please try again.
                        }
                    }
                }
            }
Beispiel #3
0
            public override void AddGumpLayout()
            {
                var info = AstronomySystem.GetConstellation(Chart.Constellation);

                AddPage(0);

                AddBackground(0, 0, 454, 350, 0x24AE);
                AddHtmlLocalized(32, 68, 112, 36, 1158505, false, false); // Constellation Name:
                AddHtml(154, 68, 300, 36, Color("#0040FF", string.IsNullOrEmpty(Chart.ConstellationName) ? "This constellation has not yet been named" : Chart.ConstellationName), false, false);

                AddHtmlLocalized(32, 104, 75, 36, 1158502, false, false); // Charted By:
                AddHtml(112, 104, 50, 36, Color("#0040FF", Chart.ChartedBy == null ? string.Empty : Chart.ChartedBy.Name), false, false);

                AddHtmlLocalized(32, 140, 75, 36, 1158503, false, false); // Charted On:
                AddHtml(112, 140, 80, 36, Color("#0040FF", Chart.ChartedOn.ToShortDateString()), false, false);

                AddHtmlLocalized(32, 176, 125, 18, 1158504, false, false); // Time-Coordinate:
                AddHtmlLocalized(47, 199, 60, 36, AstronomySystem.TimeCoordinateLocalization(info.TimeCoordinate), 0x1F, false, false);

                AddHtmlLocalized(157, 199, 20, 36, 1158489, false, false); // RA
                AddHtml(182, 199, 20, 36, Color("#0040FF", info.CoordRA.ToString()), false, false);

                AddHtmlLocalized(242, 199, 25, 36, 1158490, false, false); // DEC
                AddHtml(272, 199, 50, 36, Color("#0040FF", info.CoordDEC.ToString()), false, false);

                AddBackground(32, 253, 343, 22, 0x2486);
                AddTextEntry(34, 255, 339, 18, 0, 1, string.Empty, 34);

                AddButton(375, 245, 0x232C, 0x232D, 1, GumpButtonType.Reply, 0);
            }
Beispiel #4
0
        public override void OnResponse(RelayInfo info)
        {
            if (!User.InRange(Tele.Location, 2) || User.Map != Tele.Map)
            {
                return;
            }

            Tele.LastUse = DateTime.UtcNow;

            switch (info.ButtonID)
            {
            case 60000:     // RA 10's Up
                if (Tele.RA >= 20)
                {
                    Tele.RA -= 20;
                }
                else
                {
                    Tele.RA += 10;
                }
                User.SendSound(0x4A);
                break;

            case 60001:     // RA 10's Down
                if (Tele.RA < 10)
                {
                    Tele.RA += 20;
                }
                else
                {
                    Tele.RA -= 10;
                }
                User.SendSound(0x4A);
                break;

            case 60002:     // RA 1's Up
                int raOnes = GetPlace(Tele.RA, 1);

                if (raOnes >= 9)
                {
                    Tele.RA -= 9;
                }
                else
                {
                    Tele.RA++;
                }
                User.SendSound(0x4A);
                break;

            case 60003:     // RA 1's Down
                int raOnes1 = GetPlace(Tele.RA, 1);

                if (raOnes1 == 0)
                {
                    Tele.RA += 9;
                }
                else
                {
                    Tele.RA--;
                }
                User.SendSound(0x4A);
                break;

            case 60004:     // DEC 10's Up
                if (Tele.DEC >= 90)
                {
                    Tele.DEC -= 90;
                }
                else
                {
                    Tele.DEC += 10;
                }
                User.SendSound(0x4A);
                break;

            case 60005:     // DEC 10's Down
                if (Tele.DEC < 10)
                {
                    Tele.DEC += 90;
                }
                else
                {
                    Tele.DEC -= 10;
                }
                User.SendSound(0x4A);
                break;

            case 60006:     // DEC 1's Up
                int decOnes = GetPlace((int)Math.Truncate(Tele.DEC), 1);

                if (decOnes >= 9)
                {
                    Tele.DEC -= 9;
                }
                else
                {
                    Tele.DEC++;
                }
                User.SendSound(0x4A);
                break;

            case 60007:     // DEC 1's Down
                int decOnes1 = GetPlace((int)Math.Truncate(Tele.DEC), 1);

                if (decOnes1 <= 0)
                {
                    Tele.DEC += 9;
                }
                else
                {
                    Tele.DEC--;
                }
                User.SendSound(0x4A);
                break;

            case 60008:     // DEC .2 Up
                int dec = GetDecimalPlace(Tele.DEC);

                if (dec >= 8)
                {
                    Tele.DEC = Math.Truncate(Tele.DEC);
                }
                else
                {
                    Tele.DEC += .2;
                }
                User.SendSound(0x4A);
                break;

            case 60009:     // DEC .2 Down
                int dec1 = GetDecimalPlace(Tele.DEC);

                if (dec1 < 2)
                {
                    Tele.DEC += 0.8;
                }
                else if (dec1 == 2)
                {
                    Tele.DEC = Math.Truncate(Tele.DEC);
                }
                else
                {
                    Tele.DEC -= 0.2;
                }

                User.SendSound(0x4A);
                break;

            case 70000:     // View Coord
                if (Tele.RA > AstronomySystem.MaxRA || Tele.DEC > AstronomySystem.MaxDEC)
                {
                    User.SendLocalizedMessage(1158488);     // You have entered invalid coordinates.
                    User.SendSound(81);
                }
                else
                {
                    InterstellarObject = null;
                    Constellation      = null;
                    ImageID            = AstronomySystem.RandomSkyImage(User);

                    var timeCoord = Tele.TimeCoordinate;

                    if (timeCoord == TimeCoordinate.Day)
                    {
                        User.SendLocalizedMessage(1158513);     // You won't have much luck seeing the night sky during the day...
                    }
                    else
                    {
                        var constellation = AstronomySystem.GetConstellation(timeCoord, Tele.RA, Tele.DEC);

                        if (constellation != null)
                        {
                            Constellation = constellation;

                            User.SendLocalizedMessage(1158492, "", 0xBF);     // You peer into the heavens and see...a constellation!
                            User.SendSound(User.Female ? 0x32B : 0x43D);
                        }
                        else if (0.2 > Utility.RandomDouble())
                        {
                            InterstellarObject = AstronomySystem.GetRandomInterstellarObject();

                            User.SendLocalizedMessage(InterstellarObject.Item2, "", 0xBF);     //
                            User.SendSound(User.Female ? 0x32B : 0x43D);
                        }
                        else
                        {
                            User.SendLocalizedMessage(1158491, "", 0xBF);     // You peer into the heavens and see...only empty space...
                        }
                    }
                }

                Refresh();
                return;
            }

            if (info.ButtonID != 0)
            {
                Refresh();
            }
        }
Beispiel #5
0
        public override void AddGumpLayout()
        {
            AddPage(0);

            if (ImageID == 0)
            {
                ImageID = AstronomySystem.RandomSkyImage(User);
            }

            AddImage(0, 0, ImageID);

            AddImage(222, 597, 0x694);
            AddImage(229, 600, GetGumpNumber(GetPlace(Tele.RA, 10)));

            AddButton(222, 584, 0x697, 0x698, 60000, GumpButtonType.Reply, 0);
            AddButton(222, 631, 0x699, 0x69A, 60001, GumpButtonType.Reply, 0);

            AddImage(256, 597, 0x694);
            AddImage(263, 600, GetGumpNumber(GetPlace(Tele.RA, 1)));

            AddButton(256, 584, 0x697, 0x698, 60002, GumpButtonType.Reply, 0);
            AddButton(256, 631, 0x699, 0x69A, 60003, GumpButtonType.Reply, 0);

            AddButton(291, 597, 0x69B, 0x69C, 70000, GumpButtonType.Reply, 0);
            AddTooltip(1158499); // View Coordinate

            AddImage(332, 597, 0x694);
            AddImage(339, 600, GetGumpNumber(GetPlace((int)Math.Truncate(Tele.DEC), 10)));

            AddButton(332, 584, 0x697, 0x698, 60004, GumpButtonType.Reply, 0);
            AddButton(332, 631, 0x699, 0x69A, 60005, GumpButtonType.Reply, 0);

            AddImage(366, 597, 0x694);
            AddImage(373, 600, GetGumpNumber(GetPlace((int)Math.Truncate(Tele.DEC), 1)));

            AddButton(366, 584, 0x697, 0x698, 60006, GumpButtonType.Reply, 0);
            AddButton(366, 631, 0x699, 0x69A, 60007, GumpButtonType.Reply, 0);

            AddImage(400, 597, 0x694);
            AddImage(407, 600, GetGumpNumber(GetDecimalPlace(Tele.DEC)));

            AddButton(400, 584, 0x697, 0x698, 60008, GumpButtonType.Reply, 0);
            AddButton(400, 631, 0x699, 0x69A, 60009, GumpButtonType.Reply, 0);

            AddImage(397, 623, 0x696);

            AddHtmlLocalized(251, 651, 100, 50, 1158489, 0x6B55, false, false); // RA
            AddTooltip(1158497);                                                // Right Ascension

            AddHtmlLocalized(371, 651, 100, 50, 1158490, 0x6B55, false, false); // DEC
            AddTooltip(1158498);                                                // Declination

            if (Constellation != null)
            {
                RenderConstellation();
            }
            else if (InterstellarObject != null)
            {
                RenderInterstellarObject();
            }
        }