public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 1: //OK { from.CloseGump(typeof(PlayerDuelAcceptGump)); DuelCore.InitializeDuel(m_Duel); break; } case 2: //Cancel { from.CloseGump(typeof(PlayerDuelAcceptGump)); if (m_Duel.Attacker != null) { m_Duel.Attacker.SendMessage(String.Format("{0} has declined your duel request.", from.Name)); } from.SendMessage("You decide not to duel them."); m_Duel.State = DuelState.Cancel; DuelCore.CancelDuel(m_Duel); break; } } }
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType) { base.OnTargetCancel(from, cancelType); from.SendMessage("You have cancelled the duel."); m_Duel.State = DuelState.Cancel; DuelCore.CancelDuel(m_Duel); }
public TopTenGump(Mobile from) : base(0, 0) { this.Closable = true; this.Disposable = true; this.Dragable = true; this.Resizable = false; this.AddPage(0); this.AddImageTiled(83, 92, 393, 414, 9354); this.AddAlphaRegion(85, 94, 388, 409); this.AddImage(394, 105, 9000); this.AddLabel(99, 106, 0, @"Project X Top 10 Duelists"); this.AddLabel(98, 105, 0, @"Project X Top 10 Duelists"); this.AddLabel(97, 104, 1160, @"Project X Top 10 Duelists"); this.AddLabel(97, 177, 100, @"Name"); this.AddLabel(236, 177, 100, @"Wins"); this.AddLabel(300, 177, 100, @"Losses"); DuelCore.DropInfos(); List <DuelInfo> info = new List <DuelInfo>(DuelCore.Infos.Values); info.Sort(); int count = 0; for (int i = 0; i < info.Count; ++i) { if (count > 9) { break; } if (info[i].Mobile.AccessLevel > AccessLevel.Player) { continue; } int y = (count + 1) * 30 + 174; this.AddLabel(98, y, 63, info[i].Mobile.Name); this.AddLabel(236, y, 63, info[i].Wins.ToString()); this.AddLabel(300, y, 63, info[i].Losses.ToString()); ++count; } if (from.AccessLevel >= AccessLevel.Administrator) { this.AddLabel(96, 131, 36, @"Welcome, administrator. Press this button to"); this.AddLabel(96, 152, 36, @"reset all scores."); this.AddButton(205, 157, 2181, 2181, 1, GumpButtonType.Reply, 0); } }
protected override void OnTarget(Mobile from, object target) { if (target is Mobile) { Mobile targ = (Mobile)target; if (DuelCore.Infos.ContainsKey(targ.Serial)) { from.SendGump(new DuelInfoGump(DuelCore.GetInfo(targ))); } else { from.SendMessage("That person has not dueled anyone."); } } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 8: //Add { from.CloseGump(typeof(PlayerDuelGump)); int[] switches = info.Switches; for (int i = 0; i < m_Duel.Rules.Length; ++i) { m_Duel.Rules[i] = false; } for (int i = 0; i < switches.Length; ++i) { m_Duel.Rules[switches[i] - 1] = true; } from.Target = new DuelTarget(m_Duel); break; } case 9: //Cancel { from.CloseGump(typeof(PlayerDuelGump)); DuelCore.CancelDuel(m_Duel); break; } } }
protected override void OnTarget(Mobile from, object target) { if (target is PlayerMobile) { Mobile m = (Mobile)target; if (m.NetState == null) { from.SendMessage("That player is not online, please select a new target."); from.Target = new DuelTarget(m_Duel); return; } if (m == from) { from.SendMessage("You cannot duel yourself, please select a new target."); from.Target = new DuelTarget(m_Duel); return; } if (m.Criminal) { from.SendMessage("You may not start a duel with someone who is flagged criminal, please select a new target."); from.Target = new DuelTarget(m_Duel); return; } if (Spells.SpellHelper.CheckCombat(m)) { from.SendMessage("That person is currently in combat, please select a new target."); from.Target = new DuelTarget(m_Duel); return; } if (m_Duel.FiveX && m.SkillsTotal > 5000) { from.SendMessage("That player has over 500 skillpoints and is not a valid candidate for a 5x duel. Please select a new target."); from.Target = new DuelTarget(m_Duel); return; } if (DuelCore.FindDuel(m) == null) { if (!m.HasGump(typeof(PlayerDuelAcceptGump))) { if (!m.HasGump(typeof(PlayerDuelGump))) { if (m.Target == null) { m_Duel.Defender = m; m.SendGump(new PlayerDuelAcceptGump(m_Duel)); from.SendMessage("You have sent them an invitation. Waiting for them to accept..."); Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(delegate(object state) { if (m_Duel.State == DuelState.Setup) { m.CloseGump(typeof(PlayerDuelAcceptGump)); m.SendMessage("Your duel invitation has timed out."); from.SendMessage(String.Format("Your duel invitation with {0} has timed out.", m.Name)); DuelCore.CancelDuel(m_Duel); } }), null); } else { from.SendMessage("You may not start a duel with a person that is targeting something. Please select a new target."); from.Target = new DuelTarget(m_Duel); } } else { from.SendMessage("That person is already setting up a duel. Please select a new target."); from.Target = new DuelTarget(m_Duel); } } else { from.SendMessage("That player has already been offered a duel. Please select a new target."); from.Target = new DuelTarget(m_Duel); } } else { from.SendMessage("That player is already in a duel. Please select a new target."); from.Target = new DuelTarget(m_Duel); } } else { from.SendMessage("You may only duel players, please select a new target."); from.Target = new DuelTarget(m_Duel); } }