Mercurial > hg > batmud > misc
annotate materials/parsematerial.pl @ 334:0a62974ff1f3 misc
Use modern [] style array definitions instead of array() in PHP output.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 31 Dec 2015 06:33:23 +0200 |
parents | c12fd8e5c1b0 |
children |
rev | line source |
---|---|
0 | 1 #!/usr/bin/perl -w |
132 | 2 # |
3 # BatMUD material data parser and converter | |
4 # Developed by Matti Hämäläinen (Ggr Pupunen) <ccr@tnsp.org> | |
272 | 5 # (C) Copyright 2006-2015 Tecnic Software productions (TNSP) |
132 | 6 # |
7 # Converts "raw" material data (output of 'cast identify at material') | |
8 # from log(s) into various formats and intermediate data for additional | |
9 # processing by other tools. | |
10 # | |
0 | 11 use strict; |
136 | 12 use warnings; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
13 use Data::Dumper; |
0 | 14 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
15 |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
16 # |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
17 # Data translation table generated with csv2transtab.pl |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
18 # |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
19 my $transTable = |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
20 { |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
21 2 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
22 "very light" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
23 "light" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
24 "normal" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
25 "heavy" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
26 "very heavy" => 4, |
241 | 27 "incredibly heavy" => 5, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
28 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
29 3 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
30 "very fragile" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
31 "fragile" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
32 "normal" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
33 "sturdy" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
34 "very sturdy" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
35 "incredibly sturdy" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
36 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
37 4 => { |
168 | 38 "not magical" => 0, |
39 "weakly magical" => 1, | |
40 "a bit magical" => 2, | |
241 | 41 "magical" => 3, |
42 "notable magical" => 4, | |
168 | 43 "very magical" => 5, |
44 "highly magical" => 6, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
45 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
46 5 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
47 "unburnable" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
48 "almost unburnable" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
49 "quite unburnable" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
50 "normal" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
51 "quite flammable" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
52 "very flammable" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
53 "highly flammable" => 6, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
54 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
55 6 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
56 "icy" => 0, |
241 | 57 "chilly" => 1, |
58 "drafty" => 2, | |
59 "comfortable" => 3, | |
60 "very warm" => 4, | |
61 "excellent" => 5, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
62 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
63 7 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
64 "non toxic" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
65 "very low toxicity" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
66 "low toxicity" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
67 "mediocre toxicity" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
68 "toxic" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
69 "very toxic" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
70 "highly toxic" => 6, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
71 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
72 8 => { |
241 | 73 "lousy" => 0, |
159 | 74 "poor" => 1, |
241 | 75 "weak" => 2, |
76 "insulator" => 3, | |
77 "good" => 4, | |
78 "great" => 5, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
79 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
80 9 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
81 "loose" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
82 "a bit loose" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
83 "quite solid" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
84 "solid" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
85 "very solid" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
86 "incredibly solid" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
87 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
88 10 => { |
159 | 89 "poor mentality" => 0, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
90 "low mentality" => 1, |
159 | 91 "some mentality" => 2, |
92 "mental" => 3, | |
241 | 93 "high mentality" => 4, |
94 "great mentality" => 5, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
95 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
96 11 => { |
241 | 97 "great reactivity" => 0, |
98 "high reactivity" => 1, | |
99 "notable reactivity" => 2, | |
159 | 100 "reactive" => 3, |
241 | 101 "low reactivity" => 4, |
102 "poor reactivity" => 5, | |
103 "not reactive" => 6, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
104 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
105 12 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
106 "not used" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
107 "rarely used" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
108 "sometimes used" => 2, |
241 | 109 "quite much used" => 3, |
110 "frequently used" => 4, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
111 "most common" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
112 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
113 13 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
114 "not used" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
115 "rarely used" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
116 "sometimes used" => 2, |
241 | 117 "quite much used" => 3, |
118 "frequently used" => 4, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
119 "most common" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
120 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
121 14 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
122 "cheap" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
123 "low-priced" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
124 "average" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
125 "valuable" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
126 "very valuable" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
127 "highly valuable" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
128 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
129 15 => { |
241 | 130 "very common" => 0, |
131 "quite common" => 1, | |
132 "common" => 2, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
133 "average" => 3, |
241 | 134 "rare" => 4, |
135 "very rare" => 5, | |
136 "impossible" => 6, | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
137 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
138 16 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
139 "Organ" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
140 "Cloth" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
141 "Paper" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
142 "Bone" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
143 "Metal" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
144 "Wood" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
145 "Stone" => 6, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
146 "Alloy" => 7, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
147 "Inorg" => 8, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
148 "Glass" => 9, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
149 "Gem" => 10, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
150 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
151 17 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
152 "No" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
153 "Yes" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
154 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
155 18 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
156 "Hit" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
157 "Protrusion" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
158 "Crag" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
159 "Lode" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
160 "Pocket" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
161 "Gloss" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
162 "Shard" => 6, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
163 "Deposit" => 7, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
164 "Mountain" => 8, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
165 "Nest" => 9, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
166 "Stack" => 10, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
167 "Mound" => 11, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
168 "Chunky" => 12, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
169 "Puddle" => 13, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
170 "Slab" => 14, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
171 "Network" => 15, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
172 "Pool" => 16, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
173 "Hill" => 17, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
174 "Mass" => 18, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
175 "Tangle" => 19, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
176 "Graveyard" => 20, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
177 "Lump" => 21, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
178 "Coil" => 22, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
179 "Abyss" => 23, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
180 "Pile" => 24, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
181 "Torrent" => 25, |
247
8d394425c71e
Add types from rift plasma.
Matti Hamalainen <ccr@tnsp.org>
parents:
241
diff
changeset
|
182 "Conflagration" => 26, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
183 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
184 19 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
185 "heap" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
186 "stick" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
187 "pocket" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
188 "hunk" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
189 "shard" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
190 "string" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
191 "stone" => 6, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
192 "slice" => 7, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
193 "wisp" => 8, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
194 "wad" => 9, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
195 "clump" => 10, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
196 "carcass" => 11, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
197 "gob" => 12, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
198 "strip" => 13, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
199 "dough" => 14, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
200 "ball" => 15, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
201 "chunk" => 16, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
202 "load" => 17, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
203 "leaf" => 18, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
204 "salt" => 19, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
205 "pile" => 20, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
206 "isotope" => 21, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
207 "tusk" => 22, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
208 "clod" => 23, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
209 "lump" => 24, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
210 "lode" => 25, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
211 "piece" => 26, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
212 "flame" => 27, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
213 "stem" => 28, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
214 "sphere" => 29, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
215 "fragment" => 30, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
216 "mineral" => 31, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
217 "twig" => 32, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
218 "stalk" => 33, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
219 "crystal" => 34, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
220 "log" => 35, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
221 "reed" => 36, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
222 "nugget" => 37, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
223 "mix" => 38, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
224 "mic" => 39, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
225 "pulp" => 40, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
226 "block" => 41, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
227 "puddle" => 42, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
228 "sliver" => 43, |
247
8d394425c71e
Add types from rift plasma.
Matti Hamalainen <ccr@tnsp.org>
parents:
241
diff
changeset
|
229 "bulge" => 44, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
230 }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
231 20 => { |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
232 "formed" => 0, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
233 "stick" => 1, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
234 "bundle" => 2, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
235 "ellipsoid" => 3, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
236 "pocket" => 4, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
237 "brick" => 5, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
238 "mold" => 6, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
239 "gene" => 7, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
240 "shard" => 8, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
241 "form" => 9, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
242 "wisp" => 10, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
243 "isometric" => 11, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
244 "cord" => 12, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
245 "billot" => 13, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
246 "bar" => 14, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
247 "bolt" => 15, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
248 "strip" => 16, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
249 "ball" => 17, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
250 "billit" => 18, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
251 "chunk" => 19, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
252 "octagon" => 20, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
253 "cube" => 21, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
254 "ingot" => 22, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
255 "chip" => 23, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
256 "casting" => 24, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
257 "dean" => 25, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
258 "piece" => 26, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
259 "flame" => 27, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
260 "billet" => 28, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
261 "crafted" => 29, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
262 "cut" => 30, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
263 "pelt" => 31, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
264 "strand" => 32, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
265 "crystal" => 33, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
266 "log" => 34, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
267 "reed" => 35, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
268 "tetragonal" => 36, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
269 "sheet" => 37, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
270 "strap" => 38, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
271 "reem" => 39, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
272 "length" => 40, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
273 "sculpted" => 41, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
274 "block" => 42, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
275 "hexagonal" => 43, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
276 "product" => 44, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
277 "shaped" => 45, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
278 "puddle" => 46, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
279 "fibres" => 47, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
280 "slab" => 48, |
247
8d394425c71e
Add types from rift plasma.
Matti Hamalainen <ccr@tnsp.org>
parents:
241
diff
changeset
|
281 "flare" => 49, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
282 }, |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
283 }; |
305 | 284 |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
285 my $transFixes = |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
286 { |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
287 16 => { |
305 | 288 "Organic" => 0, |
289 "Cloth" => 1, | |
290 "Paper" => 2, | |
291 "Bone" => 3, | |
292 "Metal" => 4, | |
293 "Wood" => 5, | |
294 "Stone" => 6, | |
295 "Alloy" => 7, | |
296 "Inorganic" => 8, | |
297 "Glass" => 9, | |
298 "Gem" => 10, | |
299 }, | |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
300 }; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
301 |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
302 |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
303 my $revTransTable = {}; |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
304 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
305 my @fieldInfo = ( |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
306 { "i" => 1, "f" => "name", "w" => 15, "l" => "Name", "s" => "Name" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
307 { "i" => 2, "f" => "weight", "w" => 10, "l" => "Weight", "s" => "Weight" }, |
254 | 308 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
309 { "i" => 3, "f" => "sturdyness", "w" => 18, "l" => "Sturdyness", "s" => "Sturdyness" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
310 { "i" => 4, "f" => "magic", "w" => 15, "l" => "Magic", "s" => "Magic" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
311 { "i" => 5, "f" => "flammability", "w" => 18, "l" => "Flammability", "s" => "Flammability" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
312 { "i" => 6, "f" => "warmth", "w" => 11, "l" => "Warmth", "s" => "Warmth" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
313 { "i" => 7, "f" => "toxicity", "w" => 18, "l" => "Toxicity", "s" => "Toxicity" }, |
159 | 314 { "i" => 8, "f" => "resistivity", "w" => 9, "l" => "Resistivity", "s" => "Resist" }, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
315 { "i" => 9, "f" => "malleability", "w" => 18, "l" => "Malleability", "s" => "Malleability" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
316 { "i" => 10, "f" => "mentality", "w" => 18, "l" => "Mentality", "s" => "Mentality" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
317 { "i" => 11, "f" => "reactivity", "w" => 18, "l" => "Reactivity", "s" => "Reactivity" }, |
254 | 318 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
319 { "i" => 12, "f" => "weapon_rarity", "w" => 15, "l" => "Weapon rarity", "s" => "Weapon rarity" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
320 { "i" => 13, "f" => "armour_rarity", "w" => 15, "l" => "Armour rarity", "s" => "Armour rarity" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
321 { "i" => 14, "f" => "value", "w" => 15, "l" => "Value", "s" => "Value" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
322 { "i" => 15, "f" => "rarity", "w" => 12, "l" => "Rarity", "s" => "Rarity" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
323 { "i" => 16, "f" => "type", "w" => 6, "l" => "Type", "s" => "Type" }, |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
324 { "i" => 17, "f" => "found_nature", "w" => 3, "l" => "Found in Nature", "s" => "FN?" }, |
266
37c071cbb0ed
Increase lode_name field width.
Matti Hamalainen <ccr@tnsp.org>
parents:
265
diff
changeset
|
325 { "i" => 18, "f" => "lode_name", "w" => 13, "l" => "Lode name", "s" => "Lode name" }, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
326 { "i" => 19, "f" => "raw_names", "w" => 35, "l" => "Raw names", "s" => "Raw names" }, |
295 | 327 { "i" => 20, "f" => "refined_names", "w" => 35, "l" => "Refined names", "s" => "Refined names" }, |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
328 ); |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
329 |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
330 |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
331 sub ptranslate($$) |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
332 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
333 if (defined($$revTransTable{$_[0]}{$_[1]})) |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
334 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
335 return $$revTransTable{$_[0]}{$_[1]}; |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
336 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
337 else |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
338 { |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
339 die("$0: Unknown REVERSE translation table type ".$_[0]." : ".$_[1]."\n"); |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
340 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
341 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
342 |
277 | 343 |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
344 sub pt($$) |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
345 { |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
346 return ptranslate($_[1], $_[0]{$_[1]}) |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
347 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
348 |
277 | 349 |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
350 sub pta($$) |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
351 { |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
352 return map { ptranslate($_[1], $_) } @{$_[0]{$_[1]}}; |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
353 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
354 |
277 | 355 |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
356 sub mtranslate($$) |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
357 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
358 if (defined($$transTable{$_[0]}{$_[1]})) |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
359 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
360 return $$transTable{$_[0]}{$_[1]}; |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
361 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
362 else |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
363 { |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
364 die("$0: Unknown translation table type ".$_[0]." : ".$_[1]."\n"); |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
365 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
366 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
367 |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
368 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
369 ### |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
370 ### Check options |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
371 ### |
112 | 372 my $opt_mode = ""; |
118 | 373 my $opt_strip = 1; |
0 | 374 |
257 | 375 while (defined(my $arg = shift)) |
376 { | |
142 | 377 if ($arg eq "-csv") { $opt_mode = $arg; } |
112 | 378 elsif ($arg eq "-tf") { $opt_mode = $arg; } |
379 elsif ($arg eq "-names") { $opt_mode = $arg; } | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
380 elsif ($arg eq "-perl") { $opt_mode = $arg; } |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
381 elsif ($arg eq "-php") { $opt_mode = $arg; } |
142 | 382 elsif ($arg eq "-table") { $opt_mode = $arg; } |
288
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
383 elsif ($arg eq "-dumpfiles") { $opt_mode = $arg; $opt_strip = 0; } |
118 | 384 elsif ($arg eq "-dump") { $opt_mode = $arg; $opt_strip = 0; } |
257 | 385 else |
386 { | |
112 | 387 die("Invalid option '$arg'\n"); |
388 } | |
389 } | |
390 | |
268 | 391 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
392 ### |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
393 ### Parse input materials |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
394 ### |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
395 my $data = {}; |
142 | 396 my $name = ""; |
282 | 397 my $nline = 0; |
287 | 398 while (defined(my $line = <STDIN>)) |
257 | 399 { |
282 | 400 $nline++; |
287 | 401 chomp($line); |
281 | 402 if ($line =~ /MATERIAL STATS \(([a-z ]+)\)\:/) |
403 { | |
404 $name = $1; | |
405 } | |
406 elsif ($line =~ /^Weight \(g\/l\)\: *\(([a-z. ]+)\) *Sturdyness\: *\(([a-z. ]+)\)/) | |
407 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
408 $$data{$name}{2} = mtranslate(2, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
409 $$data{$name}{3} = mtranslate(3, $2); |
281 | 410 } |
411 elsif ($line =~ /^Magic\: *\(([a-z. ]+)\) *Flammability\: *\(([a-z. ]+)\)/) | |
412 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
413 $$data{$name}{4} = mtranslate(4, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
414 $$data{$name}{5} = mtranslate(5, $2); |
281 | 415 } |
416 elsif ($line =~ /^Warmth\: *\(([a-z. ]+ outfit)\) *Toxicity\: *\(([a-z. ]+)\)/) | |
417 { | |
418 my ($tmp1, $tmp2) = ($1, $2); | |
419 $tmp1 =~ s/ +outfit$//; | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
420 $$data{$name}{6} = mtranslate(6, $tmp1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
421 $$data{$name}{7} = mtranslate(7, $tmp2); |
281 | 422 } |
423 elsif ($line =~ /^Warmth\: *\(([a-z. ]+)\) *Toxicity\: *\(([a-z. ]+)\)/) | |
424 { | |
425 my ($tmp1, $tmp2) = ($1, $2); | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
426 $$data{$name}{6} = mtranslate(6, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
427 $$data{$name}{7} = mtranslate(7, $2); |
281 | 428 } |
429 elsif ($line =~ /^Resistivity\: *\(([a-z. ]+ insulator)\) *Malleability\: *\(([a-z. ]+)\)?/) | |
430 { | |
431 my ($tmp1, $tmp2) = ($1, $2); | |
432 $tmp1 =~ s/ +insulator$//; | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
433 $$data{$name}{8} = mtranslate(8, $tmp1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
434 $$data{$name}{9} = mtranslate(9, $tmp2); |
281 | 435 } |
436 elsif ($line =~ /^Resistivity\: *\(([a-z. ]+)\) *Malleability\: *\(([a-z. ]+)\)?/) | |
437 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
438 $$data{$name}{8} = mtranslate(8, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
439 $$data{$name}{9} = mtranslate(9, $2); |
281 | 440 } |
441 elsif ($line =~ /^Mentality\: *\(([a-z. ]+)\) *Reactivity\: *\(([a-z. ]+)\)?/) | |
442 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
443 $$data{$name}{10} = mtranslate(10, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
444 $$data{$name}{11} = mtranslate(11, $2); |
281 | 445 } |
446 elsif ($line =~ /^Weapon rarity\: *\(([a-z. ]+)\) *Armour rarity\: *\(([a-z. ]+)\)/) | |
447 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
448 $$data{$name}{12} = mtranslate(12, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
449 $$data{$name}{13} = mtranslate(13, $2); |
281 | 450 } |
451 elsif ($line =~ /^Value \(gp\/kg\)\: *\(([a-z -]+)\) *Rarity\: *\(([a-z. ]+)\)/) | |
452 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
453 $$data{$name}{14} = mtranslate(14, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
454 $$data{$name}{15} = mtranslate(15, $2); |
281 | 455 } |
456 elsif ($line =~ /^Article\: *([a-z. ]+) *Type: *([A-Za-z]+)/) | |
457 { | |
295 | 458 my ($tmp1, $tmp2) = ($1, $2); |
459 $tmp1 =~ s/ *$//; | |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
460 |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
461 $$data{$name}{"article"} = $tmp1; |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
462 $$data{$name}{16} = mtranslate(16, $tmp2); |
281 | 463 } |
464 elsif ($line =~ /^Found nature\: *(Yes|No) *Lode name\: *([A-Za-z]+)/) | |
465 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
466 $$data{$name}{17} = mtranslate(17, $1); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
467 $$data{$name}{18} = mtranslate(18, $2); |
281 | 468 } |
469 elsif ($line =~ /^Raw names\: *([a-z, ]+[a-z])/) | |
470 { | |
471 my $tmp = $1; | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
472 @{$$data{$name}{19}} = map { mtranslate(19, $_) } split(/, */, $tmp); |
281 | 473 } |
474 elsif ($line =~ /^Refined names\: *([a-z, ]+[a-z])/) | |
475 { | |
476 my $tmp = $1; | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
477 @{$$data{$name}{20}} = map { mtranslate(20, $_) } split(/, */, $tmp); |
281 | 478 } |
479 elsif ($line =~ /^-+$|^\s*$/) | |
480 { | |
481 # Ignore empty lines, and -* | |
482 } | |
483 else | |
484 { | |
282 | 485 print STDERR "Unparsed line #".$nline.": ".$line."\n"; |
281 | 486 } |
0 | 487 } |
488 | |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
489 # Fix material types |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
490 foreach my $mid (keys %$transFixes) |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
491 { |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
492 $$transTable{$mid} = $$transFixes{$mid}; |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
493 } |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
494 |
112 | 495 # Sort the entries by name |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
496 my @entries = sort { $a cmp $b } keys %$data; |
0 | 497 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
498 # Sort materials by type |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
499 my %matByType = (); |
259 | 500 foreach my $name (@entries) |
501 { | |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
502 push(@{$matByType{$$data{$name}{16}}}, lc($name)); |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
503 } |
112 | 504 |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
505 # List of known types |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
506 my $matTypes = $$transTable{16}; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
507 |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
508 # Create reverse translation table |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
509 foreach my $mid (keys %$transTable) |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
510 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
511 foreach my $mkey (keys %{$$transTable{$mid}}) |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
512 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
513 $$revTransTable{$mid}{$$transTable{$mid}{$mkey}} = $mkey; |
258
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
514 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
515 } |
8f3c5d3ea25a
Add value translation helper functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
257
diff
changeset
|
516 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
517 |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
518 sub get_datastr($$) |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
519 { |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
520 my ($name, $i) = @_; |
278 | 521 return $name if ($i == 1); |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
522 return join(", ", pta($$data{$name}, $i)) if (ref($$data{$name}{$i}) eq "ARRAY"); |
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
523 return pt($$data{$name}, $i); |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
524 } |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
525 |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
526 |
288
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
527 sub print_material_long($$$) |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
528 { |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
529 my ($file, $mat, $name) = @_; |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
530 |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
531 printf $file |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
532 "MATERIAL STATS (".$name."):\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
533 "-------------------------------------------------------------------------------\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
534 "Weight (g/l): %-17s Sturdyness: (%s)\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
535 "Magic: %-17s Flammability: (%s)\n", |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
536 "(".pt($mat, 2).")", pt($mat, 3), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
537 "(".pt($mat, 4).")", pt($mat, 5); |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
538 |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
539 printf $file |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
540 "Warmth: %-17s Toxicity: (%s)\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
541 "Resistivity: %-17s Malleability: (%s)\n", |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
542 "(".pt($mat, 6).")", pt($mat, 7), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
543 "(".pt($mat, 8).")", pt($mat, 9); |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
544 |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
545 printf $file |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
546 "Mentality: %-17s Reactivity: (%s)\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
547 "Weapon rarity: %-17s Armour rarity: (%s)\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
548 "Value (gp/kg): %-17s Rarity: (%s)\n", |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
549 "(".pt($mat, 10).")", pt($mat, 11), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
550 "(".pt($mat, 12).")", pt($mat, 13), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
551 "(".pt($mat, 14).")", pt($mat, 15); |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
552 |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
553 printf $file |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
554 "Article: %-17s Type: %s\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
555 "Found nature: %-17s Lode name: %s\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
556 "Raw names: %s\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
557 "Refined names: %s\n", |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
558 $$mat{"article"}, pt($mat, 16), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
559 pt($mat, 17), pt($mat, 18), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
560 join(", ", pta($mat, 19)), |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
561 join(", ", pta($mat, 20)); |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
562 } |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
563 |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
564 |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
565 ### |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
566 ### Output functionality begins here |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
567 ### |
112 | 568 |
298 | 569 ### |
570 ### Print material names only, one per line | |
571 ### | |
257 | 572 if ($opt_mode eq "-names") |
573 { | |
574 foreach my $name (@entries) | |
575 { | |
263 | 576 print $name."\n"; |
112 | 577 } |
578 } | |
298 | 579 ### |
580 ### Print CSV format list | |
581 ### | |
264 | 582 elsif ($opt_mode eq "-csv") |
583 { | |
257 | 584 foreach my $name (@entries) |
585 { | |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
586 print join(";", map { get_datastr($name, $$_{"i"}) } @fieldInfo)."\n"; |
0 | 587 } |
112 | 588 } |
298 | 589 ### |
590 ### Dump long-format material data to individual files | |
591 ### | |
288
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
592 elsif ($opt_mode eq "-dumpfiles") |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
593 { |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
594 foreach my $name (@entries) |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
595 { |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
596 my $filename = $name.".mat"; |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
597 $filename =~ s/[^a-z0-9]/_/g; |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
598 open(OUTFILE, ">", $filename) or die("Error opening file '".$filename."' ".$!."\n"); |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
599 print_material_long(\*OUTFILE, $$data{$name}, $name); |
288
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
600 close(OUTFILE); |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
601 } |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
602 } |
298 | 603 ### |
604 ### Dump long-format material data to stdout | |
605 ### | |
257 | 606 elsif ($opt_mode eq "-dump") |
607 { | |
608 foreach my $name (@entries) | |
609 { | |
288
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
610 print "\n". |
e2f5b059e14d
Factor long mode dump into a function. Add -dumpfiles option.
Matti Hamalainen <ccr@tnsp.org>
parents:
287
diff
changeset
|
611 "-------------------------------------------------------------------------------\n"; |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
612 print_material_long(\*STDOUT, $$data{$name}, $name); |
118 | 613 } |
614 } | |
298 | 615 ### |
616 ### Print TinyFugue script variables | |
617 ### | |
257 | 618 elsif ($opt_mode eq "-tf") |
619 { | |
305 | 620 print "/set gmat_names=".join(' ', map { my $tmp = $_; $tmp =~ s/ /_/g; $tmp } @entries)."\n"; |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
621 print "/set gmat_ntypes=".join(' ', map(lc(ptranslate(16, $$data{$_}{16})), @entries))."\n"; |
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
622 print "/set gmat_types=".join(' ', sort map(lc(ptranslate(16, $_)), values %$matTypes))."\n"; |
305 | 623 |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
624 foreach my $mkey (sort keys %$matTypes) |
257 | 625 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
626 my $type = $$matTypes{$mkey}; |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
627 print "/set gmat_type_". |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
628 lc(ptranslate(16, $type))."=". |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
629 join('|', @{$matByType{$type}})."\n"; |
7
245e7fff4d4d
Added option to output material data for GgrTF use.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
630 } |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
631 } |
298 | 632 ### |
633 ### Print a nice ASCII table | |
634 ### | |
257 | 635 elsif ($opt_mode eq "-table") |
636 { | |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
637 my $str = join("", |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
638 map { |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
639 sprintf("%-".$$_{"w"}."s | ", $$_{"s"}) |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
640 } @fieldInfo); |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
641 |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
642 print $str."\n"; |
142 | 643 $str =~ s/[^|]/-/g; |
644 $str =~ s/\|/+/g; | |
264 | 645 print $str."\n"; |
142 | 646 |
257 | 647 foreach my $name (@entries) |
648 { | |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
649 print join("", map { |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
650 sprintf("%-".$$_{"w"}."s | ", get_datastr($name, $$_{"i"})); |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
651 } @fieldInfo)."\n"; |
0 | 652 } |
653 } | |
298 | 654 ### |
655 ### Dump a Perl module with material data | |
656 ### | |
257 | 657 elsif ($opt_mode eq "-perl") |
658 { | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
659 $Data::Dumper::Indent = 0; |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
660 $Data::Dumper::Useqq = 1; |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
661 $Data::Dumper::Purity = 1; |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
662 |
264 | 663 print |
664 "package Materials;\n". | |
665 "require Exporter;\n". | |
666 "\@ISA = qw(Exporter);\n". | |
667 "\n". | |
668 "\@EXPORT = qw(matTable transTable revTransTable matByType matTypes);\n". | |
669 "\n"; | |
137 | 670 |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
671 my $dumper = Data::Dumper->new([$data], ["matTable"]); |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
672 print "our ".$dumper->Dump()."\n\n"; |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
673 |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
674 $dumper = Data::Dumper->new([\%$transTable], ["transTable"]); |
137 | 675 print "our ".$dumper->Dump()."\n\n"; |
676 | |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
677 $dumper = Data::Dumper->new([\%$revTransTable], ["revTransTable"]); |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
678 print "our ".$dumper->Dump()."\n\n"; |
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
679 |
137 | 680 $dumper = Data::Dumper->new([\%matByType], ["matByType"]); |
681 print "our ".$dumper->Dump()."\n\n"; | |
682 | |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
683 $dumper = Data::Dumper->new([\%$matTypes], ["matTypes"]); |
137 | 684 print "our ".$dumper->Dump()."\n\n"; |
685 | |
686 print "1;\n"; | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
687 } |
297
0620fe91a259
Change output PHP array variable names.
Matti Hamalainen <ccr@tnsp.org>
parents:
295
diff
changeset
|
688 ### |
0620fe91a259
Change output PHP array variable names.
Matti Hamalainen <ccr@tnsp.org>
parents:
295
diff
changeset
|
689 ### Dump PHP array format data |
0620fe91a259
Change output PHP array variable names.
Matti Hamalainen <ccr@tnsp.org>
parents:
295
diff
changeset
|
690 ### |
257 | 691 elsif ($opt_mode eq "-php") |
692 { | |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
693 print "<?php\n". |
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
694 "\$matTransNames = [". |
261 | 695 join(",", map { "\"".$$_{"l"}."\"" } @fieldInfo). |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
696 "];\n\n". |
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
697 "\$matTransTable = [\n"; |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
698 foreach my $i (sort { $a <=> $b } keys %$transTable) |
257 | 699 { |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
700 print " ["; |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
701 foreach my $j (sort { $$transTable{$i}{$a} <=> $$transTable{$i}{$b} } keys %{$$transTable{$i}}) |
257 | 702 { |
318
c12fd8e5c1b0
Simplify things regarding organ/organic, inorg/inorganic a bit,
Matti Hamalainen <ccr@tnsp.org>
parents:
305
diff
changeset
|
703 print $$transTable{$i}{$j}; |
261 | 704 $j =~ s/very /v./; |
705 $j =~ s/incredibly /incr./; | |
706 print " => \"".$j."\"," | |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
707 } |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
708 print "],\n"; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
709 } |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
710 print "];\n\n". |
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
711 "\$matDataTable = [\n"; |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
712 foreach my $name (sort { $a cmp $b } keys %$data) |
257 | 713 { |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
714 print " \"$name\" => ["; |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
715 for (my $qn = 1; $qn < scalar(@fieldInfo); $qn++) |
257 | 716 { |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
717 my $i = $fieldInfo[$qn]{"i"}; |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
718 if (ref($$data{$name}{$i}) eq "ARRAY") |
257 | 719 { |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
720 print "[".join(",", @{$$data{$name}{$i}})."],"; |
257 | 721 } |
265
acb168049adf
Major rework of how the utility works internally.
Matti Hamalainen <ccr@tnsp.org>
parents:
264
diff
changeset
|
722 else |
257 | 723 { |
304
5f5f45216218
Cleanup data structure usage.
Matti Hamalainen <ccr@tnsp.org>
parents:
299
diff
changeset
|
724 print $$data{$name}{$i}.", "; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
725 } |
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
726 } |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
727 print "],\n"; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
728 } |
334
0a62974ff1f3
Use modern [] style array definitions instead of array() in PHP output.
Matti Hamalainen <ccr@tnsp.org>
parents:
318
diff
changeset
|
729 print "];\n?>\n"; |
129
56b84ce195d9
Combined csv2phpsql.pl to parsematerial.pl
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
730 } |