// Bare-bones teleporter. No extra checks like the ones in Items/Misc/PublicMoongate.cs. public override bool OnMoveOver(Mobile m) { if (!gateOpened) { return(false); } if (!m.Player) { return(false); } // If no preset target phase, use the moon MoonPhase curPhase = Clock.GetMoonPhase(Map.Felucca, this.GetWorldLocation().X, 0); // If a target phase is specified on gate creation, override the moon if (m_usePhase) { curPhase = m_targetPhase; } Point3D dest = MoonPhase2Destination(curPhase); BaseCreature.TeleportPets(m, dest, this.Map); m.MoveToWorld(dest, this.Map); if (m.AccessLevel == AccessLevel.Player || !m.Hidden) { m.PlaySound(0x1FE); } return(false); }
public static string DescribeMoonPhase(MoonPhase mp, ITranslationHelper Helper) { switch (mp) { case MoonPhase.ErrorPhase: return(Helper.Get("moon-text.error")); case MoonPhase.FirstQuarter: return(Helper.Get("moon-text.phase-firstqrt")); case MoonPhase.FullMoon: return(Helper.Get("moon-text.phase-full")); case MoonPhase.NewMoon: return(Helper.Get("moon-text.phase-new")); case MoonPhase.ThirdQuarter: return(Helper.Get("moon-text.phase-thirdqrt")); case MoonPhase.WaningCrescent: return(Helper.Get("moon-text.phase-waningcres")); case MoonPhase.WaningGibbeous: return(Helper.Get("moon-text.phase-waninggibb")); case MoonPhase.WaxingCrescent: return(Helper.Get("moon-text.phase-waxingcres")); case MoonPhase.WaxingGibbeous: return(Helper.Get("moon-text.phase-waxinggibb")); default: return(Helper.Get("moon-text.error")); } }
public Rectangle GetNightMoonSprite(MoonPhase currPhase) { switch (currPhase) { case MoonPhase.BloodMoon: return(Icons.BloodMoon); case MoonPhase.NewMoon: return(Icons.NewMoon); case MoonPhase.WaxingCrescent: return(Icons.WaxingCrescent2); case MoonPhase.FirstQuarter: return(Icons.FirstQuarter); case MoonPhase.WaxingGibbeous: return(Icons.WaxingGibbeous); case MoonPhase.FullMoon: return(Icons.FullMoon); case MoonPhase.WaningGibbeous: return(Icons.WaningGibbeous); case MoonPhase.ThirdQuarter: return(Icons.ThirdQuarter); case MoonPhase.WaningCrescent: return(Icons.WaningCrescent2); } return(Icons.NewMoon); }
public TCHUDMessage(string message, MoonPhase mPhase) : base(message) { this.messagePhase = mPhase; this.message = message; this.noIcon = false; color = Color.SeaGreen; timeLeft = 3500f; }
public void MoonPhase_Set_Get(MoonPhase value) { var packet = new WorldInfo(); packet.MoonPhase = value; Assert.Equal(value, packet.MoonPhase); }
private int GetOneOverSpawnChance() { int num = 1; MoonPhase moonPhase = Main.GetMoonPhase(); num = ((moonPhase != 0 && moonPhase != MoonPhase.Empty) ? 10800 : 3600); return(num / 60); }
public UltimaMoongate_U4(MoonPhase phase) : base(0x1F13) { ThisGateIs = phase; Movable = false; Visible = false; Name = "An Ultima IV-style moongate opening at " + getPhaseName((int)phase); initTimer(); }
private void MoonPhaseForm_Load(object sender, EventArgs e) { this.Icon = Icon.FromHandle(Resources.IMAGE_MOON02.GetHicon()); var v1 = new VanaTime() { Year = api.VanaTime.CurrentYear, Month = api.VanaTime.CurrentMonth, Day = api.VanaTime.CurrentDay, Hour = api.VanaTime.CurrentHour, Minute = api.VanaTime.CurrentMinute, Second = api.VanaTime.CurrentSecond, }; MoonPhase lastMoonPhase = EliteAPIControl.GetMoonPhaseFromVanaTime(v1); for (int i = 0; i <= 4; i++) { gridMoonPhase.Columns[i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; gridMoonPhase.Columns[i].HeaderCell.Style.Font = new Font(gridMoonPhase.Font, gridMoonPhase.Font.Style | FontStyle.Bold); } MoonPhase last = EliteAPIControl.GetMoonPhaseFromVanaTime(v1); for (int i = 0; i < 360; i++) { var v2 = EliteAPIControl.addVanaDay(v1, i); MoonPhase m = EliteAPIControl.GetMoonPhaseFromVanaTime(v2); if (last != m) { gridMoonPhase.Rows.Add(); gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[0].Value = EliteAPIControl.GetEarthTimeFromVanaTime(v2).ToString("yyyy/MM/dd HH:mm"); gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[1].Value = string.Format("{0:0000}/{1:00}/{2:00}", v2.Year, v2.Month, v2.Day); gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[2].Value = MainForm.dicWeekDayImage[EliteAPIControl.GetWeekdayFromVanaTime(v2)]; gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[3].Value = MainForm.dicMoonPhaseImage[m]; gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].Cells[4].Value = MainForm.dicMoonPhaseName[m]; //行の色変更 gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Black; gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionForeColor = Color.Black; if (m == MoonPhase.New || m == MoonPhase.Full) { gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.BackColor = Color.FromArgb(0x80, 0xFF, 0xFF); gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionBackColor = Color.FromArgb(0x80, 0xFF, 0xFF); } else if (m == MoonPhase.FirstQuarter || m == MoonPhase.LastQuarter) { gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.BackColor = Color.LightGray; gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionBackColor = Color.LightGray; } else { gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.BackColor = Color.White; gridMoonPhase.Rows[gridMoonPhase.Rows.Count - 1].DefaultCellStyle.SelectionBackColor = Color.White; } } last = m; } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); ThisGateIs = (MoonPhase)reader.ReadInt(); initTimer(); }
void Update() { MoonPhase today = TimeState.GetTodaysMoonPhase(), tomorrow = TimeState.GetTomorrowsMoonPhase(); TodayPhase.text = today.ToString(true); TomorrowPhase.text = tomorrow.ToString(true); PhaseIconImage.sprite = PhaseIcons[(int)today]; }
// Update is called once per frame void Update() { double latitude = Input.location.lastData.latitude; //-17.3663289; double longitude = Input.location.lastData.longitude; //-66.1758675; var moonPosition = SunCalc.getMoonPosition(DateTime.UtcNow, latitude, longitude); var moonIllumination = SunCalc.getMoonIllumination(DateTime.UtcNow); var phase = MoonPhase.GetMoonPhase((float)moonIllumination.phase); phaseText.text = phase.Name; distanceText.text = moonPosition.distance + " Km."; //Texture2D texture = Resources.Load<Texture2D>(phase.ImagePath); }
public MoonPhase GetLunarPhase() { //divide it by the cycle. int currentDay = GetDayOfCycle(SDate.Now()); MoonPhase ret = SDVMoon.GetLunarPhase(currentDay); if (IsBloodMoon) //restructuring. { return(MoonPhase.BloodMoon); } return(ret); }
public static Rectangle GetMoonSprite(MoonPhase moon) { if (moon == MoonPhase.FirstQuarter) { return(Icons.FirstQuarter); } if (moon == MoonPhase.FullMoon) { return(Icons.FullMoon); } if (moon == MoonPhase.NewMoon) { return(Icons.NewMoon); } if (moon == MoonPhase.ThirdQuarter) { return(Icons.ThirdQuarter); } if (moon == MoonPhase.WaningCrescent) { return(Icons.WaningCrescent1); } if (moon == MoonPhase.WaxingCrescent) { return(Icons.WaxingCrescent1); } if (moon == MoonPhase.WaningGibbeous) { return(Icons.WaningGibbeous); } if (moon == MoonPhase.WaxingGibbeous) { return(Icons.WaxingGibbeous); } if (moon == MoonPhase.BlueMoon) { return(Icons.BlueMoon); } if (moon == MoonPhase.HarvestMoon) { return(Icons.HarvestMoon); } if (moon == MoonPhase.SpiritsMoon) { return(Icons.SpiritsEve); } return(Icons.NewMoon); }
public static string DescribeMoonPhase(MoonPhase mp) { switch (mp) { case MoonPhase.ErrorPhase: return("ErrorPhase"); case MoonPhase.FirstQuarter: return("FirstQuarter"); case MoonPhase.FullMoon: return("FullMoon"); case MoonPhase.NewMoon: return("NewMoon"); case MoonPhase.ThirdQuarter: return("ThirdQuarter"); case MoonPhase.WaningCrescent: return("WaningCrescent"); case MoonPhase.WaningGibbeous: return("WaningGibbous"); case MoonPhase.WaxingCrescent: return("WaxingCrescent"); case MoonPhase.WaxingGibbeous: return("WaxingGibbous"); case MoonPhase.BloodMoon: return("BloodMoon"); case MoonPhase.BlueMoon: return("BlueMoon"); case MoonPhase.HarvestMoon: return("HarvestMoon"); case MoonPhase.SpiritsMoon: return("SpiritsMoon"); default: return("ErrorMoon"); } }
public MoonPhase GetLunarPhase() { //divide it by the cycle. int currentDay = GetDayOfCycle(SDate.Now()); MoonPhase ret = SDVMoon.GetLunarPhase(currentDay); if (ret == MoonPhase.FullMoon) { if (Dice.NextDoublePositive() <= ModConfig.BadMoonRising) { return(MoonPhase.BloodMoon); } } return(ret); }
} // @ public string GetDayOfWeekName(Weekday day) /// <summary> /// Will get a string representation of the current moon phase /// </summary> /// <param name="phase">MoonPhase to get a proper String equivalent of.</param> /// <returns></returns> public string GetMoonPhaseName(MoonPhase phase) { string phaseName = String.Empty; switch (phase) { case MoonPhase.FirstQuarter: phaseName = "First Quarter"; break; case MoonPhase.Full: phaseName = "Full"; break; case MoonPhase.LastQuarter: phaseName = "Last Quarter"; break; case MoonPhase.New: phaseName = "New"; break; case MoonPhase.WaningCrescent: case MoonPhase.WaningCrescent2: phaseName = "Waning Crescent"; break; case MoonPhase.WaningGibbous: case MoonPhase.WaningGibbous2: phaseName = "Waning Gibbous"; break; case MoonPhase.WaxingCrescent: case MoonPhase.WaxingCrescent2: phaseName = "Waxing Crescent"; break; case MoonPhase.WaxingGibbous: case MoonPhase.WaxingGibbous2: phaseName = "Waxing Gibbous"; break; } // @ switch (phase) return(phaseName); } // @ public string GetMoonPhaseName(MoonPhase phase)
public MoonPhase GetLunarPhase() { //divide it by the cycle. int currentCycle = (int)Math.Floor(SDate.Now().DaysSinceStart / (double)cycleLength); int currentDay = GetDayOfCycle(SDate.Now()); MoonPhase ret = SDVMoon.GetLunarPhase(currentDay); if (ret == MoonPhase.FullMoon) { if (Dice.NextDoublePositive() <= ModConfig.BadMoonRising) { return(MoonPhase.BloodMoon); } } return(ret); }
/// <summary>Returns a list of dates on which in the input moon phase occurs within the current object's year. Basically, this method finds all the roots within a given range for a periodic function.</summary> /// <param name="phase">Phase to calcualte for. MoonPhases enumeration.</param> /// <returns>List of dates phase occurs on.</returns> public List<DateTime> MoonPhases(MoonPhase phase) { // create a new list List<DateTime> phaseDates = new List<DateTime>(); double year = (double)this.now.Year; for (year -= 0.05; year < this.now.Year + 1; year += 0.05) { DateTime d = Julian2Date( MoonPhaseDate(year, phase) ); // if the list already contains the calculated date, do not include it again. // or if the date is not within the current object's year. if (!phaseDates.Contains(d) && d.Year == this.now.Year) phaseDates.Add(d); } return phaseDates; }
public static Rectangle GetNightMoonSprite(MoonPhase currPhase) { switch (currPhase) { case MoonPhase.BloodMoon: return(Icons.BloodMoonIntensifies); case MoonPhase.NewMoon: return(Icons.NewMoon); case MoonPhase.WaxingCrescent: return(Icons.WaxingCrescent2); case MoonPhase.FirstQuarter: return(Icons.FirstQuarter); case MoonPhase.WaxingGibbeous: return(Icons.WaxingGibbeous); case MoonPhase.FullMoon: return(Icons.FullMoon); case MoonPhase.WaningGibbeous: return(Icons.WaningGibbeous); case MoonPhase.ThirdQuarter: return(Icons.ThirdQuarter); case MoonPhase.WaningCrescent: return(Icons.WaningCrescent2); case MoonPhase.BlueMoon: return(Icons.BlueMoon); case MoonPhase.HarvestMoon: return(Icons.HarvestMoon); case MoonPhase.SpiritsMoon: return(Icons.SpiritsEve); } return(Icons.NewMoon); }
/// <summary>Returns a list of dates on which in the input moon phase occurs within the current object's year. Basically, this method finds all the roots within a given range for a periodic function.</summary> /// <param name="phase">Phase to calcualte for. MoonPhases enumeration.</param> /// <returns>List of dates phase occurs on.</returns> public static List <DateTimeOffset> GetMoonPhases(MoonPhase phase) { // create a new list List <DateTimeOffset> phaseDates = new List <DateTimeOffset>(); double year = (double)DateTime.Now.Year; for (year -= 0.05; year < DateTime.Now.Year + 1; year += 0.05) { DateTimeOffset d = Julian2Date(MoonPhaseDate(year, phase)); // if the list already contains the calculated date, do not include it again. // or if the date is not within the current object's year. if (!phaseDates.Contains(d) && d.Year == DateTime.Now.Year) { phaseDates.Add(d); } } return(phaseDates); }
public MoonPhase CurrentPhase() { MoonPhase def = GetLunarPhase(); if (IsBloodMoon) { return(MoonPhase.BloodMoon); } if (IsBlueMoon) { return(MoonPhase.BlueMoon); } if (IsHarvestMoon) { return(MoonPhase.HarvestMoon); } if (Game1.currentSeason == "fall" && Game1.dayOfMonth == 27) { return(MoonPhase.SpiritsMoon); } return(def); }
public void CalculateMoonPhases() { int days = DaysSinceStart(); if (days < 0) { SolinariApex = SolinariApexes[22 + days]; SolinariPhase = MoonPhase.LowSanction; NuitariPhase = MoonPhase.LowSanction; LunitariPhase = MoonPhase.LowSanction; NuitariApex = MoonPhaseApex.NewMoon; LunitariApex = MoonPhaseApex.NewMoon; } else { SolinariPhase = SolinariPhases[(22 + days) % 36]; SolinariApex = SolinariApexes[days % 36]; LunitariPhase = LunitariPhases[(17 + days) % 28]; LunitariApex = LunitariApexes[days % 28]; NuitariPhase = NuitariPhases[(4 + days) % 8]; NuitariApex = NuitariApexes[days % 8]; } }
public static MoonPhaseChange GetPhaseChange(this MoonPhase phase) { switch (phase) { case MoonPhase.FullMoon: return(MoonPhaseChange.Neither); case MoonPhase.WaningGibbous: return(MoonPhaseChange.Waning); case MoonPhase.ThirdQuarter: return(MoonPhaseChange.Waning); case MoonPhase.WaningCrescent: return(MoonPhaseChange.Waning); case MoonPhase.NewMoon: return(MoonPhaseChange.Neither); case MoonPhase.WaxingCrescent: return(MoonPhaseChange.Waxing); case MoonPhase.FirstQuarter: return(MoonPhaseChange.Waxing); case MoonPhase.WaxingGibbous: return(MoonPhaseChange.Waxing); default: throw new ArgumentException($"unexpected MoonPhase {phase}"); } }
public static string ToString(this MoonPhase phase, bool includeWaxWane) { switch (phase) { case MoonPhase.FullMoon: return("Full Moon"); case MoonPhase.WaningGibbous: return((includeWaxWane ? "Waning " : "") + "Gibbous"); case MoonPhase.ThirdQuarter: return("Third Quarter"); case MoonPhase.WaningCrescent: return((includeWaxWane ? "Waning " : "") + "Crescent"); case MoonPhase.NewMoon: return("New Moon"); case MoonPhase.WaxingCrescent: return((includeWaxWane ? "Waxing " : "") + "Crescent"); case MoonPhase.FirstQuarter: return("First Quarter"); case MoonPhase.WaxingGibbous: return((includeWaxWane ? "Waxing " : "") + "Gibbous"); default: throw new ArgumentException($"unexpected MoonPhase {phase}"); } }
public Rectangle GetMoonSprite(MoonPhase moon) { if (moon == MoonPhase.FirstQuarter) { return(Icons.FirstQuarter); } if (moon == MoonPhase.FullMoon) { return(Icons.FullMoon); } if (moon == MoonPhase.NewMoon) { return(Icons.NewMoon); } if (moon == MoonPhase.ThirdQuarter) { return(Icons.ThirdQuarter); } if (moon == MoonPhase.WaningCrescent) { return(Icons.WaningCrescent1); } if (moon == MoonPhase.WaxingCrescent) { return(Icons.WaxingCrescent1); } if (moon == MoonPhase.WaningGibbeous) { return(Icons.WaningGibbeous); } if (moon == MoonPhase.WaxingGibbeous) { return(Icons.WaxingGibbeous); } return(Icons.NewMoon); }
// Converts MoonPhase to Point3D destination. Coords lifted from Items/Misc/PublicMoongate.cs public static Point3D MoonPhase2Destination(MoonPhase phase) { Point3D dest = Point3D.Zero; switch (phase) { case MoonPhase.NewMoon: dest = new Point3D(4467, 1283, 5); break; case MoonPhase.WaxingCrescentMoon: dest = new Point3D(1336, 1997, 5); break; case MoonPhase.FirstQuarter: dest = new Point3D(1499, 3771, 5); break; case MoonPhase.WaxingGibbous: dest = new Point3D(771, 752, 5); break; case MoonPhase.FullMoon: dest = new Point3D(2701, 692, 5); break; case MoonPhase.WaningGibbous: dest = new Point3D(1828, 2948, -20); break; case MoonPhase.LastQuarter: dest = new Point3D(643, 2067, 5); break; case MoonPhase.WaningCrescent: dest = new Point3D(3563, 2139, 31); break; } return(dest); }
public static bool IsWaning(this MoonPhase phase) { return(phase.GetPhaseChange() == MoonPhaseChange.Waning); }
public UltimaMoongate_U4_Gate(double opentime, MoonPhase targetPhase) : base(opentime) { m_targetPhase = targetPhase; m_usePhase = true; }
/// <summary> /// Gets nearest phase date /// </summary> private Date NearestPhase(SkyContext c, MoonPhase p) { return(c.GetDate(LunarEphem.NearestPhase(c.JulianDay, p))); }
/// <summary>Calculates the Julian Day the input phases occurs closets to the input fractional year.</summary> /// <param name="year">Year and day as a fraction in which to calculate the phase occurance.</param> /// <param name="phase">Phase to calculate.</param> /// <returns>Return a date and time as a fractional Julian Day.</returns> public static double MoonPhaseDate(double year, MoonPhase phase) { double k = 0; double t = 0; /* time in Julian centuries */ double m = 0; /* Sun's mean anomaly */ double mprime = 0; /* Moon's mean anomaly */ double f = 0; /* Moon's argument of latitude */ double omega = 0; /* Longitude of the ascending node of the lunar orbit */ double w = 0; /* quarter phase corrections */ double[] a; /* planatary arguments */ double atotal = 0; /* sum of planatary arguments */ double corrections = 0; /* sum of corrections */ double e = 0; /* eccentricity of Earth's orbit */ // init planatary arguments array a = new double[14]; k = Math.Floor( (year - 2000.0) * 12.3685) + ( (double)phase * 0.25 ); t = (k/1236.85); e = 1.0 - t * ( 0.002516 - ( 0.0000074 * t)); // pg 308 m = Deg2Radian * (2.5534 + (29.10535669 * k) - t * t * ( 0.0000218 - (0.00000011 * t ))); mprime = Deg2Radian * (201.5643 + (385.81693528 * k) + t * t * ( 0.0107438 + (0.00001239 * t) - (0.000000058 * t * t))); f = Deg2Radian * (160.7108 + (390.67050274 * k) + t * t * ( 0.0016341 + (0.00000227 * t) - (0.000000011 * t * t))); omega = Deg2Radian * (124.7746 - (1.56375580 * k) + t * t * ( 0.0020691 + (0.00000215 * t))); a[0] = Deg2Radian * (299.77 + (0.107408 * k) - (0.009173 * t * t)); a[1] = Deg2Radian * (251.88 + (0.016321 * k)); a[2] = Deg2Radian * (251.83 + (26.651886 * k)); a[3] = Deg2Radian * (349.42 + (36.412478 * k)); a[4] = Deg2Radian * (84.66 + (18.206239 * k)); a[5] = Deg2Radian * (141.74 + (53.303771 * k)); a[6] = Deg2Radian * (207.14 + (2.453732 * k)); a[7] = Deg2Radian * (154.84 + (7.306860 * k)); a[8] = Deg2Radian * (34.52 + (27.261239 * k)); a[9] = Deg2Radian * (207.19 + (0.121824 * k)); a[10] = Deg2Radian * (291.34 + (1.844379 * k)); a[11] = Deg2Radian * (161.72 + (24.198154 * k)); a[12] = Deg2Radian * (239.56 + (25.513099 * k)); a[13] = Deg2Radian * (331.55 + (3.592518 * k)); atotal = .000001 * ((325 * Math.Sin(a[0])) + (165 * Math.Sin(a[1])) + (164 * Math.Sin(a[2])) + (126 * Math.Sin(a[3])) + (110 * Math.Sin(a[4])) + ( 62 * Math.Sin(a[5])) + ( 60 * Math.Sin(a[6])) + ( 56 * Math.Sin(a[7])) + ( 47 * Math.Sin(a[8])) + ( 42 * Math.Sin(a[9])) + ( 40 * Math.Sin(a[10])) + ( 37 * Math.Sin(a[11])) + ( 35 * Math.Sin(a[12])) + ( 23 * Math.Sin(a[13]))); switch (phase) { case(MoonPhase.NewMoon): { corrections = - (0.40720 * Math.Sin(mprime)) + (0.17241 * e * Math.Sin(m)) + (0.01608 * Math.Sin(2*mprime)) + (0.01039 * Math.Sin(2 * f)) + (0.00739 * e * Math.Sin(mprime - m)) - (0.00514 * e * Math.Sin(mprime + m)) + (0.00208 * e * e * Math.Sin(2 * m)) - (0.00111 * Math.Sin(mprime - 2 * f)) - (0.00057 * Math.Sin(mprime + 2 * f)) + (0.00056 * e * Math.Sin(2 * mprime + m)) - (0.00042 * Math.Sin(3 * mprime)) + (0.00042 * e * Math.Sin(m + 2 * f)) + (0.00038 * e * Math.Sin(m - 2 * f)) - (0.00024 * e * Math.Sin(2 * mprime - m)) - (0.00017 * Math.Sin(omega)) - (0.00007 * Math.Sin(mprime + 2 * m)) + (0.00004 * Math.Sin(2 * mprime - 2 * f)) + (0.00004 * Math.Sin(3 * m)) + (0.00003 * Math.Sin(mprime + m - 2 * f)) + (0.00003 * Math.Sin(2 * mprime + 2 * f)) - (0.00003 * Math.Sin(mprime + m + 2 * f)) + (0.00003 * Math.Sin(mprime - m + 2 * f)) - (0.00002 * Math.Sin(mprime - m - 2 * f)) - (0.00002 * Math.Sin(3 * mprime + m)) + (0.00002 * Math.Sin(4 * mprime)); break; } case(MoonPhase.FullMoon) : { corrections = - (0.40614 * Math.Sin(mprime)) + (0.17302 * e * Math.Sin(m)) + (0.01614 * Math.Sin(2*mprime)) + (0.01043 * Math.Sin(2 * f)) + (0.00734 * e * Math.Sin(mprime - m)) - (0.00515 * e * Math.Sin(mprime + m)) + (0.00209 * e * e * Math.Sin(2 * m)) - (0.00111 * Math.Sin(mprime - 2 * f)) - (0.00057 * Math.Sin(mprime + 2 * f)) + (0.00056 * e * Math.Sin(2 * mprime + m)) - (0.00042 * Math.Sin(3 * mprime)) + (0.00042 * e * Math.Sin(m + 2 * f)) + (0.00038 * e * Math.Sin(m - 2 * f)) - (0.00024 * e * Math.Sin(2 * mprime - m)) - (0.00017 * Math.Sin(omega)) - (0.00007 * Math.Sin(mprime + 2 * m)) + (0.00004 * Math.Sin(2 * mprime - 2 * f)) + (0.00004 * Math.Sin(3 * m)) + (0.00003 * Math.Sin(mprime + m - 2 * f)) + (0.00003 * Math.Sin(2 * mprime + 2 * f)) - (0.00003 * Math.Sin(mprime + m + 2 * f)) + (0.00003 * Math.Sin(mprime - m + 2 * f)) - (0.00002 * Math.Sin(mprime - m - 2 * f)) - (0.00002 * Math.Sin(3 * mprime + m)) + (0.00002 * Math.Sin(4 * mprime)); break; } case(MoonPhase.FirstQuarter): case(MoonPhase.LastQuarter): { corrections = - (0.62801 * Math.Sin(mprime)) + (0.17172 * e * Math.Sin(m)) - (0.01183 * e * Math.Sin(mprime + m)) + (0.00862 * Math.Sin(2 * mprime)) + (0.00804 * Math.Sin(2 * f)) + (0.00454 * e * Math.Sin(mprime - m)) + (0.00204 * e * e * Math.Sin(2 * m)) - (0.00180 * Math.Sin(mprime - 2 * f)) - (0.00070 * Math.Sin(mprime + 2 * f)) - (0.00040 * Math.Sin(3 * mprime)) - (0.00034 * e * Math.Sin(2 * mprime - m)) + (0.00032 * e * Math.Sin(m + 2 * f)) + (0.00032 * e * Math.Sin(m - 2 * f)) - (0.00028 * e * e * Math.Sin(mprime + 2 * m)) + (0.00027 * e * Math.Sin(2 * mprime + m)) - (0.00017 * Math.Sin(omega)) - (0.00005 * Math.Sin(mprime - m - 2 * f)) + (0.00004 * Math.Sin(2 * mprime + 2 * f)) - (0.00004 * Math.Sin(mprime + m + 2 * f)) + (0.00004 * Math.Sin(mprime - 2 * m)) + (0.00003 * Math.Sin(mprime + m - 2 * f)) + (0.00003 * Math.Sin(3 * m)) + (0.00002 * Math.Sin(2 * mprime - 2 * f)) + (0.00002 * Math.Sin(mprime - m + 2 * f)) - (0.00002 * Math.Sin(3 * mprime + m)); w = .00306 - .00038 * e * Math.Cos(m) + .00026 * Math.Cos(mprime) - .00002 * Math.Cos(mprime - m) + .00002 * Math.Cos(mprime + m) + .00002 * Math.Cos(2*f); if ( phase == MoonPhase.LastQuarter ) w = -w; break; } default: { ; // throw some exception here break; } } // end switch return (2451550.09765 + (29.530588853 * k) + (0.0001337 * Math.Pow(t,2)) - (0.000000150 * Math.Pow(t,3)) + (0.00000000073 * Math.Pow(t,4)) + corrections + atotal + w); } // MoonPhase
} // @ public string GetDayOfWeekName(Weekday day) /// <summary> /// Will get a string representation of the current moon phase /// </summary> /// <param name="phase">MoonPhase to get a proper String equivalent of.</param> /// <returns></returns> public string GetMoonPhaseName (MoonPhase phase) { string phaseName = String.Empty; switch (phase) { case MoonPhase.FirstQuarter: phaseName = "First Quarter"; break; case MoonPhase.Full: phaseName = "Full"; break; case MoonPhase.LastQuarter: phaseName = "Last Quarter"; break; case MoonPhase.New: phaseName = "New"; break; case MoonPhase.WaningCrescent: case MoonPhase.WaningCrescent2: phaseName = "Waning Crescent"; break; case MoonPhase.WaningGibbous: case MoonPhase.WaningGibbous2: phaseName = "Waning Gibbous"; break; case MoonPhase.WaxingCrescent: case MoonPhase.WaxingCrescent2: phaseName = "Waxing Crescent"; break; case MoonPhase.WaxingGibbous: case MoonPhase.WaxingGibbous2: phaseName = "Waxing Gibbous"; break; } // @ switch (phase) return phaseName; } // @ public string GetMoonPhaseName(MoonPhase phase)
/// <summary> /// Will get the name of the Moon Phase passed as a String /// </summary> /// <param name="phase">MoonPhase enum indicating the String to return</param> /// <returns>In-game name of the moon phase passed, String.Empty on error</returns> public static String GetMoonPhaseName(MoonPhase phase) { if (Instance == null) return String.Empty; int key = (int)phase | (int)ResourceBit.Moon; String result; if (Instance.ResourcesCache.TryGetValue(key, out result)) return result; return String.Empty; }