-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDM_EC_GetIDs.pas
60 lines (48 loc) · 1.07 KB
/
DM_EC_GetIDs.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
unit DM_EC_GetIDs;
{
Hotkey: Ctrl+F5
Gets FormID in the format used by Easy Containers.
Change the hotkey to your preference.
}
uses xEditApi, SysUtils, StrUtils;
var
outputs: TStringList;
function IsESL(f: IInterface): Boolean;
begin
Result := GetElementEditValues(ElementByIndex(f, 0), 'Record Header\Record Flags\ESL') = 1;
end;
function ActualFixedFormId(e: IInterface): string;
var
fID, ffID: Cardinal;
begin
fID := FormID(e);
if(IsESL(GetFile(e))) then ffID := fID and $FFF
else ffID := fID and $FFFFFF;
Result := Lowercase(IntToHex(ffID, 1));
end;
function Initialize: integer;
begin
outputs := TStringList.Create;
end;
function Finalize: Integer;
var
i: Integer;
begin
AddMessage(Format(
'%s',
[StringReplace(outputs.DelimitedText, '"""', '"', [rfReplaceAll])]
));
outputs.Free;
end;
function RecordToStr(e: IInterface): string;
begin
Result := Format('"%s|0x%s"', [
GetFileName(GetFile(e)),
ActualFixedFormId(e)
]);
end;
function Process(e: IInterface): Integer;
begin
outputs.Add(RecordToStr(MasterOrSelf(e)));
end;
end.