some party list style fixes

This commit is contained in:
goat 2020-04-22 21:29:14 +02:00
parent 427a7632ee
commit 19b09a9077

View file

@ -26,29 +26,30 @@ namespace Dalamud.Game.ClientState
{ {
Address = addressResolver; Address = addressResolver;
this.dalamud = dalamud; this.dalamud = dalamud;
partyListUpdateHook = new Hook<PartyListUpdateDelegate>(Address.PartyListUpdate, new PartyListUpdateDelegate(PartyListUpdateDetour), this); this.partyListUpdateHook = new Hook<PartyListUpdateDelegate>(Address.PartyListUpdate, new PartyListUpdateDelegate(PartyListUpdateDetour), this);
} }
public void Enable() public void Enable()
{ {
partyListUpdateHook.Enable(); this.partyListUpdateHook.Enable();
} }
public void Dispose() public void Dispose()
{ {
if (!this.isReady) if (!this.isReady)
partyListUpdateHook.Dispose(); this.partyListUpdateHook.Dispose();
isReady = false; this.isReady = false;
} }
private long PartyListUpdateDetour(IntPtr structBegin, long param2, char param3) private long PartyListUpdateDetour(IntPtr structBegin, long param2, char param3)
{ {
var result = partyListUpdateHook.Original(structBegin, param2, param3); var result = this.partyListUpdateHook.Original(structBegin, param2, param3);
partyListBegin = structBegin + 0xB48; this.partyListBegin = structBegin + 0xB48;
partyListUpdateHook.Dispose(); this.partyListUpdateHook.Dispose();
isReady = true; this.isReady = true;
return result; return result;
} }
public PartyMember this[int index] public PartyMember this[int index]
{ {
get get
@ -59,7 +60,7 @@ namespace Dalamud.Game.ClientState
return null; return null;
var tblIndex = partyListBegin + index * 24; var tblIndex = partyListBegin + index * 24;
var memberStruct = Marshal.PtrToStructure<Structs.PartyMember>(tblIndex); var memberStruct = Marshal.PtrToStructure<Structs.PartyMember>(tblIndex);
return new PartyMember(dalamud.ClientState.Actors, memberStruct); return new PartyMember(this.dalamud.ClientState.Actors, memberStruct);
} }
} }
@ -84,13 +85,13 @@ namespace Dalamud.Game.ClientState
public bool MoveNext() public bool MoveNext()
{ {
currentIndex++; this.currentIndex++;
return currentIndex != party.Length; return this.currentIndex != this.party.Length;
} }
public void Reset() public void Reset()
{ {
currentIndex = 0; this.currentIndex = 0;
} }
public PartyMember Current => this.party[this.currentIndex]; public PartyMember Current => this.party[this.currentIndex];