Ejemplo n.º 1
0
    public HItem(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        RoomItemId = format.Read <int>(ref packetSpan);
        Type       = (HProductType)format.ReadUTF8(ref packetSpan)[0];
        Id         = format.Read <int>(ref packetSpan);
        TypeId     = format.Read <int>(ref packetSpan);
        Category   = (HFurniCategory)format.Read <int>(ref packetSpan);

        StuffData = HStuffData.Parse(format, ref packetSpan);

        IsRecyclable = format.Read <bool>(ref packetSpan);
        IsTradable   = format.Read <bool>(ref packetSpan);
        IsGroupable  = format.Read <bool>(ref packetSpan);
        IsSellable   = format.Read <bool>(ref packetSpan);

        CanPlaceInMarketplace = format.Read <bool>(ref packetSpan);
        SecondsToExpiration   = format.Read <int>(ref packetSpan);

        HasRentPeriodStarted = format.Read <bool>(ref packetSpan);
        RoomId = format.Read <int>(ref packetSpan);

        if (Type == HProductType.Stuff)
        {
            SlotId = format.ReadUTF8(ref packetSpan);
            Extra  = format.Read <int>(ref packetSpan);
        }
    }
Ejemplo n.º 2
0
    public HCatalogProduct(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Type = (HProductType)format.ReadUTF8(ref packetSpan)[0];
        switch (Type)
        {
        case HProductType.Badge:
        {
            ExtraData    = format.ReadUTF8(ref packetSpan);
            ProductCount = 1;
            break;
        }

        default:
        {
            ClassId      = format.Read <int>(ref packetSpan);
            ExtraData    = format.ReadUTF8(ref packetSpan);
            ProductCount = format.Read <int>(ref packetSpan);
            if (IsLimited = format.Read <bool>(ref packetSpan))
            {
                LimitedTotal     = format.Read <int>(ref packetSpan);
                LimitedRemaining = format.Read <int>(ref packetSpan);
            }
            break;
        }
        }
    }
Ejemplo n.º 3
0
    public HCatalogPage(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id          = format.Read <int>(ref packetSpan);
        CatalogType = format.ReadUTF8(ref packetSpan);
        LayoutCode  = format.ReadUTF8(ref packetSpan);

        Images = new string[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Images.Length; i++)
        {
            Images[i] = format.ReadUTF8(ref packetSpan);
        }

        Texts = new string[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Texts.Length; i++)
        {
            Texts[i] = format.ReadUTF8(ref packetSpan);
        }

        Offers = new HCatalogOffer[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Offers.Length; i++)
        {
            Offers[i] = new HCatalogOffer(format, ref packetSpan);
        }

        OfferId = format.Read <int>(ref packetSpan);
        AcceptSeasonCurrencyAsCredits = format.Read <bool>(ref packetSpan);

        IsFrontPage = !packetSpan.IsEmpty;
    }
Ejemplo n.º 4
0
    public HFloorObject(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id     = format.Read <int>(ref packetSpan);
        TypeId = format.Read <int>(ref packetSpan);

        int x = format.Read <int>(ref packetSpan);
        int y = format.Read <int>(ref packetSpan);

        Facing = (HDirection)format.Read <int>(ref packetSpan);
        Tile   = new HPoint(x, y, float.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture));

        Height = double.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture);
        Extra  = format.Read <int>(ref packetSpan);

        StuffData = HStuffData.Parse(format, ref packetSpan);

        SecondsToExpiration = format.Read <int>(ref packetSpan);
        UsagePolicy         = (HUsagePolicy)format.Read <int>(ref packetSpan);

        OwnerId = format.Read <int>(ref packetSpan);
        if (TypeId < 0)
        {
            StaticClass = format.ReadUTF8(ref packetSpan);
        }
    }
Ejemplo n.º 5
0
    public HWallItem(IHFormat format, ref ReadOnlySpan <byte> packetData)
    {
        Id                  = int.Parse(format.ReadUTF8(ref packetData));
        TypeId              = format.Read <int>(ref packetData);
        Location            = format.ReadUTF8(ref packetData);
        Data                = format.ReadUTF8(ref packetData);
        SecondsToExpiration = format.Read <int>(ref packetData);
        UsagePolicy         = (HUsagePolicy)format.Read <int>(ref packetData);
        OwnerId             = format.Read <int>(ref packetData);

        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][3..];
Ejemplo n.º 6
0
    public HSlideObjectBundle(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        int locationX = format.Read <int>(ref packetSpan);
        int locationY = format.Read <int>(ref packetSpan);

        int    targetX = format.Read <int>(ref packetSpan);
        int    targetY = format.Read <int>(ref packetSpan);
        HPoint location, target;

        Objects = new HSlideObject[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Objects.Length; i++)
        {
            int objectId = format.Read <int>(ref packetSpan);

            location = new HPoint(locationX, locationY, float.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture));
            target   = new HPoint(targetX, targetY, float.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture));

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

        Id = format.Read <int>(ref packetSpan);
        if (!packetSpan.IsEmpty)
        {
            var type = (HMoveType)format.Read <int>(ref packetSpan);

            int entityIndex = format.Read <int>(ref packetSpan);
            location = new HPoint(locationX, locationY, float.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture));
            target   = new HPoint(targetX, targetY, float.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture));

            Entity = new HSlideObject(entityIndex, location, target, type);
        }
    }
Ejemplo n.º 7
0
    public static HPerk[] Parse(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        var perkAllowances = new HPerk[format.Read <int>(ref packetSpan)];

        for (int i = 0; i < perkAllowances.Length; i++)
        {
            perkAllowances[i] = new HPerk(format.ReadUTF8(ref packetSpan),
                                          format.ReadUTF8(ref packetSpan), format.Read <bool>(ref packetSpan));
        }
        return(perkAllowances);
    }
Ejemplo n.º 8
0
    public HGroupEntry(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id             = format.Read <int>(ref packetSpan);
        Name           = format.ReadUTF8(ref packetSpan);
        BadgeCode      = format.ReadUTF8(ref packetSpan);
        PrimaryColor   = format.ReadUTF8(ref packetSpan);
        SecondaryColor = format.ReadUTF8(ref packetSpan);

        Favorite = format.Read <bool>(ref packetSpan);
        OwnerId  = format.Read <int>(ref packetSpan);
        HasForum = format.Read <bool>(ref packetSpan);
    }
Ejemplo n.º 9
0
    public HMapStuffData(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
        : this()
    {
        int length = format.Read <int>(ref packetSpan);

        Data = new(length);

        for (int i = 0; i < length; i++)
        {
            Data[format.ReadUTF8(ref packetSpan)] = format.ReadUTF8(ref packetSpan);
        }
    }
Ejemplo n.º 10
0
    public static HNavigatorSearchResult[] Parse(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        string searchCode = format.ReadUTF8(ref packetSpan);
        string filter     = format.ReadUTF8(ref packetSpan);

        var results = new HNavigatorSearchResult[format.Read <int>(ref packetSpan)];

        for (int i = 0; i < results.Length; i++)
        {
            results[i] = new HNavigatorSearchResult(format, ref packetSpan);
        }
        return(results);
    }
Ejemplo n.º 11
0
    public HPoll(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id = format.Read <int>(ref packetSpan);

        StartMessage = format.ReadUTF8(ref packetSpan);
        EndMessage   = format.ReadUTF8(ref packetSpan);

        Questions = new HPollQuestion[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Questions.Length; i++)
        {
            Questions[i] = new HPollQuestion(format, ref packetSpan);
        }
        format.Read <bool>(ref packetSpan);
    }
Ejemplo n.º 12
0
    public HNavigatorSearchResult(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        SearchCode = format.ReadUTF8(ref packetSpan);
        Text       = format.ReadUTF8(ref packetSpan);

        ActionAllowed = format.Read <int>(ref packetSpan);
        ForceClosed   = format.Read <bool>(ref packetSpan);
        ViewMode      = format.Read <int>(ref packetSpan);

        Rooms = new HRoomEntry[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Rooms.Length; i++)
        {
            Rooms[i] = new HRoomEntry(format, ref packetSpan);
        }
    }
Ejemplo n.º 13
0
    /// <summary>
    /// Reads a string from <paramref name="source"/> and then 'advances'.
    /// </summary>
    /// <exception cref="IndexOutOfRangeException">Thrown if the <paramref name="source"/> does not have enough data to read a string.</exception>
    public static string ReadUTF8(this IHFormat format, ref ReadOnlySpan <byte> source)
    {
        string value = format.ReadUTF8(source, out int bytesRead);

        source = source.Slice(bytesRead);
        return(value);
    }
Ejemplo n.º 14
0
 public HCrackableStuffData(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
     : this()
 {
     State  = format.ReadUTF8(ref packetSpan);
     Hits   = format.Read <int>(ref packetSpan);
     Target = format.Read <int>(ref packetSpan);
 }
Ejemplo n.º 15
0
    public HUserSearchResult(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id    = format.Read <int>(ref packetSpan);
        Name  = format.ReadUTF8(ref packetSpan);
        Motto = format.ReadUTF8(ref packetSpan);

        IsOnline  = format.Read <bool>(ref packetSpan);
        CanFollow = format.Read <bool>(ref packetSpan);

        format.ReadUTF8(ref packetSpan);

        Gender = format.Read <int>(ref packetSpan) == 1 ? HGender.Male : HGender.Female;
        Figure = format.ReadUTF8(ref packetSpan);

        RealName = format.ReadUTF8(ref packetSpan);
    }
Ejemplo n.º 16
0
    public static HCatalogNode Parse(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        var    root = new HCatalogNode(format, ref packetSpan);
        bool   newAdditionsAvailable = format.Read <bool>(ref packetSpan);
        string catalogType           = format.ReadUTF8(ref packetSpan);

        return(root);
    }
Ejemplo n.º 17
0
    public HPetInformation(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id   = format.Read <int>(ref packetSpan);
        Name = format.ReadUTF8(ref packetSpan);

        Level    = format.Read <int>(ref packetSpan);
        MaxLevel = format.Read <int>(ref packetSpan);

        Experience    = format.Read <int>(ref packetSpan);
        MaxExperience = format.Read <int>(ref packetSpan);

        Energy    = format.Read <int>(ref packetSpan);
        MaxEnergy = format.Read <int>(ref packetSpan);

        Nutrition    = format.Read <int>(ref packetSpan);
        MaxNutrition = format.Read <int>(ref packetSpan);

        Scratches = format.Read <int>(ref packetSpan);
        OwnerId   = format.Read <int>(ref packetSpan);
        Age       = format.Read <int>(ref packetSpan);
        OwnerName = format.ReadUTF8(ref packetSpan);

        BreedId = format.Read <int>(ref packetSpan);

        HasFreeSaddle = format.Read <bool>(ref packetSpan);
        IsRiding      = format.Read <bool>(ref packetSpan);

        SkillThresholds = new int[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < SkillThresholds.Length; i++)
        {
            SkillThresholds[i] = format.Read <int>(ref packetSpan);
        }
        AccessRights = format.Read <int>(ref packetSpan);

        CanBreed   = format.Read <bool>(ref packetSpan);
        CanHarvest = format.Read <bool>(ref packetSpan);
        CanRevive  = format.Read <bool>(ref packetSpan);

        RarityLevel               = format.Read <int>(ref packetSpan);
        MaxWellBeingSeconds       = format.Read <int>(ref packetSpan);
        RemainingWellBeingSeconds = format.Read <int>(ref packetSpan);
        RemainingGrowingSeconds   = format.Read <int>(ref packetSpan);

        HasBreedingPermission = format.Read <bool>(ref packetSpan);
    }
Ejemplo n.º 18
0
 public HHighScoreData(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
 {
     Score = format.Read <int>(ref packetSpan);
     Users = new string[format.Read <int>(ref packetSpan)];
     for (int i = 0; i < Users.Length; i++)
     {
         Users[i] = format.ReadUTF8(ref packetSpan);
     }
 }
Ejemplo n.º 19
0
 public HStringArrayStuffData(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
     : this()
 {
     Data = new string[format.Read <int>(ref packetSpan)];
     for (int i = 0; i < Data.Length; i++)
     {
         Data[i] = format.ReadUTF8(ref packetSpan);
     }
 }
Ejemplo n.º 20
0
    public HFriendData(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id       = format.Read <int>(ref packetSpan);
        Username = format.ReadUTF8(ref packetSpan);
        Gender   = format.Read <int>(ref packetSpan) == 1 ? HGender.Male : HGender.Female;

        IsOnline   = format.Read <bool>(ref packetSpan);
        CanFollow  = format.Read <bool>(ref packetSpan);
        Figure     = format.ReadUTF8(ref packetSpan);
        CategoryId = format.Read <int>(ref packetSpan);
        Motto      = format.ReadUTF8(ref packetSpan);
        RealName   = format.ReadUTF8(ref packetSpan);
        format.ReadUTF8(ref packetSpan);

        IsPersisted = format.Read <bool>(ref packetSpan);
        format.Read <bool>(ref packetSpan);
        IsPocketHabboUser  = format.Read <bool>(ref packetSpan);
        RelationshipStatus = (HRelationship)format.Read <short>(ref packetSpan);
    }
Ejemplo n.º 21
0
    public HRoomEntry(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id   = format.Read <int>(ref packetSpan);
        Name = format.ReadUTF8(ref packetSpan);

        OwnerId   = format.Read <int>(ref packetSpan);
        OwnerName = format.ReadUTF8(ref packetSpan);

        DoorMode     = (HDoorMode)format.Read <int>(ref packetSpan);
        UserCount    = format.Read <int>(ref packetSpan);
        MaxUserCount = format.Read <int>(ref packetSpan);

        Description = format.ReadUTF8(ref packetSpan);
        TradeMode   = (HTradeMode)format.Read <int>(ref packetSpan);
        Ranking     = format.Read <int>(ref packetSpan);
        Stars       = format.Read <int>(ref packetSpan);
        Category    = (HRoomCategory)format.Read <int>(ref packetSpan);

        Tags = new string[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Tags.Length; i++)
        {
            Tags[i] = format.ReadUTF8(ref packetSpan);
        }

        HRoomFlags roomFlags = (HRoomFlags)format.Read <int>(ref packetSpan);

        if (roomFlags.HasFlag(HRoomFlags.HasCustomThumbnail))
        {
            ThumbnailUrl = format.ReadUTF8(ref packetSpan);
        }
        if (roomFlags.HasFlag(HRoomFlags.HasGroup))
        {
            GroupId        = format.Read <int>(ref packetSpan);
            GroupName      = format.ReadUTF8(ref packetSpan);
            GroupBadgeCode = format.ReadUTF8(ref packetSpan);
        }
        if (roomFlags.HasFlag(HRoomFlags.HasAdvertisement))
        {
            AdName             = format.ReadUTF8(ref packetSpan);
            AdDescription      = format.ReadUTF8(ref packetSpan);
            AdExpiresInMinutes = format.Read <int>(ref packetSpan);
        }

        ShowOwner   = roomFlags.HasFlag(HRoomFlags.ShowOwner);
        AllowPets   = roomFlags.HasFlag(HRoomFlags.AllowPets);
        ShowEntryAd = roomFlags.HasFlag(HRoomFlags.ShowRoomAd);
    }
Ejemplo n.º 22
0
    public HCatalogNode(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Visible = format.Read <bool>(ref packetSpan);

        Icon         = format.Read <int>(ref packetSpan);
        PageId       = format.Read <int>(ref packetSpan);
        PageName     = format.ReadUTF8(ref packetSpan);
        Localization = format.ReadUTF8(ref packetSpan);

        OfferIds = new int[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < OfferIds.Length; i++)
        {
            OfferIds[i] = format.Read <int>(ref packetSpan);
        }

        Children = new HCatalogNode[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Children.Length; i++)
        {
            Children[i] = new HCatalogNode(format, ref packetSpan);
        }
    }
Ejemplo n.º 23
0
    public HUserObject(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id   = format.Read <int>(ref packetSpan);
        Name = format.ReadUTF8(ref packetSpan);

        Figure = format.ReadUTF8(ref packetSpan);
        Gender = (HGender)format.ReadUTF8(ref packetSpan)[0];

        CustomData = format.ReadUTF8(ref packetSpan);
        RealName   = format.ReadUTF8(ref packetSpan);
        DirectMail = format.Read <bool>(ref packetSpan);

        RespectTotal  = format.Read <int>(ref packetSpan);
        RespectLeft   = format.Read <int>(ref packetSpan);
        ScratchesLeft = format.Read <int>(ref packetSpan);

        StreamPublishingAllowed = format.Read <bool>(ref packetSpan);

        if (DateTime.TryParse(format.ReadUTF8(ref packetSpan), out DateTime lastAccess))
        {
            LastAccess = lastAccess;
        }

        NameChangeAllowed   = format.Read <bool>(ref packetSpan);
        AccountSafetyLocked = format.Read <bool>(ref packetSpan);
    }
Ejemplo n.º 24
0
    public HHighScoreStuffData(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
        : this()
    {
        State     = format.ReadUTF8(ref packetSpan);
        ScoreType = (HScoreType)format.Read <int>(ref packetSpan);
        ClearType = (HScoreClearType)format.Read <int>(ref packetSpan);

        Entries = new HHighScoreData[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Entries.Length; i++)
        {
            Entries[i] = new HHighScoreData(format, ref packetSpan);
        }
    }
Ejemplo n.º 25
0
    public HUserProfile(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id               = format.Read <int>(ref packetSpan);
        Username         = format.ReadUTF8(ref packetSpan);
        Motto            = format.ReadUTF8(ref packetSpan);
        Figure           = format.ReadUTF8(ref packetSpan);
        CreationDate     = DateTime.Parse(format.ReadUTF8(ref packetSpan));
        AchievementScore = format.Read <int>(ref packetSpan);
        FriendCount      = format.Read <int>(ref packetSpan);

        IsFriend            = format.Read <bool>(ref packetSpan);
        IsFriendRequestSent = format.Read <bool>(ref packetSpan);
        IsOnline            = format.Read <bool>(ref packetSpan);

        Groups = new HGroupEntry[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Groups.Length; i++)
        {
            Groups[i] = new HGroupEntry(format, ref packetSpan);
        }

        SinceLastAccessInSeconds = format.Read <int>(ref packetSpan);
        OpenProfileView          = format.Read <bool>(ref packetSpan);
    }
Ejemplo n.º 26
0
    public HCatalogOffer(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id          = format.Read <int>(ref packetSpan);
        DisplayName = format.ReadUTF8(ref packetSpan);
        IsRentable  = format.Read <bool>(ref packetSpan);

        CreditCost        = format.Read <int>(ref packetSpan);
        OtherCurrencyCost = format.Read <int>(ref packetSpan);
        OtherCurrencyType = format.Read <int>(ref packetSpan);
        CanGift           = format.Read <bool>(ref packetSpan);

        Products = new HCatalogProduct[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Products.Length; i++)
        {
            Products[i] = new HCatalogProduct(format, ref packetSpan);
        }

        ClubLevel   = format.Read <int>(ref packetSpan);
        AllowBundle = format.Read <bool>(ref packetSpan);
        IsPet       = format.Read <bool>(ref packetSpan);

        PreviewImage = format.ReadUTF8(ref packetSpan);
    }
Ejemplo n.º 27
0
    public HPollQuestion(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Id = format.Read <int>(ref packetSpan);
        format.Read <int>(ref packetSpan);
        Type       = (HPollType)format.Read <int>(ref packetSpan);
        Text       = format.ReadUTF8(ref packetSpan);
        Category   = format.Read <int>(ref packetSpan);
        AnswerType = format.Read <int>(ref packetSpan);

        Choices = new HPollChoice[format.Read <int>(ref packetSpan)];
        for (int i = 0; i < Choices.Length; i++)
        {
            Choices[i] = new HPollChoice(format, ref packetSpan);
        }
    }
Ejemplo n.º 28
0
    public static HFloorObject[] Parse(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        int ownersCount = format.Read <int>(ref packetSpan);
        var owners      = new Dictionary <int, string>(ownersCount);

        for (int i = 0; i < ownersCount; i++)
        {
            owners.Add(format.Read <int>(ref packetSpan), format.ReadUTF8(ref packetSpan));
        }

        var floorObjects = new HFloorObject[format.Read <int>(ref packetSpan)];

        for (int i = 0; i < floorObjects.Length; i++)
        {
            var floorObject = new HFloorObject(format, ref packetSpan);
            floorObject.OwnerName = owners[floorObject.OwnerId];

            floorObjects[i] = floorObject;
        }
        return(floorObjects);
    }
Ejemplo n.º 29
0
    public HEntityUpdate(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
    {
        Index = format.Read <int>(ref packetSpan);

        Tile = new HPoint(format.Read <int>(ref packetSpan), format.Read <int>(ref packetSpan),
                          float.Parse(format.ReadUTF8(ref packetSpan), CultureInfo.InvariantCulture));

        HeadFacing = (HDirection)format.Read <int>(ref packetSpan);
        BodyFacing = (HDirection)format.Read <int>(ref packetSpan);

        string action = format.ReadUTF8(ref packetSpan);

        string[] actionData = action.Split('/', 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]),
                                          float.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;
            }
            }
        }
    }
Ejemplo n.º 30
0
 public HPollChoice(IHFormat format, ref ReadOnlySpan <byte> packetSpan)
 {
     Value = format.ReadUTF8(ref packetSpan);
     Text  = format.ReadUTF8(ref packetSpan);
     Type  = format.Read <int>(ref packetSpan);
 }