public void StartMystery(Mobile from) { if (from == null) { return; } MysteryTypeDetail mysteryTypeDetail = AncientMystery.GetMysteryDetails(m_RevealedMysteryType); if (mysteryTypeDetail == null) { return; } m_Completed = true; from.SendSound(0x0F8); switch (m_RevealedMysteryType) { case MysteryType.Daemon: Mysteries.Daemon(from); break; case MysteryType.Fountain: Mysteries.Fountain(from); break; case MysteryType.Medusa: Mysteries.Medusa(from); break; case MysteryType.Mongbat: Mysteries.Mongbat(from); break; case MysteryType.Sphinx: Mysteries.SphinxMystery(from); break; case MysteryType.Vampire: Mysteries.Vampire(from); break; } }
public void AttemptStartMystery(Mobile from) { if (from == null) { return; } MysteryTypeDetail mysteryTypeDetail = AncientMystery.GetMysteryDetails(m_RevealedMysteryType); if (mysteryTypeDetail == null) { return; } if (m_Completed) { from.SendMessage("The mystery held within the scroll has already been uncovered."); return; } Point3D mysteryLocation = mysteryTypeDetail.m_MysteryLocation; if (from.InRange(mysteryLocation, 10)) { bool anotherMysteryActive = false; IPooledEnumerable searchArea = Map.GetObjectsInRange(mysteryLocation, 20); foreach (Object targetObject in searchArea) { if (targetObject is MysteryLocation) { anotherMysteryActive = true; break; } } searchArea.Free(); if (anotherMysteryActive) { from.SendMessage("There appears to be some sort of mysterious activity already underway here. Perhaps it would be best to return later."); return; } from.RevealingAction(); from.SendMessage("The mystery unfolds..."); StartMystery(from); } else { from.SendMessage("From your research, you believe a search should be conducted at " + mysteryLocation.X.ToString() + "," + mysteryLocation.Y.ToString() + "."); } }
public void CheckRevealMystery(Mobile from) { if (m_Discoveries.Count >= DiscoveriesRequired && m_ResearchAdded >= ResearchRequired) { int TotalValues = 0; Dictionary <MysteryType, int> DictMysteryTypes = new Dictionary <MysteryType, int>(); for (int a = 0; a < DiscoveriesRequired; a++) { MysteryType mysteryType = m_Discoveries[a]; if (DictMysteryTypes.ContainsKey(mysteryType)) { DictMysteryTypes[mysteryType]++; } else { DictMysteryTypes.Add(mysteryType, 1); } } foreach (KeyValuePair <MysteryType, int> pair in DictMysteryTypes) { TotalValues += pair.Value; } double mysteryCheck = Utility.RandomDouble(); double CumulativeAmount = 0.0; double AdditionalAmount = 0.0; //Determine Mystery foreach (KeyValuePair <MysteryType, int> pair in DictMysteryTypes) { AdditionalAmount = (double)pair.Value / (double)TotalValues; if (mysteryCheck >= CumulativeAmount && mysteryCheck < (CumulativeAmount + AdditionalAmount)) { m_RevealedMysteryType = pair.Key; } CumulativeAmount += AdditionalAmount; } from.SendSound(0x0F8); m_Revealed = true; MysteryTypeDetail mysteryTypeDetail = AncientMystery.GetMysteryDetails(m_RevealedMysteryType); from.SendMessage("You have revealed the mystery! It is " + mysteryTypeDetail.m_Name + "."); } }
public void AddDiscovery(Mobile from) { int mysteryTypeCount = Enum.GetNames(typeof(MysteryType)).Length; MysteryType mysteryType = (MysteryType)Utility.RandomMinMax(0, mysteryTypeCount - 1); MysteryTypeDetail mysteryTypeDetail = AncientMystery.GetMysteryDetails(mysteryType); m_Discoveries.Add(mysteryType); from.SendMessage("You have made a discovery towards the mystery!"); from.SendSound(0x102); CheckRevealMystery(from); }
public static MysteryTypeDetail GetMysteryDetails(MysteryType mysteryType) { MysteryTypeDetail mysteryTypeDetail = new MysteryTypeDetail(); switch (mysteryType) { case MysteryType.Daemon: mysteryTypeDetail.m_MysteryType = MysteryType.Daemon; mysteryTypeDetail.m_Name = "The Pact"; mysteryTypeDetail.m_StatueItemId = 13899; mysteryTypeDetail.m_StatueHue = 2500; mysteryTypeDetail.m_StatueOffsetX = 14; mysteryTypeDetail.m_StatueOffsetY = -62; mysteryTypeDetail.m_MysteryLocation = new Point3D(4644, 3654, 100); break; case MysteryType.Fountain: mysteryTypeDetail.m_MysteryType = MysteryType.Fountain; mysteryTypeDetail.m_Name = "The Collapse"; mysteryTypeDetail.m_StatueItemId = 17090; mysteryTypeDetail.m_StatueHue = 2500; mysteryTypeDetail.m_StatueOffsetX = 14; mysteryTypeDetail.m_StatueOffsetY = -40; mysteryTypeDetail.m_MysteryLocation = new Point3D(1170, 2916, 0); break; case MysteryType.Medusa: mysteryTypeDetail.m_MysteryType = MysteryType.Medusa; mysteryTypeDetail.m_Name = "The Seduction"; mysteryTypeDetail.m_StatueItemId = 16572; mysteryTypeDetail.m_StatueHue = 2500; mysteryTypeDetail.m_StatueOffsetX = 14; mysteryTypeDetail.m_StatueOffsetY = -40; mysteryTypeDetail.m_MysteryLocation = new Point3D(1128, 3452, 0); break; case MysteryType.Mongbat: mysteryTypeDetail.m_MysteryType = MysteryType.Mongbat; mysteryTypeDetail.m_Name = "The Jest"; mysteryTypeDetail.m_StatueItemId = 6483; mysteryTypeDetail.m_StatueHue = 2500; mysteryTypeDetail.m_StatueOffsetX = -7; mysteryTypeDetail.m_StatueOffsetY = -18; mysteryTypeDetail.m_MysteryLocation = new Point3D(1370, 505, 1); break; case MysteryType.Sphinx: mysteryTypeDetail.m_MysteryType = MysteryType.Sphinx; mysteryTypeDetail.m_Name = "The Enigma"; mysteryTypeDetail.m_StatueItemId = 17091; mysteryTypeDetail.m_StatueHue = 2500; mysteryTypeDetail.m_StatueOffsetX = 15; mysteryTypeDetail.m_StatueOffsetY = -35; mysteryTypeDetail.m_MysteryLocation = new Point3D(1857, 962, -1); break; case MysteryType.Vampire: mysteryTypeDetail.m_MysteryType = MysteryType.Vampire; mysteryTypeDetail.m_Name = "The Betrayal"; mysteryTypeDetail.m_StatueItemId = 17093; mysteryTypeDetail.m_StatueHue = 2500; mysteryTypeDetail.m_StatueOffsetX = 14; mysteryTypeDetail.m_StatueOffsetY = -63; mysteryTypeDetail.m_MysteryLocation = new Point3D(1467, 2511, 7); break; } return(mysteryTypeDetail); }
public AncientMysteryGump(AncientMysteryScroll ancientMysteryScroll, Mobile from) : base(15, 15) { m_AncientMysteryScroll = ancientMysteryScroll; Closable = true; Disposable = true; Dragable = true; Resizable = false; AddPage(0); AddImage(15, 15, 30500); //Scroll Background int textHue = 2036; List <Point2D> m_LargeIconPoints = new List <Point2D>(); m_LargeIconPoints.Add(new Point2D(355, 280)); m_LargeIconPoints.Add(new Point2D(210, 355)); m_LargeIconPoints.Add(new Point2D(75, 280)); m_LargeIconPoints.Add(new Point2D(75, 130)); m_LargeIconPoints.Add(new Point2D(355, 130)); m_LargeIconPoints.Add(new Point2D(210, 39)); List <Point2D> m_SmallIconPoints = new List <Point2D>(); m_SmallIconPoints.Add(new Point2D(302, 354)); //AddItem(302, 358, 8792, 2611); m_SmallIconPoints.Add(new Point2D(147, 355)); //AddItem(146, 359, 8792, 2611); m_SmallIconPoints.Add(new Point2D(70, 220)); // AddItem(69, 224, 8792, 2611); m_SmallIconPoints.Add(new Point2D(147, 80)); //AddItem(145, 83, 8792, 2611); m_SmallIconPoints.Add(new Point2D(303, 80)); //AddItem(303, 85, 8792, 2611); m_SmallIconPoints.Add(new Point2D(380, 220)); //AddItem(379, 225, 8792, 2611); int discoveriesCount = m_AncientMysteryScroll.m_Discoveries.Count; if (discoveriesCount > AncientMysteryScroll.DiscoveriesRequired) { discoveriesCount = AncientMysteryScroll.DiscoveriesRequired; } //Research for (int a = 0; a < AncientMysteryScroll.ResearchRequired; a++) { Point2D point = m_SmallIconPoints[a]; if (a < m_AncientMysteryScroll.ResearchAdded) { AddItem(point.X, point.Y, 8792, 2611); } else { AddImage(point.X, point.Y, 2279); } } //Discoveries for (int a = 0; a < AncientMysteryScroll.DiscoveriesRequired; a++) { Point2D point = m_LargeIconPoints[a]; if (a < discoveriesCount) { MysteryTypeDetail mysteryTypeDetail = GetMysteryDetails(m_AncientMysteryScroll.m_Discoveries[a]); AddItem(point.X + mysteryTypeDetail.m_StatueOffsetX, point.Y + mysteryTypeDetail.m_StatueOffsetY, mysteryTypeDetail.m_StatueItemId, mysteryTypeDetail.m_StatueHue); } else { AddImage(point.X, point.Y, 7039); } } if (!m_AncientMysteryScroll.Revealed) { AddLabel(190, 175, textHue, "An Ancient Mystery"); } string line1 = ""; string line2 = ""; if (m_AncientMysteryScroll.Revealed) { MysteryTypeDetail mysteryTypeDetail = GetMysteryDetails(m_AncientMysteryScroll.RevealedMysteryType); AddItem(210 + mysteryTypeDetail.m_StatueOffsetX, 170 + mysteryTypeDetail.m_StatueOffsetY, mysteryTypeDetail.m_StatueItemId, 2501); line1 = "MYSTERY REVEALED"; if (m_AncientMysteryScroll.Completed) { line1 = "MYSTERY COMPLETED"; } line2 = "\"" + mysteryTypeDetail.m_Name + "\""; AddLabel(230 - (line1.Length * 3), 220, textHue, line1); AddLabel(240 - (line2.Length * 3), 240, textHue, line2); } else { line1 = "Click to Contribute Items"; AddLabel(240 - (line1.Length * 3), 240, textHue, line1); } if (!m_AncientMysteryScroll.Completed) { AddButton(230, 260, 9721, 9725, 1, GumpButtonType.Reply, 0); } int researchRemaining = AncientMysteryScroll.ResearchRequired - m_AncientMysteryScroll.ResearchAdded; AddItem(25, 400, 8002, 2550); AddItem(50, 395, 7187, 2550); AddLabel(87, 400, textHue, "->"); AddItem(104, 390, 8792, 2611); AddLabel(37, 425, textHue, "Research Needed: " + researchRemaining.ToString()); int discoveriesRemaining = AncientMysteryScroll.DiscoveriesRequired - m_AncientMysteryScroll.m_Discoveries.Count; if (discoveriesRemaining < 0) { discoveriesRemaining = 0; } AddItem(323, 403, 5357, 0); AddItem(350, 395, 5355, 2635); AddLabel(390, 400, textHue, "->"); AddItem(400, 390, 4810, 2500); AddLabel(312, 425, textHue, "Discoveries Needed: " + discoveriesRemaining.ToString()); }