public void _ItemQuerySingleResponse(PacketIn packet) { UInt32 ItemID; // UInt32 unk; // uint unk8; // string s; ItemID = packet.ReadUInt32(); if (!(ItemID == 0x80000000)) // invalid item flag? { ItemProto proto = new ItemProto(); proto.Id = ItemID; proto.Class = packet.ReadUInt32(); proto.SubClass = packet.ReadUInt32(); packet.ReadUInt32(); proto.Name = packet.ReadString(); packet.ReadByte(); packet.ReadByte(); packet.ReadByte(); proto.DisplayInfoID = packet.ReadUInt32(); proto.Quality = packet.ReadUInt32(); proto.Flags = packet.ReadUInt32(); proto.Faction = packet.ReadUInt32(); proto.BuyPrice = packet.ReadUInt32(); proto.SellPrice = packet.ReadUInt32(); proto.InventoryType = packet.ReadUInt32(); proto.AllowableClass = packet.ReadUInt32(); proto.AllowableRace = packet.ReadUInt32(); proto.ItemLevel = packet.ReadUInt32(); proto.RequiredLevel = packet.ReadUInt32(); proto.RequiredSkill = packet.ReadUInt32(); proto.RequiredSkillRank = packet.ReadUInt32(); proto.RequiredSpell = packet.ReadUInt32(); proto.RequiredHonorRank = packet.ReadUInt32(); proto.RequiredCityRank = packet.ReadUInt32(); proto.RequiredReputationFaction = packet.ReadUInt32(); proto.RequiredReputationRank = packet.ReadUInt32(); proto.MaxCount = packet.ReadUInt32(); proto.Stackable = packet.ReadUInt32(); proto.ContainerSlots = packet.ReadUInt32(); proto.StatsCount = packet.ReadUInt32(); for (UInt32 i = 0; i<proto.StatsCount; i++) { proto.ItemStat = new _ItemStat[10]; proto.ItemStat[i].ItemStatType = packet.ReadUInt32(); proto.ItemStat[i].ItemStatValue = packet.ReadUInt32(); } proto.ScalingStatDistribution = packet.ReadUInt32(); proto.ScalingStatValue = packet.ReadUInt32(); for (int i = 0; i < 2; i++) { proto.Damage = new _ItemDamage[2]; proto.Damage[i].DamageMin = packet.ReadFloat(); proto.Damage[i].DamageMax = packet.ReadFloat(); proto.Damage[i].DamageType = packet.ReadUInt32(); } proto.Armor = packet.ReadUInt32(); proto.HolyRes = packet.ReadUInt32(); proto.FireRes = packet.ReadUInt32(); proto.NatureRes = packet.ReadUInt32(); proto.FrostRes = packet.ReadUInt32(); proto.ShadowRes = packet.ReadUInt32(); proto.ArcaneRes = packet.ReadUInt32(); proto.Delay = packet.ReadUInt32(); proto.Ammo_type = packet.ReadUInt32(); proto.RangedModRange = packet.ReadFloat(); for (int i = 0; i < 5; i++) { proto.Spells = new _ItemSpell[5]; proto.Spells[i].SpellId = packet.ReadUInt32(); proto.Spells[i].SpellTrigger = packet.ReadUInt32(); proto.Spells[i].SpellCharges = packet.ReadUInt32(); proto.Spells[i].SpellCooldown = packet.ReadUInt32(); proto.Spells[i].SpellCategory = packet.ReadUInt32(); proto.Spells[i].SpellCategoryCooldown = packet.ReadUInt32(); } proto.Bonding = packet.ReadUInt32(); proto.Description = packet.ReadString(); proto.PageText = packet.ReadUInt32(); proto.LanguageID = packet.ReadUInt32(); proto.PageMaterial = packet.ReadUInt32(); proto.StartQuest = packet.ReadUInt32(); proto.LockID = packet.ReadUInt32(); proto.Material = packet.ReadUInt32(); proto.Sheath = packet.ReadUInt32(); proto.RandomProperty = packet.ReadUInt32(); proto.RandomSuffix = packet.ReadUInt32(); proto.Block = packet.ReadUInt32(); proto.ItemSet = packet.ReadUInt32(); proto.MaxDurability = packet.ReadUInt32(); proto.Area = packet.ReadUInt32(); proto.Map = packet.ReadUInt32(); proto.BagFamily = packet.ReadUInt32(); proto.TotemCategory = packet.ReadUInt32(); for (UInt32 i = 0; i < 3; i++) { proto.Socket = new _ItemSocket[3]; proto.Socket[i].Color = packet.ReadUInt32(); proto.Socket[i].Content = packet.ReadUInt32(); } proto.socketBonus = packet.ReadUInt32(); proto.GemProperties = packet.ReadUInt32(); proto.RequiredDisenchantSkill = packet.ReadUInt32(); proto.ArmorDamageModifier = packet.ReadFloat(); proto.Duration = packet.ReadInt32(); proto.ItemLimitCategory = packet.ReadUInt32(); proto.HolidayId = packet.ReadUInt32(); //TODO /* objmgr.Add(proto); objmgr.AssignNameToObj(proto->Id, TYPEID_ITEM, proto->Name); objmgr.AssignNameToObj(proto->Id, TYPEID_CONTAINER, proto->Name);*/ } }
public void HandleChat(PacketIn packet) { try { string channel = null; UInt64 guid = 0; GameGuid fguid = null, fguid2 = null; string username = null; byte Type = packet.ReadByte(); UInt32 Language = packet.ReadUInt32(); guid = packet.ReadUInt64(); fguid = new GameGuid(guid); packet.ReadInt32(); if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL) { channel = packet.ReadString(); } if (Type == 47) return; fguid2 = new GameGuid(packet.ReadUInt64()); UInt32 Length = packet.ReadUInt32(); string Message = Encoding.Default.GetString(packet.ReadBytes((int)Length)); //Message = Regex.Replace(Message, @"\|H[a-zA-z0-9:].|h", ""); // Why do i should need spells and quest linked? ;> Message = Regex.Replace(Message, @"\|[rc]{1}[a-zA-z0-9]{0,8}", ""); // Colorfull chat message also isn't the most important thing. byte afk = 0; if (fguid.GetOldGuid() == 0) { username = "******"; } else { //if (netLogicCore.ObjectMgr.objectExists(fguid)) //username = netLogicCore.ObjectMgr.GetObject(fguid).Name; } if (username == null) { ChatQueue que = new ChatQueue(); que.GUID = fguid; que.Type = Type; que.Language = Language; if ((ChatMsg)Type == ChatMsg.CHAT_MSG_CHANNEL) que.Channel = channel; que.Length = Length; que.Message = Message; que.AFK = afk; ChatQueued.Add(que); QueryName(guid); return; } object[] param = new object[] { (ChatMsg)Type, channel, username, Message }; netInstance.Event(new Event(EventType.EVENT_CHAT_MSG, "0", param)); //Log.WriteLine(LogType.Chat, "[{1}] {0}", Message, username); } catch (Exception ex) { Log.WriteLine(LogType.Error, "Exception Occured"); Log.WriteLine(LogType.Error, "Message: {0}", ex.Message); Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace); } }
public void HandleCharEnum(PacketIn packet) { byte count = packet.ReadByte(); PlayerEnum[] chr = new PlayerEnum[10]; for (int i = 0; i < count; i++) { chr[i].GUID = new GameGuid(packet.ReadUInt64()); chr[i].Name = packet.ReadString(); chr[i].Race = packet.ReadByte(); chr[i].Class = packet.ReadByte(); chr[i].Gender = packet.ReadByte(); chr[i].Skin = packet.ReadByte(); chr[i].Face = packet.ReadByte(); chr[i].HairStyle = packet.ReadByte(); chr[i].HairColor = packet.ReadByte(); chr[i].FacialHair = packet.ReadByte(); chr[i].Level = packet.ReadByte(); chr[i].ZoneID = packet.ReadUInt32(); chr[i].MapID = packet.ReadUInt32(); chr[i].X = packet.ReadFloat(); chr[i].Y = packet.ReadFloat(); chr[i].Z = packet.ReadFloat(); chr[i].Guild = packet.ReadUInt32(); chr[i].CharacterFlags = packet.ReadUInt32(); chr[i].CustomizationFlags = packet.ReadUInt32(); chr[i].FirstLogin = packet.ReadByte(); chr[i].PetInfoID = packet.ReadUInt32(); chr[i].PetLevel = packet.ReadUInt32(); chr[i].PetFamilyID = packet.ReadUInt32(); chr[i]._items = new PlayerEnumItem[23]; for (int x = 0; x <= 22; x++) { chr[i]._items[x].displayId = packet.ReadUInt32(); chr[i]._items[x].inventorytype = packet.ReadByte(); chr[i]._items[x].enchant = packet.ReadUInt32(); // enchant (2.4 patch) } /* packet.ReadByte(); packet.ReadByte(); packet.ReadByte(); packet.ReadByte();*/ CharacterListExt cx; cx.p = chr[i]; cx.class_ = "classname"; cx.race = "racename"; cx.zone = "zonename"; cx.map_ = "mapname"; Global.GetInstance().GetWSession().GetCharList().Add(cx); } #region Default Char Create if (count == 0) { PacketOut outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_CREATE); outpacket.Write("qweqwe"); outpacket.Write((byte)1); // race - human outpacket.Write((byte)1); // class - warrior outpacket.Write((byte)0); // gender - male outpacket.Write((byte)1); // skin outpacket.Write((byte)1); // face outpacket.Write((byte)1); // hair style outpacket.Write((byte)1); // hair color outpacket.Write((byte)1); // facial hair outpacket.Write((byte)1); // outfit id Send(outpacket); outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_ENUM); Send(outpacket); // return; } else { } #endregion Log.WriteLine(netLogic.Shared.LogType.Success, "Received info about {0} characters", count); PingLoop(); LevelManager.Load("CharactersList"); }
public void HandleRealmlist(PacketIn packetIn) { //packetIn.ReadByte(); UInt16 Length = packetIn.ReadUInt16(); UInt32 Request = packetIn.ReadUInt32(); int realmscount = packetIn.ReadInt16(); //Console.Write(packetIn.ToHex()); Log.WriteLine(LogType.Success, "Got information about {0} realms.", realmscount); Realm[] realms = new Realm[realmscount]; try { for (int i = 0; i < realmscount; i++) { realms[i].Type = packetIn.ReadByte(); realms[i].Color = packetIn.ReadByte(); packetIn.ReadByte(); // unk realms[i].Name = packetIn.ReadString(); realms[i].Address = packetIn.ReadString(); realms[i].Population = packetIn.ReadFloat(); realms[i].NumChars = packetIn.ReadByte(); realms[i].Language = packetIn.ReadByte(); packetIn.ReadByte(); } Realmlist = realms; LevelManager.Load("RealmServers"); //netInstance.Event(new Event(EventType.EVENT_REALMLIST, "", new object[] { Realmlist })); } catch (Exception ex) { Log.WriteLine(LogType.Error, "Exception Occured"); Log.WriteLine(LogType.Error, "Message: {0}", ex.Message); Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace); Disconnect(); } }
public void Handle_NameQuery(PacketIn packet) { byte mask = packet.ReadByte(); GameGuid guid = new GameGuid(mask, packet.ReadBytes(GameGuid.BitCount8(mask))); packet.ReadByte(); string name = packet.ReadString(); packet.ReadByte(); //Races Race = (Races)packet.ReadByte(); //Gender Gender = (Gender)packet.ReadByte(); //Classes Class = (Classes)packet.ReadByte(); /* if (netLogicCore.ObjectMgr.GetObject(guid) != null) // Update existing Object { obj = netLogicCore.ObjectMgr.GetObject(guid); obj.Name = name; // netLogicCore.ObjectMgr.updateObject(obj); }*/ /* else // Create new Object -- FIXME: Add to new 'names only' list? { obj = new MMOObject(guid); obj.Name = name; netLogicCore.ObjectMgr.newObject(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 == guid) { Log.WriteLine(netLogic.Shared.LogType.Chat, "[{1}] {0}", message.Message, name); ChatQueued.Remove(message); } } }*/ }
public void Handle_CreatureQuery(PacketIn packet) { Entry entry = new Entry(); entry.entry = packet.ReadUInt32(); entry.name = packet.ReadString(); entry.blarg = packet.ReadBytes(3); entry.subname = packet.ReadString(); entry.flags = packet.ReadUInt32(); entry.subtype = packet.ReadUInt32(); entry.family = packet.ReadUInt32(); entry.rank = packet.ReadUInt32(); /* foreach (MMOObject obj in netLogicCore.ObjectMgr.WorldObjects) { if (obj.Fields != null) { if (obj.Fields[(int)UpdateFieldsLoader.GetUpdateField(ObjectTypes.TYPEID_UNIT,"OBJECT_FIELD_ENTRY").Value] == entry.entry) { obj.Name = entry.name; obj.Rank = entry.rank; obj.Family = entry.family; obj.SubType = entry.subtype; //netLogicCore.ObjectMgr.updateObject(obj); } } }*/ }