Exemple #1
0
        public static IEnumerable <Formula> ReadAchemistRecipes()
        {
            if (_baseAddress == 0)
            {
                throw new InvalidOperationException("Connect to Darkland process first!");
            }

            using (var accessor = new MemoryAccessor("dosbox"))
            {
                var bytes = new byte[FormulaeSize * CharacterCount];
                if (accessor.ReadMemory(_baseAddress + FormulaeMonitorOffset, bytes))
                {
                    return(ToFormulaeList(bytes));
                }
            }

            return(Enumerable.Empty <Formula>());
        }
Exemple #2
0
        public static IEnumerable <Character> ReadParty()
        {
            if (_baseAddress == 0)
            {
                throw new InvalidOperationException("Connect to Darkland process first!");
            }

            var knownSaints   = ReadKnownSaints().ToList();
            var knownFormulae = ReadKnownFormulae().ToList();

            var party = new List <Character>(NumberofCharacters);

            using (var accessor = new MemoryAccessor("dosbox"))
            {
                for (var i = 0; i < NumberofCharacters; i++)
                {
                    var bytes = new byte[Character.CharacterSize];
                    if (accessor.ReadMemory(_baseAddress + PartyOffset + i * Character.CharacterSize, bytes))
                    {
                        var character = new Character(new ByteStream(bytes), 0, i);

                        if (knownFormulae.Count() > i)
                        {
                            character.FormulaeBitmask = knownFormulae.ElementAt(i);
                        }
                        if (knownSaints.Count() > i)
                        {
                            character.SaintBitmask = knownSaints.ElementAt(i);
                        }

                        party.Add(character);
                    }
                }
            }

            return(party);
        }
Exemple #3
0
        public static IEnumerable <SaintBitmask> ReadKnownSaints()
        {
            if (_baseAddress == 0)
            {
                throw new InvalidOperationException("Connect to Darkland process first!");
            }

            var saints = new List <SaintBitmask>(NumberofCharacters);

            using (var accessor = new MemoryAccessor("dosbox"))
            {
                for (var i = 0; i < NumberofCharacters; i++)
                {
                    var bytes = new byte[SaintBitmask.SaintBitmaskSize];
                    if (accessor.ReadMemory(
                            _baseAddress + KnownSaintsOffset + i * SaintBitmask.SaintBitmaskSize, bytes))
                    {
                        saints.Add(SaintBitmask.FromBytes(bytes));
                    }
                }
            }

            return(saints);
        }
Exemple #4
0
        public static IEnumerable <FormulaeBitmask> ReadKnownFormulae()
        {
            if (_baseAddress == 0)
            {
                throw new InvalidOperationException("Connect to Darkland process first!");
            }

            var formulae = new List <FormulaeBitmask>(NumberofCharacters);

            using (var accessor = new MemoryAccessor("dosbox"))
            {
                for (var i = 0; i < NumberofCharacters; i++)
                {
                    var bytes = new byte[FormulaeBitmask.FormulaeBitmaskSize];
                    if (accessor.ReadMemory(
                            _baseAddress + KnownFormulaeOffset + i * FormulaeBitmask.FormulaeBitmaskSize, bytes))
                    {
                        formulae.Add(FormulaeBitmask.FromBytes(bytes));
                    }
                }
            }

            return(formulae);
        }