private static void StopRace() { SMTP("The race has stopped!"); if (StopTimer != null) StopTimer.Stop(); if (RaceTimer != null) RaceTimer.Stop(); if (m_Region != null) { m_Region.Unregister(); m_Region = null; } while (CrateList.Count > 0) CrateList[0].Delete(); while (AppleList.Count > 0) AppleList[0].Delete(); if (Participants > 0) { while (PartList.Count > 0) { RaceData rd = PartList[0]; Mobile mob = rd.Part; PartList.Remove(PartList[0]); PartData.Remove(mob); RemovePlayer(mob); } } if (FinData != null) { foreach (FinishedData fd in FinData) { Mobile mob = fd.m_FinPart; string str; int money = 0; switch (fd.m_Place) { default: str = "Thank you for participating in this Crate Race, unfortunately you have not won anything. Good luck next time!"; break; case 1: money = (int)BankedMoney / 3; str = "You have won this Crate Race, Congratulations!"; break; case 2: money = (int)BankedMoney / 6; str = "You have managed to become second in this Crate Race, Congratulations!"; break; case 3: money = (int)BankedMoney / 9; str = "You have managed to become third in this Crate Race, Congratulations!"; break; } if (Rewards) { int amount = 0; switch (fd.m_Place) { case 1: amount = 3; break; case 2: amount = 2; break; case 3: amount = 1; break; } if(amount > 0) EventRewardSystem.CreateCopperBar(mob.Name, mob.BankBox, amount, "Crate Race Event"); } mob.SendMessage(str); if (money > 0) mob.AddToBackpack(new BankCheck(money)); RemovePlayer(mob); mob.SendGump(new RaceRankGump(FinData, 0)); } } OpenCrates = 0; BankedMoney = 0; PartData.Clear(); Running = false; }
public static void Start(CrateStone stone) { m_StartTime = 5; Map = stone.Map; X = stone.X; Y = stone.Y; Z = stone.Z; Rewards = stone.Rewards; StoneLocation = stone.Location; Animalised = stone.Animalised; QuickSpeed = stone.QuickSpeed; MaxCrates = stone.MaxCrates; Price = stone.Price; Laps = stone.Laps; MinutesOpen = stone.MinutesOpen; Rectangles = stone.Rectangles; m_Region = new CrateRegion(stone.RegionRect, Map); m_Region.Register(); Running = true; EventSystem.Start(MinutesOpen, Name, new EDC.StartMethod(StartNewRace), new EDC.StopMethod(StopRace), new EDC.JoinMethod(RequestJoin)); }