public BaseRTTGump(Mobile from, string strNotice, string strSkill, int x, int y) : base(x, y) { m_Mobile = from; m_strNotify = strNotice; m_strSkill = strSkill; //close any other RTT gumps from.CloseGump(typeof(BaseRTTGump)); // notify staff if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled)) { Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Administrator, 0x482, String.Format("{0}({1}) is taking the RTT ({2}).", m_Mobile.Name, m_Mobile.Serial, strSkill)); } // record the fact that the RTT test is being taken Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true); lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, String.Format("({0}) RTT Launched.", strSkill)); lh.Finish(); //This will call any child-gump's SetupGump and set it up like the child wants. SetupGump(); //Save when we launched the gump for later recording m_RTTLaunched = DateTime.Now; // if the player fails to respond in 'timeout' time, then we will cound this as an RTT failure. // this does two things: (1) makes the next test 5 minutes from now, (2) will move them closer to being counted as a macroer m_timeout = new RTTTimer(m_Mobile, TimeSpan.FromSeconds(Utility.RandomList(90, 120, 180))); m_timeout.Start(); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { try { // kill our timeout timer if (m_timeout != null) { m_timeout.Stop(); m_timeout = null; } int button = info.ButtonID; TimeSpan diff = DateTime.Now - m_RTTLaunched; if (button == m_CorrectResponse + m_CorrectResponseOffset) { // record answer Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true); lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("PASSED the RTT in {0} ms", diff.TotalMilliseconds)); lh.Finish(); m_Mobile.SendMessage("Thanks for verifying that you're at your computer."); ((PlayerMobile)m_Mobile).RTTResult(true); if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled)) { if (diff <= TimeSpan.FromSeconds(1.0)) { Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x22, String.Format("{0}({1}) has quickly passed the RTT ({2} ms) ({3}).", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify)); } else { Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x482, String.Format("{0}({1}) has passed the RTT ({2} ms). ({3})", m_Mobile.Name, m_Mobile.Serial, diff.TotalMilliseconds, m_strNotify)); } // Look for and record suspiciously fast answers if (diff <= TimeSpan.FromSeconds(3.0)) { Scripts.Commands.LogHelper lh2 = new Server.Scripts.Commands.LogHelper("RTTAlert.log", false, true); lh2.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("{0} ms", diff.TotalMilliseconds)); lh2.Finish(); } } } else { // record answer Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true); lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, string.Format("FAILED the RTT in {0} ms", diff.TotalMilliseconds)); lh.Finish(); m_Mobile.SendMessage("You have failed the AFK test."); ((PlayerMobile)m_Mobile).RTTResult(false); if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled)) { Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x482, String.Format("{0}({1}) has failed the RTT. ({2})", m_Mobile.Name, m_Mobile.Serial, this.m_strNotify)); } } } catch (Exception e) { Scripts.Commands.LogHelper.LogException(e); } }
public BaseRTTGump(Mobile from, string strNotice, string strSkill, int x, int y) : base(x, y) { m_Mobile = from; m_strNotify = strNotice; m_strSkill = strSkill; //close any other RTT gumps from.CloseGump(typeof(BaseRTTGump)); // notify staff if (CoreAI.IsDynamicFeatureSet(CoreAI.FeatureBits.RTTNotifyEnabled)) { Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Administrator, 0x482, String.Format("{0}({1}) is taking the RTT ({2}).", m_Mobile.Name, m_Mobile.Serial, strSkill)); } // record the fact that the RTT test is being taken Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("RTT.log", false, true); lh.Log(Scripts.Commands.LogType.Mobile, m_Mobile, String.Format("({0}) RTT Launched.", strSkill)); lh.Finish(); //This will call any child-gump's SetupGump and set it up like the child wants. SetupGump(); //Save when we launched the gump for later recording m_RTTLaunched = DateTime.Now; // if the player fails to respond in 'timeout' time, then we will cound this as an RTT failure. // this does two things: (1) makes the next test 5 minutes from now, (2) will move them closer to being counted as a macroer m_timeout = new RTTTimer(m_Mobile, TimeSpan.FromSeconds(Utility.RandomList(90,120,180))); m_timeout.Start(); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; // wea: Correctly clear gumps for newer clients. from.CloseGumps(typeof(ResurrectGump)); if (info.ButtonID == 1 || info.ButtonID == 2) { if (from is PlayerMobile && ((PlayerMobile)from).Mortal && from.AccessLevel == AccessLevel.Player) { from.SendMessage("Thy soul was too closely intertwined with thy flesh - thou'rt unable to incorporate a new body."); return; } if (from.Map == null || !from.Map.CanFit(from.Location, 16, CanFitFlags.requireSurface)) { from.SendLocalizedMessage(502391); // Thou can not be resurrected there! return; } if (m_Price > 0) { if (info.IsSwitched(1)) { if (Banker.Withdraw(from, m_Price)) { from.SendLocalizedMessage(1060398, m_Price.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString()); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage(1060020); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage(1060019); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound(0x214); from.FixedEffect(0x376A, 10, 16); from.Resurrect(); // adam: 3/18/08 - virtues are obsolete /*if ( m_Healer != null && from != m_Healer ) * { * VirtueLevel level = VirtueHelper.GetLevel( m_Healer, VirtueName.Compassion ); * * switch ( level ) * { * case VirtueLevel.Seeker: from.Hits = AOS.Scale( from.HitsMax, 20 ); break; * case VirtueLevel.Follower: from.Hits = AOS.Scale( from.HitsMax, 40 ); break; * case VirtueLevel.Knight: from.Hits = AOS.Scale( from.HitsMax, 80 ); break; * } * }*/ Mobile m = from; Misc.Titles.AwardFame(from, -100, true); // TODO: Proper fame loss PlayerMobile pm = from as PlayerMobile; // If the player is an inmate of AI, we don't want them taking stat-loss // Adam: we now have gumps that don't invoke stat loss (m_Statloss) if (!Core.AOS && StatLossCandidate(from) && m_Statloss == true) { double loss = (100.0 - (4.0 + (from.ShortTermMurders / 5.0))) / 100.0; //5 to 15% loss if (loss < 0.85) { loss = 0.85; } else if (loss > 0.95) { loss = 0.95; } if (from.RawStr * loss > 10) { from.RawStr = (int)(from.RawStr * loss); } if (from.RawInt * loss > 10) { from.RawInt = (int)(from.RawInt * loss); } if (from.RawDex * loss > 10) { from.RawDex = (int)(from.RawDex * loss); } for (int s = 0; s < from.Skills.Length; s++) { if (from.Skills[s].Base * loss > 35) { from.Skills[s].Base *= loss; } } //Pix: LOG it!! try { Server.Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("statloss.log"); lh.Log(Server.Scripts.Commands.LogType.Mobile, pm, "Statloss was " + loss.ToString()); lh.Finish(); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } } }
public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; // wea: Correctly clear gumps for newer clients. from.CloseGumps(typeof(ResurrectGump)); if ( info.ButtonID == 1 || info.ButtonID == 2 ) { if (from is PlayerMobile && ((PlayerMobile)from).Mortal && from.AccessLevel == AccessLevel.Player) { from.SendMessage("Thy soul was too closely intertwined with thy flesh - thou'rt unable to incorporate a new body."); return; } if (from.Map == null || !from.Map.CanFit(from.Location, 16, CanFitFlags.requireSurface)) { from.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there! return; } if ( m_Price > 0 ) { if ( info.IsSwitched( 1 ) ) { if ( Banker.Withdraw( from, m_Price ) ) { from.SendLocalizedMessage( 1060398, m_Price.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. from.SendLocalizedMessage( 1060022, Banker.GetBalance( from ).ToString() ); // You have ~1_AMOUNT~ gold in cash remaining in your bank box. } else { from.SendLocalizedMessage( 1060020 ); // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing. return; } } else { from.SendLocalizedMessage( 1060019 ); // You decide against paying the healer, and thus remain dead. return; } } from.PlaySound( 0x214 ); from.FixedEffect( 0x376A, 10, 16 ); from.Resurrect(); // adam: 3/18/08 - virtues are obsolete /*if ( m_Healer != null && from != m_Healer ) { VirtueLevel level = VirtueHelper.GetLevel( m_Healer, VirtueName.Compassion ); switch ( level ) { case VirtueLevel.Seeker: from.Hits = AOS.Scale( from.HitsMax, 20 ); break; case VirtueLevel.Follower: from.Hits = AOS.Scale( from.HitsMax, 40 ); break; case VirtueLevel.Knight: from.Hits = AOS.Scale( from.HitsMax, 80 ); break; } }*/ Mobile m = from; Misc.Titles.AwardFame( from, -100, true ); // TODO: Proper fame loss PlayerMobile pm = from as PlayerMobile; // If the player is an inmate of AI, we don't want them taking stat-loss // Adam: we now have gumps that don't invoke stat loss (m_Statloss) if (!Core.AOS && StatLossCandidate(from) && m_Statloss == true) { double loss = (100.0 - ( 4.0 + (from.ShortTermMurders/5.0))) / 100.0;//5 to 15% loss if ( loss < 0.85 ) loss = 0.85; else if ( loss > 0.95 ) loss = 0.95; if ( from.RawStr * loss > 10 ) from.RawStr = (int)(from.RawStr * loss); if ( from.RawInt * loss > 10 ) from.RawInt = (int)(from.RawInt * loss); if ( from.RawDex * loss > 10 ) from.RawDex = (int)(from.RawDex * loss); for (int s=0;s<from.Skills.Length;s++) { if ( from.Skills[s].Base * loss > 35 ) from.Skills[s].Base *= loss; } //Pix: LOG it!! try { Server.Scripts.Commands.LogHelper lh = new Server.Scripts.Commands.LogHelper("statloss.log"); lh.Log(Server.Scripts.Commands.LogType.Mobile, pm, "Statloss was " + loss.ToString()); lh.Finish(); } catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } } } }