-
Notifications
You must be signed in to change notification settings - Fork 1
/
DM_Outfit_items.pas
77 lines (67 loc) · 1.46 KB
/
DM_Outfit_items.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
Use this script to find which armor pieces is an NPC using.
Method:
Finds the name of the outfit used by an NPC.
Finds the name of the armors that belong to an outfit.
Outputs everything to clipboard
}
unit DM_Outfit_items;
interface
uses xEditApi
,StrUtils, SysUtils, Vcl.Forms, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Controls, Vcl.Dialogs, System.Classes
;
implementation
var
lst: TStringList;
procedure ProcessOutfit(e: IInterface);
var
i: Integer;
items, li: IInterface;
begin
items := ElementBySignature(e, 'INAM');
if not Assigned(items) then
exit;
for i := 0 to ElementCount(items) - 1 do begin
li := ElementByIndex(items, i);
lst.add(#9 + GetEditValue(li) );
end;
end;
procedure ProcessNPC(e: IInterface);
begin
lst.add(#9'NPC: ' + GetEditValue(ElementBySignature(e, 'DOFT')) );
end;
function Initialize: integer;
begin
lst := TStringList.Create;
end;
function Process(e: IInterface): Integer;
var
sig: string;
begin
lst.add( GetEditValue(ElementBySignature(e, 'EDID')) );
sig := Signature(e);
if sig = 'NPC_' then begin
ProcessNPC(e);
end
else if sig = 'OTFT' then begin
ProcessOutfit(e);
end;
end;
function Finalize: Integer;
var
frm: TForm;
ed: TEdit;
begin
frm := TForm.Create(nil);
ed := TEdit.Create(frm);
try
ed.Parent := frm;
ed.Text := Trim(lst.text);
ed.SelectAll;
ed.CopyToClipboard;
finally
frm.Free;
lst.Free;
end;
end;
end.