Skip to content

Commit

Permalink
Merge pull request #28 from sychotixdev/master
Browse files Browse the repository at this point in the history
Fixed player buffs by removing unnecessary extra cache list. List was…
  • Loading branch information
zaafar authored Sep 9, 2019
2 parents b1cd8a7 + eb8f20a commit 721c027
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Core/PoEMemory/Components/Life.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class Life : Component
private readonly CachedValue<List<Buff>> _cachedValueBuffs;
private readonly CachedValue<LifeComponentOffsets> _life;

private List<Buff> cacheBuff = new List<Buff>();

public Life() {
_life = new FrameCache<LifeComponentOffsets>(() => Address == 0 ? default : M.Read<LifeComponentOffsets>(Address));
_cachedValueBuffs = new FrameCache<List<Buff>>(ParseBuffs);
Expand Down Expand Up @@ -57,7 +55,7 @@ public List<Buff> ParseBuffs() {
var length = BuffLast - BuffStart;
var numBuffs = (int) length / 8;
if (length <= 0 || numBuffs >= MaxBuffCount || numBuffs <= 0 || BuffEnd <= 0) // * 8 as we buff pointer takes 8 bytes.
return cacheBuff;
return new List<Buff>();
var buffer = new long[numBuffs];
ProcessMemory.ReadProcessMemoryArray(M.OpenProcessHandle, (IntPtr) BuffStart, buffer, 0, numBuffs);

Expand All @@ -73,7 +71,6 @@ public List<Buff> ParseBuffs() {
if (!string.IsNullOrEmpty(buff.Name)) result.Add(buff);
}

cacheBuff = result;
return result;
}
catch (Exception e)
Expand Down

0 comments on commit 721c027

Please sign in to comment.