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 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); } }