summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/util/gather_items
blob: 0764aa91106abedb177f0c987ceb9e7cf8b68724 (plain) (blame)
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
#!/usr/bin/perl -w

my $db = grep /^-d$/, @ARGV;

open IN, "util/cpp_version itemname.cc|" or die "Can't read itemname.cc\n";
{ undef local $/; $_ = <IN>; }
close IN;

$items{"wand of $_"} = 1 for /WAND_[A-Z_]+: *return "([^"]+)";/g;
$items{"potion of $_"} = 1 for /POT_[A-Z_]+: *return "([^"]+)";/g;
$items{"scroll of $_"} = 1 for /SCR_[A-Z_]+: *return "([^"]+)";/g;
$items{$_} = 1 for /RING_[A-Z_]+: *return "([^"]+)";/g;
$items{$_} = 1 for /AMU_[A-Z_]+: *return "([^"]+)";/g;
unless ($db)
{
    $items{"$_ rune of Zot"} = 1 for /RUNE_[A-Z_]+: *return "([^"]+)";/g;
    $items{"$_ deck of cards"} = 1 for /DECK_RARITY_[A-Z_]+: *return "([^"]+)";/g;
}
$items{$_} = 1 for /MISC_[A-Z_]+: *return "([^"]+)";/g;
$items{"book of $_"} = 1 for /BOOK_[A-Z_]+: *return "([^"]+)";/g;
$items{"staff of $_"} = 1 for /STAFF_[A-Z_]+: *return "([^"]+)";/g;
$items{"rod of $_"} = 1 for /ROD_[A-Z_]+: *return "([^"]+)";/g;
$items{$_} = 1 for /FOOD_[A-Z_]+: buff << "([^"]+)";/g;

open IN, "util/cpp_version itemprop.cc|" or die "Can't read itemprop.cc\n";
{ undef local $/; $_ = <IN>; }
close IN;

$items{$_} = 1 for /^ *\{ *ARM_[A-Z_]+, *"([^"]+)"/mg;
$items{$_} = 1 for /^ *\{ *WPN_[A-Z_]+, *"([^"]+)"/mg;
$items{$_} = 1 for /^ *\{ *MI_[A-Z_]+, *"([^"]+)"/mg;
#"
# food is redundant -- fixme!

$items{$_} = 1 for (split /\n/, <<END);
chunk of flesh
corpse
eggplant
gold piece
Grand Grimoire
lightning rod
manual
Necronomicon
orb of Zot
pair of boots
pair of gloves
rod of destruction
rune of Zot
tome of Destruction
Young Poisoner's Handbook
END

$items{"decaying skeleton"} = 1 if $db;

delete $items{$_} for (split /\n/, <<END);
boots
gloves
rod of lightning
END

for (sort keys %items)
{
    next if /bugginess/i;
    # yay consistency, all other descs use proper capitalization
    tr/A-Z/a-z/ if $db && !/Geryon/;
    print "$_\n";
}