Пример #1
0
		public static void CreatureNameQueryRequest(RealmClient client, RealmPacketIn packet)
		{
			uint creatureEntry = packet.ReadUInt32();
			EntityId creatureEntityId = packet.ReadEntityId();

			var npc = WorldMgr.GetObject(creatureEntityId) as NPC;
			if (npc != null)
			{
				var entry = npc.Entry;
				var name = entry.Name;
				var title = entry.Title;
				var info = entry.Info;
				using (RealmPacketOut pkt = new RealmPacketOut(RealmServerOpCode.SMSG_CREATURE_QUERY_RESPONSE, 
					5 + 4 + 1 + 36 + 2 + name.Length + title.Length))
				{
					pkt.WriteUInt(creatureEntry);
					pkt.Write(name);
					pkt.WriteByte(0);							// Name2
					pkt.WriteByte(0);							// Name3
					pkt.WriteByte(0);							// Name4
					pkt.WriteCString(title);
					//pkt.WriteCString(info);
					pkt.WriteUInt(entry.Flags);
					pkt.Write((uint)entry.Type);
					pkt.WriteUInt(entry.Family);
					pkt.Write((uint)entry.Rank);
					pkt.WriteUInt(entry.UInt1);
					pkt.WriteUInt(entry.SpellDataId);
					pkt.WriteUInt(npc.DisplayId);
					pkt.Write(entry.Float1);
					pkt.Write(entry.Float2);
					pkt.WriteByte(0);
					pkt.WriteByte(entry.IsLeader);


					client.Send(pkt);
				}
			}
		}
Пример #2
0
		public static void Start()
		{
			Account acc = new Account("abc");
			//acc.InitializeAccount

			var rec = CharacterRecord.GetRecordByName("Abc");
			if (rec == null)
			{
				rec = CharacterRecord.CreateNewCharacterRecord(acc, "Abc");

				rec.Gender = (GenderType)1;
				rec.Skin = (byte)1;
				rec.Face = (byte)1;
				rec.HairStyle = (byte)1;
				rec.HairColor = (byte)1;
				rec.FacialHair = (byte)1;
				rec.Outfit = (byte)1;


				var archetype = RaceClassMgr.GetArchetype(ClassType.Warlock, RaceType.Human);

				var race = archetype.Race;

				rec.Class = archetype.Class.ClassID;
				rec.Race = race.Type;
				rec.Level = 1;
				rec.PositionX = race.StartPosition.X;
				rec.PositionY = race.StartPosition.Y;
				rec.PositionZ = race.StartPosition.Z;
				rec.Orientation = race.StartPosition.W;
				rec.CurrentMap = race.StartMap;
				rec.CurrentZone = race.StartZone;
				rec.TotalPlayTime = 0;
				rec.LevelPlayTime = 0;
				rec.TutorialFlags = new byte[32];

				uint h = 4000000;
				rec.Health = (int)h;

				if (race.Type == RaceType.BloodElf)
				{
					rec.DisplayId = race.ModelOffset - (uint)rec.Gender;
				}
				else
				{
					rec.DisplayId = race.ModelOffset + (uint)rec.Gender;
				}
				rec.SaveAndFlush();
			}

			var client = new FakeRealmClient(acc);
			var chr = new Character(acc, rec, client);

			var packet = new RealmPacketOut(RealmServerOpCode.CMSG_CAST_SPELL);
			packet.WriteUInt(3662);
			client.Receive(packet);


			packet = new RealmPacketOut(RealmServerOpCode.CMSG_CANCEL_CAST);
			packet.WriteUInt(425);
			client.Receive(packet);


			packet = new RealmPacketOut(RealmServerOpCode.CMSG_MESSAGECHAT);
			packet.WriteUInt((uint)ChatMsgType.Officer);
			packet.WriteUInt((uint)ChatLanguage.Darnassian);
			client.Receive(packet);

			var region = WorldMgr.GetRegion(MapId.Outland);
			if (region != null)
			{
				var pos = new Vector3();
				region.AddObjectInstantly(chr, ref pos);
			}
		}