예제 #1
0
        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);
            }
        }
예제 #2
0
 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);
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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;
        }
예제 #5
0
 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);
 }
예제 #6
0
 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?
        }
예제 #8
0
 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);
     }
 }
예제 #10
0
        public static void Add(
            NetworkMessage message,
            byte containerId
            )
        {
            message.AddByte((byte)ServerPacketType.ContainerClose);

            message.AddByte(containerId);
        }
예제 #11
0
        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);
        }
예제 #13
0
        public static void Add(
            NetworkMessage message,
            uint creatureID,
            byte newHealth
            )
        {
            message.AddByte((byte)ServerPacketType.CreatureHealth);

            message.AddUInt32(creatureID);
            message.AddByte(newHealth);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
            }
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
        }
예제 #20
0
        public static void Add(
            Connection connection,
            NetworkMessage message,
            Tile tile
            )
        {
            message.AddByte((byte)ServerPacketType.TileUpdate);

            message.AddLocation(tile.Location);
            MapPacket.AddTileDescription(connection, message, tile);
        }
예제 #21
0
        public static void Add
        (
            Connection connection,
            NetworkMessage message,
            Tile tile
        )
        {
            message.AddByte((byte)ServerPacketType.TileUpdate);

            message.AddLocation(tile.Location);
            MapPacket.AddTileDescription(connection, message, tile);
        }
예제 #22
0
        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);
        }
예제 #23
0
 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
         );
 }
예제 #24
0
        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);
        }
예제 #25
0
        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);
            }
        }
예제 #26
0
        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);
        }
예제 #28
0
        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);
        }
예제 #30
0
 public static void Add(NetworkMessage message, TextMessageType type, string text)
 {
     message.AddByte((byte)ServerPacketType.TextMessage);
     message.AddByte((byte)type);
     message.AddString(text);
 }
예제 #31
0
 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);
 }
예제 #33
0
 public static void Add(NetworkMessage message, byte lightLevel, byte lightColor)
 {
     message.AddByte((byte)ServerPacketType.WorldLight);
     message.AddByte(lightLevel);
     message.AddByte(lightColor);
 }
예제 #34
0
 public static void Add(NetworkMessage message, string messageOfTheDay)
 {
     message.AddByte((byte)ServerPacketType.MessageOfTheDay);
     message.AddString("1\n" + messageOfTheDay);
 }
예제 #35
0
 public static void Add(NetworkMessage message, SlotType slot, Item item)
 {
     message.AddByte((byte)ServerPacketType.InventorySetSlot);
     message.AddByte((byte)slot);
     message.AddItem(item);
 }
예제 #36
0
 public static void Add(NetworkMessage message,uint id)
 {
     message.AddByte((byte)ServerPacketType.VipLogout);
     message.AddUInt32(id);
 }
예제 #37
0
 public static void Add(NetworkMessage message)
 {
     message.AddByte((byte)ServerPacketType.Death);
 }
예제 #38
0
 public static void Add(NetworkMessage message, ushort channelId, string channelName)
 {
     message.AddByte((byte)ServerPacketType.ChannelOpen);
     message.AddUInt16(channelId);
     message.AddString(channelName);
 }
예제 #39
0
 public static void Add(NetworkMessage message, int flags)
 {
     message.AddByte((byte)ServerPacketType.PlayerFlags);
     message.AddUInt16((ushort)flags);
 }
예제 #40
0
 public static void Add(NetworkMessage message, ushort channelId, string channelName)
 {
     message.AddByte((byte)ServerPacketType.ChannelOpen);
     message.AddUInt16(channelId);
     message.AddString(channelName);
 }
예제 #41
0
 public static void Add(NetworkMessage message, SlotType slot)
 {
     message.AddByte((byte)ServerPacketType.InventoryClearSlot);
     message.AddByte((byte)slot);
 }
예제 #42
0
 public static void Add(NetworkMessage message, Location location, Effect effect)
 {
     message.AddByte((byte)ServerPacketType.Effect);
     message.AddLocation(location);
     message.AddByte((byte)effect);
 }
예제 #43
0
 public static void Add(NetworkMessage message, TextMessageType type, string text)
 {
     message.AddByte((byte)ServerPacketType.TextMessage);
     message.AddByte((byte)type);
     message.AddString(text);
 }
예제 #44
0
 public static void Add(NetworkMessage message, int flags)
 {
     message.AddByte((byte)ServerPacketType.PlayerFlags);
     message.AddUInt16((ushort)flags);
 }
 public static void Add(NetworkMessage message, Direction direction)
 {
     message.AddByte((byte)ServerPacketType.PlayerWalkCancel);
     message.AddByte((byte)direction);
 }
예제 #46
0
 public static void Add(NetworkMessage message, string Name)
 {
     message.AddByte((byte)ServerPacketType.ChannelOpenPrivate);
     message.AddString(Name);
 }
예제 #47
0
 public static void Add(NetworkMessage message, Direction direction)
 {
     message.AddByte((byte)ServerPacketType.PlayerWalkCancel);
     message.AddByte((byte)direction);
 }
예제 #48
0
 public static void Add(NetworkMessage message, Creature creature)
 {
     message.AddByte((byte)ServerPacketType.CreatureOutfit);
     message.AddUInt32(creature.Id);
     message.AddOutfit(creature.Outfit);
 }
예제 #49
0
 public static void Add(NetworkMessage message)
 {
     message.AddByte((byte)ServerPacketType.Death);
 }
예제 #50
0
 public static void Add(NetworkMessage message, uint id)
 {
     message.AddByte((byte)ServerPacketType.VipLogin);
     message.AddUInt32(id);
 }