Skip to content

Instantly share code, notes, and snippets.

@yggdrasil75
Created December 4, 2020 22:09
Show Gist options
  • Save yggdrasil75/79efcb2583ce31e8baee642f56b3608c to your computer and use it in GitHub Desktop.
Save yggdrasil75/79efcb2583ce31e8baee642f56b3608c to your computer and use it in GitHub Desktop.
// This section filters clothing items
slKeywordList(aRecord, slKeywords);
if StrWithinSL('Clothing', slKeywords) then begin
if debugMsg then msg('filtering clothing');
slTemp.Clear;
//Randomize; //why is this here?
slTemp.CommaText := 'ArmorClothing, VendorItemClothing, ClothingBody';
for i := 0 to slTemp.Count-1 do begin
if HasKeyword(aRecord, slTemp[i]) then begin
if ContainsText(full(aRecord), 'Fine') then begin
slItem.CommaText := '00086991, 000CEE80';
end else
slItem.CommaText := '0001BE1A, 000209A6, 000261C0, 0003452E';
Result := GetRecordByFormID(slItem[Random(slItem.Count)]);
end;
end;
slTemp.CommaText := 'ClothingHead';
for i := 0 to slTemp.Count-1 do begin
if HasKeyword(aRecord, slTemp[i]) then begin
if ContainsText(full(aRecord), 'Fine') then begin
slItem.CommaText := '000CEE84';
end else
slItem.CommaText := '00017696, 000330B3, 000209AA, 000330BC';
Result := GetRecordByFormID(slItem[Random(slItem.Count)]);
end;
end;
slTemp.CommaText := 'ClothingHands';
for i := 0 to slTemp.Count-1 do begin
if HasKeyword(aRecord, slTemp[i]) then begin
Result := GetRecordByFormID('000261C1');
end;
end;
slTemp.CommaText := 'ClothingFeet';
for i := 0 to slTemp.Count-1 do begin
if HasKeyword(aRecord, slTemp[i]) then begin
if ContainsText(full(aRecord), 'Fine') then begin
slItem.CommaText := '00086993, 000CEE82';
end else
slItem.CommaText := '0001BE1B, 000209A5, 000261BD, 0003452F';
Result := GetRecordByFormID(slItem[Random(slItem.Count)]);
end;
end;
//runs for books (spelltomes only atm)
if (sig(aRecord) = 'BOOK') then
Result := BookTemplate(aRecord);
if Assigned(Result) then begin
if ProcessTime then begin
stopTime := Time;
addProcessTime('GetTemplate', TimeBtwn(startTime, stopTime));
end;
slKeywords.Free;
slFiles.Free;
slTemp.Free;
slItem.Free;
slBOD2.Free;
Exit;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment