commit
043eac23ed
9 changed files with 336 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,58 @@ |
|||||||
|
Scriptname ETR_CellStorageScript extends ObjectReference |
||||||
|
|
||||||
|
FormList Property ETR_ItemsNew Auto |
||||||
|
FormList Property ETR_ItemsFound Auto |
||||||
|
FormList Property ETR_ItemsStored Auto |
||||||
|
FormList Property ETR_PersistentStorageList Auto |
||||||
|
|
||||||
|
|
||||||
|
event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) |
||||||
|
Debug.Notification("OnItemRemoved") |
||||||
|
bool bStored = ETR_ItemsStored.HasForm(akBaseItem) |
||||||
|
|
||||||
|
if GetItemCount(akBaseItem) > 0 |
||||||
|
if ! bStored |
||||||
|
ETR_ItemsFound.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsStored.AddForm(akBaseItem) |
||||||
|
Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsStored.") |
||||||
|
endif |
||||||
|
return |
||||||
|
endif |
||||||
|
|
||||||
|
if Eddoursul_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) |
||||||
|
Debug.Notification("ETR_PersistentStorageList") |
||||||
|
; do nothing |
||||||
|
if ! bStored |
||||||
|
ETR_ItemsFound.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsStored.AddForm(akBaseItem) |
||||||
|
Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsStored.") |
||||||
|
endif |
||||||
|
|
||||||
|
else |
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsStored.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsFound.AddForm(akBaseItem) |
||||||
|
Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsFound.") |
||||||
|
|
||||||
|
endif |
||||||
|
|
||||||
|
endevent |
||||||
|
|
||||||
|
|
||||||
|
event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) |
||||||
|
|
||||||
|
if ETR_ItemsStored.HasForm(akBaseItem) |
||||||
|
return |
||||||
|
endif |
||||||
|
|
||||||
|
ETR_ItemsFound.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsStored.AddForm(akBaseItem) |
||||||
|
|
||||||
|
;UI.Invoke("HUD Menu", "_root.AHZWidgetContainer.AHZWidget.RefreshWidgets") |
||||||
|
|
||||||
|
Debug.Notification("Added " + akBaseItem.GetName() + " to cell storage and ETR_ItemsStored.") |
||||||
|
|
||||||
|
endevent |
@ -0,0 +1,112 @@ |
|||||||
|
Scriptname ETR_TrackFoundItems extends ReferenceAlias |
||||||
|
|
||||||
|
Actor Property PlayerRef Auto |
||||||
|
|
||||||
|
FormList Property ETR_ItemsNew Auto |
||||||
|
FormList Property ETR_ItemsFound Auto |
||||||
|
FormList Property ETR_ItemsStored Auto |
||||||
|
FormList Property ETR_PersistentStorageList Auto |
||||||
|
FormList Property ETR_ExcludeFromNew Auto |
||||||
|
|
||||||
|
Container Property ETR_CellStorageContainer Auto |
||||||
|
|
||||||
|
Keyword Property LocTypePlayerHouse Auto |
||||||
|
|
||||||
|
bool bAtHome = false |
||||||
|
int iFollowerIndex = 0 |
||||||
|
|
||||||
|
|
||||||
|
event OnInit() |
||||||
|
OnPlayerLoadGame() |
||||||
|
endevent |
||||||
|
|
||||||
|
|
||||||
|
Event OnPlayerLoadGame() |
||||||
|
AddInventoryEventFilter(ETR_ItemsFound) |
||||||
|
EndEvent |
||||||
|
|
||||||
|
|
||||||
|
Event OnLocationChange(Location akOldLoc, Location akNewLoc) |
||||||
|
|
||||||
|
bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse) |
||||||
|
|
||||||
|
int iCurrentFollowers = 0; |
||||||
|
Actor[] aFollowers = Eddoursul_Functions.GetPlayerFollowers() |
||||||
|
int i = aFollowers.length |
||||||
|
while i > 0 |
||||||
|
i -= 1 |
||||||
|
if ! aFollowers[i].IsDead() && ! aFollowers[i].IsDisabled() |
||||||
|
iCurrentFollowers += aFollowers[i].GetFormID() |
||||||
|
endif |
||||||
|
endwhile |
||||||
|
|
||||||
|
if iCurrentFollowers == iFollowerIndex |
||||||
|
return |
||||||
|
endif |
||||||
|
|
||||||
|
; If the list of followers has changed, rebuild ETR_ItemsFound and ETR_ItemsNew |
||||||
|
iFollowerIndex = iCurrentFollowers |
||||||
|
|
||||||
|
Debug.Notification("Team changed, updating lists") |
||||||
|
|
||||||
|
ETR_ItemsFound.Revert() |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
|
||||||
|
i = aFollowers.length |
||||||
|
while i > 0 |
||||||
|
i -= 1 |
||||||
|
if ! aFollowers[i].IsDead() && ! aFollowers[i].IsDisabled() |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
endif |
||||||
|
endwhile |
||||||
|
|
||||||
|
ETR_ItemsNew.Revert() |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 26, None, ETR_ExcludeFromNew) ; armor |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 41, None, ETR_ExcludeFromNew) ; weapons |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 27, None, ETR_ExcludeFromNew) ; books |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 32, None, ETR_ExcludeFromNew) ; misc items |
||||||
|
|
||||||
|
endEvent |
||||||
|
|
||||||
|
|
||||||
|
event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) |
||||||
|
|
||||||
|
if akDestContainer |
||||||
|
if akDestContainer as Actor |
||||||
|
if (akDestContainer as Actor).IsPlayerTeammate() |
||||||
|
; Keep follower items marked as found |
||||||
|
return |
||||||
|
endif |
||||||
|
elseif ETR_PersistentStorageList.HasForm(akDestContainer) |
||||||
|
ETR_ItemsFound.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsStored.AddForm(akBaseItem) |
||||||
|
Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsStored") |
||||||
|
return |
||||||
|
endif |
||||||
|
endif |
||||||
|
|
||||||
|
if bAtHome && (! akDestContainer || akDestContainer.GetParentCell() == PlayerRef.GetParentCell()) && Eddoursul_Functions.HasRefInCell(akBaseItem, None, true, ETR_PersistentStorageList) |
||||||
|
|
||||||
|
ObjectReference cellStorage = Eddoursul_Functions.GetOrCreateCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) |
||||||
|
|
||||||
|
if cellStorage.GetItemCount(akBaseItem) == 0 |
||||||
|
cellStorage.AddItem(akBaseItem, 1, true) |
||||||
|
endif |
||||||
|
|
||||||
|
elseif PlayerRef.GetItemCount(akBaseItem) == 0 && Eddoursul_Functions.GetItemCountInActors(Eddoursul_Functions.GetPlayerFollowers(), akBaseItem) == 0 |
||||||
|
|
||||||
|
Debug.Notification("Moving " + akBaseItem.GetName() + " to ETR_ItemsNew") |
||||||
|
ETR_ItemsFound.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsStored.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsNew.AddForm(akBaseItem) |
||||||
|
|
||||||
|
endif |
||||||
|
|
||||||
|
endevent |
@ -0,0 +1,82 @@ |
|||||||
|
Scriptname ETR_TrackNewItems extends ReferenceAlias |
||||||
|
|
||||||
|
Actor Property PlayerRef Auto |
||||||
|
|
||||||
|
FormList Property ETR_ItemsNew Auto |
||||||
|
FormList Property ETR_ItemsFound Auto |
||||||
|
FormList Property ETR_ItemsStored Auto |
||||||
|
FormList Property ETR_ExcludeFromNew Auto |
||||||
|
FormList Property ETR_PersistentStorageList Auto |
||||||
|
|
||||||
|
|
||||||
|
event OnInit() |
||||||
|
|
||||||
|
if Game.GetModByName("HearthFires.esm") < 255 && Game.GetModByName("Enderal - Forgotten Stories.esm") == 255 |
||||||
|
ETR_ExcludeFromNew.AddForm(Game.GetFormFromFile(0x807, "HearthFires.esm")) ; BYOHHouseCraftingCategorySmithing |
||||||
|
endif |
||||||
|
|
||||||
|
OnPlayerLoadGame() |
||||||
|
|
||||||
|
endevent |
||||||
|
|
||||||
|
|
||||||
|
event OnPlayerLoadGame() |
||||||
|
|
||||||
|
AddInventoryEventFilter(ETR_ItemsNew) |
||||||
|
|
||||||
|
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 |
||||||
|
|
||||||
|
; Rebuild all lists to avoid discrepancies, stale data, and broken records |
||||||
|
|
||||||
|
ETR_ItemsStored.Revert() |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 26, None, ETR_ExcludeFromNew) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 41, None, ETR_ExcludeFromNew) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 27, None, ETR_ExcludeFromNew) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(ETR_PersistentStorageList, ETR_ItemsStored, 32, None, ETR_ExcludeFromNew) |
||||||
|
|
||||||
|
ETR_ItemsFound.Revert() |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(PlayerRef, ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
|
||||||
|
Actor[] aFollowers = Eddoursul_Functions.GetPlayerFollowers() |
||||||
|
int i = aFollowers.length |
||||||
|
while i > 0 |
||||||
|
i -= 1 |
||||||
|
if ! aFollowers[i].IsDead() && ! aFollowers[i].IsDisabled() |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 26, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 41, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 27, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
Eddoursul_Functions.AddItemsOfTypeAndKeywordToList(aFollowers[i], ETR_ItemsFound, 32, None, ETR_ExcludeFromNew, false, false, false) |
||||||
|
endif |
||||||
|
endwhile |
||||||
|
|
||||||
|
ETR_ItemsNew.Revert() |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 26, None, ETR_ExcludeFromNew) ; armor |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 41, None, ETR_ExcludeFromNew) ; weapons |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 27, None, ETR_ExcludeFromNew) ; books |
||||||
|
Eddoursul_Functions.AddAllFormsToList(ETR_ItemsNew, 32, None, ETR_ExcludeFromNew) ; misc items |
||||||
|
|
||||||
|
endevent |
||||||
|
|
||||||
|
|
||||||
|
event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) |
||||||
|
|
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsFound.AddForm(akBaseItem) |
||||||
|
ETR_ItemsStored.RemoveAddedForm(akBaseItem) |
||||||
|
|
||||||
|
Debug.Notification("New artifact acquired: " + akBaseItem.GetName()) |
||||||
|
|
||||||
|
endevent |
@ -0,0 +1,84 @@ |
|||||||
|
Scriptname ETR_TrackStoredItems extends ReferenceAlias |
||||||
|
|
||||||
|
Actor Property PlayerRef Auto |
||||||
|
|
||||||
|
FormList Property ETR_ItemsNew Auto |
||||||
|
FormList Property ETR_ItemsFound Auto |
||||||
|
FormList Property ETR_ItemsStored Auto |
||||||
|
FormList Property ETR_PersistentStorageList Auto |
||||||
|
|
||||||
|
Container Property ETR_CellStorageContainer Auto |
||||||
|
|
||||||
|
Keyword Property LocTypePlayerHouse Auto |
||||||
|
|
||||||
|
bool bAtHome = false |
||||||
|
|
||||||
|
|
||||||
|
event OnInit() |
||||||
|
OnPlayerLoadGame() |
||||||
|
endevent |
||||||
|
|
||||||
|
|
||||||
|
Event OnPlayerLoadGame() |
||||||
|
AddInventoryEventFilter(ETR_ItemsStored) |
||||||
|
EndEvent |
||||||
|
|
||||||
|
|
||||||
|
Event OnLocationChange(Location akOldLoc, Location akNewLoc) |
||||||
|
bAtHome = akNewLoc && akNewLoc.HasKeyword(LocTypePlayerHouse) |
||||||
|
endEvent |
||||||
|
|
||||||
|
|
||||||
|
; The item is already registered as stored, and we just stored more |
||||||
|
event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) |
||||||
|
|
||||||
|
if ! bAtHome |
||||||
|
return |
||||||
|
endif |
||||||
|
|
||||||
|
if akDestContainer |
||||||
|
|
||||||
|
if !(akDestContainer as Actor) |
||||||
|
if ETR_PersistentStorageList.HasForm(akDestContainer) |
||||||
|
return |
||||||
|
endif |
||||||
|
elseif (akDestContainer as Actor).IsPlayerTeammate() |
||||||
|
return |
||||||
|
endif |
||||||
|
|
||||||
|
endif |
||||||
|
|
||||||
|
if ! akDestContainer || akDestContainer.GetParentCell() == PlayerRef.GetParentCell() |
||||||
|
|
||||||
|
ObjectReference cellStorage = Eddoursul_Functions.GetOrCreateCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) |
||||||
|
|
||||||
|
if cellStorage.GetItemCount(akBaseItem) == 0 && Eddoursul_Functions.HasRefInCell(akBaseItem, None, true, ETR_PersistentStorageList) |
||||||
|
cellStorage.AddItem(akBaseItem, 1, true) |
||||||
|
endif |
||||||
|
|
||||||
|
endif |
||||||
|
|
||||||
|
endevent |
||||||
|
|
||||||
|
|
||||||
|
; We took a stored item, and we want to find out if it's the last stored item of its kind |
||||||
|
event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) |
||||||
|
|
||||||
|
if akSourceContainer && !(akSourceContainer as Actor) && ETR_PersistentStorageList.HasForm(akSourceContainer) |
||||||
|
if Eddoursul_Functions.GetItemCountInList(ETR_PersistentStorageList, akBaseItem) == 0 |
||||||
|
Debug.Notification("Added " + akBaseItem.GetName() + " to ETR_ItemsFound") |
||||||
|
ETR_ItemsStored.RemoveAddedForm(akBaseItem) |
||||||
|
ETR_ItemsFound.AddForm(akBaseItem) |
||||||
|
ETR_ItemsNew.RemoveAddedForm(akBaseItem) |
||||||
|
endif |
||||||
|
|
||||||
|
elseif bAtHome |
||||||
|
ObjectReference cellStorage = Eddoursul_Functions.GetOrCreateCellStorage(PlayerRef, ETR_PersistentStorageList, ETR_CellStorageContainer) |
||||||
|
int iCount = cellStorage.GetItemCount(akBaseItem) |
||||||
|
if iCount > 0 && ! Eddoursul_Functions.HasRefInCell(akBaseItem, None, true, ETR_PersistentStorageList) |
||||||
|
cellStorage.RemoveItem(akBaseItem, iCount, true) |
||||||
|
endif |
||||||
|
|
||||||
|
endif |
||||||
|
|
||||||
|
endevent |
Loading…
Reference in new issue