public void RemovePrize(IPrize prize) { if (Prizes.Contains(prize)) { Prizes.Remove(prize); _drawer.Remove(prize); } }
protected void EndGamble(Mobile from) { if (from == null || from.Deleted) { return; } from.EndAction(GetType()); double a = Utility.RandomDouble(); double b = Math.Min(LuckCap, from.Luck) / (double)LuckCap; double c = a + b; Normalize(ref c); //Console.WriteLine("LDT: A = {0} B = {1} C = {2}", a, b, c); LuckyDipPrize prizeEntry = GetPrize(c); if (prizeEntry == null || prizeEntry.Disabled || prizeEntry.Equals(LuckyDipPrize.Empty)) { from.SendMessage(34, "Sorry {0}, you didn't win anything, better luck next time!", from.RawName); Delete(); return; } Item prize = prizeEntry.CreateInstance <Item>(); if (prize == null) { Prizes.Remove(prizeEntry); VitaNexCore.ToConsole( "WARNING: An instance of {0} could not be constructed in {1} at {2}", prizeEntry.Type.FullName, GetType().FullName, prizeEntry.GetType().FullName); from.SendMessage(34, "We couldn't process your ticket, please try again."); return; } from.SendMessage(85, "Congratulations, you won a prize! ({0})", prize.ResolveName(from)); ReplaceWith(prize); }