1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

107 lines
2.8 KiB

Scriptname ArtifactTrackerPlayer extends ReferenceAlias
FormList Property ETR_ItemsNew Auto
FormList Property ETR_ItemsFound Auto
FormList Property ETR_ItemsStored Auto
int iFollowerIndex = 0
int iArtifactCount = 0
event OnInit()
Utility.wait(3.0) ; wait for quickstart scripts to finish
OnPlayerLoadGame()
endevent
Event OnPlayerLoadGame()
if ! Load()
ETR_ItemsNew.Revert()
ETR_ItemsFound.Revert()
ETR_ItemsStored.Revert()
UnregisterForUpdate()
Debug.Notification("Failed to initialize ArtifactTracker.dll")
return
endif
if skse.GetPluginVersion("Ahzaab's moreHUD Plugin") >= 30800
ahzmorehud.RegisterIconFormList("dbmNew", ETR_ItemsNew)
ahzmorehud.RegisterIconFormList("dbmFound", ETR_ItemsFound)
ahzmorehud.RegisterIconFormList("dbmDisp", ETR_ItemsStored)
endif
if skse.GetPluginVersion("Ahzaab's moreHUD Inventory Plugin") >= 10017
ahzmorehudie.RegisterIconFormList("dbmNew", ETR_ItemsNew)
ahzmorehudie.RegisterIconFormList("dbmFound", ETR_ItemsFound)
ahzmorehudie.RegisterIconFormList("dbmDisp", ETR_ItemsStored)
endif
if SKSE.GetPluginVersion("QuickLootEE") >= 0
QuickLootEE.RegisterNewItemsList(ETR_ItemsNew)
QuickLootEE.RegisterDisplayedItemsList(ETR_ItemsStored)
QuickLootEE.RegisterFoundItemsList(ETR_ItemsFound)
endif
int iNewArtifactCount = GetArtifactCount()
if iNewArtifactCount != iArtifactCount
iArtifactCount = iNewArtifactCount
Debug.Notification("Artifact list changed, rebuilding the list")
ETR_ItemsNew.Revert() ; rebuild the list
endif
; Rebuild all lists to avoid discrepancies, stale data, and broken records
RescanStoredArtifacts()
RescanFoundArtifacts()
RescanNewArtifacts()
EndEvent
Event OnLocationChange(Location akOldLoc, Location akNewLoc)
int iCurrentFollowers = 0;
Actor[] aFollowers = GetPlayerFollowers()
int i = aFollowers.length
while i > 0
i -= 1
iCurrentFollowers += aFollowers[i].GetFormID()
endwhile
if iCurrentFollowers != iFollowerIndex
iFollowerIndex = iCurrentFollowers
RegisterForSingleUpdate(5.0) ; wait until followers load into the location
endif
endEvent
Event OnUpdate()
Debug.Notification("Team changed, updating ETR_ItemsFound")
RescanFoundArtifacts()
EndEvent
; NATIVE FUNCTIONS
bool function Load() native global
int function GetArtifactCount() native global
function RescanStoredArtifacts() native global
function RescanFoundArtifacts() native global
function RescanNewArtifacts() native global
ObjectReference function GetCellStorage() native global
ObjectReference function GetCurrentContainer() native global
function SyncCellStorage() native global
Actor[] function GetPlayerFollowers() native global
function RegisterPersistentStorage(ObjectReference ref) native global