changeset 6:2a9a89879b51 misc

Improvements.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 20 Oct 2008 08:42:15 +0000
parents 4ace936a44ec
children 245e7fff4d4d
files materials/csv2phpsql.pl materials/data/cotton.mat materials/material.inc.php materials/mkmaterialinfo.sh
diffstat 4 files changed, 41 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/materials/csv2phpsql.pl	Mon Oct 20 08:21:38 2008 +0000
+++ b/materials/csv2phpsql.pl	Mon Oct 20 08:42:15 2008 +0000
@@ -85,19 +85,19 @@
     "high reactivity" => 6,
   },
   12 => {
-    "not" => 0,
-    "rarely" => 1,
-    "sometimes" => 2,
-    "frequently" => 3,
-    "quite much" => 4,
+    "not used" => 0,
+    "rarely used" => 1,
+    "sometimes used" => 2,
+    "frequently used" => 3,
+    "quite much used" => 4,
     "most common" => 5,
   },
   13 => {
-    "not" => 0,
-    "rarely" => 1,
-    "sometimes" => 2,
-    "frequently" => 3,
-    "quite much" => 4,
+    "not used" => 0,
+    "rarely used" => 1,
+    "sometimes used" => 2,
+    "frequently used" => 3,
+    "quite much used" => 4,
     "most common" => 5,
   },
   14 => {
@@ -291,7 +291,7 @@
 my %data = ();
 while (<STDIN>) {
   chomp;
-  if (/^([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z -]+);([a-z ]+);([a-zA-Z ]+);(Yes|No);([A-Z][a-z]+);([a-z, ]+);([a-z, ]+)$/) {
+  if (/^([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z ]+);([a-z -]+);([a-z ]+);([a-zA-Z ]+);(Yes|No);([A-Z][a-z]+);([a-z, ]+);([a-z, ]+);$/) {
     for (my $i = 2; $i <= 18; $i++) {
       $data{$1}{$i} = $$i;
     }
@@ -324,7 +324,7 @@
       print $transtab{$i}{$j};
       $j =~ s/very /v./;
       $j =~ s/incredibly /incr./;
-      print " => \"".$j."\","
+      print " => \"$j\","
     }
     print "),\n";
   }
--- a/materials/data/cotton.mat	Mon Oct 20 08:21:38 2008 +0000
+++ b/materials/data/cotton.mat	Mon Oct 20 08:42:15 2008 +0000
@@ -7,7 +7,7 @@
 Mentality:     (poor mentality)   Reactivity:    (great reactivity)
 Weapon rarity: (not used)         Armour rarity: (sometimes used)
 Value (gp/kg): (cheap)            Rarity:        (common)
-Article:       a                       Type:          Organ
+Article:       a                       Type:          Cloth
 Found nature:  Yes                     Lode name:     Mound
 Raw names:     piece, strip, ball
 Refined names: piece, strip, ball
--- a/materials/material.inc.php	Mon Oct 20 08:21:38 2008 +0000
+++ b/materials/material.inc.php	Mon Oct 20 08:42:15 2008 +0000
@@ -2,25 +2,25 @@
 $transNameTable = array("Name","Weight","Sturdyness","Magic","Flammability","Warmth","Toxicity","Resist","Malleability","Mentality","Reactivity","Weapon rarity","Armour rarity","Value","Rarity","Type","Found in Nature","Lode name","Raw names","Refined names",);
 
 $transTable = array(
-  0 => array(0 => "v.light",2 => "normal",4 => "v.heavy",1 => "light",3 => "heavy",),
-  1 => array(4 => "v.sturdy",2 => "normal",3 => "sturdy",0 => "v.fragile",5 => "incr.sturdy",1 => "fragile",),
-  2 => array(0 => "notable magical",1 => "v.magical",3 => "highly magical",2 => "weakly magical",4 => "not magical",6 => "a bit magical",5 => "magical",),
-  3 => array(0 => "quite unburnable",1 => "normal",2 => "quite flammable",3 => "highly flammable",4 => "almost unburnable",6 => "v.flammable",5 => "unburnable",),
-  4 => array(1 => "drafty",0 => "icy",3 => "chilly",2 => "comfortable",4 => "excellent",),
-  5 => array(0 => "low toxicity",1 => "v.toxic",2 => "highly toxic",3 => "toxic",5 => "non toxic",4 => "v.low toxicity",6 => "mediocre toxicity",),
-  6 => array(0 => "insulator",2 => "weak",1 => "good",3 => "poor",4 => "great",5 => "lousy",),
-  7 =>  array(3 => "solid",2 => "quite solid",5 => "incr.solid",0 => "loose",4 => "v.solid",1 => "a bit loose",),
-  8 => array(0 => "some mentality",1 => "low mentality",2 => "mental",3 => "poor mentality",5 => "high mentality",4 => "great mentality",),
-  9 => array(0 => "great reactivity",3 => "poor reactivity",2 => "reactive",1 => "not reactive",4 => "low reactivity",5 => "notable reactivity",6 => "high reactivity",),
- 10 => array(5 => "most common",4 => "quite much",3 => "frequently",2 => "sometimes",1 => "rarely",0 => "not used",),
- 11 => array(5 => "most common",4 => "quite much",3 => "frequently",2 => "sometimes",1 => "rarely",0 => "not used",),
- 12 => array(3 => "valuable",2 => "average",5 => "highly valuable",0 => "cheap",4 => "v.valuable",1 => "low-priced",),
- 13 => array(6 => "v.common",5 => "quite common",3 => "average",0 => "impossible",2 => "rare",4 => "common",1 => "v.rare",),
- 14 => array(0 => "Organ",1 => "Cloth",3 => "Bone",2 => "Paper",4 => "Metal",6 => "Stone",5 => "Wood",7 => "Alloy",9 => "Glass",8 => "Inorg",10 => "Gem",),
- 15 => array(1 => "Yes",0 => "No",),
- 16 => array(2 => "Crag",1 => "Protrusion",0 => "Hit",3 => "Lode",4 => "Pocket",7 => "Deposit",6 => "Shard",5 => "Gloss",8 => "Mountain",9 => "Nest",10 => "Stack",11 => "Mound",12 => "Puddle",13 => "Slab",14 => "Network",15 => "Pool",16 => "Hill",17 => "Mass",19 => "Graveyard",18 => "Tangle",20 => "Lump",21 => "Coil",22 => "Abyss",24 => "Torrent",23 => "Pile",),
- 17 => array(0 => "heap",3 => "hunk",2 => "pocket",1 => "stick",4 => "shard",6 => "stone",5 => "string",8 => "wisp",7 => "slice",9 => "wad",10 => "clump",13 => "strip",12 => "gob",11 => "carcas",15 => "ball",14 => "dough",16 => "chunk",17 => "load",18 => "leaf",19 => "salt",20 => "pile",21 => "isotope",22 => "tusk",23 => "clod",24 => "lump",25 => "lode",26 => "piece",27 => "flame",28 => "stem",29 => "sphere",30 => "fragment",32 => "twig",31 => "mineral",34 => "crystal",33 => "stalk",35 => "log",36 => "reed",37 => "nugget",38 => "mix",41 => "block",40 => "pulp",39 => "mic",42 => "puddle",43 => "sliver",),
- 18 => array(0 => "formed",4 => "pocket",3 => "elipsoid",2 => "bundle",1 => "stick",6 => "mold",5 => "brick",9 => "form",8 => "shard",7 => "gene",11 => "isometric",10 => "wisp",12 => "cord",14 => "bar",13 => "billot",16 => "strip",15 => "bolt",17 => "ball",19 => "chunk",18 => "billit",20 => "octagon",21 => "cube",22 => "ingot",23 => "chip",24 => "casting",25 => "dean",26 => "piece",27 => "flame",28 => "billet",29 => "crafted",30 => "cut",31 => "pelt",33 => "crystal",32 => "strand",34 => "log",35 => "reed",36 => "tetragonal",38 => "strap",37 => "sheet",40 => "length",39 => "reem",41 => "sculpted",44 => "product",43 => "hexagonal",42 => "block",46 => "puddle",45 => "shaped",47 => "fibres",),
+  array(0 => "v.light",2 => "normal",4 => "v.heavy",1 => "light",3 => "heavy",),
+  array(4 => "v.sturdy",2 => "normal",3 => "sturdy",0 => "v.fragile",5 => "incr.sturdy",1 => "fragile",),
+  array(0 => "notable magical",1 => "v.magical",3 => "highly magical",2 => "weakly magical",4 => "not magical",6 => "a bit magical",5 => "magical",),
+  array(0 => "quite unburnable",1 => "normal",2 => "quite flammable",3 => "highly flammable",4 => "almost unburnable",6 => "v.flammable",5 => "unburnable",),
+  array(1 => "drafty",0 => "icy",3 => "chilly",2 => "comfortable",4 => "excellent",),
+  array(0 => "low toxicity",1 => "v.toxic",2 => "highly toxic",3 => "toxic",5 => "non toxic",4 => "v.low toxicity",6 => "mediocre toxicity",),
+  array(0 => "insulator",2 => "weak",1 => "good",3 => "poor",4 => "great",5 => "lousy",),
+  array(3 => "solid",2 => "quite solid",5 => "incr.solid",0 => "loose",4 => "v.solid",1 => "a bit loose",),
+  array(0 => "some mentality",1 => "low mentality",2 => "mental",3 => "poor mentality",5 => "high mentality",4 => "great mentality",),
+  array(0 => "great reactivity",3 => "poor reactivity",2 => "reactive",1 => "not reactive",4 => "low reactivity",5 => "notable reactivity",6 => "high reactivity",),
+  array(5 => "most common",0 => "not used",2 => "sometimes used",4 => "quite much used",3 => "frequently used",1 => "rarely used",),
+  array(5 => "most common",0 => "not used",2 => "sometimes used",4 => "quite much used",3 => "frequently used",1 => "rarely used",),
+  array(3 => "valuable",2 => "average",5 => "highly valuable",0 => "cheap",4 => "v.valuable",1 => "low-priced",),
+  array(6 => "v.common",5 => "quite common",3 => "average",0 => "impossible",2 => "rare",4 => "common",1 => "v.rare",),
+  array(0 => "Organ",1 => "Cloth",3 => "Bone",2 => "Paper",4 => "Metal",6 => "Stone",5 => "Wood",7 => "Alloy",9 => "Glass",8 => "Inorg",10 => "Gem",),
+  array(1 => "Yes",0 => "No",),
+  array(2 => "Crag",1 => "Protrusion",0 => "Hit",3 => "Lode",4 => "Pocket",7 => "Deposit",6 => "Shard",5 => "Gloss",8 => "Mountain",9 => "Nest",10 => "Stack",11 => "Mound",12 => "Puddle",13 => "Slab",14 => "Network",15 => "Pool",16 => "Hill",17 => "Mass",19 => "Graveyard",18 => "Tangle",20 => "Lump",21 => "Coil",22 => "Abyss",24 => "Torrent",23 => "Pile",),
+  array(0 => "heap",3 => "hunk",2 => "pocket",1 => "stick",4 => "shard",6 => "stone",5 => "string",8 => "wisp",7 => "slice",9 => "wad",10 => "clump",13 => "strip",12 => "gob",11 => "carcas",15 => "ball",14 => "dough",16 => "chunk",17 => "load",18 => "leaf",19 => "salt",20 => "pile",21 => "isotope",22 => "tusk",23 => "clod",24 => "lump",25 => "lode",26 => "piece",27 => "flame",28 => "stem",29 => "sphere",30 => "fragment",32 => "twig",31 => "mineral",34 => "crystal",33 => "stalk",35 => "log",36 => "reed",37 => "nugget",38 => "mix",41 => "block",40 => "pulp",39 => "mic",42 => "puddle",43 => "sliver",),
+  array(0 => "formed",4 => "pocket",3 => "elipsoid",2 => "bundle",1 => "stick",6 => "mold",5 => "brick",9 => "form",8 => "shard",7 => "gene",11 => "isometric",10 => "wisp",12 => "cord",14 => "bar",13 => "billot",16 => "strip",15 => "bolt",17 => "ball",19 => "chunk",18 => "billit",20 => "octagon",21 => "cube",22 => "ingot",23 => "chip",24 => "casting",25 => "dean",26 => "piece",27 => "flame",28 => "billet",29 => "crafted",30 => "cut",31 => "pelt",33 => "crystal",32 => "strand",34 => "log",35 => "reed",36 => "tetragonal",38 => "strap",37 => "sheet",40 => "length",39 => "reem",41 => "sculpted",44 => "product",43 => "hexagonal",42 => "block",46 => "puddle",45 => "shaped",47 => "fibres",),
 );
 
 $matTable = array(
@@ -48,16 +48,18 @@
   "cedar" => array(1, 2, 6, 3, 3, 4, 4, 0, 3, 0, 1, 0, 1, 5, 5, 1, 10, ),
   "cesium" => array(2, 1, 2, 3, 3, 2, 5, 1, 1, 0, 0, 0, 3, 3, 4, 1, 7, ),
   "chalk" => array(1, 1, 2, 0, 3, 3, 0, 0, 3, 6, 0, 0, 0, 4, 6, 1, 7, ),
+  "charcoal" => array(0, 0, 6, 6, 3, 1, 3, 0, 3, 0, 0, 0, 0, 3, 0, 0, 23, ),
   "chromium" => array(3, 2, 5, 4, 0, 1, 5, 5, 3, 4, 2, 2, 3, 3, 4, 1, 7, ),
   "chrysoberyl" => array(2, 5, 6, 4, 3, 2, 4, 0, 1, 3, 0, 0, 2, 4, 10, 1, 7, ),
   "clay" => array(0, 0, 6, 3, 3, 4, 2, 2, 3, 6, 1, 1, 0, 6, 6, 1, 16, ),
   "cloth" => array(1, 1, 2, 3, 1, 6, 1, 0, 3, 0, 0, 2, 0, 5, 1, 0, 11, ),
   "coal" => array(2, 0, 6, 3, 3, 5, 2, 0, 3, 0, 0, 0, 0, 4, 6, 1, 2, ),
   "cobalt" => array(3, 5, 5, 4, 0, 0, 2, 4, 3, 6, 2, 2, 3, 3, 4, 1, 3, ),
+  "concrete" => array(2, 0, 2, 0, 3, 2, 4, 0, 3, 2, 0, 0, 0, 5, 6, 0, 2, ),
   "copper" => array(4, 2, 5, 1, 3, 3, 5, 2, 1, 4, 4, 3, 0, 5, 4, 1, 3, ),
   "coral" => array(2, 1, 6, 0, 3, 6, 1, 0, 3, 0, 0, 0, 2, 1, 3, 0, 14, ),
   "cork" => array(0, 0, 6, 3, 0, 6, 2, 0, 3, 0, 1, 1, 0, 6, 5, 1, 17, ),
-  "cotton" => array(1, 2, 2, 3, 2, 6, 1, 0, 3, 0, 0, 2, 0, 4, 0, 1, 11, ),
+  "cotton" => array(1, 2, 2, 3, 2, 6, 1, 0, 3, 0, 0, 2, 0, 4, 1, 1, 11, ),
   "crystal" => array(2, 1, 1, 4, 3, 2, 4, 0, 3, 3, 1, 0, 3, 3, 9, 1, 13, ),
   "darksteel" => array(3, 4, 0, 1, 4, 6, 5, 4, 3, 6, 2, 2, 2, 4, 7, 0, 7, ),
   "diamond" => array(2, 5, 6, 6, 3, 2, 4, 0, 3, 1, 0, 0, 5, 1, 10, 1, 7, ),
@@ -110,6 +112,7 @@
   "moss agate" => array(3, 3, 0, 0, 3, 2, 4, 0, 0, 4, 0, 0, 2, 2, 10, 1, 7, ),
   "mowgles" => array(3, 2, 2, 2, 0, 4, 5, 1, 3, 3, 0, 0, 0, 6, 4, 0, 7, ),
   "mowglite" => array(3, 2, 2, 2, 0, 4, 5, 1, 3, 3, 0, 0, 0, 6, 4, 1, 3, ),
+  "neo burlap" => array(2, 3, 5, 2, -1,4, 1, 0, 1, 5, 0, 0, 3, 0, 1, 0, -1,),
   "nickel" => array(3, 5, 5, 4, 0, 0, 2, 3, 0, 4, 4, 4, 1, 4, 4, 1, 3, ),
   "nullium" => array(3, 4, 1, 0, 3, 1, 2, 4, 5, 4, 0, 0, 4, 3, 4, 1, 22, ),
   "oak" => array(1, 2, 5, 3, 3, 4, 4, 0, 3, 0, 1, 0, 1, 5, 5, 1, 10, ),
@@ -123,6 +126,7 @@
   "pearl" => array(2, 1, 6, 2, 3, 2, 4, 0, 3, 6, 0, 0, 4, 2, 10, 0, 7, ),
   "petrified wood" => array(2, 2, 2, 0, 0, 2, 4, 0, 3, 2, 0, 0, 2, 1, 6, 1, 2, ),
   "pewter" => array(3, 1, 5, 1, 3, 6, 5, 0, 1, 6, 1, 2, 1, 4, 7, 0, 3, ),
+  "phosphorus" => array(3, 2, 6, 2, 1, 2, 2, 0, 3, 6, 0, 0, 1, 3, 0, 0, 7, ),
   "platinum" => array(4, 4, 1, 0, 3, 1, 5, 3, 1, 4, 0, 0, 4, 4, 4, 1, 3, ),
   "porcelain" => array(0, 0, 6, 2, 3, 4, 2, 2, 3, 4, 4, 0, 1, 2, 8, 0, 17, ),
   "potassium" => array(3, 0, 2, 3, 1, 2, 2, 0, 3, 6, 0, 0, 2, 2, 4, 1, 7, ),
--- a/materials/mkmaterialinfo.sh	Mon Oct 20 08:21:38 2008 +0000
+++ b/materials/mkmaterialinfo.sh	Mon Oct 20 08:42:15 2008 +0000
@@ -4,6 +4,7 @@
 LISTLONG="$DESTDIR/materials_long.txt"
 LISTSHORT="$DESTDIR/materials_short.txt"
 LISTCSV="$DESTDIR/materials.csv"
+LISTPHP="$DESTDIR/material.inc.php"
 
 # Create the long list
 echo "Generating long list..."
@@ -26,3 +27,6 @@
 
 echo "Generating CSV"
 cat $DATADIR/*.mat | perl -w parsematerial.pl -csv > "$LISTCSV"
+
+echo "Generating PHP ..."
+perl -w csv2phpsql.pl -php < "$LISTCSV" > "$LISTPHP"