protected override void OnTarget(Mobile from, object targ) { PlayerMobile pm = targ as PlayerMobile; if (pm == null) { from.SendMessage("Only players can be sent to jail."); return; } Account acct = pm.Account as Account; int sentence = 12; // 12 hour minimum sentence if (Trouble == true) { sentence = 2; // two hour sentance for troublemakets } else { foreach (AccountComment comm in acct.Comments) { if (comm.Content.IndexOf("Jailed for ") != -1 && comm.Content.IndexOf("Tag count: ") != -1) { sentence += 12; // 12 hours for each previous [jail'ing } else if (comm.Content.IndexOf(" : reported using the [macroer command") != -1) { sentence += 12; // 12 hours for every time they were caught resource botting } } } // stable the players pets StablePets(from, pm); // handle jailing of logged out players Point3D destPoint = Jail.GetCell(m_Cell); pm.MoveToWorld(destPoint, Map.Felucca); if (pm.NetState == null) { pm.LogoutLocation = destPoint; pm.Map = Map.Internal; } JailExitGate.AddInmate(pm, sentence); pm.SendMessage("You have been jailed for {0} hours.", sentence); from.SendMessage("{0} has been jailed for {1} hours.", pm.Name, sentence); LogHelper Logger = new LogHelper("jail.log", false, true); Logger.Log(LogType.Mobile, pm, string.Format("{0}:{1}:{2}:{3}", from.Name, m_Cell, m_Comment, sentence)); Logger.Finish(); Commands.CommandLogging.WriteLine(from, "{0} jailed {1}(Username: {2}) into cell {3} for {5} hours with reason: {4}.", from.Name, pm.Name, acct.Username, m_Cell, m_Comment, sentence); if (Trouble == true) { acct.Comments.Add(new AccountComment(from.Name, DateTime.Now + "\nTag count: " + (acct.Comments.Count + 1) + "\nJailedTroubleMaker for " + sentence + " hours. Reason: " + m_Comment)); } else { acct.Comments.Add(new AccountComment(from.Name, DateTime.Now + "\nTag count: " + (acct.Comments.Count + 1) + "\nJailed for " + sentence + " hours. Reason: " + m_Comment)); } }
public void GoToJail() { if (m_Player == null || m_Player.Deleted) { return; } Account acct = m_Player.Account as Account; int sentence = 12; // 12 hour minimum sentence if (Trouble == true) { sentence = 2; // two hour sentance for troublemakets } else { foreach (AccountComment comm in acct.Comments) { if (comm.Content.IndexOf("Jailed for ") != -1 && comm.Content.IndexOf("Tag count: ") != -1) { sentence += 12; // 12 hours for each previous [jail'ing } else if (comm.Content.IndexOf(" : reported using the [macroer command") != -1) { sentence += 12; // 12 hours for every time they were caught resource botting } } } // stable the players pets StablePets(m_Player); // move to jail Point3D destPoint = Jail.GetCell(m_Cell); m_Player.MoveToWorld(destPoint, Map.Felucca); // handle jailing of logged out players if (m_Player.NetState == null) { m_Player.LogoutLocation = destPoint; m_Player.Map = Map.Internal; } JailExitGate.AddInmate(m_Player, sentence); m_Player.SendMessage("You have been jailed for {0} hours.", sentence); LogHelper Logger = new LogHelper("jail.log", false, true); Logger.Log(LogType.Mobile, m_Player, string.Format("{0}:{1}:{2}:{3}", "SYSTEM", m_Cell, m_Comment, sentence)); Logger.Finish(); if (Trouble == true) { acct.Comments.Add(new AccountComment("SYSTEM", DateTime.Now + "\nTag count: " + (acct.Comments.Count + 1) + "\nJailedTroubleMaker for " + sentence + " hours. Reason: " + m_Comment)); } else { acct.Comments.Add(new AccountComment("SYSTEM", DateTime.Now + "\nTag count: " + (acct.Comments.Count + 1) + "\nJailed for " + sentence + " hours. Reason: " + m_Comment)); } }