Exemplo n.º 1
0
        static void AddRealmPacket(IDictionary <RealmServerOpCode, LockfreeQueue <RealmReceiveInfo> > packets,
                                   PacketSender sender, PacketIn packet, TestFakeClient client)
        {
            var opCode = (RealmServerOpCode)packet.PacketId.RawId;

            LockfreeQueue <RealmReceiveInfo> queue;

            if (!packets.TryGetValue(opCode, out queue))
            {
                packets.Add(opCode, queue = new LockfreeQueue <RealmReceiveInfo>());
            }

            var def = PacketAnalyzer.GetDefinition(packet.PacketId, sender);

            if (def != null)
            {
                if (packet is RealmPacketIn)
                {
                    packet = ((DisposableRealmPacketIn)packet).Copy();
                }
                var parser = new PacketParser(packet, sender);
                parser.Parse();
                queue.Enqueue(new RealmReceiveInfo {
                    Parser = parser, Client = client
                });

                //packet.IncrementUsage();
            }
        }
Exemplo n.º 2
0
		public void TestCharEnum()
		{
			var account = Setup.AccountPool.CreateAccount();
			var client = new TestFakeClient(account);

			var record1 = account.AddRecord();
			var record2 = account.AddRecord();

			CharacterHandler.SendCharEnum(client);

			var parser = client.DequeueSMSGInfo(RealmServerOpCode.SMSG_CHAR_ENUM).Parser;

			CheckCharEnumSize(parser, account.Characters);

			var charEnum = parser.ParsedPacket;
			Assert.IsNotNull(charEnum);

			var chars = charEnum["Characters"];

			var char1 = chars[0];
			var char2 = chars[1];

			Assert.AreEqual(char1["Id"].EntityIdValue, record1.EntityId);
			Assert.AreEqual(char2["Id"].EntityIdValue, record2.EntityId);

		}
Exemplo n.º 3
0
		public static void Init(TestContext testContext)
		{
			chr = Setup.AllianceCharacterPool.Create();
			client = chr.FakeClient;
			disenchantSpell = SpellHandler.Get(SpellId.DisenchantPT);
			disenchantSpell.CastDelay = 0;	// we don't want to wait

			ItemMgr.LoadAll();
			//LootMgr.LoadAll();
			ContentMgr.Load<ItemLootItemEntry>();
		}
Exemplo n.º 4
0
 public void SendRandomPacket(TestFakeClient client)
 {
 }
Exemplo n.º 5
0
		static void AddRealmPacket(IDictionary<RealmServerOpCode, LockfreeQueue<RealmReceiveInfo>> packets,
			PacketSender sender, PacketIn packet, TestFakeClient client)
		{
			var opCode = (RealmServerOpCode)packet.PacketId.RawId;

			LockfreeQueue<RealmReceiveInfo> queue;
			if (!packets.TryGetValue(opCode, out queue))
			{
				packets.Add(opCode, queue = new LockfreeQueue<RealmReceiveInfo>());
			}

			var def = PacketAnalyzer.GetDefinition(packet.PacketId, sender);
			if (def != null)
			{
				if (packet is RealmPacketIn)
				{
					packet = ((DisposableRealmPacketIn) packet).Copy();
				}
				var parser = new PacketParser(packet, sender);
				parser.Parse();
				queue.Enqueue(new RealmReceiveInfo { Parser = parser, Client = client });

				//packet.IncrementUsage();
			}
		}