public ConfirmChallengeGump(Mobile from, Mobile target, DuelLocationEntry duelloc) : base(0, 0) { if (target == null || from == null) return; // uncomment the line below to log all challenges into the command log //CommandLogging.WriteLine( from, "{0} {1} challenged {2}", from.AccessLevel, CommandLogging.Format( from ), CommandLogging.Format( target )); this.m_From = from; this.m_Target = target; this.m_DuelLocation = duelloc; XmlPoints a = (XmlPoints)XmlAttach.FindAttachment(from, typeof(XmlPoints)); XmlPoints atarg = (XmlPoints)XmlAttach.FindAttachment(target, typeof(XmlPoints)); this.Closable = false; this.Dragable = true; this.AddPage(0); this.AddBackground(10, 200, 200, 150, 5054); this.AddLabel(20, 205, 68, String.Format(GetText(target, 200259))); // "You have been challenged by" this.AddLabel(20, 225, 68, String.Format(GetText(target, 200260), from.Name)); // "{0}. Accept?" int y = 250; if (this.m_DuelLocation != null) { this.AddLabel(20, y, 0, String.Format(GetText(target, 200649), this.m_DuelLocation.Name)); // "Location: {0}" } else { this.AddLabel(20, y, 0, String.Format(GetText(target, 200649), GetText(target, 200661))); // "Location: Duel Here" } y += 20; if (a == null || a.Deleted || atarg == null || atarg.Deleted || !atarg.CanAffectPoints(target, target, from, true)) { this.AddLabel(20, y, 33, String.Format(GetText(target, 200256))); // "You will NOT gain points!" } this.AddRadio(35, 290, 9721, 9724, false, 1); // accept/yes radio this.AddRadio(135, 290, 9721, 9724, true, 2); // decline/no radio this.AddHtmlLocalized(72, 290, 200, 30, 1049016, 0x7fff, false, false); // Yes this.AddHtmlLocalized(172, 290, 200, 30, 1049017, 0x7fff, false, false); // No this.AddButton(80, 320, 2130, 2129, 3, GumpButtonType.Reply, 0); // Okay button }
public static bool DuelLocationAvailable(DuelLocationEntry duelloc) { // check to see whether there are any players at the location if (duelloc == null || duelloc.DuelMap == null) return true; int duelrange = duelloc.DuelRange; if (duelloc.DuelRange <= 0) duelrange = 16; foreach (Mobile m in duelloc.DuelMap.GetMobilesInRange(duelloc.DuelLocation, duelrange)) { if (m.Player) return false; } return true; }