Beispiel #1
0
        public HFurniture(HPacket packet)
        {
            Id     = packet.ReadInt32();
            TypeId = packet.ReadInt32();

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

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

            int category = packet.ReadInt32();

            ReadData(packet, category);

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

            OwnerId = packet.ReadInt32();
            if (TypeId < 0)
            {
                var loc6 = packet.ReadUTF8();
            }
        }
Beispiel #2
0
        public HEntity(HPacket 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));

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

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

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

            case 4:
            {
                packet.ReadUTF8();
                packet.ReadInt32();
                packet.ReadUTF8();
                for (int j = packet.ReadInt32(); j > 0; j--)
                {
                    packet.ReadUInt16();
                }
                break;
            }
            }
        }
Beispiel #3
0
 public bool IsWalkable(HPoint tile)
 {
     return(IsWalkable(tile.X, tile.Y));
 }
Beispiel #4
0
        public HEntityAction(HPacket packet)
        {
            Index = packet.ReadInt32();

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

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

            string[] actionData = packet.ReadUTF8()
                                  .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":
                {
                    IsEmpowered = true;
                    break;
                }

                case "mv":
                {
                    string[] values = actionValues[1].Split(',');
                    if (values.Length >= 3)
                    {
                        Tile = 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;
                }
                }
            }
        }