private void LoadPlots() { for (int i = 0; i < m_MagHousingZones.Length; i++) { bool prime = (i > 0 && i < 6) || i > 14; MaginciaHousingPlot tramplot = new MaginciaHousingPlot(m_Identifiers[i], m_MagHousingZones[i], prime, Map.Trammel); MaginciaHousingPlot felplot = new MaginciaHousingPlot(m_Identifiers[i], m_MagHousingZones[i], prime, Map.Felucca); bool isBlocked = m_Identifiers[i] == "SW-3" || m_Identifiers[i] == "SW-4"; RegisterPlot(tramplot); if (!isBlocked) { RegisterPlot(felplot); } tramplot.AddPlotStone(m_StoneLocs[i]); tramplot.LottoEnds = DateTime.UtcNow + m_LottoDuration; if (!isBlocked) { felplot.AddPlotStone(m_StoneLocs[i]); felplot.LottoEnds = DateTime.UtcNow + m_LottoDuration; } } }
public void ValidatePlots() { for (int i = 0; i < m_Identifiers.Length; i++) { Rectangle2D rec = m_MagHousingZones[i]; string id = m_Identifiers[i]; MaginciaHousingPlot plotTram = m_Plots.FirstOrDefault(p => p.Identifier == id && p.Map == Map.Trammel); MaginciaHousingPlot plotFel = m_Plots.FirstOrDefault(p => p.Identifier == id && p.Map == Map.Felucca); if (plotTram == null && !m_FreeHousingZones[Map.Trammel].Contains(rec)) { Console.WriteLine("Adding {0} to Magincia Free Housing Zone.[{1}]", rec, "Plot non-existent"); m_FreeHousingZones[Map.Trammel].Add(rec); } else if (plotTram != null && plotTram.Stone == null && (plotTram.Writ == null || plotTram.Writ.Expired)) { Console.WriteLine("Adding {0} to Magincia Free Housing Zone.[{1}]", rec, "Plot existed, writ expired"); UnregisterPlot(plotTram); } if (plotFel == null && !m_FreeHousingZones[Map.Felucca].Contains(rec)) { Console.WriteLine("Adding {0} to Magincia Free Housing Zone.[{1}]", rec, "Plot non-existent"); m_FreeHousingZones[Map.Felucca].Add(rec); } else if (plotFel != null && plotFel.Stone == null && (plotFel.Writ == null || plotFel.Writ.Expired)) { Console.WriteLine("Adding {0} to Magincia Free Housing Zone.[{1}]", rec, "Plot existed, writ expired"); UnregisterPlot(plotFel); } } }
public static string FormatSextant(MaginciaHousingPlot plot) { int z = plot.Map.GetAverageZ(plot.Bounds.X, plot.Bounds.Y); Point3D p = new Point3D(plot.Bounds.X, plot.Bounds.Y, z); return(FormatSextant(p, plot.Map)); }
public void OnExpired() { MaginciaLottoSystem.UnregisterPlot(m_Plot); m_Plot = null; m_Expired = true; m_Expires = DateTime.MinValue; InvalidateProperties(); }
public PlotWinnerGump(MaginciaHousingPlot plot) : base(75, 75) { m_Plot = plot; AddBackground(0, 0, 424, 351, 9500); AddImage(5, 10, 5411); AddHtmlLocalized(170, 13, 150, 16, 1150484, GreenColor, false, false); // WRIT OF LEASE string args = String.Format("{0}\t{1}\t{2}", plot.Identifier, plot.Map, String.Format("{0} {1}", plot.Bounds.X, plot.Bounds.Y)); AddHtmlLocalized(10, 40, 404, 180, 1150499, args, BlueColor, true, true); AddButton(5, 235, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 235, 150, 16, 1150498, EntryColor, false, false); // CLAIM DEED }
public WritOfLease(MaginciaHousingPlot plot) : base(5358) { Hue = 0x9A; m_Plot = plot; m_Expires = plot.Expires; m_Expired = false; if (plot != null) { m_Facet = plot.Map; m_Identifier = plot.Identifier; m_RecallLoc = plot.RecallLoc; } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (info.ButtonID >= 5 && from.AccessLevel > AccessLevel.Player) { int index = info.ButtonID - 5; if (index >= 0 && index < m_List.Count) { MaginciaHousingPlot plot = m_List[index]; if (plot != null) { from.SendGump(new PlotTrackingGump(plot)); } } } }
public static Point3D GetPlotStoneLoc(MaginciaHousingPlot plot) { if (plot == null) { return(Point3D.Zero); } for (int i = 0; i < m_Identifiers.Length; i++) { if (m_Identifiers[i] == plot.Identifier) { return(m_StoneLocs[i]); } } int z = plot.Map.GetAverageZ(plot.Bounds.X - 1, plot.Bounds.Y - 1); return(new Point3D(plot.Bounds.X - 1, plot.Bounds.Y - 1, z)); }
public static void UnregisterPlot(MaginciaHousingPlot plot) { if (plot == null) { return; } if (plot.Stone != null && !plot.Stone.Deleted) { plot.Stone.Delete(); } if (m_Plots.Contains(plot)) { m_Plots.Remove(plot); } if (plot.Map != null && m_FreeHousingZones.ContainsKey(plot.Map) && !m_FreeHousingZones[plot.Map].Contains(plot.Bounds)) { m_FreeHousingZones[plot.Map].Add(plot.Bounds); } }
public static void RegisterPlot(MaginciaHousingPlot plot) { m_Plots.Add(plot); }
public LottoTrackingGump() : base(50, 50) { AddBackground(0, 0, 410, 564, 9500); AddHtml(205, 10, 205, 20, "<DIV ALIGN=RIGHT><Basefont Color=#FFFFFF>New Magincia Lotto Tracking</DIV>", false, false); AddHtml(10, 10, 205, 20, Color(string.Format("Gold Sink: {0}", MaginciaLottoSystem.GoldSink.ToString("###,###,###")), 0xFFFFFF), false, false); AddHtml(45, 40, 40, 20, Color("ID", LabelColor), false, false); AddHtml(85, 40, 60, 20, Color("Facet", LabelColor), false, false); AddHtml(145, 40, 40, 20, Color("#bids", LabelColor), false, false); m_List = new List <MaginciaHousingPlot>(MaginciaLottoSystem.Plots); int y = 60; int x = 0; for (int i = 0; i < m_List.Count; i++) { MaginciaHousingPlot plot = m_List[i]; if (plot == null) { continue; } int bids = 0; foreach (int bid in plot.Participants.Values) { bids += bid; } AddButton(10 + x, y, 4005, 4007, i + 5, GumpButtonType.Reply, 0); AddHtml(45 + x, y, 40, 22, Color(plot.Identifier, LabelColor), false, false); AddHtml(85 + x, y, 60, 22, Color(plot.Map.ToString(), LabelColor), false, false); if (plot.LottoOngoing) { AddHtml(145 + x, y, 40, 22, Color(bids.ToString(), LabelColor), false, false); } else if (plot.Complete) { AddHtml(145 + x, y, 40, 22, Color("Owned", "red"), false, false); } else { AddHtml(145 + x, y, 40, 22, Color("Expired", "red"), false, false); } if (i == 21) { y = 60; x = 200; AddHtml(45 + x, 40, 40, 20, Color("ID", LabelColor), false, false); AddHtml(85 + x, 40, 60, 20, Color("Facet", LabelColor), false, false); AddHtml(145 + x, 40, 40, 20, Color("#bids", LabelColor), false, false); } else { y += 22; } } }
public PlotTrackingGump(MaginciaHousingPlot plot) : base(50, 50) { int partCount = plot.Participants.Count; int y = 544; int x = 600; AddBackground(0, 0, x, y, 9500); AddHtml(10, 10, 580, 20, string.Format("<Center><Basefont Color=#FFFFFF>Plot {0}</Center>", plot.Identifier), false, false); AddHtml(10, 40, 80, 20, Color("Player", 0xFFFFFF), false, false); AddHtml(92, 40, 60, 20, Color("Tickets", 0xFFFFFF), false, false); AddHtml(154, 40, 60, 20, Color("Total Gold", 0xFFFFFF), false, false); x = 0; y = 60; int goldSink = 0; List <Mobile> mobiles = new List <Mobile>(plot.Participants.Keys); List <int> amounts = new List <int>(plot.Participants.Values); for (int i = 0; i < mobiles.Count; i++) { Mobile m = mobiles[i]; int amt = amounts[i]; int total = amt * plot.LottoPrice; goldSink += total; AddHtml(10 + x, y, 80, 22, Color(m.Name, 0xFFFFFF), false, false); AddHtml(92 + x, y, 60, 22, Color(amt.ToString(), 0xFFFFFF), false, false); AddHtml(154 + x, y, 60, 22, Color(total.ToString(), 0xFFFFFF), false, false); if (i == 21) { x = 200; y = 60; AddHtml(10 + x, 40, 80, 20, Color("Player", 0xFFFFFF), false, false); AddHtml(92 + x, 40, 60, 20, Color("Tickets", 0xFFFFFF), false, false); AddHtml(154 + x, 40, 60, 20, Color("Total Gold", 0xFFFFFF), false, false); } else if (i == 43) { x = 400; y = 60; AddHtml(10 + x, 40, 80, 20, Color("Player", 0xFFFFFF), false, false); AddHtml(92 + x, 40, 60, 20, Color("Tickets", 0xFFFFFF), false, false); AddHtml(154 + x, 40, 60, 20, Color("Total Gold", 0xFFFFFF), false, false); } else { y += 22; } } AddHtml(10, 10, 150, 20, Color(string.Format("Gold Sink: {0}", goldSink.ToString()), 0xFFFFFF), false, false); AddButton(10, 544 - 32, 4014, 4016, 1, GumpButtonType.Reply, 0); AddHtml(45, 544 - 32, 150, 20, Color("Back", 0xFFFFFF), false, false); }
public static bool IsRegisteredPlot(MaginciaHousingPlot plot) { return m_Plots.Contains(plot); }
public static bool IsRegisteredPlot(MaginciaHousingPlot plot) { return(m_Plots.Contains(plot)); }
private void LoadPlots() { for (int i = 0; i < m_MagHousingZones.Length; i++) { bool prime = (i > 0 && i < 6) || i > 14; MaginciaHousingPlot tramplot = new MaginciaHousingPlot(m_Identifiers[i], m_MagHousingZones[i], prime, Map.Trammel); MaginciaHousingPlot felplot = new MaginciaHousingPlot(m_Identifiers[i], m_MagHousingZones[i], prime, Map.Felucca); bool isBlocked = m_Identifiers[i] == "SW-3" || m_Identifiers[i] == "SW-4"; RegisterPlot(tramplot); if(!isBlocked) RegisterPlot(felplot); tramplot.AddPlotStone(m_StoneLocs[i]); tramplot.LottoEnds = DateTime.UtcNow + m_LottoDuration; if (!isBlocked) { felplot.AddPlotStone(m_StoneLocs[i]); felplot.LottoEnds = DateTime.UtcNow + m_LottoDuration; } } }
public MaginciaLottoGump(Mobile from, MaginciaHousingPlot plot) : base(75, 75) { m_Plot = plot; m_From = from; bool prime = plot.IsPrimeSpot; int ticketsBought = 0; if (plot.Participants.ContainsKey(from)) { ticketsBought = plot.Participants[from]; } int totalTicketsSold = 0; foreach (int i in plot.Participants.Values) { totalTicketsSold += i; } AddBackground(0, 0, 350, 380, 9500); AddHtmlLocalized(10, 10, 200, 20, 1150460, BlueColor, false, false); // New Magincia Housing Lottery AddHtmlLocalized(10, 50, 75, 20, 1150461, BlueColor, false, false); // This Facet: AddHtml(170, 50, 100, 16, string.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", LabelColor, plot.Map.ToString()), false, false); AddHtmlLocalized(10, 70, 75, 20, 1150462, BlueColor, false, false); // This Plot: AddHtml(170, 70, 100, 16, string.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, plot.Identifier), false, false); AddHtmlLocalized(10, 95, 130, 20, 1150463, BlueColor, false, false); // Total Tickets Sold: AddHtml(170, 95, 100, 16, string.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, totalTicketsSold.ToString()), false, false); AddHtmlLocalized(10, 110, 320, 40, prime ? 1150464 : 1150465, LabelColor, false, false); AddHtmlLocalized(10, 160, 90, 20, 1150466, BlueColor, false, false); // Your Tickets: AddHtml(170, 160, 100, 20, string.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, ticketsBought.ToString()), false, false); if (ticketsBought == 0) { AddHtmlLocalized(10, 175, 320, 40, 1150467, LabelColor, false, false); // You have not bought a ticket, so you have no chance of winning this plot. } else { int odds = totalTicketsSold / ticketsBought; AddHtmlLocalized(10, 175, 320, 40, 1150468, odds.ToString(), LabelColor, false, false); // Your chances of winning this plot are currently about 1 in ~1_ODDS~ } AddHtmlLocalized(10, 225, 115, 20, 1150472, BlueColor, false, false); // Price Per Ticket: AddHtml(170, 225, 100, 20, string.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, plot.LottoPrice.ToString("###,###,###")), false, false); if (plot.LottoOngoing) { if (!prime) { AddButton(310, 245, 4005, 4007, 1, GumpButtonType.Reply, 0); AddImageTiled(170, 245, 130, 20, 3004); AddTextEntry(172, 245, 126, 16, 0, 0, ""); AddHtmlLocalized(10, 245, 100, 20, 1150477, BlueColor, false, false); // Buy Tickets } else { if (plot.CanPurchaseLottoTicket(from)) { AddButton(125, 245, 4014, 4007, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(165, 242, 100, 20, 1150469, BlueColor, false, false); // Buy Ticket } else { AddHtmlLocalized(10, 240, 320, 40, 1150475, LabelColor, false, false); // You may not purchase another ticket for this plot's lottery. } } } else { AddHtml(10, 240, 320, 40, "<BASEFONT COLOR=#{0:X6}>The lottery on this plot is currently disabled.</BASEFONT>", false, false); } TimeSpan ts = plot.LottoEnds - DateTime.UtcNow; AddHtmlLocalized(10, 300, 320, 40, 1150476, LabelColor, false, false); // Ticket purchases are NONREFUNDABLE. Odds of winning may vary. if (ts.Days > 0) { AddHtmlLocalized(10, 340, 320, 20, 1150504, ts.Days.ToString(), LabelColor, false, false); // There are ~1_DAYS~ days left before the drawing. } else { AddHtmlLocalized(10, 340, 320, 20, 1150503, LabelColor, false, false); // The lottery drawing will happen in less than 1 day. } }
public static Point3D GetPlotStoneLoc(MaginciaHousingPlot plot) { if (plot == null) return Point3D.Zero; for (int i = 0; i < m_Identifiers.Length; i++) { if (m_Identifiers[i] == plot.Identifier) return m_StoneLocs[i]; } int z = plot.Map.GetAverageZ(plot.Bounds.X - 1, plot.Bounds.Y - 1); return new Point3D(plot.Bounds.X - 1, plot.Bounds.Y - 1, z); }
public static string FormatSextant(MaginciaHousingPlot plot) { int z = plot.Map.GetAverageZ(plot.Bounds.X, plot.Bounds.Y); Point3D p = new Point3D(plot.Bounds.X, plot.Bounds.Y, z); return FormatSextant(p, plot.Map); }
public static void UnregisterPlot(MaginciaHousingPlot plot) { if (plot == null) return; if (plot.Stone != null && !plot.Stone.Deleted) plot.Stone.Delete(); if (m_Plots.Contains(plot)) m_Plots.Remove(plot); if (plot.Map != null && m_FreeHousingZones.ContainsKey(plot.Map) && !m_FreeHousingZones[plot.Map].Contains(plot.Bounds)) m_FreeHousingZones[plot.Map].Add(plot.Bounds); }
public PlotTrackingGump(MaginciaHousingPlot plot) : base(50, 50) { int partCount = plot.Participants.Count; int y = 544; int x = 600; AddBackground(0, 0, x, y, 9500); AddHtml(10, 10, 580, 20, String.Format("<Center><Basefont Color=#FFFFFF>Plot {0}</Center>", plot.Identifier), false, false); AddHtml(10, 40, 80, 20, Color("Player", 0xFFFFFF), false, false); AddHtml(92, 40, 60, 20, Color("Tickets", 0xFFFFFF), false, false); AddHtml(154, 40, 60, 20, Color("Total Gold", 0xFFFFFF), false, false); x = 0; y = 60; int goldSink = 0; List<Mobile> mobiles = new List<Mobile>(plot.Participants.Keys); List<int> amounts = new List<int>(plot.Participants.Values); for (int i = 0; i < mobiles.Count; i++) { Mobile m = mobiles[i]; int amt = amounts[i]; int total = amt * plot.LottoPrice; goldSink += total; AddHtml(10 + x, y, 80, 22, Color(m.Name, 0xFFFFFF), false, false); AddHtml(92 + x, y, 60, 22, Color(amt.ToString(), 0xFFFFFF), false, false); AddHtml(154 + x, y, 60, 22, Color(total.ToString(), 0xFFFFFF), false, false); if (i == 21) { x = 200; y = 60; AddHtml(10 + x, 40, 80, 20, Color("Player", 0xFFFFFF), false, false); AddHtml(92 + x, 40, 60, 20, Color("Tickets", 0xFFFFFF), false, false); AddHtml(154 + x, 40, 60, 20, Color("Total Gold", 0xFFFFFF), false, false); } else if (i == 43) { x = 400; y = 60; AddHtml(10 + x, 40, 80, 20, Color("Player", 0xFFFFFF), false, false); AddHtml(92 + x, 40, 60, 20, Color("Tickets", 0xFFFFFF), false, false); AddHtml(154 + x, 40, 60, 20, Color("Total Gold", 0xFFFFFF), false, false); } else y += 22; } AddHtml(10, 10, 150, 20, Color(String.Format("Gold Sink: {0}", goldSink.ToString()), 0xFFFFFF), false, false); AddButton(10, 544 - 32, 4014, 4016, 1, GumpButtonType.Reply, 0); AddHtml(45, 544 - 32, 150, 20, Color("Back", 0xFFFFFF), false, false); }
public MaginciaLottoGump(Mobile from, MaginciaHousingPlot plot) : base(75, 75) { m_Plot = plot; m_From = from; bool prime = plot.IsPrimeSpot; int ticketsBought = 0; if (plot.Participants.ContainsKey(from)) ticketsBought = plot.Participants[from]; int totalTicketsSold = 0; foreach (int i in plot.Participants.Values) totalTicketsSold += i; AddBackground(0, 0, 350, 380, 9500); AddHtmlLocalized(10, 10, 200, 20, 1150460, BlueColor, false, false); // New Magincia Housing Lottery AddHtmlLocalized(10, 50, 75, 20, 1150461, BlueColor, false, false); // This Facet: AddHtml(170, 50, 100, 16, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", LabelColor, plot.Map.ToString()), false, false); AddHtmlLocalized(10, 70, 75, 20, 1150462, BlueColor, false, false); // This Plot: AddHtml(170, 70, 100, 16, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, plot.Identifier), false, false); AddHtmlLocalized(10, 95, 130, 20, 1150463, BlueColor, false, false); // Total Tickets Sold: AddHtml(170, 95, 100, 16, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, totalTicketsSold.ToString()), false, false); AddHtmlLocalized(10, 110, 320, 40, prime ? 1150464 : 1150465, LabelColor, false, false); AddHtmlLocalized(10, 160, 90, 20, 1150466, BlueColor, false, false); // Your Tickets: AddHtml(170, 160, 100, 20, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, ticketsBought.ToString()), false, false); if (ticketsBought == 0) AddHtmlLocalized(10, 175, 320, 40, 1150467, LabelColor, false, false); // You have not bought a ticket, so you have no chance of winning this plot. else { int odds = totalTicketsSold / ticketsBought; AddHtmlLocalized(10, 175, 320, 40, 1150468, odds.ToString(), LabelColor, false, false); // Your chances of winning this plot are currently about 1 in ~1_ODDS~ } AddHtmlLocalized(10, 225, 115, 20, 1150472, BlueColor, false, false); // Price Per Ticket: AddHtml(170, 225, 100, 20, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", EntryColor, plot.LottoPrice.ToString("###,###,###")), false, false); if (plot.LottoOngoing) { if (!prime) { AddButton(310, 245, 4005, 4007, 1, GumpButtonType.Reply, 0); AddImageTiled(170, 245, 130, 20, 3004); AddTextEntry(172, 245, 126, 16, 0, 0, ""); AddHtmlLocalized(10, 245, 100, 20, 1150477, BlueColor, false, false); // Buy Tickets } else { if (plot.CanPurchaseLottoTicket(from)) { AddButton(125, 245, 4014, 4007, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(165, 242, 100, 20, 1150469, BlueColor, false, false); // Buy Ticket } else AddHtmlLocalized(10, 240, 320, 40, 1150475, LabelColor, false, false); // You may not purchase another ticket for this plot's lottery. } } else AddHtml(10, 240, 320, 40, "<BASEFONT COLOR=#{0:X6}>The lottery on this plot is currently disabled.</BASEFONT>", false, false); TimeSpan ts = plot.LottoEnds - DateTime.UtcNow; AddHtmlLocalized(10, 300, 320, 40, 1150476, LabelColor, false, false); // Ticket purchases are NONREFUNDABLE. Odds of winning may vary. if(ts.Days > 0) AddHtmlLocalized(10, 340, 320, 20, 1150504, ts.Days.ToString(), LabelColor, false, false); // There are ~1_DAYS~ days left before the drawing. else AddHtmlLocalized(10, 340, 320, 20, 1150503, LabelColor, false, false); // The lottery drawing will happen in less than 1 day. }