public void GET_CHARACTER_LIST(Client client, ApiPacket packet) { var Out = new ApiPacket(Opcodes.CHAR_LIST); var players = new List <Player>(); lock (Player._Players) players = Player._Players.ToList(); Out.WriteUInt16((byte)players.Count); foreach (var player in players) { Out.WritePascalString(player.Name); Out.WriteUInt32(player.CharacterId); Out.WriteUInt16(player.Oid); Out.WriteUInt16(player.Zone.ZoneId); Out.WriteUInt16((ushort)player.X); Out.WriteUInt16((ushort)player.Y); Out.WriteUInt16((ushort)player.Z); Out.WriteUInt16(player.Heading); Out.WriteUInt32((uint)player.WorldPosition.X); Out.WriteUInt32((uint)player.WorldPosition.Y); } client.SendPacket(Out); }
public void SendScriptError(Client client, string name, int line, string message) { var packet = new ApiPacket(Opcodes.EXECUTE_SCRIPT_ERROR); packet.WritePascalString(name); packet.WriteUInt32((uint)line); packet.WriteByteArray(System.Text.ASCIIEncoding.ASCII.GetBytes(message)); client.SendPacket(packet); }
public void ZONE_GET_LIST(Client client, ApiPacket packet) { if (ZoneService._Zone_Info == null) { return; } var Out = new ApiPacket(Opcodes.ZONE_LIST); Out.WriteUInt16((byte)ZoneService._Zone_Info.Count); foreach (var zone in ZoneService._Zone_Info) { Out.WriteUInt16(zone.ZoneId); Out.WriteUInt32((uint)(zone.OffX << 12)); Out.WriteUInt32((uint)(zone.OffY << 12)); Out.WritePascalString(zone.Name); } client.SendPacket(Out); }