public static void ClientVersion(NetState state, PacketReader pvSrc) { string versionstring = pvSrc.ReadString(); int m_Major = 0; int m_Minor = 0; int m_Revision = 0; int m_Patch = 0; ClientType m_Type = ClientType.Regular; // fixed client version parsing GetClientVersion(versionstring, ref m_Major, ref m_Minor, ref m_Revision, ref m_Patch, ref m_Type); CV version = state.Version = new ClientVersion(m_Major, m_Minor, m_Revision, m_Patch, m_Type); string kickMessage = null; if (CV.Required != null && version < CV.Required) { kickMessage = String.Format("This server requires your client version be at least {0}.", CV.Required); } else if (!CV.AllowGod || !CV.AllowRegular || !CV.AllowUOTD) { if (!CV.AllowGod && version.Type == ClientType.God) { kickMessage = "This server does not allow god clients to connect."; } else if (!CV.AllowRegular && version.Type == ClientType.Regular) { kickMessage = "This server does not allow regular clients to connect."; } else if (!CV.AllowUOTD && version.Type == ClientType.UOTD) { kickMessage = "This server does not allow UO:TD clients to connect."; } if (!CV.AllowGod && !CV.AllowRegular && !CV.AllowUOTD) { kickMessage = "This server does not allow any clients to connect."; } else if (CV.AllowGod && !CV.AllowRegular && !CV.AllowUOTD && version.Type != ClientType.God) { kickMessage = "This server requires you to use the god client."; } else if (kickMessage != null) { if (CV.AllowRegular && CV.AllowUOTD) { kickMessage += " You can use regular or UO:TD clients."; } else if (CV.AllowRegular) { kickMessage += " You can use regular clients."; } else if (CV.AllowUOTD) { kickMessage += " You can use UO:TD clients."; } } } if (kickMessage != null) { state.Mobile.SendMessage(0x22, kickMessage); state.Mobile.SendMessage(0x22, "You will be disconnected in {0} seconds.", CV.KickDelay.TotalSeconds); new KickTimer(state, CV.KickDelay).Start(); } }
//Plume : Net 4 public static void ClientCrashReport(NetState state, PacketReader pvSrc) { int maj = pvSrc.ReadByte(); int min = pvSrc.ReadByte(); int rev = pvSrc.ReadByte(); int pat = pvSrc.ReadByte(); int x = pvSrc.ReadInt16(); int y = pvSrc.ReadInt16(); int z = pvSrc.ReadSByte(); int map = pvSrc.ReadByte(); string acct = pvSrc.ReadString(0x20); string pg = pvSrc.ReadString(0x20); string ip = pvSrc.ReadString(15); pvSrc.ReadInt32(); int excode = pvSrc.ReadInt32(); string procname = pvSrc.ReadString(100); string crashrep = pvSrc.ReadString(100); pvSrc.ReadByte(); int exoffset = pvSrc.ReadInt32(); List<int> list = new List<int>(); int addrcount = pvSrc.ReadByte(); for (int i = 0; i < addrcount; i++) { list.Add(pvSrc.ReadInt32()); } Server.ClientVersion version = new Server.ClientVersion(maj, min, rev, pat); if (!Directory.Exists("Logs/ClientCrashes")) { Directory.CreateDirectory("Logs/ClientCrashes"); } using (StreamWriter writer = new StreamWriter(Path.Combine("Logs/ClientCrashes", string.Format("{0}.log", DateTime.Now.ToLongDateString())), true)) { writer.Write("Time: {0} Ip:{1} Account: {2} Character: {3}\r\nClientVersion {4}\r\nLocation: {5}, {6}, {7}\r\nMap: {8}\r\nExceptionCode: {9}\r\nProcessName: {10}\r\nCrashReport: {11}\r\nExceptionOffset: {12}\r\nAddressCount: {13}\r\n", new object[] { DateTime.Now.ToString(), ip, acct, pg, version.ToString(), x.ToString(), y.ToString(), z.ToString(), map.ToString(), excode.ToString(), procname, crashrep, exoffset.ToString(), addrcount.ToString() }); for (int j = 0; j < addrcount; j++) { writer.WriteLine("Address: {0}", list[j].ToString()); } writer.WriteLine(""); } }