Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,56 @@
using System;
using Server;
namespace Server.Items
{
[Flipable(0x9C14, 0x9C15)]
public class Anniversary21Card : Item
{
[CommandProperty(AccessLevel.GameMaster)]
public string Args { get; set; }
private string[] _Staff = new string[] { Server.Misc.ServerList.ServerName };
[Constructable]
public Anniversary21Card()
: this(null)
{
}
[Constructable]
public Anniversary21Card(Mobile m) : base(0x9C14)
{
Hue = 85;
Args = String.Format("{0}\t{1}", _Staff[Utility.Random(_Staff.Length)], m != null ? m.Name : "you");
}
public override void AddNameProperty(ObjectPropertyList list)
{
list.Add(1156145, Args); // A Personally Written Anniversary Card from ~1_name~ to ~2_name~
list.Add(1062613, "#1158486");
}
public Anniversary21Card(Serial serial)
: base(serial)
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.Write(Args);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
Args = reader.ReadString();
}
}
}

View File

@@ -0,0 +1,77 @@
using System;
using Server;
using Server.Gumps;
namespace Server.Items
{
public class Anniversary21GiftToken : Item, IRewardOption
{
public override int LabelNumber { get { return 1158485; } } // 21st Anniversary Gift Token
[Constructable]
public Anniversary21GiftToken()
: base(19398)
{
Hue = 2113;
LootType = LootType.Blessed;
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.CloseGump(typeof(RewardOptionGump));
from.SendGump(new RewardOptionGump(this, 1156888));
}
else
{
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
}
}
public void GetOptions(RewardOptionList list)
{
list.Add(1, 1158479); // Brass Orrery
list.Add(2, 1158480); // Brass Telescope
}
public void OnOptionSelected(Mobile from, int choice)
{
var bag = new Bag();
bag.Hue = 2720;
switch(choice)
{
default:
bag.Delete();
break;
case 1:
bag.DropItem(new BrassOrrery());
from.AddToBackpack(bag); Delete();
break;
case 2:
bag.DropItem(new PersonalTelescope());
from.AddToBackpack(bag);
Delete(); break;
}
}
public Anniversary21GiftToken(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using Server;
namespace Server.Items
{
public class AnniversaryBag21st : Backpack
{
public override int LabelNumber { get { return 1158481; } } // 21st Anniversary Gift Bag
[Constructable]
public AnniversaryBag21st(Mobile m)
{
Hue = 1151;
DropItem(new Anniversary21GiftToken());
DropItem(new Anniversary21Card(m));
}
public AnniversaryBag21st(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using Server;
using Server.Items;
namespace Server.Misc
{
public class AnniversaryGiver21st : GiftGiver
{
public static void Initialize()
{
GiftGiving.Register(new AnniversaryGiver21st());
}
public override DateTime Start { get { return new DateTime(2019, 4, 05); } }
public override DateTime Finish { get { return new DateTime(2019, 5, 31); } }
public override TimeSpan MinimumAge { get { return TimeSpan.FromHours(12); } }
public override void GiveGift(Mobile mob)
{
var bag = new AnniversaryBag21st(mob);
switch (GiveGift(mob, bag))
{
case GiftResult.Backpack:
mob.SendLocalizedMessage(1158482); // Happy 21st Anniversary! We have placed a gift for you in your backpack.
break;
case GiftResult.BankBox:
mob.SendLocalizedMessage(1158483); // Happy 21st Anniversary! We have placed a gift for you in your bank box.
break;
}
}
}
}

View File

@@ -0,0 +1,30 @@
using Server;
namespace Server.Items
{
public class AstronomerTitleDeed : BaseRewardTitleDeed
{
public override TextDefinition Title { get { return 1158523; } } // Astronomer
public AstronomerTitleDeed()
{
}
public AstronomerTitleDeed(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,263 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Server.Items;
namespace Server.Engines.Astronomy
{
public enum TimeCoordinate
{
FiveToEight,
NineToEleven,
Midnight,
OneToFour,
Day
}
public static class AstronomySystem
{
public static bool Enabled = Core.EJ;
public static string FilePath = Path.Combine("Saves/Misc", "Astronomy.bin");
public static readonly int MaxConstellations = 1000;
public static readonly int MaxRA = 24; // zero based 0 - 24, 1 per increment
public static readonly double MaxDEC = 90; // zero based 0 - 90, 0.2 per increment
// testing only. THis needs to be deleted prior to going live.
//public static TimeCoordinate ForceTimeCoordinate { get { return PersonalTelescope.ForceTimeCoordinate; } }
public static int LoadedConstellations { get; set; }
public static List<ConstellationInfo> Constellations { get; set; }
public static List<Tuple<int, int>> InterstellarObjects { get; set; }
public static List<int> DiscoveredConstellations { get; set; }
public static void Configure()
{
if (Enabled)
{
EventSink.WorldSave += OnSave;
EventSink.WorldLoad += OnLoad;
Constellations = new List<ConstellationInfo>();
InterstellarObjects = new List<Tuple<int, int>>();
DiscoveredConstellations = new List<int>();
// comets
for (int i = 0x68D; i <= 0x693; i++)
{
InterstellarObjects.Add(new Tuple<int, int>(i, 1158514));
}
// felucca
for (int i = 0x69F; i <= 0x6A6; i++)
{
InterstellarObjects.Add(new Tuple<int, int>(i, 1158734));
}
// trammel
for (int i = 0x6A7; i <= 0x6AE; i++)
{
InterstellarObjects.Add(new Tuple<int, int>(i, 1158735));
}
// galaxy
for (int i = 0x6AF; i <= 0x6BC; i++)
{
InterstellarObjects.Add(new Tuple<int, int>(i, 1158736));
}
// planet
for (int i = 0x6BD; i <= 0x6CD; i++)
{
InterstellarObjects.Add(new Tuple<int, int>(i, 1158737));
}
}
}
public static void Initialize()
{
if (Enabled && LoadedConstellations < MaxConstellations)
{
CreateConstellations(MaxConstellations - LoadedConstellations);
}
}
private static void CreateConstellations(int amount)
{
var next = TimeCoordinate.FiveToEight;
if (LoadedConstellations > 0)
{
if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.FiveToEight).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.NineToEleven).Count())
next = TimeCoordinate.NineToEleven;
else if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.NineToEleven).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.Midnight).Count())
next = TimeCoordinate.Midnight;
else if (Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.Midnight).Count() > Constellations.Where(c => c.TimeCoordinate == TimeCoordinate.OneToFour).Count())
next = TimeCoordinate.OneToFour;
}
for (int i = 0; i < amount; i++)
{
int ra = 0;
double dec = 0.0;
do
{
ra = Utility.RandomMinMax(0, MaxRA);
dec = Utility.RandomMinMax(0, (int)MaxDEC) + Utility.RandomList(.2, .4, .6, .8, .0);
}
while (CheckExists(next, ra, dec));
var info = new ConstellationInfo(next, ra, dec, ConstellationInfo.RandomStarPositions());
Constellations.Add(info);
info.Identifier = Constellations.Count - 1;
switch (next)
{
case TimeCoordinate.FiveToEight: next = TimeCoordinate.NineToEleven; break;
case TimeCoordinate.NineToEleven: next = TimeCoordinate.Midnight; break;
case TimeCoordinate.Midnight: next = TimeCoordinate.OneToFour; break;
case TimeCoordinate.OneToFour: next = TimeCoordinate.FiveToEight; break;
}
}
}
public static void ResetConstellations()
{
ColUtility.Free(Constellations);
LoadedConstellations = 0;
CreateConstellations(MaxConstellations);
Console.WriteLine("Reset Constellations!");
}
public static ConstellationInfo GetConstellation(int id)
{
return Constellations.FirstOrDefault(info => info.Identifier == id);
}
public static ConstellationInfo GetConstellation(TimeCoordinate p, int ra, double dec)
{
return Constellations.FirstOrDefault(c => c.TimeCoordinate == p && c.CoordRA == ra && c.CoordDEC == dec);
}
private static bool CheckExists(TimeCoordinate p, int ra, double dec)
{
return Constellations.Any(c => c.TimeCoordinate == p && c.CoordRA == ra && c.CoordDEC == dec);
}
public static bool CheckNameExists(string name)
{
return Constellations.Any(c => !String.IsNullOrEmpty(c.Name) && c.Name.ToLower() == name.ToLower());
}
public static TimeCoordinate GetTimeCoordinate(IEntity e)
{
int minutes, hours, totalMinutes;
Clock.GetTime(e.Map, e.X, e.Y, out hours, out minutes, out totalMinutes);
if (hours >= 17 && hours < 21)
{
return TimeCoordinate.FiveToEight;
}
if (hours >= 21 && hours < 24)
{
return TimeCoordinate.NineToEleven;
}
if ((hours >= 24 && hours < 1) || hours == 0)
{
return TimeCoordinate.Midnight;
}
if (hours >= 1 && hours <= 4)
{
return TimeCoordinate.OneToFour;
}
return TimeCoordinate.Day;
}
public static int RandomSkyImage(Mobile m)
{
return RandomSkyImage(GetTimeCoordinate(m));
}
public static int RandomSkyImage(TimeCoordinate TimeCoordinate)
{
switch (TimeCoordinate)
{
default: return 0x67E;
case TimeCoordinate.FiveToEight: return 0x67F;
case TimeCoordinate.NineToEleven: return Utility.RandomMinMax(0x680, 0x682);
case TimeCoordinate.Midnight: return 0x686;
case TimeCoordinate.OneToFour: return Utility.RandomMinMax(0x683, 0x685);
}
}
public static Tuple<int, int> GetRandomInterstellarObject()
{
return InterstellarObjects[Utility.Random(InterstellarObjects.Count)];
}
public static int TimeCoordinateLocalization(TimeCoordinate TimeCoordinate)
{
switch (TimeCoordinate)
{
default:
case TimeCoordinate.FiveToEight: return 1158506;
case TimeCoordinate.NineToEleven: return 1158507;
case TimeCoordinate.Midnight: return 1158508;
case TimeCoordinate.OneToFour: return 1158509;
}
}
public static void AddDiscovery(ConstellationInfo info)
{
if (!DiscoveredConstellations.Contains(info.Identifier))
{
DiscoveredConstellations.Add(info.Identifier);
}
}
public static void OnSave(WorldSaveEventArgs e)
{
Persistence.Serialize(
FilePath,
writer =>
{
writer.Write(0);
writer.Write(Constellations.Count);
foreach (var info in Constellations)
{
info.Serialize(writer);
}
});
}
public static void OnLoad()
{
Persistence.Deserialize(
FilePath,
reader =>
{
reader.ReadInt();
LoadedConstellations = reader.ReadInt();
for (int i = 0; i < LoadedConstellations; i++)
{
Constellations.Add(new ConstellationInfo(reader));
}
});
}
}
}

View File

@@ -0,0 +1,63 @@
using Server;
namespace Server.Items
{
public class BrassOrrery : Item
{
public override int LabelNumber { get { return 1125363; } } // orrery
[CommandProperty(AccessLevel.GameMaster)]
public bool Active { get; set; }
[Constructable]
public BrassOrrery()
: base(0xA17C)
{
}
public override void OnDoubleClick(Mobile m)
{
if (m.InRange(GetWorldLocation(), 2))
{
ToggleActivation(m);
}
}
public void ToggleActivation(Mobile m)
{
if (Active)
{
ItemID = 0xA17C;
m.PlaySound(0x1E2);
Active = false;
}
else
{
ItemID = 0xA17B;
m.PlaySound(480);
Active = true;
}
}
public BrassOrrery(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(Active);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
Active = reader.ReadBool();
}
}
}

View File

@@ -0,0 +1,135 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Mobiles;
namespace Server.Engines.Astronomy
{
[PropertyObject]
public class ConstellationInfo
{
[CommandProperty(AccessLevel.GameMaster)]
public int Identifier { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public TimeCoordinate TimeCoordinate { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int CoordRA { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public double CoordDEC { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string Name { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile DiscoveredBy { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime DiscoveredOn { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool HasBeenDiscovered { get { return DiscoveredOn != DateTime.MinValue; } }
public StarPosition[] StarPositions { get; set; }
public ConstellationInfo(TimeCoordinate p, int coordRA, double coordDEC, StarPosition[] starInfo)
{
TimeCoordinate = p;
CoordRA = coordRA;
CoordDEC = coordDEC;
StarPositions = starInfo;
Identifier = -1;
}
public override string ToString()
{
return "...";
}
public static StarPosition[] RandomStarPositions()
{
int amount = Utility.RandomMinMax(4, 7);
var positions = new StarPosition[amount];
for(int i = 0; i < amount; i++)
{
StarPosition star = new StarPosition();
star.ImageID = Utility.RandomMinMax(0x668, 0x67D);
star.X = Utility.RandomMinMax(180, 450);
star.Y = Utility.RandomMinMax(150, 400);
positions[i] = star;
}
return positions;
}
public struct StarPosition
{
public int ImageID { get; set; }
public int X { get; set; }
public int Y { get; set; }
}
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();
var count = reader.ReadInt();
StarPositions = new StarPosition[count];
for(int i = 0; i < count; i++)
{
StarPosition pos = new StarPosition();
pos.ImageID = reader.ReadInt();
pos.X = reader.ReadInt();
pos.Y = reader.ReadInt();
StarPositions[i] = pos;
}
if (HasBeenDiscovered)
{
AstronomySystem.AddDiscovery(this);
}
}
public void Serialize(GenericWriter writer)
{
writer.Write(0);
writer.Write(Identifier);
writer.Write((int)TimeCoordinate);
writer.Write(Name);
writer.Write(DiscoveredBy);
writer.Write(DiscoveredOn);
writer.Write(CoordRA);
writer.Write(CoordDEC);
writer.Write(StarPositions.Length);
foreach(var pos in StarPositions)
{
writer.Write(pos.ImageID);
writer.Write(pos.X);
writer.Write(pos.Y);
}
}
}
}

View File

@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Mobiles;
namespace Server.Engines.Astronomy
{
public class ConstellationLedger : Item
{
public override int LabelNumber { get { return 1158520; } } // Constellation Ledger
[Constructable]
public ConstellationLedger()
: base(0xFF4)
{
Movable = false;
}
public override void OnDoubleClick(Mobile m)
{
if (m is PlayerMobile && m.InRange(GetWorldLocation(), 3))
{
BaseGump.SendGump(new ConstellationLedgerGump((PlayerMobile)m));
}
}
public class ConstellationLedgerGump : BaseGump
{
public int Page { get; set; }
public int Pages { get { return (int)Math.Ceiling((double)AstronomySystem.DiscoveredConstellations.Count / 20.0); } }
public ConstellationLedgerGump(PlayerMobile pm)
: base(pm, 100, 100)
{
Page = 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++)
{
var 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()));
}
public override void OnResponse(RelayInfo info)
{
switch (info.ButtonID)
{
case 0:
return;
case 1:
Page = 0;
break;
case 2:
Page = Math.Max(0, Page - 1);
break;
case 3:
Page = Math.Min(Page + 1, Math.Max(0, Pages - 1));
break;
case 4:
Page = Math.Max(0, Pages - 1);
break;
}
Refresh();
}
}
public ConstellationLedger(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Items;
using Server.Gumps;
using Server.Mobiles;
namespace Server.Engines.Astronomy
{
public class PrimerOnBritannianAstronomy : Item
{
public override int LabelNumber { get { return 1158515; } } // Looking to the Heavens: A Primer on Britannian Astronomy
[Constructable]
public PrimerOnBritannianAstronomy()
: base(0xFF0)
{
Hue = 298;
}
public override void OnDoubleClick(Mobile m)
{
if (m is PlayerMobile && m.InRange(GetWorldLocation(), 3))
{
var gump = new Gump(100, 100);
gump.AddImage(0, 0, 0x761C);
gump.AddImage(95, 40, 0x69E);
gump.AddHtmlLocalized(115, 200, 350, 400, 1158516, "#1158516", 0x1, false, true);
/*The study of Britannian astronomy dates back to the appearances of strangers from offwordly realms. When it was learned that
* Sosaria exists within a much larger universe, curiosity tilted our heads upwards towards the sky. Before long skilled tinkers
* granted the ability to see objects at great distance became a reality - enter the telescope. While the most impressive example
* of these contraptions is the one located in Moonglow at 43o 52'N, 122o 4'W, where I have chosen to spend my time deep in
* research, recent developments in miniaturization have brought the size of these instruments within the grasp of the casual
* observer.<br><br>Using a telescope may appear quite simple, but one would be naive to think there is no more beyond haphazardly
* pointing towards the sky to make observations!<br><br>The best viewing hours are during the night between the hours of 5pm
* and 4am. Any standard clock is an essential tool in mapping the night sky!<br><br>While there are a variety of objects in the
* night sky to observe if one points their telescope at the object as it traverses space, the real search is for constellations
* - a unique collection of several stars.<br><br>Constellations appear at various periods during the night. Constellations can
* be seen during the early evening (5pm-8pm), late at night (9pm-11pm), midnight (12am), or the middle of the night (1am-4am).
* After 4am daylight will drown out any attempt at making meaningful observations.<br><br>Constellations can be observed in
* these time periods based on their location in the night sky. Britannian astronomers have adopted a coordinate system that
* uses right ascension (RA) and declination (DEC) to pinpoint a constellation's location during night time periods.<br><br>RA
* can be measured from 0-24 and DEC can be measured from 0-90. Current Telescopes are capable of resolving increments of 1 hour
* of RA and 0.2 degrees of DEC.<br><br>When a time period has been selected and the RA and DEC have been set one need only
* initiate a switch conveniently located in the viewfinder, to check that section of the sky! Should you be lucky enough to
* see a constellation a standard mapmaking pen can be used to create a star chart. As the potential discoverer of a new
* constellation you have the opportunity to name and submit your discovery to the Britannian Astronomical Society, of whom
* this author is primary registrar, for documentation.<br><br>Happy skywatching!*/
m.SendGump(gump);
}
}
public PrimerOnBritannianAstronomy(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,217 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Mobiles;
using Server.Engines.Astronomy;
using Server.Targeting;
using Server.Engines.Craft;
using Server.Gumps;
namespace Server.Items
{
[Flipable(0xA1E4, 0xA1E5)]
public class StarChart : Item, ICraftable
{
private int _Constellation;
private string _Name;
private Mobile _ChartedBy;
private DateTime _ChartedOn;
[CommandProperty(AccessLevel.GameMaster)]
public int Constellation
{
get { return _Constellation; }
set
{
_Constellation = value;
if (_Constellation < 0)
{
Hue = 2500;
}
else
{
Hue = 0;
}
InvalidateProperties();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public string ConstellationName { get { return _Name; } set { _Name = value; InvalidateProperties(); } }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile ChartedBy { get { return _ChartedBy; } set { _ChartedBy = value; InvalidateProperties(); } }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime ChartedOn { get { return _ChartedOn; } set { _ChartedOn = value; } }
public override int LabelNumber { get { return _Constellation == -1 ? 1158743 : 1158493; } } // An Indecipherable Star Chart : Star Chart
[Constructable]
public StarChart()
: base(0xA1E4)
{
_Constellation = -1;
Hue = 2500;
}
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, ITool tool, CraftItem craftItem, int resHue)
{
Timer.DelayCall(() => SendTarget(from));
return quality;
}
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.
}
}
});
}
public override void OnDoubleClick(Mobile m)
{
if (m is PlayerMobile && IsChildOf(m.Backpack) && _Constellation > -1)
{
BaseGump.SendGump(new InternalGump((PlayerMobile)m, this));
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (_Constellation > -1)
{
if (_ChartedBy != null)
{
list.Add(1158500, _ChartedBy.Name); // Charted By: ~1_NAME~
}
list.Add(1158501, _Name ?? "A Constellation With No Name"); // TODO: Get if null
}
}
public class InternalGump : BaseGump
{
public StarChart Chart { get; set; }
public InternalGump(PlayerMobile pm, StarChart chart)
: base(pm, 50, 50)
{
pm.CloseGump(typeof(InternalGump));
Chart = chart;
}
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);
}
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.
}
}
}
}
}
public StarChart(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(_Constellation);
writer.Write(_Name);
writer.Write(_ChartedBy);
writer.Write(_ChartedOn);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
reader.ReadInt();
_Constellation = reader.ReadInt();
_Name = reader.ReadString();
_ChartedBy = reader.ReadMobile();
_ChartedOn = reader.ReadDateTime();
}
}
}

View File

@@ -0,0 +1,416 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Mobiles;
using Server.Multis;
using Server.Gumps;
using Server.Engines.Astronomy;
using Server.ContextMenus;
namespace Server.Items
{
[Flipable(0xA12C, 0xA12D)]
public class PersonalTelescope : Item, ISecurable
{
private string _DisplayName;
private double _DEC;
//[CommandProperty(AccessLevel.GameMaster)]
//public static TimeCoordinate ForceTimeCoordinate { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string DisplayName { get { return _DisplayName; } set { _DisplayName = value; InvalidateProperties(); } }
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int RA { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public double DEC
{
get { return _DEC; }
set
{
_DEC = value;
_DEC = (double)decimal.Round((decimal)_DEC, 2);
}
}
[CommandProperty(AccessLevel.GameMaster)]
public TimeCoordinate TimeCoordinate { get { return AstronomySystem.GetTimeCoordinate(this); } }
public DateTime LastUse { get; set; }
public override int LabelNumber { get { return 1125284; } }
[Constructable]
public PersonalTelescope()
: base(0xA12C)
{
Level = SecureLevel.Owner;
_DisplayName = _Names[Utility.Random(_Names.Length)];
}
public override void OnDoubleClick(Mobile m)
{
if (!IsLockedDown)
{
m.SendLocalizedMessage(1114298); // This must be locked down in order to use it.
return;
}
if (m.InRange(Location, 2))
{
var house = BaseHouse.FindHouseAt(this);
if (house != null && house.HasSecureAccess(m, Level))
{
if (DateTime.UtcNow - LastUse > TimeSpan.FromMinutes(10))
{
m.SendLocalizedMessage(1158643); // The telescope is calibrating, try again in a moment.
LastUse = DateTime.UtcNow;
}
else
{
BaseGump.SendGump(new TelescopeGump((PlayerMobile)m, this));
}
}
}
else
{
m.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
if (!String.IsNullOrEmpty(_DisplayName))
{
list.Add(1158477, _DisplayName); // <BASEFONT COLOR=#FFD24D>From the personal study of ~1_NAME~<BASEFONT COLOR=#FFFFFF>
}
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{
base.GetContextMenuEntries(from, list);
SetSecureLevelEntry.AddTo(from, this, list);
}
public PersonalTelescope(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(1);
writer.Write(_DisplayName);
writer.Write((int)Level);
writer.Write(RA);
writer.Write(DEC);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 1:
_DisplayName = reader.ReadString();
goto case 0;
case 0:
Level = (SecureLevel)reader.ReadInt();
RA = reader.ReadInt();
DEC = reader.ReadDouble();
break;
}
if (version == 0)
{
_DisplayName = _Names[Utility.Random(_Names.Length)];
}
}
private static string[] _Names =
{
"Adranath", "Aeluva the Arcanist", "Aesthyron", "Anon", "Balaki", "Clanin", "Dexter", "Doctor Spector", "Dryus Doost",
"Gilform", "Grizelda the Hag", "Hawkwind", "Heigel of Moonglow", "Intanya", "Juo'Nar", "King Blackthorn", "Koole the Arcanist",
"Kronos", "Kyrnia", "Lathiari", "Leoric Gathenwale", "Lysander Gathenwale", "Malabelle", "Mariah", "Melissa", "Minax",
"Mondain", "Mordra", "Mythran", "Neira the Necromancer", "Nystul", "Queen Zhah", "Relvinian", "Selsius the Astronomer",
"Sutek", "Uzeraan", "Wexton the Apprentice"
};
}
public class TelescopeGump : BaseGump
{
public Tuple<int, int> InterstellarObject { get; set; }
public ConstellationInfo Constellation { get; set; }
public PersonalTelescope Tele { get; set; }
public int ImageID { get; set; }
public TelescopeGump(PlayerMobile pm, PersonalTelescope tele)
: base(pm, 200, 200)
{
Tele = tele;
pm.CloseGump(typeof(TelescopeGump));
}
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();
}
}
private void RenderInterstellarObject()
{
AddImage(180, 150, InterstellarObject.Item1);
}
private void RenderConstellation()
{
foreach (var pos in Constellation.StarPositions)
{
AddImage(pos.X, pos.Y, pos.ImageID);
}
}
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 > (double)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();
}
}
private int GetPlace(int value, int place)
{
return ((value % (place * 10)) - (value % place)) / place;
}
private int GetDecimalPlace(double value)
{
decimal dec = decimal.Round((decimal)(value - Math.Truncate(value)), 2);
return (int)(dec * 10);
}
private int GetGumpNumber(int v)
{
return 0x58F + v;
}
}
}

View File

@@ -0,0 +1,291 @@
using Server;
namespace Server.Items
{
public class AstronomyTent : BaseAddon
{
public override BaseAddonDeed Deed { get { return null; } }
[Constructable]
public AstronomyTent()
{
// yellow walls
int hue = 2721;
AddonComponent comp = new AddonComponent(0x369);
comp.Hue = hue;
AddComponent(comp, -1, 3, 0);
comp = new AddonComponent(0x369);
comp.Hue = hue;
AddComponent(comp, 2, 3, 0);
comp = new AddonComponent(0x36A);
comp.Hue = hue;
AddComponent(comp, 5, 1, 0);
comp = new AddonComponent(0x36A);
comp.Hue = hue;
AddComponent(comp, 5, -1, 0);
comp = new AddonComponent(0x36F);
comp.Hue = hue;
AddComponent(comp, -4, -1, 0);
comp = new AddonComponent(0x36F);
comp.Hue = hue;
AddComponent(comp, -4, 1, 0);
comp = new AddonComponent(0x36E);
comp.Hue = hue;
AddComponent(comp, -2, -3, 0);
comp = new AddonComponent(0x36E);
comp.Hue = hue;
AddComponent(comp, 2, -3, 0);
// blue walls
hue = 1156;
comp = new AddonComponent(0x36C);
comp.Hue = hue;
AddComponent(comp, -4, 3, 0);
comp = new AddonComponent(0x369);
comp.Hue = hue;
AddComponent(comp, -3, 3, 0);
comp = new AddonComponent(0x369);
comp.Hue = hue;
AddComponent(comp, -2, 3, 0);
comp = new AddonComponent(0x369);
comp.Hue = hue;
AddComponent(comp, 3, 3, 0);
comp = new AddonComponent(0x369);
comp.Hue = hue;
AddComponent(comp, 4, 3, 0);
comp = new AddonComponent(0x368);
comp.Hue = hue;
AddComponent(comp, 5, 3, 0);
comp = new AddonComponent(0x36A);
comp.Hue = hue;
AddComponent(comp, 5, 2, 0);
comp = new AddonComponent(0x36A);
comp.Hue = hue;
AddComponent(comp, 5, 0, 0);
comp = new AddonComponent(0x36A);
comp.Hue = hue;
AddComponent(comp, 5, -2, 0);
comp = new AddonComponent(0x36D);
comp.Hue = hue;
AddComponent(comp, 5, -3, 0);
comp = new AddonComponent(0x36E);
comp.Hue = hue;
AddComponent(comp, 4, -3, 0);
comp = new AddonComponent(0x36E);
comp.Hue = hue;
AddComponent(comp, 3, -3, 0);
comp = new AddonComponent(0x36E);
comp.Hue = hue;
AddComponent(comp, -3, -3, 0);
comp = new AddonComponent(0x36F);
comp.Hue = hue;
AddComponent(comp, -4, -2, 0);
comp = new AddonComponent(0x36F);
comp.Hue = hue;
AddComponent(comp, -4, 0, 0);
comp = new AddonComponent(0x36F);
comp.Hue = hue;
AddComponent(comp, -4, 2, 0);
AddComponent(new AddonComponent(0x36B), -4, -3, 0);
// South/East Corner
comp = new AddonComponent(0x663);
comp.Hue = hue;
AddComponent(comp, 5, 3, 18);
comp = new AddonComponent(0x663);
comp.Hue = hue;
AddComponent(comp, 4, 2, 21);
comp = new AddonComponent(0x663);
comp.Hue = hue;
AddComponent(comp, 3, 1, 24);
// North/East Corner
comp = new AddonComponent(0x664);
comp.Hue = hue;
AddComponent(comp, 5, -3, 18);
comp = new AddonComponent(0x664);
comp.Hue = hue;
AddComponent(comp, 4, -2, 21);
comp = new AddonComponent(0x664);
comp.Hue = hue;
AddComponent(comp, 3, -1, 24);
// South/West Corner
comp = new AddonComponent(0x666);
comp.Hue = hue;
AddComponent(comp, -4, 3, 18);
comp = new AddonComponent(0x666);
comp.Hue = hue;
AddComponent(comp, -3, 2, 21);
comp = new AddonComponent(0x666);
comp.Hue = hue;
AddComponent(comp, -2, 1, 24);
// North/West Corner
comp = new AddonComponent(0x665);
comp.Hue = hue;
AddComponent(comp, -4, -3, 18);
comp = new AddonComponent(0x665);
comp.Hue = hue;
AddComponent(comp, -3, -2, 21);
comp = new AddonComponent(0x665);
comp.Hue = hue;
AddComponent(comp, -2, -1, 24);
// Top - East to West
comp = new AddonComponent(0x668);
comp.Hue = hue;
AddComponent(comp, 2, 0, 27);
comp = new AddonComponent(0x662);
comp.Hue = hue;
AddComponent(comp, 1, 0, 27);
comp = new AddonComponent(0x662);
comp.Hue = hue;
AddComponent(comp, 0, 0, 27);
comp = new AddonComponent(0x669);
comp.Hue = hue;
AddComponent(comp, -1, 0, 27);
// South Facing
for (int x = -3; x <= 4; x++)
{
comp = new AddonComponent(0x601);
comp.Hue = hue;
AddComponent(comp, x, 3, 18);
}
for (int x = -2; x <= 3; x++)
{
comp = new AddonComponent(0x601);
comp.Hue = hue;
AddComponent(comp, x, 2, 21);
}
for (int x = -1; x <= 2; x++)
{
comp = new AddonComponent(0x601);
comp.Hue = hue;
AddComponent(comp, x, 1, 24);
}
// North Facing
for (int x = -3; x <= 4; x++)
{
comp = new AddonComponent(0x600);
comp.Hue = hue;
AddComponent(comp, x, -3, 18);
}
for (int x = -2; x <= 3; x++)
{
comp = new AddonComponent(0x600);
comp.Hue = hue;
AddComponent(comp, x, -2, 21);
}
for (int x = -1; x <= 2; x++)
{
comp = new AddonComponent(0x600);
comp.Hue = hue;
AddComponent(comp, x, -1, 24);
}
// West Facing
for (int y = -2; y <= 2; y++)
{
comp = new AddonComponent(0x5FF);
comp.Hue = hue;
AddComponent(comp, -4, y, 18);
}
for (int y = -1; y <= 1; y++)
{
comp = new AddonComponent(0x5FF);
comp.Hue = hue;
AddComponent(comp, -3, y, 21);
}
comp = new AddonComponent(0x5FF);
comp.Hue = hue;
AddComponent(comp, -2, 0, 24);
// East Facing
for (int y = -2; y <= 2; y++)
{
comp = new AddonComponent(0x602);
comp.Hue = hue;
AddComponent(comp, 5, y, 18);
}
for (int y = -1; y <= 1; y++)
{
comp = new AddonComponent(0x602);
comp.Hue = hue;
AddComponent(comp, 4, y, 21);
}
comp = new AddonComponent(0x602);
comp.Hue = hue;
AddComponent(comp, 3, 0, 24);
AddComponent(new AddonComponent(0xB6B), 2, 0, 0);
AddComponent(new AddonComponent(0xB6C), 2, -1, 0);
AddComponent(new AddonComponent(0x9CEF), -1, 5, 0);
AddComponent(new AddonComponent(0x9CEF), 3, 5, 0);
// Center:4707, 1127, 0
}
public AstronomyTent(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}

View File

@@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Mobiles;
using Server.Items;
using Server.Gumps;
namespace Server.Engines.Astronomy
{
public class Willebrord : BaseVendor
{
public static Willebrord TramInstance { get; set; }
protected readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
protected override List<SBInfo> SBInfos { get { return m_SBInfos; } }
public override bool IsActiveVendor { get { return false; } }
public override void InitSBInfo()
{
}
public static void Initialize()
{
if (Core.EJ)
{
if (TramInstance == null)
{
TramInstance = new Willebrord();
TramInstance.MoveToWorld(new Point3D(4706, 1128, 6), Map.Trammel);
}
if (Map.Trammel.FindItem<AstronomyTent>(new Point3D(4707, 1127, 0)) == null)
{
var tent = new AstronomyTent();
tent.MoveToWorld(new Point3D(4707, 1127, 0), Map.Trammel);
}
if (Map.Trammel.FindItem<PersonalTelescope>(new Point3D(4705, 1128, 0)) == null)
{
var tele = new PersonalTelescope();
tele.Movable = false;
tele.MoveToWorld(new Point3D(4705, 1128, 0), Map.Trammel);
}
if (Map.Trammel.FindItem<BrassOrrery>(new Point3D(4705, 1126, 0)) == null)
{
var orrery = new BrassOrrery();
orrery.Movable = false;
orrery.MoveToWorld(new Point3D(4705, 1126, 0), Map.Trammel);
}
if (Map.Trammel.FindItem<ConstellationLedger>(new Point3D(4709, 1127, 0)) == null)
{
var ledger = new ConstellationLedger();
ledger.Movable = false;
ledger.MoveToWorld(new Point3D(4709, 1127, 4), Map.Trammel);
}
if (Map.Trammel.FindItem<PrimerOnBritannianAstronomy>(new Point3D(4709, 1126, 0)) == null)
{
var book = new PrimerOnBritannianAstronomy();
book.Movable = false;
book.MoveToWorld(new Point3D(4709, 1126, 4), Map.Trammel);
}
}
}
public Willebrord()
: base("the Astronomer")
{
}
public override void InitBody()
{
InitStats(100, 100, 25);
CantWalk = true;
Name = "Willebrord";
Race = Race.Human;
Body = Race.MaleBody;
HairItemID = Race.RandomHair(false);
HairHue = Race.RandomHairHue();
}
public override void InitOutfit()
{
SetWearable(new Kamishimo());
SetWearable(new ThighBoots(), 1908);
SetWearable(new FancyShirt(), 1255);
}
public override void OnDoubleClick(Mobile m)
{
if (m.InRange(Location, 3) && InLOS(m))
{
var 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);
gump.AddHtmlLocalized(290, 51, 418, 209, 1158518, 0xC63, false, true);
m.SendGump(gump);
}
}
public override bool OnDragDrop(Mobile m, Item dropped)
{
if (dropped is StarChart)
{
var 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
{
var info = AstronomySystem.GetConstellation(chart.Constellation);
if (info != null)
{
var 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;
}
public Willebrord(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
reader.ReadInt();
if (Map == Map.Trammel)
{
TramInstance = this;
}
}
}
}