public void SetCharacterEquipment(CharNames charName, byte equipmentEquipmentId,
                                          Func <CharMemLoc, IntPtr> addressSelector)
        {
            CharMemLoc charMemLoc = CharMemLoc.ByName(charName);
            var        bytes      = new[] { equipmentEquipmentId };

            _memoryAccessor.WriteMem(Settings.ProcessName, addressSelector(charMemLoc), bytes);
        }
        public byte GetCharacterEquipment(CharNames charName, Func <CharMemLoc, IntPtr> addressSelector)
        {
            CharMemLoc charMemLoc = CharMemLoc.ByName(charName);
            var        bytes      = new byte[1];

            _memoryAccessor.ReadMem(Settings.ProcessName, addressSelector(charMemLoc), bytes);
            return(bytes[0]);
        }
Example #3
0
        public string GetCharacterName(CharNames charName)
        {
            CharMemLoc cml = CharMemLoc.ByName(charName);

            byte[] bytes = new byte[cml.Name.NumBytes];
            _memoryAccessor.ReadMem(ProcessName, cml.Name.Address, bytes);

            string characterName = bytes.MapFf7BytesToString();

            return(characterName);
        }
Example #4
0
        public void SetCharacterName(CharNames charName, string newName)
        {
            CharMemLoc cml = CharMemLoc.ByName(charName);

            byte[] bytes = newName.MapStringToFf7Bytes();

            if (_momentAccessor.AtMomentOrLater(charName.AllowNamingAfter))
            {
                _memoryAccessor.WriteMem(ProcessName, cml.Name.Address, bytes);
            }
            _memoryAccessor.WriteMem(ProcessName, cml.StartingName.Address, bytes);
        }
Example #5
0
        public void RemoveArmletMateria(CharNames charNames, int keep = 0)
        {
            CharMemLoc charMemLoc = CharMemLoc.ByName(charNames);

            byte[] emptyRow = { byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue };

            for (int i = ItemSize * keep; i < charMemLoc.ArmorMateria.NumBytes; i += ItemSize)
            {
                IntPtr address = IntPtr.Add(charMemLoc.ArmorMateria.Address, i);
                var    bytes   = new byte[ItemSize];
                _memory.ReadMem(Settings.ProcessName, address, bytes);
                var materia = new MateriaSlot(bytes);
                AddMateria(materia.MateriaId, materia.Experience);
                _memory.WriteMem(Settings.ProcessName, address, emptyRow);
            }
        }