public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); m_Game = reader.ReadInt(); int count = reader.ReadInt(); for (int i = 0; i < count; ++i) { int one = reader.ReadInt(); int two = reader.ReadInt(); int three = reader.ReadInt(); int four = reader.ReadInt(); int five = reader.ReadInt(); int six = reader.ReadInt(); bool winner = reader.ReadBool(); new TicketEntry(this, one, two, three, four, five, six, winner); } m_PowerBall = PowerBall.Game; if (PowerBall.Instance != null && m_PowerBall != null && m_Game == m_PowerBall.GameNumber) { PowerBall.Instance.AddTicket(this); } }
static void Main(string[] args) { MegaMillions mega = new MegaMillions(); mega.GenerateTipps(5); mega.PrintToScreen(); string jsonMegaMillions = mega.GetJson(); EuroJackpot euroJackpot = new EuroJackpot(); euroJackpot.GenerateTipps(6); euroJackpot.PrintToScreen(); string jsonEuroJackpot = euroJackpot.GetJson(); EuroMillions euroMillions = new EuroMillions(); euroMillions.GenerateTipps(3); euroMillions.PrintToScreen(); string jsonEuroMillions = euroMillions.GetJson(); PowerBall powerBall = new PowerBall(); powerBall.GenerateTipps(3); powerBall.PrintToScreen(); string jsonPowerBall = powerBall.GetJson(); }
public void UsePower(float shootValue) { GameObject newPowerBall = GameObject.Instantiate(PowerBallPrefab, initTransform.position, Quaternion.identity); PowerBall powerBallScript = newPowerBall.GetComponent <PowerBall>(); powerBallScript.SetDirection(this.transform.forward); powerBallScript.SetElement(PowerElement, shootValue); powerBallScript.SetSpeed(ShootSpeed); }
public void TestPowerBallCompareNotEqual() { FakeNumberGenerator numberGenerator = new FakeNumberGenerator(new List <int> { 1, 2, 3, 4, 5, 6, 7 }); PowerBall mine = new PowerBall(numberGenerator); PowerBall winning = new PowerBall(numberGenerator); Assert.AreEqual(-1, mine.CompareTo(winning)); }
private PowerBall generateNumber() { numberToGenerate(); var PowerBallObject = new PowerBall(); PowerBallObject.FirstNumber = fivenumbers[0]; PowerBallObject.SecondNumber = fivenumbers[1]; PowerBallObject.ThirdNumber = fivenumbers[2]; PowerBallObject.FourthNumber = fivenumbers[3]; PowerBallObject.FifthNumber = fivenumbers[4]; PowerBallObject.PowerNumber = generatePowerNumber(); return(PowerBallObject); }
public PowerBallTicket() : base(null, TicketType.Powerball, false) { Name = "a powerball ticket"; LootType = LootType.Blessed; Hue = 2106; if (PowerBall.Instance != null && PowerBall.Game != null) { m_PowerBall = PowerBall.Game; PowerBall.Instance.AddTicket(this); m_Game = m_PowerBall.GameNumber; } else { m_Game = 0; } }
public void TestPowerBall() { int[] PH = new int[5]; int RB = 6; PH[0] = 0; PH[1] = 1; PH[2] = 2; PH[3] = 3; PH[4] = 4; PowerBall player = new PowerBall(PH, RB); PowerBall Com = new PowerBall(PH, RB); Bet <PowerBall> TryBet = new Bet <PowerBall>(); TryBet.Player = player; TryBet.Computer[0] = Com; Assert.AreEqual(1, TryBet.DoBet()); }
public PowerBallTicket(Mobile owner, PowerBall powerball) : base(owner, TicketType.Powerball, false) { Name = "a powerball ticket"; LootType = LootType.Blessed; Hue = 2106; m_PowerBall = powerball; if (m_PowerBall != null) { m_Game = m_PowerBall.GameNumber; } else { m_Game = 0; } if (PowerBall.Instance != null) { PowerBall.Instance.AddTicket(this); } }
public PowerBallStatsGump(PowerBall item, Mobile from) : base(50, 50) { m_PowerBall = item; m_From = from; int gameNumber = 0; if (PowerBall.Game != null) { gameNumber = PowerBall.Game.GameNumber; } AddPage(0); AddBackground(50, 0, 350, 350, 9250); AddPage(1); if (PowerBall.Game != null && PowerBall.Game.IsActive) { AddLabel(70, 15, labelColor, String.Format("Current Powerball Game: {0}", gameNumber)); } else { AddLabel(70, 20, GMColor, "Offline"); } if (m_From.AccessLevel > AccessLevel.Player) { AddLabel(70, 40, GMColor, String.Format("Gold Sink: {0}", PowerBall.GoldSink)); if (PowerBall.Instance != null) { AddLabel(225, 40, GMColor, "Current Game's Profit:"); AddLabel(325, 60, GMColor, String.Format("{0}", PowerBall.Instance.Profit)); } AddLabel(70, 185, GMColor, "*Warning* GM Options *Warning*"); AddLabel(105, 215, GMColor, "Reset All Stats"); AddButton(70, 215, 0xFBD, 0xFBF, 2, GumpButtonType.Reply, 0); AddLabel(105, 245, GMColor, "Current Game Guaratee Jackpot"); AddButton(70, 245, 0xFBD, 0xFBF, 3, GumpButtonType.Reply, 0); AddLabel(105, 275, GMColor, m_PowerBall.IsActive ? "Set Game Inactive" : "Set Active"); AddButton(70, 275, 0xFBD, 0xFBF, 4, GumpButtonType.Reply, 0); if (PowerBall.Game != null && PowerBall.Game.MaxWhiteBalls <= 20) { long odds = GetOdds(); if (odds > 6) { AddLabel(70, 305, GMColor, String.Format("Jackpot Odds: 1 in {0}", odds)); } } } else { int hue = 2041; AddImage(70, 200, 0x15A9, hue); AddImage(115, 265, 0x15A9, hue); AddImage(160, 200, 0x15A9, hue); AddImage(205, 265, 0x15A9, hue); AddImage(250, 200, 0x15A9, hue); AddImage(295, 265, 0x15A9, 0x21); TimeSpan ts = m_PowerBall.NextGame - DateTime.Now; string text; if (ts.TotalHours >= 1) { int minutes = (int)ts.TotalMinutes - (((int)ts.TotalHours) * 60); text = String.Format("Next Picks: {0} {1} and {2} {3}", ((int)ts.TotalHours).ToString(), ts.TotalHours == 1 ? "hour" : "hours", minutes.ToString(), ts.TotalMinutes == 1 ? "minute" : "minutes"); } else { text = String.Format("Next Picks: {0} {1}", ((int)ts.TotalMinutes).ToString(), ts.TotalMinutes == 1 ? "minute" : "minutes"); } AddLabel(70, 40, labelColor, text); } AddHtml(105, 65, 200, 16, "<Basefont Color=#FFFFFF>Purchase Ticket</Basefont>", false, false); if (PowerBall.Instance != null && PowerBall.Instance.CanBuyTickets) { AddButton(70, 65, 0xFBD, 0xFBF, 1, GumpButtonType.Reply, 0); } //else // AddImage(70, 65, 0xFB4); AddButton(70, 95, 0xFBD, 0xFBF, 0, GumpButtonType.Page, 2); AddHtml(105, 95, 200, 16, "<Basefont Color=#FFFFFF>Archived Picks</Basefont>", false, false); AddButton(70, 125, 0xFBD, 0xFBF, 0, GumpButtonType.Page, 3); AddHtml(105, 125, 200, 16, "<Basefont Color=#FFFFFF>Jackpot Winners</Basefont>", false, false); AddHtml(105, 155, 200, 16, "<Basefont Color=#FFFFFF>Current Game Info</Basefont>", false, false); if (m_PowerBall.IsActive) { AddButton(70, 155, 0xFBD, 0xFBF, 0, GumpButtonType.Page, 4); } //else // AddImage(70, 155, 0xFB4); AddPage(2); //Archived Picks AddLabel(70, 20, labelColor, "Game"); AddLabel(150, 20, labelColor, "Last 10 Picks"); AddLabel(275, 20, labelColor, "Total Payout"); int count = 0; for (int i = PowerBallStats.PicksStats.Count - 1; i >= 0; --i) { PowerBallStats stats = PowerBallStats.PicksStats[i]; string payout = String.Format("{0:##,###,###}", stats.Payout); AddHtml(70, 50 + (count * 25), 50, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", stats.GameNumber.ToString()), false, false); AddHtml(305, 50 + (count * 25), 50, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", payout), false, false); if (stats.Picks != null && stats.Picks.Count > 0) { for (int j = 0; j < stats.Picks.Count; ++j) { if (j + 1 < stats.Picks.Count) { AddHtml(125 + (j * 25), 50 + (count * 25), 25, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", stats.Picks[j]), false, false); } else { AddHtml(250, 50 + (count * 25), 25, 16, String.Format("<Basefont Color=#FF0000>{0}</Basefont>", stats.Picks[j]), false, false); } } } if (count++ >= 9) { break; } } AddButton(350, 300, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1); AddPage(3); //Jackpot Winners AddLabel(70, 20, labelColor, "Player"); AddLabel(150, 20, labelColor, "Jackpot Amount"); AddLabel(300, 20, labelColor, "Time"); count = 0; for (int i = PowerBallStats.JackpotStats.Count - 1; i >= 0; --i) { PowerBallStats stats = PowerBallStats.JackpotStats[i]; Mobile mob = stats.JackpotWinner; string jackpotamount = String.Format("{0:##,###,### Gold}", stats.JackpotAmount); AddHtml(70, 50 + (count * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", mob != null ? mob.Name : "Unanimous"), false, false); AddHtml(150, 50 + (count * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", jackpotamount), false, false); AddHtml(270, 50 + (count * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", stats.JackpotTime.ToString()), false, false); if (count++ >= 9) { break; } } AddButton(350, 300, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1); AddPage(4); //Current Game info List <Mobile> ticketList = new List <Mobile>(); if (PowerBall.Instance != null) { foreach (PowerBallTicket ticket in PowerBall.Instance.Tickets) { if (!ticketList.Contains(ticket.Owner) && ticket.Owner != null) { ticketList.Add(ticket.Owner); } } } AddLabel(70, 20, labelColor, "Current Game Information"); if (PowerBall.Instance != null || PowerBall.Instance.PowerBall != null && PowerBall.Instance.PowerBall.IsActive) { AddLabel(70, 80, labelColor, "Game Number:"); AddHtml(200, 80, 300, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", gameNumber), false, false); string jackpotamount = String.Format("{0:##,###,### Gold}", PowerBall.Instance.JackPot); AddLabel(70, 110, labelColor, "Jackpot Amount:"); AddHtml(200, 110, 300, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", PowerBall.Instance.JackPot > 0 ? jackpotamount : "0 Gold"), false, false); AddLabel(70, 140, labelColor, "Players:"); AddHtml(200, 140, 300, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ticketList.Count), false, false); if (PowerBall.Instance != null) { int entryCount = 0; foreach (PowerBallTicket t in PowerBall.Instance.Tickets) { foreach (TicketEntry e in t.Entries) { entryCount++; } } AddLabel(70, 170, labelColor, "Tickets:"); AddHtml(200, 170, 300, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", entryCount.ToString()), false, false); AddLabel(70, 200, labelColor, "Next Picks:"); AddHtml(200, 200, 300, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", PowerBall.Instance.PowerBall.NextGame), false, false); } if (ticketList != null && ticketList.Count > 0) { AddButton(70, 300, 0x483, 0x481, 0, GumpButtonType.Page, 5); AddHtml(110, 300, 200, 16, "<Basefont Color=#FFFFFF>Players</Basefont>", false, false); } } else { AddLabel(70, 80, labelColor, "Inactive"); } AddButton(350, 300, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1); AddPage(5); AddLabel(70, 20, labelColor, "Players in Current Game"); for (int k = 0; k < ticketList.Count; ++k) { if (k < 12) { AddHtml(70, 45 + (k * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ticketList[k] != null ? ticketList[k].Name : "Unanimous"), false, false); } else if (k < 24) { AddHtml(180, 45 + ((k - 12) * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ticketList[k] != null ? ticketList[k].Name : "Unanimous"), false, false); } else if (k < 36) { AddHtml(290, 45 + ((k - 24) * 25), 100, 16, String.Format("<Basefont Color=#FFFFFF>{0}</Basefont>", ticketList[k] != null ? ticketList[k].Name : "Unanimous"), false, false); } } AddButton(290, 20, 0xFB1, 0xFB3, 0, GumpButtonType.Page, 1); }
/// <summary> /// Uses the power and starts dropping it. /// The power gain cooldown automaticly starts. /// </summary> /// <param name="playerPos">The player's position for the power.</param> public void UsePower(Vector2 playerPos) { if (state != ScoreState.Gain) { //Don't activate a power if you can't use it. return; } //Drop the power over time. toAdd = -100; state = ScoreState.Loss; //Create the PowerBall. PowerBall temp = new PowerBall(GDGame, playerPos); GDGame.GetActiveScreen().Components.Add(temp); temp.Initialize(); }