public PacketObject( string class_name, PacketFacility facility, string alias, PacketPriority prio, PacketAttribute attr, DateTime dt, string info, PacketDirection dir, string src, string dst, byte mark, string message, byte[] data ) { Class = class_name; Facility = facility; Alias = alias; Priority = prio; Attribute = attr; MakeTime = dt; Information = info; Direction = dir; Source = src; Destination = dst; UserMark = mark; Message = message; Data = data; }
// we dont want help to be displayed in Help lol //public static string ReturnHelp() => "$Help"; private void ExecuteHandler(ClientSession session) { Logger.LogUserEvent("GMCOMMAND", session.GenerateIdentity(), "[Help]"); List <string> messages = PacketFacility.GetHelpMessages(session.Account.Authority).ToList(); // send messages messages.Sort(); if (Contents == "*" || !_isParsed) { session.SendPacket(session.Character.GenerateSay("-------------Commands Info-------------", 11)); foreach (string message in messages) { session.SendPacket(session.Character.GenerateSay(message, 12)); } } else { session.SendPacket(session.Character.GenerateSay("-------------Command Info-------------", 11)); foreach (string message in messages.Where(s => s.IndexOf(Contents, StringComparison.OrdinalIgnoreCase) >= 0)) { session.SendPacket(session.Character.GenerateSay(message, 12)); } } session.SendPacket(session.Character.GenerateSay("-----------------------------------------------", 11)); }
public static void Register() => PacketFacility.AddHandler(typeof(TreqPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(MinilandAddObjectPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(ChangeSpecialistLevelPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(FairyXpRate), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(FStashEndPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(PenaltyLogPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(TeleportToMePacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(ExchangeRequestPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(RemovePortalPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(GroupLeavePacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(ComplimentPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(AttachProfilerPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(GlobalEventPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(GameStartPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(ListAccountFamilyPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(InstanceMusicPacket), HandlePacket, ReturnHelp);
#pragma warning restore IDE0044, RCS1169, 649 #endregion #region Methods public static void Main(string[] args) { checked { try { #if DEBUG _isDebug = true; #endif CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US"); Console.Title = $"OpenNos Login Server{(_isDebug ? " Development Environment" : string.Empty)}"; bool ignoreStartupMessages = false; foreach (string arg in args) { ignoreStartupMessages |= arg == "--nomsg"; } // initialize Logger Logger.InitializeLogger(LogManager.GetLogger(typeof(Program))); int port = Convert.ToInt32(ConfigurationManager.AppSettings["LoginPort"]); if (!ignoreStartupMessages) { Assembly assembly = Assembly.GetExecutingAssembly(); FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); string text = $"LOGIN SERVER v{fileVersionInfo.ProductVersion}dev - PORT : {port} by OpenNos Team"; string text2 = $"Built on: {new DateTime(((fileVersionInfo.ProductBuildPart - 1) * TimeSpan.TicksPerDay) + (fileVersionInfo.ProductPrivatePart * TimeSpan.TicksPerSecond * 2)).AddYears(1999)}"; string text3 = $"Built by: {BuildInfo.BuildUser}@{BuildInfo.BuildHost} ({BuildInfo.BuildOS})"; int offset = (Console.WindowWidth / 2) + (text.Length / 2); int offset2 = (Console.WindowWidth / 2) + (text2.Length / 2); int offset3 = (Console.WindowWidth / 2) + (text3.Length / 2); string separator = new string('=', Console.WindowWidth); Console.WriteLine(separator + string.Format("{0," + offset + "}\n", text) + string.Format("{0," + offset2 + "}\n", text2) + string.Format("{0," + offset3 + "}\n", text3) + separator); } // initialize api if (CommunicationServiceClient.Instance.Authenticate(ConfigurationManager.AppSettings["MasterAuthKey"])) { Logger.Info(Language.Instance.GetMessageFromKey("API_INITIALIZED")); } // initialize DB if (!DataAccessHelper.Initialize()) { Console.ReadKey(); return; } Logger.Info(Language.Instance.GetMessageFromKey("CONFIG_LOADED")); Observable.Interval(TimeSpan.FromHours(24)).Subscribe(x => RestartProcess()); try { // initialize PacketSerialization PacketFacility.Initialize(typeof(LoginPacket)); // ReSharper disable once ObjectCreationAsStatement new NetworkManager <LoginCryptography>(ConfigurationManager.AppSettings["IPAddress"], port, typeof(LoginCryptography), false); } catch (Exception ex) { Logger.LogEventError("INITIALIZATION_EXCEPTION", "General Error Server", ex); } Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"[{DateTime.UtcNow.ToLongTimeString()}][MSG][Main]: Server running!"); Console.ResetColor(); } catch (Exception ex) { Logger.LogEventError("INITIALIZATION_EXCEPTION", "General Error", ex); Console.ReadKey(); } } }
public static void Register() => PacketFacility.AddHandler(typeof(FWithdrawPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(SummonPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(BazaarPersonalRefreshPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(RaidListRegisterPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(CharacterStatisticsPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(ChangeDignityPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(FamilyChatPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(PetControlPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(EquipmentInfoPacket), HandlePacket);
public static void Register() => PacketFacility.AddHandler(typeof(AddShellEffectPacket), HandlePacket, ReturnHelp);
public static void Register() => PacketFacility.AddHandler(typeof(SpecialistTransformPacket), HandlePacket);