public static void Add( Connection connection, NetworkMessage outMessage, Location fromLocation, Location toLocation ) { if (fromLocation.Y > toLocation.Y) { // north, for old x outMessage.AddByte((byte)ServerPacketType.MapSliceNorth); AddMapDescription(connection, outMessage, fromLocation.X - 8, toLocation.Y - 6, toLocation.Z, 18, 1); } else if (fromLocation.Y < toLocation.Y) { // south, for old x outMessage.AddByte((byte)ServerPacketType.MapSliceSouth); AddMapDescription(connection, outMessage, fromLocation.X - 8, toLocation.Y + 7, toLocation.Z, 18, 1); } if (fromLocation.X < toLocation.X) { // east, [with new y] outMessage.AddByte((byte)ServerPacketType.MapSliceEast); AddMapDescription(connection, outMessage, toLocation.X + 9, toLocation.Y - 6, toLocation.Z, 1, 14); } else if (fromLocation.X > toLocation.X) { // west, [with new y] outMessage.AddByte((byte)ServerPacketType.MapSliceWest); AddMapDescription(connection, outMessage, toLocation.X - 8, toLocation.Y - 6, toLocation.Z, 1, 14); } }
public static void Add(NetworkMessage message, Location fromLocation, Location toLocation, ProjectileType projectile) { message.AddByte((byte)ServerPacketType.Projectile); message.AddLocation(fromLocation); message.AddLocation(toLocation); message.AddByte((byte)projectile); }
public static void AddMapDescription(Connection connection, NetworkMessage message, int x, int y, int z, ushort width, ushort height) { int MAP_MAX_LAYERS = 16; int skip = -1; int startZ, endZ, zStep = 0; if (z > 7) { startZ = z - 2; endZ = Math.Min(MAP_MAX_LAYERS - 1, z + 2); zStep = 1; } else { startZ = 7; endZ = 0; zStep = -1; } for (int nz = startZ; nz != endZ + zStep; nz += zStep) { skip = AddFloorDescription(connection, message, x, y, nz, width, height, z - nz, skip); } if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } }
public static int AddFloorDescription(Connection connection, NetworkMessage message, int x, int y, int z, int width, int height, int offset, int skip) { Tile tile; for (int nx = 0; nx < width; nx++) { for (int ny = 0; ny < height; ny++) { tile = connection.Game.Map.GetTile(x + nx + offset, y + ny + offset, z); if (tile != null) { if (skip >= 0) { message.AddByte((byte)skip); message.AddByte(0xFF); } skip = 0; AddTileDescription(connection, message, tile); } else { skip++; if (skip == 0xFF) { message.AddByte(0xFF); message.AddByte(0xFF); skip = -1; } } } } return skip; }
public static void Add(NetworkMessage message, uint creatureId, byte lightLevel, byte lightColor) { message.AddByte((byte)ServerPacketType.CreatureLight); message.AddUInt32(creatureId); message.AddByte(lightLevel); message.AddByte(lightColor); }
public static void Add(NetworkMessage message, Location location, TextColor color, string text) { message.AddByte((byte)ServerPacketType.AnimatedText); message.AddLocation(location); message.AddByte((byte)color); message.AddString(text); }
public static void Add(NetworkMessage message) { message.AddByte(0x1F); // type message.AddUInt32(0x1337); // time in seconds since server start message.AddByte(0x10); // fractional time? }
public static void Add(NetworkMessage message, uint playerId, bool canReportBugs) { message.AddByte((byte)ServerPacketType.SelfAppear); message.AddUInt32(playerId); message.AddByte(0x32); message.AddByte(0); message.AddByte(Convert.ToByte(canReportBugs)); }
public static void Add(NetworkMessage message, Location fromLocation, byte fromStackPosition) { if (fromStackPosition < 10) { message.AddByte((byte)ServerPacketType.TileRemoveThing); message.AddLocation(fromLocation); message.AddByte(fromStackPosition); } }
public static void Add( NetworkMessage message, byte containerId ) { message.AddByte((byte)ServerPacketType.ContainerClose); message.AddByte(containerId); }
public static void Add(NetworkMessage message, List<Channel> channels) { message.AddByte((byte)ServerPacketType.ChannelList); message.AddByte((byte)channels.Count); foreach (var c in channels) { message.AddUInt16((ushort)c.Id); message.AddString(c.Name); } }
public static void Add( NetworkMessage message, byte containerIndex, byte containerPosition ) { message.AddByte((byte)ServerPacketType.ContainerRemoveItem); message.AddByte(containerIndex); message.AddByte(containerPosition); }
public static void Add( NetworkMessage message, uint creatureID, byte newHealth ) { message.AddByte((byte)ServerPacketType.CreatureHealth); message.AddUInt32(creatureID); message.AddByte(newHealth); }
public static void Add( NetworkMessage message, Location fromLocation, byte fromStackPosition, Location toLocation ) { message.AddByte((byte)ServerPacketType.CreatureMove); message.AddLocation(fromLocation); message.AddByte(fromStackPosition); message.AddLocation(toLocation); }
public static void Add( NetworkMessage message, Creature creature ) { message.AddByte((byte)ServerPacketType.TileTransformThing); message.AddLocation(creature.Tile.Location); message.AddByte(creature.Tile.GetStackPosition(creature)); message.AddUInt16(0x63); message.AddUInt32(creature.Id); message.AddByte((byte)creature.Direction); }
public static void Add( NetworkMessage message, Location location, byte stackPosition, Item item ) { message.AddByte((byte)ServerPacketType.TileAddThing); message.AddLocation(location); message.AddByte(stackPosition); message.AddItem(item); }
public static void Add(NetworkMessage message, Player player, IEnumerable<Outfit> outfits) { message.AddByte((byte)ServerPacketType.OutfitWindow); message.AddOutfit(player.Outfit); message.AddByte((byte)outfits.Count()); foreach (Outfit outfit in outfits) { message.AddUInt16((ushort)outfit.LookType); message.AddString(outfit.Name); message.AddByte(outfit.Addons); } }
public static void Add( NetworkMessage message, Location location, byte stackPosition, Creature creature, bool known, uint removeKnown ) { message.AddByte((byte)ServerPacketType.TileAddThing); message.AddLocation(location); message.AddByte(stackPosition); message.AddCreature(creature, known, removeKnown); }
public static void Add( NetworkMessage message, string senderName, ushort senderLevel, SpeechType speechType, string text, Location location, ChatChannel channelId, uint time ) { message.AddByte((byte)ServerPacketType.CreatureSpeech); message.AddUInt32(0x00000000); message.AddString(senderName); message.AddUInt16(senderLevel); message.AddByte((byte)speechType); switch (speechType) { case SpeechType.Say: case SpeechType.Whisper: case SpeechType.Yell: case SpeechType.MonsterSay: case SpeechType.MonsterYell: case SpeechType.PrivateNPCToPlayer: message.AddLocation(location); break; case SpeechType.ChannelRed: case SpeechType.ChannelRedAnonymous: case SpeechType.ChannelOrange: case SpeechType.ChannelYellow: case SpeechType.ChannelWhite: message.AddUInt16((ushort)channelId); break; case SpeechType.RuleViolationReport: message.AddUInt32(time); break; default: break; } message.AddString(text); }
public static void Add( Connection connection, NetworkMessage message, Tile tile ) { message.AddByte((byte)ServerPacketType.TileUpdate); message.AddLocation(tile.Location); MapPacket.AddTileDescription(connection, message, tile); }
public static void Add ( Connection connection, NetworkMessage message, Tile tile ) { message.AddByte((byte)ServerPacketType.TileUpdate); message.AddLocation(tile.Location); MapPacket.AddTileDescription(connection, message, tile); }
public static void Add ( NetworkMessage message, ushort health, ushort maxHealth, uint capacity, uint experience, ushort level, byte levelPercent, ushort mana, ushort maxMana, byte magicLevel, byte magicLevelPercent, byte soul, ushort stamina ) { message.AddByte((byte)ServerPacketType.PlayerStatus); message.AddUInt16(health); message.AddUInt16(maxHealth); message.AddUInt32(capacity); message.AddUInt32(experience); message.AddUInt16(level); message.AddByte(levelPercent); message.AddUInt16(mana); message.AddUInt16(maxMana); message.AddByte(magicLevel); message.AddByte(magicLevelPercent); message.AddByte(soul); message.AddUInt16(stamina); }
public static void Add(Connection connection, NetworkMessage message, Location playerLocation) { message.AddByte((byte)ServerPacketType.MapDescription); message.AddLocation(playerLocation); AddMapDescription( connection, message, playerLocation.X - 8, playerLocation.Y - 6, playerLocation.Z, 18, 14 ); }
public static void Add( NetworkMessage message, ushort health, ushort maxHealth, uint capacity, uint experience, ushort level, byte levelPercent, ushort mana, ushort maxMana, byte magicLevel, byte magicLevelPercent, byte soul, ushort stamina ) { message.AddByte((byte)ServerPacketType.PlayerStatus); message.AddUInt16(health); message.AddUInt16(maxHealth); message.AddUInt32(capacity); message.AddUInt32(experience); message.AddUInt16(level); message.AddByte(levelPercent); message.AddUInt16(mana); message.AddUInt16(maxMana); message.AddByte(magicLevel); message.AddByte(magicLevelPercent); message.AddByte(soul); message.AddUInt16(stamina); }
public static void Add ( NetworkMessage message, byte containerId, ushort containerSpriteId, string containerName, byte volume, bool hasParent, IEnumerable <Item> items ) { message.AddByte((byte)ServerPacketType.ContainerOpen); message.AddByte(containerId); message.AddUInt16(containerSpriteId); message.AddString(containerName); message.AddByte(volume); message.AddByte(Convert.ToByte(hasParent)); message.AddByte((byte)items.Count()); foreach (Item item in items) { message.AddItem(item); } }
public static void Add ( Connection connection, NetworkMessage outMessage, Location fromLocation, byte fromStackPosition, Location toLocation ) { //floor change up outMessage.AddByte((byte)ServerPacketType.FloorChangeUp); //going to surface if (toLocation.Z == 7) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 5, 18, 14, 3, skip); //(floor 7 and 6 already set) skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 4, 18, 14, 4, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 3, 18, 14, 5, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 2, 18, 14, 6, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 1, 18, 14, 7, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 0, 18, 14, 8, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //underground, going one floor up (still underground) else if (toLocation.Z > 7) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, fromLocation.Z - 3, 18, 14, 3, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //moving up a floor up makes us out of sync //west outMessage.AddByte((byte)ServerPacketType.MapSliceWest); AddMapDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y + 1 - 6, toLocation.Z, 1, 14); //north outMessage.AddByte((byte)ServerPacketType.MapSliceNorth); AddMapDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z, 18, 1); }
public static void Add( Connection connection, NetworkMessage outMessage, Location fromLocation, byte fromStackPosition, Location toLocation ) { //floor change up outMessage.AddByte((byte)ServerPacketType.FloorChangeUp); //going to surface if (toLocation.Z == 7) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 5, 18, 14, 3, skip); //(floor 7 and 6 already set) skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 4, 18, 14, 4, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 3, 18, 14, 5, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 2, 18, 14, 6, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 1, 18, 14, 7, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, 0, 18, 14, 8, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //underground, going one floor up (still underground) else if (toLocation.Z > 7) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, fromLocation.Z - 3, 18, 14, 3, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //moving up a floor up makes us out of sync //west outMessage.AddByte((byte)ServerPacketType.MapSliceWest); AddMapDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y + 1 - 6, toLocation.Z, 1, 14); //north outMessage.AddByte((byte)ServerPacketType.MapSliceNorth); AddMapDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z, 18, 1); }
public static void Add ( Connection connection, NetworkMessage outMessage, Location fromLocation, byte fromStackPosition, Location toLocation ) { //floor change down outMessage.AddByte((byte)ServerPacketType.FloorChangeDown); //going from surface to underground if (toLocation.Z == 8) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z, 18, 14, -1, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z + 1, 18, 14, -2, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z + 2, 18, 14, -3, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //going further down else if (toLocation.Z > fromLocation.Z && toLocation.Z > 8 && toLocation.Z < 14) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z + 2, 18, 14, -3, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //moving down a floor makes us out of sync //east outMessage.AddByte((byte)ServerPacketType.MapSliceEast); AddMapDescription(connection, outMessage, fromLocation.X + 9, fromLocation.Y - 1 - 6, toLocation.Z, 1, 14); //south outMessage.AddByte((byte)ServerPacketType.MapSliceSouth); AddMapDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y + 7, toLocation.Z, 18, 1); }
public static void Add( Connection connection, NetworkMessage outMessage, Location fromLocation, byte fromStackPosition, Location toLocation ) { //floor change down outMessage.AddByte((byte)ServerPacketType.FloorChangeDown); //going from surface to underground if (toLocation.Z == 8) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z, 18, 14, -1, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z + 1, 18, 14, -2, skip); skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z + 2, 18, 14, -3, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //going further down else if (toLocation.Z > fromLocation.Z && toLocation.Z > 8 && toLocation.Z < 14) { int skip = -1; skip = AddFloorDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y - 6, toLocation.Z + 2, 18, 14, -3, skip); if (skip >= 0) { outMessage.AddByte((byte)skip); outMessage.AddByte(0xFF); } } //moving down a floor makes us out of sync //east outMessage.AddByte((byte)ServerPacketType.MapSliceEast); AddMapDescription(connection, outMessage, fromLocation.X + 9, fromLocation.Y - 1 - 6, toLocation.Z, 1, 14); //south outMessage.AddByte((byte)ServerPacketType.MapSliceSouth); AddMapDescription(connection, outMessage, fromLocation.X - 8, fromLocation.Y + 7, toLocation.Z, 18, 1); }
public static void Add(NetworkMessage message, TextMessageType type, string text) { message.AddByte((byte)ServerPacketType.TextMessage); message.AddByte((byte)type); message.AddString(text); }
public static void Add(NetworkMessage message, Creature creature) { message.AddByte((byte)ServerPacketType.CreatureSpeed); message.AddUInt32(creature.Id); message.AddUInt16(creature.Speed); }
public static void Add(NetworkMessage message, SlotType slot) { message.AddByte((byte)ServerPacketType.InventoryClearSlot); message.AddByte((byte)slot); }
public static void Add(NetworkMessage message, byte lightLevel, byte lightColor) { message.AddByte((byte)ServerPacketType.WorldLight); message.AddByte(lightLevel); message.AddByte(lightColor); }
public static void Add(NetworkMessage message, string messageOfTheDay) { message.AddByte((byte)ServerPacketType.MessageOfTheDay); message.AddString("1\n" + messageOfTheDay); }
public static void Add(NetworkMessage message, SlotType slot, Item item) { message.AddByte((byte)ServerPacketType.InventorySetSlot); message.AddByte((byte)slot); message.AddItem(item); }
public static void Add(NetworkMessage message,uint id) { message.AddByte((byte)ServerPacketType.VipLogout); message.AddUInt32(id); }
public static void Add(NetworkMessage message) { message.AddByte((byte)ServerPacketType.Death); }
public static void Add(NetworkMessage message, ushort channelId, string channelName) { message.AddByte((byte)ServerPacketType.ChannelOpen); message.AddUInt16(channelId); message.AddString(channelName); }
public static void Add(NetworkMessage message, int flags) { message.AddByte((byte)ServerPacketType.PlayerFlags); message.AddUInt16((ushort)flags); }
public static void Add(NetworkMessage message, Location location, Effect effect) { message.AddByte((byte)ServerPacketType.Effect); message.AddLocation(location); message.AddByte((byte)effect); }
public static void Add(NetworkMessage message, Direction direction) { message.AddByte((byte)ServerPacketType.PlayerWalkCancel); message.AddByte((byte)direction); }
public static void Add(NetworkMessage message, string Name) { message.AddByte((byte)ServerPacketType.ChannelOpenPrivate); message.AddString(Name); }
public static void Add(NetworkMessage message, Creature creature) { message.AddByte((byte)ServerPacketType.CreatureOutfit); message.AddUInt32(creature.Id); message.AddOutfit(creature.Outfit); }
public static void Add(NetworkMessage message, uint id) { message.AddByte((byte)ServerPacketType.VipLogin); message.AddUInt32(id); }