private static void OnAttackGranted(int client, PacketReader reader) { int serial30 = reader.ReadInt32(); IncomingPackets.OnAttackGranted(client, serial30); }
private static void OnTarget(int client, PacketReader reader) { byte type = reader.ReadByte(); IncomingPackets.OnTarget(client, type); }
private static void OnItemDeleted(int client, PacketReader reader) { int serial = reader.ReadInt32(); IncomingPackets.OnItemDeleted(client, serial); }
private static void OnPlayerDeath(int client, PacketReader reader) { IncomingPackets.OnPlayerDeath(client); }
public static void Initialize() { IncomingPackets.Register(0xD9, 0x10C, false, OnReceive); CommandSystem.Register("HWInfo", AccessLevel.GameMaster, HWInfo_OnCommand); }
public static void Configure() { IncomingPackets.Register(0x02, 7, true, MovementReq); IncomingPackets.Register(0xF0, 0, true, NewMovementReq); IncomingPackets.Register(0xF1, 9, true, TimeSyncReq); }
public static unsafe void Configure() { IncomingPackets.Register(0xD9, 0x10C, false, &OnReceive); CommandSystem.Register("HWInfo", AccessLevel.GameMaster, HWInfo_OnCommand); }
private static void OnCompressedGump(int client, PacketReader reader) { int serialdd = reader.ReadInt32(); int iddd = reader.ReadInt32(); int xdd = reader.ReadInt32(); int ydd = reader.ReadInt32(); int compressLendd = reader.ReadInt32(); if (compressLendd <= 4) { return; } else { compressLendd -= 4; } int decompressLendd = reader.ReadInt32() + 1; byte[] decompresseddd = new byte[decompressLendd]; byte[] compresseddd = new byte[compressLendd]; Buffer.BlockCopy(reader.Data, reader.Index, compresseddd, 0, compressLendd); reader.Seek(compressLendd, SeekOrigin.Current); int success; //if (IntPtr.Size == 8) success = NativeMethods.uncompress64(decompresseddd, ref decompressLendd, compresseddd, compressLendd); success = NativeMethods.uncompress32(decompresseddd, ref decompressLendd, compresseddd, compressLendd); if (success != 0) { Log.LogDataMessage(client, reader.Data, "*** Error decompressing gump layout:"); return; } string layoutdd = ASCIIEncoding.ASCII.GetString(decompresseddd).TrimEnd('\0'); int offsetdd = 27 + compressLendd; int linesdd = reader.ReadInt32(); compressLendd = reader.ReadInt32(); string[] textdd = new string[linesdd]; if (compressLendd > 4) { compressLendd -= 4; compresseddd = new byte[compressLendd]; decompressLendd = reader.ReadInt32() + 1; decompresseddd = new byte[decompressLendd]; Buffer.BlockCopy(reader.Data, reader.Index, compresseddd, 0, compressLendd); reader.Seek(compressLendd, SeekOrigin.Current); //if (IntPtr.Size == 8) success = NativeMethods.uncompress64(decompresseddd, ref decompressLendd, compresseddd, compressLendd); success = NativeMethods.uncompress32(decompresseddd, ref decompressLendd, compresseddd, compressLendd); if (success != 0) { Log.LogDataMessage(client, reader.Data, "*** Error decompressing gump strings:"); return; } offsetdd = 0; int lendd = 0; for (int x = 0; x < linesdd; x++) { lendd = (decompresseddd[offsetdd] << 8 | decompresseddd[offsetdd + 1]) * 2; offsetdd += 2; textdd[x] = UnicodeEncoding.BigEndianUnicode.GetString(decompresseddd, offsetdd, lendd); offsetdd += lendd; } } IncomingPackets.OnGenericGump(client, serialdd, iddd, xdd, ydd, layoutdd, textdd); }
IEnumerator Start() { Instance = this; using (client = new Host()) { Address address = new Address(); address.SetHost(ip); address.Port = port; client.Create(); peer = client.Connect(address); ENet.Event netEvent; while (true) { bool polled = false; while (!polled) { if (client.CheckEvents(out netEvent) <= 0) { if (client.Service(15, out netEvent) <= 0) { break; } polled = true; } switch (netEvent.Type) { case ENet.EventType.None: break; case ENet.EventType.Connect: Debug.Log("Client connected to server"); break; case ENet.EventType.Disconnect: Debug.Log("Client disconnected from server"); break; case ENet.EventType.Timeout: Debug.Log("Client connection timeout"); break; case ENet.EventType.Receive: Debug.Log("Packet received from server - Channel ID: " + netEvent.ChannelID + ", Data length: " + netEvent.Packet.Length); byte[] buffer = new byte[1024]; netEvent.Packet.CopyTo(buffer); MemoryStream stream = new MemoryStream(buffer); BinaryReader reader = new BinaryReader(stream); while (stream.Position < netEvent.Packet.Length) { byte packetId = reader.ReadByte(); ClientPacketType packetType = (ClientPacketType)packetId; IncomingPackets.ReceivePacket(packetType, reader); } netEvent.Packet.Dispose(); break; } } yield return(0); } client.Flush(); } }
public static unsafe void Configure() { IncomingPackets.RegisterEncoded(0x19, true, &SetAbility); }
public static unsafe void Configure() { IncomingPackets.Register(0x3B, 0, true, &VendorBuyReply); IncomingPackets.Register(0x9F, 0, true, &VendorSellReply); }
public static void Configure() { IncomingPackets.Register(0xFA, 1, true, UltimaStoreOpenRequest); }
public static void Configure() { IncomingPackets.Register(0xB5, 0x40, true, OpenChatWindowRequest); IncomingPackets.Register(0xB3, 0, true, ChatAction); }
private static void OnAttackTarget(int client, PacketReader reader) { int serialaa = reader.ReadInt32(); IncomingPackets.OnAttackTarget(client, serialaa); }
public static void Configure() { IncomingPackets.Register(0xD4, 0, true, HeaderChange); IncomingPackets.Register(0x66, 0, true, ContentChange); IncomingPackets.Register(0x93, 99, true, OldHeaderChange); }
private static void OnProperties(int client, PacketReader reader) { reader.ReadInt16(); // WORD 0x01 int serial = reader.ReadInt32(); reader.ReadInt16(); // WORD 0x00 int hash = reader.ReadInt32(); Property p; StringBuilder propertyText = new StringBuilder(); List <Property> propertyList = new List <Property>(); string named6 = ""; bool nameSet = false, first = true; int lastCliloc = -1; for (; ;) { p = new Property(); p.Cliloc = reader.ReadInt32(); if (p.Cliloc == 0) { break; } if (!first) { propertyText.Append("\r\n"); } int len = reader.ReadInt16(); if (len > 0) { //TODO: Fix the below two lines to use reader.ReadUnicodeString(); p.Arguments = UnicodeEncoding.Unicode.GetString(reader.Data, reader.Index, len).Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); reader.Seek(len, SeekOrigin.Current); p.Text = Cliloc.GetLocalString(p.Cliloc, p.Arguments); if (!nameSet) { named6 = p.Text; nameSet = true; } } else { p.Text = Cliloc.GetProperty(p.Cliloc); if (!nameSet) { named6 = p.Text; nameSet = true; } } if (lastCliloc != -1) { if (lastCliloc != p.Cliloc) { propertyList.Add(p); propertyText.Append(p.Text); } } else { propertyList.Add(p); propertyText.Append(p.Text); } lastCliloc = p.Cliloc; first = false; } IncomingPackets.OnProperties(client, serial, named6, propertyList.ToArray(), propertyText.ToString()); }
private static void OnLoggedOut(int client, PacketReader pvSrc) { IncomingPackets.OnLoggedOut(client); }
private static void OnMapChanged(int client, PacketReader reader) { byte map = reader.ReadByte(); IncomingPackets.OnMapChanged(client, map); }
private static void OnMobileStatus(int client, PacketReader reader) { int length11 = reader.Size; int serial = reader.ReadInt32(); string name = reader.ReadString(30); int hits = reader.ReadInt16(); int maxHits = reader.ReadInt16(); reader.ReadByte(); // Allow Name Change byte features = reader.ReadByte(); int sex = 2; if (length11 > 43) { sex = reader.ReadByte(); } if (length11 <= 44) { IncomingPackets.OnShortStatus(client, serial, name, hits, maxHits, sex); } else { PlayerStatus ps = new PlayerStatus(); ps.Name = name; ps.Health = hits; ps.MaxHealth = maxHits; ps.Sex = sex; ps.Features = features; ps.Str = reader.ReadInt16(); ps.Dex = reader.ReadInt16(); ps.Int = reader.ReadInt16(); ps.Stamina = reader.ReadInt16(); ps.MaxStamina = reader.ReadInt16(); ps.Mana = reader.ReadInt16(); ps.MaxMana = reader.ReadInt16(); ps.Gold = reader.ReadInt32(); ps.PhysicalResist = reader.ReadInt16(); ps.Weight = reader.ReadInt16(); switch (features) { case 3: ps.StatCap = reader.ReadInt16(); ps.Followers = reader.ReadByte(); ps.MaxFollowers = reader.ReadByte(); break; case 4: ps.StatCap = reader.ReadInt16(); ps.Followers = reader.ReadByte(); ps.MaxFollowers = reader.ReadByte(); ps.FireResist = reader.ReadInt16(); ps.ColdResist = reader.ReadInt16(); ps.PoisonResist = reader.ReadInt16(); ps.EnergyResist = reader.ReadInt16(); ps.Luck = reader.ReadInt16(); ps.MinDamage = reader.ReadInt16(); ps.MaxDamage = reader.ReadInt16(); ps.TithingPoints = reader.ReadInt32(); break; case 5: ps.MaxWeight = reader.ReadInt16(); ps.Race = reader.ReadByte(); ps.StatCap = reader.ReadInt16(); ps.Followers = reader.ReadByte(); ps.MaxFollowers = reader.ReadByte(); ps.FireResist = reader.ReadInt16(); ps.ColdResist = reader.ReadInt16(); ps.PoisonResist = reader.ReadInt16(); ps.EnergyResist = reader.ReadInt16(); ps.Luck = reader.ReadInt16(); ps.MinDamage = reader.ReadInt16(); ps.MaxDamage = reader.ReadInt16(); ps.TithingPoints = reader.ReadInt32(); break; case 6: ps.MaxWeight = reader.ReadInt16(); ps.Race = reader.ReadByte(); ps.StatCap = reader.ReadInt16(); ps.Followers = reader.ReadByte(); ps.MaxFollowers = reader.ReadByte(); ps.FireResist = reader.ReadInt16(); ps.ColdResist = reader.ReadInt16(); ps.PoisonResist = reader.ReadInt16(); ps.EnergyResist = reader.ReadInt16(); ps.Luck = reader.ReadInt16(); ps.MinDamage = reader.ReadInt16(); ps.MaxDamage = reader.ReadInt16(); ps.TithingPoints = reader.ReadInt32(); ps.MaxPhysicalResist = reader.ReadInt16(); ps.MaxFireResist = reader.ReadInt16(); ps.MaxColdResist = reader.ReadInt16(); ps.MaxPoisonResist = reader.ReadInt16(); ps.MaxEnergyResist = reader.ReadInt16(); ps.DefenseChanceIncrease = reader.ReadInt16(); reader.ReadInt16(); ps.HitChanceIncrease = reader.ReadInt16(); ps.SwingSpeedIncrease = reader.ReadInt16(); ps.DamageIncrease = reader.ReadInt16(); ps.LowerReagentCost = reader.ReadInt16(); ps.SpellDamageIncrease = reader.ReadInt16(); ps.FasterCastRecovery = reader.ReadInt16(); ps.FasterCasting = reader.ReadInt16(); ps.LowerManaCost = reader.ReadInt16(); break; } IncomingPackets.OnLongStatus(client, serial, ps); } }
public static void Initialize() { IncomingPackets.Register(0x71, 0, true, BBClientRequest); }
public static void Configure() { IncomingPackets.Register(0xFB, 2, false, ShowPublicHouseContent); }