Exemplo n.º 1
0
 public HostClickPlayerEventArgs(int Header, int PlayerID, int X, int Y)
     : base()
 {
     this.Header   = Header;
     this.PlayerID = PlayerID;
     this.Tile     = new HPoint(X, Y);
 }
Exemplo n.º 2
0
 public bool Equals(HPoint other)
 {
     return(_point.Equals(other._point) &&
            int.Equals(_x, other._x) &&
            int.Equals(_y, other._y) &&
            string.Equals(_z, other._z));
 }
Exemplo n.º 3
0
        public HFloorItem(HMessage packet)
        {
            Id     = packet.ReadInteger();
            TypeId = packet.ReadInteger();

            var tile = new HPoint(packet.ReadInteger(), packet.ReadInteger());

            Facing = (HDirection)packet.ReadInteger();

            tile.Z = double.Parse(packet.ReadString(), CultureInfo.InvariantCulture);
            Tile   = tile;

            packet.ReadString();
            packet.ReadInteger();

            Category = packet.ReadInteger();
            Stuff    = ReadData(packet, Category);

            SecondsToExpiration = packet.ReadInteger();
            UsagePolicy         = packet.ReadInteger();

            OwnerId = packet.ReadInteger();
            if (TypeId < 0)
            {
                packet.ReadString();
            }
        }
Exemplo n.º 4
0
        public HFloorItem(HPacket packet)
        {
            Id     = packet.ReadInt32();
            TypeId = packet.ReadInt32();

            var tile = new HPoint(packet.ReadInt32(), packet.ReadInt32());

            Facing = (HDirection)packet.ReadInt32();

            tile.Z = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);
            Tile   = tile;

            var loc1 = packet.ReadUTF8();
            var loc3 = packet.ReadInt32();

            Category = packet.ReadInt32();
            Stuff    = ReadData(packet, Category);

            var loc4 = packet.ReadInt32();
            var loc5 = packet.ReadInt32();

            OwnerId = packet.ReadInt32();
            if (TypeId < 0)
            {
                var loc6 = packet.ReadUTF8();
            }
        }
Exemplo n.º 5
0
        public HFloorItem(HPacket packet)
            : base(packet)
        {
            Id = packet.ReadInt32();
            TypeId = packet.ReadInt32();

            var tile = new HPoint(packet.ReadInt32(), packet.ReadInt32());
            Facing = (HDirection)packet.ReadInt32();

            tile.Z = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);
            Tile = tile;

            Remnants.Enqueue(packet.ReadUTF8());
            Remnants.Enqueue(packet.ReadInt32());

            Category = packet.ReadInt32();
            Stuff = ReadData(packet, Category);

            SecondsToExpiration = packet.ReadInt32();
            UsagePolicy = packet.ReadInt32();

            OwnerId = packet.ReadInt32();
            if (TypeId < 0)
            {
                Remnants.Enqueue(packet.ReadUTF8());
            }
        }
 public HostMoveFurnitureEventArgs(Func<Task> continuation, int step, HMessage packet)
     : base(continuation, step, packet)
 {
     Id = packet.ReadInteger();
     Tile = new HPoint(packet.ReadInteger(), packet.ReadInteger());
     Direction = (HDirection)packet.ReadInteger();
 }
Exemplo n.º 7
0
        public HFloorObject(HPacket packet)
        {
            Id     = packet.ReadInt32();
            TypeId = packet.ReadInt32();

            var tile = new HPoint(packet.ReadInt32(), packet.ReadInt32());

            Facing = (HDirection)packet.ReadInt32();

            tile.Z = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);
            Tile   = tile;

            Height = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);
            Extra  = packet.ReadInt32();

            Category = packet.ReadInt32();
            Stuff    = ReadData(packet, Category);

            SecondsToExpiration = packet.ReadInt32();
            UsagePolicy         = (HUsagePolicy)packet.ReadInt32();

            OwnerId = packet.ReadInt32();
            if (TypeId < 0)
            {
                StaticClass = packet.ReadUTF8();
            }
        }
Exemplo n.º 8
0
        public HSlideObjectBundle(HPacket packet)
        {
            HPoint location = new HPoint(packet.ReadInt32(), packet.ReadInt32());
            HPoint target   = new HPoint(packet.ReadInt32(), packet.ReadInt32());

            Objects = new HSlideObject[packet.ReadInt32()];
            for (int i = 0; i < Objects.Length; i++)
            {
                int objectId = packet.ReadInt32();
                location.Z = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);
                target.Z   = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);

                Objects[i] = new HSlideObject(objectId, location, target);
            }

            Id = packet.ReadInt32();

            if (packet.ReadableBytes > 0)
            {
                HMoveType type = (HMoveType)packet.ReadInt32();

                int entityIndex = packet.ReadInt32();
                location.Z = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);
                target.Z   = double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture);

                Entity = new HSlideObject(entityIndex, location, target, type);
            }
        }
Exemplo n.º 9
0
        public HEntity(HPacket packet)
            : base(packet)
        {
            Id       = packet.ReadInt32();
            Name     = packet.ReadUTF8();
            Motto    = packet.ReadUTF8();
            FigureId = packet.ReadUTF8();
            Index    = packet.ReadInt32();

            Tile = new HPoint(packet.ReadInt32(), packet.ReadInt32(),
                              double.Parse(packet.ReadUTF8(), CultureInfo.InvariantCulture));

            Remnants.Enqueue(packet.ReadInt32());
            EntityType = packet.ReadInt32();

            switch (EntityType)
            {
            case 1:
            {
                Gender = (HGender)packet.ReadUTF8().ToLower()[0];
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadInt32());
                FavoriteGroup = packet.ReadUTF8();
                Remnants.Enqueue(packet.ReadUTF8());
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadBoolean());
                break;
            }

            case 2:
            {
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadUTF8());
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadBoolean());
                Remnants.Enqueue(packet.ReadBoolean());
                Remnants.Enqueue(packet.ReadBoolean());
                Remnants.Enqueue(packet.ReadBoolean());
                Remnants.Enqueue(packet.ReadBoolean());
                Remnants.Enqueue(packet.ReadBoolean());
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadUTF8());
                break;
            }

            case 4:
            {
                Remnants.Enqueue(packet.ReadUTF8());
                Remnants.Enqueue(packet.ReadInt32());
                Remnants.Enqueue(packet.ReadUTF8());
                for (int j = packet.ReadInt32(); j > 0; j--)
                {
                    Remnants.Enqueue(packet.ReadUInt16());
                }
                break;
            }
            }
        }
Exemplo n.º 10
0
        public HEntity(HMessage packet)
        {
            Id       = packet.ReadInteger();
            Name     = packet.ReadString();
            Motto    = packet.ReadString();
            FigureId = packet.ReadString();
            Index    = packet.ReadInteger();

            Tile = new HPoint(packet.ReadInteger(), packet.ReadInteger(),
                              double.Parse(packet.ReadString(), CultureInfo.InvariantCulture));

            packet.ReadInteger();
            int type = packet.ReadInteger();

            switch (type)
            {
            case 1:
            {
                Gender = SKore.ToGender(packet.ReadString());
                packet.ReadInteger();
                packet.ReadInteger();
                FavoriteGroup = packet.ReadString();
                packet.ReadString();
                packet.ReadInteger();
                packet.ReadBoolean();

                break;
            }

            case 2:
            {
                packet.ReadInteger();
                packet.ReadInteger();
                packet.ReadString();
                packet.ReadInteger();
                packet.ReadBoolean();
                packet.ReadBoolean();
                packet.ReadBoolean();
                packet.ReadBoolean();
                packet.ReadBoolean();
                packet.ReadBoolean();
                packet.ReadInteger();
                packet.ReadString();
                break;
            }

            case 4:
            {
                packet.ReadString();
                packet.ReadInteger();
                packet.ReadString();
                for (int j = packet.ReadInteger(); j > 0; j--)
                {
                    packet.ReadShort();
                }
                break;
            }
            }
        }
Exemplo n.º 11
0
        public HWallItem(HPacket packet)
        {
            Id                  = int.Parse(packet.ReadUTF8());
            TypeId              = packet.ReadInt32();
            Location            = packet.ReadUTF8();
            Data                = packet.ReadUTF8();
            SecondsToExpiration = packet.ReadInt32();
            UsagePolicy         = (HUsagePolicy)packet.ReadInt32();
            OwnerId             = packet.ReadInt32();

            if (float.TryParse(Data, out _))
            {
                State = int.Parse(Data);
            }

            string[] locations = Location.Split(' ');
            if (Location.IndexOf(":") == 0 && locations.Length >= 3)
            {
                Placement = locations[2];

                if (locations[0].Length <= 3 || locations[1].Length <= 2)
                {
                    return;
                }
                string firstLoc  = locations[0].Substring(3);
                string secondLoc = locations[1].Substring(2);

                locations = firstLoc.Split(',');
                if (locations.Length >= 2)
                {
                    Global    = new HPoint(int.Parse(locations[0]), int.Parse(locations[1]));
                    locations = secondLoc.Split(',');

                    if (locations.Length >= 2)
                    {
                        Local = new HPoint(int.Parse(locations[0]), int.Parse(locations[1]));
                    }
                }
            }
            else if (locations.Length >= 2)
            {
                Placement = locations[0];
                if (Placement == "rightwall" || Placement == "frontwall")
                {
                    Placement = "r";
                }
                else
                {
                    Placement = "l";
                }

                string[] coords = locations[1].Split(',');
                if (coords.Length >= 3)
                {
                    Y = float.Parse(coords[0], CultureInfo.InvariantCulture);
                    Z = float.Parse(coords[1], CultureInfo.InvariantCulture);
                }
            }
        }
Exemplo n.º 12
0
 public HFurniture(int id, int typeId, int ownerId,
     string ownerName, HPoint tile, HDirection direction)
 {
     Id = id;
     TypeId = typeId;
     OwnerId = ownerId;
     OwnerName = ownerName;
     Tile = tile;
     Direction = direction;
 }
Exemplo n.º 13
0
 public HFurniture(int id, int typeId, int ownerId,
                   string ownerName, HPoint tile, HDirection direction)
 {
     Id        = id;
     TypeId    = typeId;
     OwnerId   = ownerId;
     OwnerName = ownerName;
     Tile      = tile;
     Direction = direction;
 }
Exemplo n.º 14
0
 public HFurnitureData(int furnitureOwnerId, string furnitureOwnerName,
                       int furnitureId, int furnitureTypeId, HPoint tile, HDirection direction, int state)
 {
     FurnitureOwnerId   = furnitureOwnerId;
     FurnitureOwnerName = furnitureOwnerName;
     FurnitureId        = furnitureId;
     furnitureTypeId    = FurnitureTypeId;
     Tile      = tile;
     Direction = direction;
     State     = state;
 }
Exemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HEntity"/> class with the specified information,
 /// </summary>
 /// <param name="id">The id of the <see cref="HEntity"/>.</param>
 /// <param name="index">The room index value of the <see cref="HEntity"/>.</param>
 /// <param name="name">The name of the <see cref="HEntity"/>.</param>
 /// <param name="tile">The <see cref="HPoint"/> of the <see cref="HEntity"/>.</param>
 /// <param name="motto">The motto of the <see cref="HEntity"/>.</param>
 /// <param name="gender">The <see cref="HGender"/> of the <see cref="HEntity"/>.</param>
 /// <param name="figureId">The figure id of the <see cref="HEntity"/>.</param>
 /// <param name="favoriteGroup">The favorite group badge of the <see cref="HEntity"/>.</param>
 public HEntity(int id, int index, string name, HPoint tile,
     string motto, HGender gender, string figureId, string favoriteGroup)
 {
     Id = id;
     Index = index;
     Name = name;
     Tile = tile;
     Motto = motto;
     Gender = gender;
     FigureId = figureId;
     FavoriteGroup = favoriteGroup;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HEntity"/> class with the specified information,
 /// </summary>
 /// <param name="id">The id of the <see cref="HEntity"/>.</param>
 /// <param name="index">The room index value of the <see cref="HEntity"/>.</param>
 /// <param name="name">The name of the <see cref="HEntity"/>.</param>
 /// <param name="tile">The <see cref="HPoint"/> of the <see cref="HEntity"/>.</param>
 /// <param name="motto">The motto of the <see cref="HEntity"/>.</param>
 /// <param name="gender">The <see cref="HGender"/> of the <see cref="HEntity"/>.</param>
 /// <param name="figureId">The figure id of the <see cref="HEntity"/>.</param>
 /// <param name="favoriteGroup">The favorite group badge of the <see cref="HEntity"/>.</param>
 public HEntity(int id, int index, string name, HPoint tile,
                string motto, HGender gender, string figureId, string favoriteGroup)
 {
     Id            = id;
     Index         = index;
     Name          = name;
     Tile          = tile;
     Motto         = motto;
     Gender        = gender;
     FigureId      = figureId;
     FavoriteGroup = favoriteGroup;
 }
Exemplo n.º 17
0
 public HPlayerData(string playerName, int playerId, int playerIndex,
                    HPoint tile, string figureId, string motto, HGender gender, string groupName)
 {
     PlayerName    = playerName;
     PlayerId      = playerId;
     PlayerIndex   = playerIndex;
     Tile          = tile;
     FigureId      = figureId;
     Motto         = motto;
     Gender        = gender;
     FavoriteGroup = groupName;
 }
Exemplo n.º 18
0
        public FurnitureMoveEventArgs(Func<Task> continuation, int step, HMessage packet)
            : base(continuation, step, packet)
        {
            Id = packet.ReadInteger();
            TypeId = packet.ReadInteger();

            int x = packet.ReadInteger();
            int y = packet.ReadInteger();
            Direction = (HDirection)packet.ReadInteger();

            Tile = new HPoint(x, y,
                double.Parse(packet.ReadString(), CultureInfo.InvariantCulture));

            // TODO: Find the chunks before OwnerId and read them.
            OwnerId = packet.ReadInteger(packet.Length - 6);
        }
Exemplo n.º 19
0
        public HPlayerAction(bool empowered, int playerIndex, HPoint tile, HPoint movingTo, HSign sign,
                             HStance stance, HDirection headDirection, HDirection bodyDirection, HAction latestAction)
        {
            Empowered   = empowered;
            PlayerIndex = playerIndex;

            Tile     = tile;
            MovingTo = movingTo;

            Sign   = sign;
            Stance = stance;

            HeadDirection = headDirection;
            BodyDirection = bodyDirection;

            LatestAction = latestAction;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HEntityAction"/> class with the specified information.
        /// </summary>
        /// <param name="isEmpowered">The value that determines whether the <see cref="IHEntity"/> has privileges.</param>
        /// <param name="index">The room index value of the <see cref="IHEntity"/>.</param>
        /// <param name="tile">The <see cref="HPoint"/> of where the <see cref="IHEntity"/> is currently on.</param>
        /// <param name="movingTo">The <see cref="HPoint"/> of where the <see cref="IHEntity"/> will move to next.</param>
        /// <param name="sign">The <see cref="HSign"/> that the <see cref="IHEntity"/> has raised.</param>
        /// <param name="stance">The current <see cref="HStance"/> of the <see cref="IHEntity"/>.</param>
        /// <param name="headDirection">The <see cref="HDirection"/> of the <see cref="IHEntity"/>'s head.</param>
        /// <param name="bodyDirection">The <see cref="HDirection"/> of the <see cref="IHEntity"/>'s body.</param>
        /// <param name="lastAction">The <see cref="HAction"/> that the <see cref="IHEntity"/> has recently done.</param>
        public HEntityAction(bool isEmpowered, int index, HPoint tile, HPoint movingTo,
                             HSign sign, HStance stance, HDirection headDirection, HDirection bodyDirection, HAction lastAction)
        {
            Index       = index;
            IsEmpowered = isEmpowered;

            Tile     = tile;
            MovingTo = movingTo;

            Sign   = sign;
            Stance = stance;

            HeadDirection = headDirection;
            BodyDirection = bodyDirection;

            LastAction = lastAction;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HEntityAction"/> class with the specified information.
        /// </summary>
        /// <param name="isEmpowered">The value that determines whether the <see cref="IHEntity"/> has privileges.</param>
        /// <param name="index">The room index value of the <see cref="IHEntity"/>.</param>
        /// <param name="tile">The <see cref="HPoint"/> of where the <see cref="IHEntity"/> is currently on.</param>
        /// <param name="movingTo">The <see cref="HPoint"/> of where the <see cref="IHEntity"/> will move to next.</param>
        /// <param name="sign">The <see cref="HSign"/> that the <see cref="IHEntity"/> has raised.</param>
        /// <param name="stance">The current <see cref="HStance"/> of the <see cref="IHEntity"/>.</param>
        /// <param name="headDirection">The <see cref="HDirection"/> of the <see cref="IHEntity"/>'s head.</param>
        /// <param name="bodyDirection">The <see cref="HDirection"/> of the <see cref="IHEntity"/>'s body.</param>
        /// <param name="lastAction">The <see cref="HAction"/> that the <see cref="IHEntity"/> has recently done.</param>
        public HEntityAction(bool isEmpowered, int index, HPoint tile, HPoint movingTo,
            HSign sign, HStance stance, HDirection headDirection, HDirection bodyDirection, HAction lastAction)
        {
            Index = index;
            IsEmpowered = isEmpowered;

            Tile = tile;
            MovingTo = movingTo;

            Sign = sign;
            Stance = stance;

            HeadDirection = headDirection;
            BodyDirection = bodyDirection;

            LastAction = lastAction;
        }
        public PlayerActionEventArgs(HMessage packet)
        {
            _packet = packet;
            Header = _packet.Header;
            int x, y;
            string z, actionTxt;

            int position = 0;
            PlayerCount = _packet.ReadInt(ref position);
            PlayerIndex = _packet.ReadInt(ref position);
            x = _packet.ReadInt(ref position);
            y = _packet.ReadInt(ref position);
            z = _packet.ReadString(ref position);
            Tile = new HPoint(x, y, z);
            HeadDirection = (HDirection)_packet.ReadInt(ref position);
            BodyDirection = (HDirection)_packet.ReadInt(ref position);
            actionTxt = _packet.ReadString(ref position);
            actionTxt = actionTxt.GetChild("//mv ", '/');
        }
Exemplo n.º 23
0
        public FurnitureDropEventArgs(Func<Task> continuation, int step, HMessage packet)
            : base(continuation, step, packet)
        {
            Id = Packet.ReadInteger();
            TypeId = Packet.ReadInteger();

            int x = Packet.ReadInteger();
            int y = Packet.ReadInteger();

            Direction = (HDirection)Packet.ReadInteger();
            Tile = new HPoint(x, y, double.Parse(Packet.ReadString()));

            Packet.ReadString();
            Packet.ReadInteger();
            Packet.ReadInteger();
            Packet.ReadString();

            IsRental = (Packet.ReadInteger() != 1);
            Packet.ReadInteger();

            OwnerId = Packet.ReadInteger();
            OwnerName = Packet.ReadString();
        }
Exemplo n.º 24
0
        public HFurniture(HMessage packet)
        {
            Id     = packet.ReadInteger();
            TypeId = packet.ReadInteger();

            Tile   = new HPoint(packet.ReadInteger(), packet.ReadInteger());
            Facing = (HDirection)packet.ReadInteger();
            Tile.Z = double.Parse(packet.ReadString(), CultureInfo.InvariantCulture);

            var loc1 = packet.ReadString();
            var loc3 = packet.ReadInteger();

            Category = packet.ReadInteger();
            Stuff    = ReadData(packet, Category);

            var loc4 = packet.ReadInteger();
            var loc5 = packet.ReadInteger();

            OwnerId = packet.ReadInteger();
            if (TypeId < 0)
            {
                var loc6 = packet.ReadString();
            }
        }
Exemplo n.º 25
0
 public bool IsWalkable(HPoint tile)
 {
     return(IsWalkable(tile.X, tile.Y));
 }
Exemplo n.º 26
0
 public bool IsWalkable(HPoint tile)
 {
     return IsWalkable(tile.X, tile.Y);
 }
Exemplo n.º 27
0
        public HEntityUpdate(HMessage packet)
        {
            Index = packet.ReadInteger();

            Tile = new HPoint(packet.ReadInteger(), packet.ReadInteger(),
                              double.Parse(packet.ReadString(), CultureInfo.InvariantCulture));

            HeadFacing = (HDirection)packet.ReadInteger();
            BodyFacing = (HDirection)packet.ReadInteger();

            string action = packet.ReadString();

            string[] actionData = action.Split(
                new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string actionInfo in actionData)
            {
                string[] actionValues = actionInfo.Split(' ');

                if (actionValues.Length < 2)
                {
                    continue;
                }
                if (string.IsNullOrWhiteSpace(actionValues[0]))
                {
                    continue;
                }

                switch (actionValues[0])
                {
                case "flatctrl":
                {
                    IsController = true;
                    break;
                }

                case "mv":
                {
                    string[] values = actionValues[1].Split(',');
                    if (values.Length >= 3)
                    {
                        MovingTo = new HPoint(int.Parse(values[0]), int.Parse(values[1]),
                                              double.Parse(values[2], CultureInfo.InvariantCulture));
                    }
                    Action = HAction.Move;
                    break;
                }

                case "sit":
                {
                    Action = HAction.Sit;
                    Stance = HStance.Sit;
                    break;
                }

                case "lay":
                {
                    Action = HAction.Lay;
                    Stance = HStance.Lay;
                    break;
                }

                case "sign":
                {
                    Sign   = (HSign)int.Parse(actionValues[1]);
                    Action = HAction.Sign;
                    break;
                }
                }
            }
        }
Exemplo n.º 28
0
 public HostWalkEventArgs(Func<Task> continuation, int step, HMessage packet)
     : base(continuation, step, packet)
 {
     Tile = new HPoint(packet.ReadInteger(0),
         packet.ReadInteger(4));
 }
Exemplo n.º 29
0
 public TileEventArgs(HPoint tile,
     MouseButtons button, int clicks, int x, int y, int delta)
     : base(button, clicks, x, y, delta)
 {
     Tile = tile;
 }
Exemplo n.º 30
0
 public HostWalkEventArgs(int Header, int X, int Y)
     : base()
 {
     this.Header = Header;
     this.Tile   = new HPoint(X, Y);
 }
Exemplo n.º 31
0
 public bool Equals(HPoint other)
 {
     return(_point.Equals(other._point) && _x == other._x && _y == other._y && string.Equals(_z, other._z));
 }
Exemplo n.º 32
0
 static HPoint()
 {
     Empty = new HPoint(0, 0, "0.0");
 }
Exemplo n.º 33
0
 public HostClickPlayerEventArgs(Func<Task> continuation, int step, HMessage packet)
     : base(continuation, step, packet)
 {
     Id = packet.ReadInteger();
     Tile = new HPoint(packet.ReadInteger(), packet.ReadInteger());
 }
Exemplo n.º 34
0
 public void PaintTile(HPoint tile, Color marker)
 {
     PaintTile(tile.X, tile.Y, marker);
 }