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(); } }
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(); } }