Exemple #1
0
        private static void Initialize()
        {
            StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (StartupPath == null)
            {
                throw new InvalidOperationException();
            }

            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

            PacketWaitEntries = new PacketWaitEntries();

            _incomingQueue = new ThreadQueue <Packet>(ProcessIncomingQueue);
            _outgoingQueue = new ThreadQueue <Packet>(ProcessOutgoingQueue);

            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();

            IncomingPacketFilters.Initialize();
            OutgoingPacketFilters.Initialize();

            CommandsManager.Initialize();

            AssistantOptions.Load();
        }
Exemple #2
0
        public void Initialize()
        {
            Engine.Items   = new ItemCollection(0);
            Engine.Mobiles = new MobileCollection(Engine.Items);
            Engine.Player  = new PlayerMobile(1);

            OutgoingPacketHandlers.Initialize();
        }
Exemple #3
0
        internal static bool Initialize(MainWindow mainWindow)
        {
            if (File.Exists(Path.Combine(StartupPath, "Updater_New.exe")))
            {
                try
                {
                    File.Copy(Path.Combine(StartupPath, "Updater_New.exe"), Path.Combine(StartupPath, "Updater.exe"), true);
                }
                catch (Exception)
                {
                }
            }

            string[] renameFiles = Directory.GetFiles(StartupPath, "*.new", SearchOption.AllDirectories);
            foreach (string renameFile in renameFiles)
            {
                string path     = Path.GetDirectoryName(renameFile);
                string origFile = Path.Combine(path, Path.GetFileNameWithoutExtension(renameFile));
                try
                {
                    File.Delete(origFile);
                    File.Move(renameFile, origFile);
                }
                catch (Exception)
                {
                }
            }

            if (!MainWindow.CurrentOptions.IsValid())
            {
                return(false);
            }
            //try { Config.Register( "UOM hooks", Path.Combine( StartupPath, "UOMachine.exe" ), Path.Combine( StartupPath, "ClientHook.dll" ) ); }
            //catch (Exception ex)
            //{
            //    Utility.Log.LogMessage( ex );
            //    /* Ensure EasyHook files are in output directory if you get this error */
            //    System.Windows.MessageBox.Show( Strings.ErrorwithGACinstallation );
            //    return false;
            //}
            myMainWindow = mainWindow;
            InternalEventHandler.IncomingPacketHandler.Initialize();
            InternalEventHandler.OutgoingPacketHandler.Initialize();
            Network.Initialize();
            InternalEventHandler.IPCHandler.Initialize();
            mySkillNames = Skills.GetSkills(MainWindow.CurrentOptions.UOFolder);
            TileData.Initialize(MainWindow.CurrentOptions.UOFolder);
            Map.Initialize(MainWindow.CurrentOptions.UOFolder, MainWindow.CurrentOptions.CacheLevel);
            Art.Initialize(MainWindow.CurrentOptions.UOFolder);
            Cliloc.Initialize(MainWindow.CurrentOptions.UOFolder);
            NamespaceToAssembly.Initialize();
            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();
            return(true);
        }
        public void WontThrowExceptionVersionAlpha()
        {
            // 5.0.1j
            byte[] packet = { 0xbd, 0x00, 0x0a, 0x35, 0x2e, 0x30, 0x2e, 0x31, 0x6a, 0x00 };

            OutgoingPacketHandlers.Initialize();

            PacketHandler handler = OutgoingPacketHandlers.GetHandler(0xBD);

            handler?.OnReceive(new PacketReader(packet, packet.Length, false));

            Engine.ClientVersion = null;
        }
Exemple #5
0
        private static void Initialize()
        {
            StartupPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (StartupPath == null)
            {
                throw new InvalidOperationException();
            }

            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

            PacketWaitEntries = new PacketWaitEntries();

            _incomingQueue = new ThreadQueue <Packet>(ProcessIncomingQueue);
            _outgoingQueue = new ThreadQueue <Packet>(ProcessOutgoingQueue);

            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();

            OutgoingPacketFilters.Initialize();

            CommandsManager.Initialize();

            string langOverridePath = Path.Combine(StartupPath, "Data", "languageOverride.json");

            if (!File.Exists(langOverridePath))
            {
                return;
            }

            string fileText = File.ReadAllText(langOverridePath);

            JObject jsonObject = JObject.Parse(fileText);

            if (jsonObject?["Language"] == null)
            {
                return;
            }

            Language lang = (Language)jsonObject["Language"]?.ToObject <Language>();

            if (lang != Language.Default)
            {
                Options.SetLanguage(lang);
            }

            Options.LanguageOverride = lang;
        }
Exemple #6
0
        public void WillChangeLastAliasOnTargetSent()
        {
            _player.LastTargetSerial = 0x02;

            AliasCommands.SetDefaultAliases();

            Assert.AreEqual(0x02, AliasCommands.GetAlias("last"));

            OutgoingPacketHandlers.Initialize();
            PacketHandler handler = OutgoingPacketHandlers.GetHandler(0x6C);

            byte[] packet =
            {
                0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAA, 0xBB, 0xCC, 0xDD, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
            };

            handler?.OnReceive(new PacketReader(packet, packet.Length, true));

            Assert.AreEqual(0xAABBCCDD, (uint)AliasCommands.GetAlias("last"));
        }
Exemple #7
0
        public void Initialize()
        {
            _packetLengths = new int[byte.MaxValue];

            string json = File.ReadAllText(Path.Combine(Environment.CurrentDirectory,
                                                        "packetlengths.json"));

            JObject jsonObj = JObject.Parse(json);

            foreach (JProperty token in jsonObj["PacketLengths"].Children <JProperty>())
            {
                int key = int.Parse(token.Name);
                int val = token.Value.ToObject <int>();

                if (val == 0x8000)
                {
                    val = 0;
                }

                _packetLengths[key] = val;
            }

            _player = new PlayerMobile(0x01)
            {
                Equipment = new ItemCollection(0x01)
            };
            _backpack = new Item(0x40000002)
            {
                Container = new ItemCollection(0x40000002), Owner = 0x01
            };
            _player.SetLayer(Layer.Backpack, _backpack.Serial);

            Engine.Items.Add(_backpack);

            Engine.Player = _player;

            IncomingPacketHandlers.Initialize();
            OutgoingPacketHandlers.Initialize();

            Engine.InternalPacketSentEvent += OnInternalPacketSentEvent;
        }