Removed filter by the Unique flag, added filter by linked ref
This commit is contained in:
parent
64aecebcba
commit
7378a8de90
@ -66,7 +66,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MarkPersistent(e: IInterface): boolean;
|
function MarkPersistent(e: IwbMainRecord): boolean;
|
||||||
begin
|
begin
|
||||||
AddMessage(' + Marking as persistent: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
AddMessage(' + Marking as persistent: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
Inc(flaggedCount);
|
Inc(flaggedCount);
|
||||||
@ -74,20 +74,53 @@ begin
|
|||||||
CheckNonPersistentOverride(e);
|
CheckNonPersistentOverride(e);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CheckNonPersistentOverride(e: IInterface): integer;
|
function CheckNonPersistentOverride(e: IwbMainRecord): integer;
|
||||||
begin
|
begin
|
||||||
if IsWinningOverride(e) then exit;
|
if IsWinningOverride(e) then exit;
|
||||||
if not GetIsPersistent(WinningOverride(e)) then
|
if not GetIsPersistent(WinningOverride(e)) then
|
||||||
AddMessage(' ! WARNING: the highest override of ' + ShortName(e) + ' is not persistent: ' + PathName(WinningOverride(e)));
|
AddMessage(' ! WARNING: the highest override of ' + ShortName(e) + ' is not persistent: ' + PathName(WinningOverride(e)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetLinkedRefNull(rec: IwbMainRecord): IwbMainRecord;
|
||||||
|
var
|
||||||
|
linkedRefs, currentItem: IwbElement;
|
||||||
|
linkedCount, i: integer;
|
||||||
|
begin
|
||||||
|
linkedRefs := ElementByPath(rec, 'Linked References');
|
||||||
|
linkedCount := ElementCount(linkedRefs);
|
||||||
|
for i := 0 to Pred(linkedCount) do begin
|
||||||
|
currentItem := ElementByIndex(linkedRefs, i);
|
||||||
|
if not Assigned(LinksTo(ElementByPath(currentItem, 'Keyword/Ref'))) then begin
|
||||||
|
result := LinksTo(ElementByPath(currentItem, 'Ref'));
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function GetLinkedRef(rec: IwbMainRecord; keyword: IwbMainRecord): IwbMainRecord;
|
||||||
|
var
|
||||||
|
linkedRefs, currentItem: IwbElement;
|
||||||
|
linkedCount, i: integer;
|
||||||
|
begin
|
||||||
|
linkedRefs := ElementByPath(rec, 'Linked References');
|
||||||
|
linkedCount := ElementCount(linkedRefs);
|
||||||
|
for i := 0 to Pred(linkedCount) do begin
|
||||||
|
currentItem := ElementByIndex(linkedRefs, i);
|
||||||
|
if Equals(LinksTo(ElementByPath(currentItem, 'Keyword/Ref')), keyword) then begin
|
||||||
|
result := LinksTo(ElementByPath(currentItem, 'Ref'));
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function Process(e: IInterface): integer;
|
function Process(e: IInterface): integer;
|
||||||
var
|
var
|
||||||
currentPlugin: IwbFile;
|
currentPlugin: IwbFile;
|
||||||
baseRefRecord, package, refCell, actorLocation: IwbMainRecord;
|
baseRefRecord, package, refCell, actorLocation, linkedRef, linkedRefKeyword: IwbMainRecord;
|
||||||
i, baseID, packageCount: integer;
|
packages: IwbElement;
|
||||||
sig, baseSig, packageLoc: string;
|
i, baseID, packageCount, typeId: integer;
|
||||||
isREFR, isACHR: boolean;
|
sig, baseSig, packageLoc, packageType: string;
|
||||||
|
isREFR, isACHR, skip: boolean;
|
||||||
begin
|
begin
|
||||||
if not pluginAnnounced then begin
|
if not pluginAnnounced then begin
|
||||||
currentPlugin := GetFile(e);
|
currentPlugin := GetFile(e);
|
||||||
@ -176,10 +209,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Skip non-persistent, non-unique actors. Multi-package bandits will probably be late on their schedules.
|
|
||||||
if GetElementNativeValues(baseRefRecord, 'ACBS\Flags\Unique') = 0 then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
// Skip Starts Dead NPCs
|
// Skip Starts Dead NPCs
|
||||||
if GetElementNativeValues(e, 'Record Header\Record Flags\Starts Dead') <> 0 then
|
if GetElementNativeValues(e, 'Record Header\Record Flags\Starts Dead') <> 0 then
|
||||||
exit;
|
exit;
|
||||||
@ -188,25 +217,30 @@ begin
|
|||||||
if GetElementNativeValues(baseRefRecord, 'ACBS\Flags\Simple Actor') <> 0 then
|
if GetElementNativeValues(baseRefRecord, 'ACBS\Flags\Simple Actor') <> 0 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
packageCount := ElementCount(ElementByPath(baseRefRecord, 'Packages'));
|
packages := ElementByPath(baseRefRecord, 'Packages');
|
||||||
|
packageCount := ElementCount(packages);
|
||||||
|
|
||||||
// Skip unique actors without packages (probably, flagged erroneously)
|
// Skip actors without packages
|
||||||
if packageCount = 0 then
|
if packageCount = 0 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if packageCount = 1 then begin
|
skip := false;
|
||||||
|
|
||||||
// Skip actors, having a single package revolving around their editor location or themselves
|
for i := 0 to Pred(packageCount) do begin
|
||||||
package := LinksTo(ElementByIndex(ElementByPath(baseRefRecord, 'Packages'), 0));
|
package := LinksTo(ElementByIndex(packages, i));
|
||||||
|
|
||||||
if not Assigned(package) then
|
if not Assigned(package) then begin
|
||||||
exit;
|
skip := true;
|
||||||
|
AddMessage(' ! WARNING: Invalid package entry: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
|
|
||||||
packageLoc := GetElementEditValues(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Type');
|
packageLoc := GetElementEditValues(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PLDT\Type');
|
||||||
|
|
||||||
if (Pos(packageLoc, 'Near editor location|Near self') <> 0) then begin
|
if (packageLoc = 'Near editor location') or (packageLoc = 'Near self') then begin
|
||||||
AddMessage(' Skipping editor location actor: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
AddMessage(' Skipping editor location actor: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
exit;
|
skip := true;
|
||||||
|
continue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (packageLoc = 'In cell') then begin
|
if (packageLoc = 'In cell') then begin
|
||||||
@ -214,13 +248,39 @@ begin
|
|||||||
if Assigned(refCell) then begin
|
if Assigned(refCell) then begin
|
||||||
if Equals(refCell, LinksTo(ElementByPath(e, 'Cell'))) then begin
|
if Equals(refCell, LinksTo(ElementByPath(e, 'Cell'))) then begin
|
||||||
AddMessage(' Skipping actor, staying in one cell: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
AddMessage(' Skipping actor, staying in one cell: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
exit;
|
skip := true;
|
||||||
|
continue;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if (GetElementEditValues(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PTDA\Target Data\Type') = 'Linked Reference') then begin
|
||||||
|
|
||||||
|
linkedRefKeyword := LinksTo(ElementByPath(ElementByIndex(ElementByPath(package, 'Package Data\Data Input Values'), 0), 'PTDA\Target Data\Reference'));
|
||||||
|
|
||||||
|
if Assigned(linkedRefKeyword) then begin
|
||||||
|
linkedRef := GetLinkedRef(e, linkedRefKeyword);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
linkedRef := GetLinkedRefNull(e);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if Assigned(linkedRef) then begin
|
||||||
|
if Equals(LinksTo(ElementByPath(linkedRef, 'Cell')), LinksTo(ElementByPath(e, 'Cell'))) then begin
|
||||||
|
AddMessage(' Skipping actor, staying in one cell with his linked ref: ' + GetElementEditValues(e, 'NAME') + ' - (' + Name(e) + ')');
|
||||||
|
skip := true;
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
skip := false;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
if skip then exit;
|
||||||
|
|
||||||
MarkPersistent(e);
|
MarkPersistent(e);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user