public ItemBuffMemory(StashItem stashItem, int endOfSection)
        {
            (_stashItem, _endOfSection) = (stashItem, endOfSection);
            var data = Bytes.AsSpan(Offsets.ItemBuffCount);

            BuffInstance.ReadList(ref data); // activeBuffs
            BuffInstance.ReadList(ref data); // inactiveBuffs
            var selfBuffs = BuffDuration.ReadList(ref data);

            foreach (var(buffId, _) in selfBuffs)
            {
                List.Add(Amalur.GetBuff(buffId));
            }
        }
示例#2
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]);
        Bytes             = _gameSave.Body.AsSpan(offset, dataLength).ToArray();
        ItemSockets       = new(gameSave, itemGemsOffset, itemGemsLength);
        ItemBuffs         = new(gameSave, this, itemBuffsOffset, itemBuffsLength);
        var span = Bytes.AsSpan(Offsets.BuffCount);

        foreach (var(buffId, _) in BuffDuration.ReadList(ref span))
        {
            PlayerBuffs.Add(Amalur.GetBuff(buffId));
        }
        if (HasCustomName)
        {
            ItemName = _gameSave.Encoding.GetString(Bytes, Offsets.Name, NameLength);
        }
    }
示例#3
0
    public StashItem(GameSave gameSave, int offset, int dataLength, Gem[] gems)
    {
        ItemOffset = offset;
        Bytes      = gameSave.Body.AsSpan(offset, dataLength).ToArray();
        var span = Bytes.AsSpan(Offsets.BuffCount);

        foreach (var(buffId, _) in BuffDuration.ReadList(ref span))
        {
            PlayerBuffs.Add(Amalur.GetBuff(buffId));
        }
        if (HasCustomName)
        {
            ItemName = gameSave.Encoding.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;
    }