Exemplo n.º 1
0
 private DateTime CalcuateAlarmTime(DateTime lastBuff, BuffDuration buffTime, int subtractTime, bool timeBefore)
 {
     if (!timeBefore)
     {
         return(lastBuff.AddHours((int)buffTime));
     }
     else
     {
         var time = lastBuff.AddHours((int)buffTime).Subtract(new TimeSpan(0, subtractTime, 0));
         return(time);
     }
 }
        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));
            }
        }
Exemplo n.º 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]);
        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);
        }
    }
Exemplo n.º 4
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;
    }
Exemplo n.º 5
0
 public void SetDuration(float duration)
 {
     this.duration = duration;
 }
Exemplo n.º 6
0
 public Buff(Unit caster)
     : base(caster)
 {
     this.target   = this.caster;
     this.duration = Internal.BuffDuration.Infinity;
 }
Exemplo n.º 7
0
 public Buff(Unit caster, float duration)
     : base(caster)
 {
     this.target   = this.caster;
     this.duration = duration;
 }
Exemplo n.º 8
0
 public void SetBuff(BuffDuration buffInfo)
 {
     SetBuff(buffInfo.buffid, buffInfo.buffDuration);
 }