private GemDefinition(uint typeId, string name, string internalName, uint buffId, char socketType)
 {
     TypeId       = typeId;
     Name         = name;
     InternalName = internalName;
     Buff         = Amalur.GetBuff(buffId);
     SocketType   = socketType;
 }
            public ItemBuffMemory(StashItem stashItem, int endOfSection)
            {
                (_stashItem, _endOfSection) = (stashItem, endOfSection);
                int count     = Count;
                var firstBuff = Offsets.FirstItemBuff;

                for (int i = 0; i < count; i++)
                {
                    var buffId = MemoryUtilities.Read <uint>(Bytes, firstBuff + (i * 16) + 4);
                    List.Add(Amalur.GetBuff(buffId));
                }
            }
Exemple #3
0
 public Item(GameSave gameSave, int typeIdOffset, int offset, int dataLength, int itemBuffsOffset, int itemBuffsLength, int itemGemsOffset, int itemGemsLength)
 {
     (_gameSave, TypeIdOffset, ItemOffset) = (gameSave, typeIdOffset, offset);
     _levelShiftOffset = (byte)(8 * gameSave.Body[TypeIdOffset + 10]);
     ItemBytes         = _gameSave.Body.AsSpan(offset, dataLength).ToArray();
     ItemSockets       = new ItemSockets(gameSave, itemGemsOffset, itemGemsLength);
     ItemBuffs         = new ItemBuffMemory(gameSave, itemBuffsOffset, itemBuffsLength);
     PlayerBuffs       = new List <Buff>(BuffCount);
     for (int i = 0; i < PlayerBuffs.Capacity; i++)
     {
         PlayerBuffs.Add(Amalur.GetBuff(MemoryUtilities.Read <uint>(ItemBytes, Offsets.FirstBuff + i * 8)));
     }
     if (HasCustomName)
     {
         ItemName = Encoding.UTF8.GetString(ItemBytes, Offsets.Name, NameLength);
     }
 }
        private static bool TryParseBuffList(string value, [NotNullWhen(true)] out Buff[]?buffs)
        {
            buffs = null;
            if (value.Length % 6 != 0)
            {
                return(false);
            }
            var results = value.Length == 0 ? Array.Empty <Buff>() : new Buff[value.Length / 6];

            for (int i = 0; i < results.Length; i++)
            {
                if (!uint.TryParse(value.Substring(i * 6, 6), NumberStyles.HexNumber, null, out uint buffId))
                {
                    return(false);
                }
                results[i] = Amalur.GetBuff(buffId);
            }
            buffs = results;
            return(true);
        }
Exemple #5
0
        public StashItem(GameSave gameSave, int offset, int dataLength, Gem[] gems)
        {
            ItemOffset           = offset;
            Bytes                = gameSave.Body.AsSpan(offset, dataLength).ToArray();
            PlayerBuffs.Capacity = BuffCount;
            var firstBuff = Offsets.FirstBuff;

            for (int i = 0; i < PlayerBuffs.Capacity; i++)
            {
                PlayerBuffs.Add(Amalur.GetBuff(MemoryUtilities.Read <uint>(Bytes, firstBuff + (i * 8))));
            }
            if (HasCustomName)
            {
                ItemName = Encoding.UTF8.GetString(Bytes, Offsets.Name, NameLength);
            }
            Gems = gems;
            // socket section is either FF
            // or 20 02, followed by int32 count, and int32 handle per gem.
            int socketsStart = gems.Length == 0
                ? Bytes.Length - 1
                : gems[0].ItemOffset - offset - (4 * (1 + gems.Length)) - 2;

            ItemBuffs = Bytes[Offsets.HasItemBuffs] == 0x14 ? new ItemBuffMemory(this, socketsStart) : Definition.ItemBuffs;
        }