public void MoveSouth() { var builder = new PacketBuilder(Packets.SendToClient.CreaturePositionUpdate); var oldPos = _player.Position; var oldZIndex = _player.ZIndex; builder.AddPosition(oldPos); builder.AddU8(oldZIndex); // old stack position (z-index) _player.MoveDown(); var newPos = _player.Position; builder.AddPosition(newPos); builder.Send(_player); builder.AddPacketId(Packets.SendToClient.MoveDown); /* add rest of map description */ _player.Packets.Map.AddMapDescriptionToBuilder(builder, (ushort)(oldPos.X - 8), (ushort)(newPos.Y + 7), newPos.Z, GameClient.Width, 1, true); builder.Send(_player); var newZIndex = IoC.Game.GetCreatureZIndex(_player, _player.Position); IoC.Game.CreatureMoved(_player, oldPos, newPos, newZIndex); }
// if (!tile.skip) // { // if (skip >= 0) // { // builder.AddU8((byte) skip); // builder.AddU8(0xFF); // } // // skip = 0; // var count = 0; // if (tile.t.GroundId > 0) // { // builder.AddU16(tile.t.GroundId); // count++; // } // // if (tile.t.Items?.Count > 0) // { // foreach (var t in tile.t.Items) // { // if (count > 9) // break; // builder.AddItem(t); // count++; // } // } // // var creatures = Game.Instance.GetCreaturesOnTile(currentTile); // // if (creatures == null) continue; // foreach (var creature in creatures) // { // if (count > 9) // break; // builder.AddCreature(_player, creature); // count++; // } // } // else // { // skip++; // if (skip != 0xFF) continue; // builder.AddU8(0xFF); // builder.AddU8(0xFF); // skip = -1; // } // } public void CreatureMoved(Position oldPos, Position newPos, byte newZIndex) { var builder = new PacketBuilder(); builder.AddPacketId(Packets.SendToClient.CreaturePositionUpdate); builder.AddPosition(oldPos); builder.AddU8(newZIndex); // not 100% sure if it should be new or old z-index builder.AddPosition(newPos); builder.Send(_player); }
public void Projectile(Position source, Position destination, byte projectileId) { var builder = new PacketBuilder(Packets.SendToClient.ProjectileEffect); builder.AddPosition(source); builder.AddPosition(destination); builder.AddU8((byte)(projectileId - 1)); // projectile id - 1 because the client adds 1 to whatever we send builder.Send(_player); // 3 (4) == HMM projectile id }
public void Magic(Position destination, byte projectileId) { var builder = new PacketBuilder(Packets.SendToClient.MagicEffect); builder.AddPosition(destination); builder.AddU8((byte)(projectileId - 1)); // projectile id - 1 because the client adds 1 to whatever we send builder.Send(_player); }
public void Logout(Creature creature) { var builder = new PacketBuilder(Packets.SendToClient.MagicEffect); builder.AddPosition(creature.Position); builder.AddU8(2); // effect id - 1 builder.Send(_player); }
public void Animated(Position pos, Colors color, string message) { var builder = new PacketBuilder(Packets.SendToClient.AnimatedText); builder.AddPosition(pos); builder.AddU8((byte)color); builder.AddString(message); builder.Send(_player); }
public void CreatureAppear(Creature creature) { var builder = new PacketBuilder(); builder.AddPacketId(Packets.SendToClient.ItemOrCreatureAppearOnTile); builder.AddPosition(creature.Position); builder.AddCreature(_player, creature); builder.Send(_player); }
public void CreatureDisappear(Creature creature) { var builder = new PacketBuilder(); builder.AddPacketId(Packets.SendToClient.ItemOrCreatureDisappear); builder.AddPosition(creature.Position); builder.AddU8(creature.ZIndex); builder.Send(_player); }
public void ItemAppear(Position pos, Item item) { var builder = new PacketBuilder(); builder.AddPacketId(Packets.SendToClient.ItemOrCreatureAppearOnTile); builder.AddPosition(pos); builder.AddItem(item); builder.Send(_player); }
public void Creature(Position pos, string message) { var builder = new PacketBuilder(Packets.SendToClient.Message); builder.AddString(""); // source player builder.AddU8((byte)MessageTypes.Creature); // message type builder.AddPosition(pos); builder.AddString(message); builder.Send(_player); }
public void Yell(Position pos, string fromName, string message) { var builder = new PacketBuilder(Packets.SendToClient.Message); builder.AddString(fromName); // source player builder.AddU8((byte)MessageTypes.Yell); // message type builder.AddPosition(pos); builder.AddString(message.ToUpper()); builder.Send(_player); }
public void LocalMessage(Position pos, string fromName, string message, byte speechType) { var builder = new PacketBuilder(Packets.SendToClient.Message); builder.AddString(fromName); // source player builder.AddU8(speechType); // message type builder.AddPosition(pos); builder.AddString(message); builder.Send(_player); }
public void CreatureTurn(Creature creature) { var builder = new PacketBuilder(); builder.AddPacketId(Packets.SendToClient.CreatureTurn); builder.AddPosition(creature.Position); builder.AddU8(creature.ZIndex); builder.AddU16(0x63); builder.AddU32(creature.Id); builder.AddU8((byte)creature.Direction); builder.Send(_player); }
public void MoveEast() { var builder = new PacketBuilder(Packets.SendToClient.CreaturePositionUpdate); var oldPos = _player.Position; var oldZIndex = _player.ZIndex; builder.AddPosition(oldPos); builder.AddU8(oldZIndex); // old stack position (z-index) _player.MoveRight(); var newPos = _player.Position; builder.AddPosition(newPos); builder.AddPacketId(Packets.SendToClient.MoveRight); /* add rest of map description */ _player.Packets.Map.AddMapDescriptionToBuilder(builder, (ushort)(newPos.X + 9), (ushort)(newPos.Y - 6), newPos.Z, 1, GameClient.Height, true); builder.Send(_player); IoC.Game.CreatureMoved(_player, oldPos, newPos, oldZIndex); }
public void AddFullMapToBuilder(PacketBuilder builder) { builder.AddPacketId(Packets.SendToClient.FullScreenMap); /* add player position */ builder.AddPosition(_player.Position); /* add rest of map description */ // AddMapDescriptionToBuilder(builder, 0, 0, GameClient.Width - 1, GameClient.Height - 1); AddMapDescriptionToBuilder(builder, (ushort)(_player.Position.X - 8), (ushort)(_player.Position.Y - 6), _player.Position.Z, GameClient.Width, GameClient.Height, false); }