Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PartyFinderListing"/> class.
        /// </summary>
        /// <param name="listing">The interop listing data.</param>
        /// <param name="dataManager">The DataManager instance.</param>
        /// <param name="seStringManager">The SeStringManager instance.</param>
        internal PartyFinderListing(PartyFinderPacketListing listing, DataManager dataManager, SeStringManager seStringManager)
        {
            this.objective          = listing.Objective;
            this.conditions         = listing.Conditions;
            this.dutyFinderSettings = listing.DutyFinderSettings;
            this.lootRules          = listing.LootRules;
            this.searchArea         = listing.SearchArea;
            this.slots       = listing.Slots.Select(accepting => new PartyFinderSlot(accepting)).ToArray();
            this.jobsPresent = listing.JobsPresent;

            this.Id               = listing.Id;
            this.ContentIdLower   = listing.ContentIdLower;
            this.Name             = seStringManager.Parse(listing.Name.TakeWhile(b => b != 0).ToArray());
            this.Description      = seStringManager.Parse(listing.Description.TakeWhile(b => b != 0).ToArray());
            this.World            = new Lazy <World>(() => dataManager.GetExcelSheet <World>().GetRow(listing.World));
            this.HomeWorld        = new Lazy <World>(() => dataManager.GetExcelSheet <World>().GetRow(listing.HomeWorld));
            this.CurrentWorld     = new Lazy <World>(() => dataManager.GetExcelSheet <World>().GetRow(listing.CurrentWorld));
            this.Category         = (DutyFinderCategory)listing.Category;
            this.RawDuty          = listing.Duty;
            this.Duty             = new Lazy <ContentFinderCondition>(() => dataManager.GetExcelSheet <ContentFinderCondition>().GetRow(listing.Duty));
            this.DutyType         = (DutyType)listing.DutyType;
            this.BeginnersWelcome = listing.BeginnersWelcome == 1;
            this.SecondsRemaining = listing.SecondsRemaining;
            this.MinimumItemLevel = listing.MinimumItemLevel;
            this.Parties          = listing.NumParties;
            this.SlotsAvailable   = listing.NumSlots;
            this.JobsPresent      = listing.JobsPresent
                                    .Select(id => new Lazy <ClassJob>(
                                                () => id == 0
                        ? null
                        : dataManager.GetExcelSheet <ClassJob>().GetRow(id)))
                                    .ToArray();
        }
Beispiel #2
0
        internal PartyFinderListing(PartyFinder.Listing listing, DataManager dataManager, SeStringManager seStringManager)
        {
            this.objective          = listing.objective;
            this.conditions         = listing.conditions;
            this.dutyFinderSettings = listing.dutyFinderSettings;
            this.lootRules          = listing.lootRules;
            this.searchArea         = listing.searchArea;
            this.slots       = listing.slots.Select(accepting => new PartyFinderSlot(accepting)).ToArray();
            this.jobsPresent = listing.jobsPresent;

            Id               = listing.id;
            ContentIdLower   = listing.contentIdLower;
            Name             = seStringManager.Parse(listing.name.TakeWhile(b => b != 0).ToArray());
            Description      = seStringManager.Parse(listing.description.TakeWhile(b => b != 0).ToArray());
            World            = new Lazy <World>(() => dataManager.GetExcelSheet <World>().GetRow(listing.world));
            HomeWorld        = new Lazy <World>(() => dataManager.GetExcelSheet <World>().GetRow(listing.homeWorld));
            CurrentWorld     = new Lazy <World>(() => dataManager.GetExcelSheet <World>().GetRow(listing.currentWorld));
            Category         = (Category)listing.category;
            RawDuty          = listing.duty;
            Duty             = new Lazy <ContentFinderCondition>(() => dataManager.GetExcelSheet <ContentFinderCondition>().GetRow(listing.duty));
            DutyType         = (DutyType)listing.dutyType;
            BeginnersWelcome = listing.beginnersWelcome == 1;
            SecondsRemaining = listing.secondsRemaining;
            MinimumItemLevel = listing.minimumItemLevel;
            Parties          = listing.numParties;
            SlotsAvailable   = listing.numSlots;
            JobsPresent      = listing.jobsPresent
                               .Select(id => new Lazy <ClassJob>(() => id == 0
                                                                          ? null
                                                                          : dataManager.GetExcelSheet <ClassJob>().GetRow(id)))
                               .ToArray();
        }
Beispiel #3
0
        /// <summary>
        /// Read an SeString from a specified memory address.
        /// </summary>
        /// <param name="memoryAddress">The memory address to read from.</param>
        /// <param name="maxLength">The maximum length of the string.</param>
        /// <returns>The read in string.</returns>
        public static SeString ReadSeString(IntPtr memoryAddress, int maxLength)
        {
            ReadRaw(memoryAddress, maxLength, out var buffer);

            var eos = Array.IndexOf(buffer, (byte)0);

            if (eos < 0)
            {
                return(seStringManager.Parse(buffer));
            }
            else
            {
                var newBuffer = new byte[eos];
                Buffer.BlockCopy(buffer, 0, newBuffer, 0, eos);
                return(seStringManager.Parse(newBuffer));
            }
        }
Beispiel #4
0
        public void TestNewLinePayload()
        {
            var manager             = new SeStringManager(null);
            var newLinePayloadBytes = new byte[] { 0x02, 0x10, 0x01, 0x03 };

            var seString = manager.Parse(newLinePayloadBytes);

            Assert.True(newLinePayloadBytes.SequenceEqual(seString.Encode()));
        }
Beispiel #5
0
        /// <summary>
        /// Read a null-terminated SeString from a specified memory address.
        /// </summary>
        /// <param name="memoryAddress">The memory address to read from.</param>
        /// <returns>The read in string.</returns>
        public static SeString ReadSeStringNullTerminated(IntPtr memoryAddress)
        {
            var buffer = ReadRawNullTerminated(memoryAddress);

            return(seStringManager.Parse(buffer));
        }