public void Handle_NameQuery(PacketIn packet) { WoWGuid guid = new WoWGuid(packet.ReadUInt64()); string name = packet.ReadString(); packet.ReadByte(); Race Race = (Race)packet.ReadUInt32(); Gender Gender = (Gender)packet.ReadUInt32(); Classname Class = (Classname)packet.ReadUInt32(); if (objectMgr.objectExists(guid)) // Update existing Object { Object obj = objectMgr.getObject(guid); obj.Name = name; objectMgr.updateObject(obj); } else // Create new Object -- FIXME: Add to new 'names only' list? { Object obj = new Object(guid); obj.Name = name; objectMgr.addObject(obj); /* Process chat message if we looked them up now */ for (int i = 0; i < ChatQueued.Count; i++) { ChatQueue message = (ChatQueue)ChatQueued[i]; if (message.GUID.GetOldGuid() == guid.GetOldGuid()) { Log.WriteLine(LogType.Chat, "[{1}] {0}", message.Message, name); ChatQueued.Remove(message); } } } }
private void Handle_NameQuery(WoWReader wr) { WoWGuid guid = new WoWGuid(wr.ReadUInt64()); string name = wr.ReadString(); UInt16 unk = wr.ReadByte(); UInt32 Race = wr.ReadUInt32(); UInt32 Gender = wr.ReadUInt32(); UInt32 Level = wr.ReadUInt32(); BoogieCore.Log(LogType.NeworkComms, "Got NameQuery Response - GUID: {4} Name: {0} - Race: {1} - Gender: {2} - Level: {3}", name, Race, Gender, Level, BitConverter.ToUInt64(guid.GetNewGuid(), 0)); Object obj = BoogieCore.world.getObject(guid); if (obj != null) // Update existing object { obj.Name = name; obj.Race = Race; obj.Gender = Gender; obj.Level = Level; BoogieCore.world.updateObject(obj); } else // Create new Object -- FIXME: Add to new 'names only' list? { obj = new Object(); obj.GUID = guid; obj.Name = name; obj.Race = Race; obj.Gender = Gender; obj.Level = Level; BoogieCore.world.newObject(obj, true); } /* Process chat message if we looked them up now */ for (int i = 0; i < ChatQueued.Count; i++) { ChatQueue message = (ChatQueue)ChatQueued[i]; if (message.GUID.GetOldGuid() == guid.GetOldGuid()) { BoogieCore.Event(new Event(EventType.EVENT_CHAT, Time.GetTime(), message, name)); ChatQueued.Remove(message); } } // WoWChat uses this to retrive names on friends and ignore list. BoogieCore.Event(new Event(EventType.EVENT_NAMEQUERY_RESPONSE, Time.GetTime(), guid, name)); }