ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/doc/playbook/skills-extract
Revision: 1.1.1.1 (vendor branch)
Committed: Fri Feb 3 07:12:39 2006 UTC (18 years, 5 months ago) by root
Branch: UPSTREAM
CVS Tags: UPSTREAM_2006_03_15, LAST_C_VERSION, STABLE, UPSTREAM_2006_02_22, difficulty_fix_merge_060810_2300, UPSTREAM_2006_02_03
Branch point for: difficulty_fix
Changes since 1.1: +0 -0 lines
Log Message:
initial import

File Contents

# User Rev Content
1 root 1.1 # treas-extract - parse the treasures-file and output the
2     # player's stats in a structured format.
3    
4     # read in the list of player randomitems from randitem
5     BEGIN {
6     # yeah, its kludgey, but hey, I've been programming awk for
7     # all of 1 day!
8    
9     noticeitem["holy_symbol"] = 1;
10     noticeitem["random_knowledge"] = 1;
11    
12     ignoreitem["basic_skills"] = 1;
13     ignoreitem["skill_melee_weapon"] = 1;
14    
15     newname["skill_climbing"] = "mountaineer";
16     newname["spell_skills"] = "spellcasting";
17     newname["wizard_skills"] = "spellcasting, Praying";
18     newname["skill_missile_weapon"] = "Missile weapons";
19     newname["fighter_skills"] = "Missile weapons";
20     newname["mage_skills"] = "spellcasting (talisman)";
21     newname["holy_symbol"] = "praying (holy symbol)";
22     newname["random_knowledge"] = "random skill";
23    
24     # Read the player treasure types
25     pl = 0;
26     while ((getline buff < eqitems) == 1) {
27     nr = split(buff, line, ",");
28     player[pl] = line[1];
29     list[pl] = line[2];
30     pl++;
31     }
32     close(playerlist);
33    
34     }
35    
36     $1 == "treasure" {
37     for ( i=0; i < pl ; i++ ) {
38     if ($2 == list[i]) { # matched players list
39     nrloop=0;
40     do {
41     getline;
42     if($1 in ignoreitem) continue;
43     if($1 == ("yes"||"no")) {
44     nrloop++;
45     continue;
46     } else if($1 == "end") {
47     if(nrloop==0) { break; } else { nrloop--; }
48     continue;
49     }
50     if(!($2 in noticeitem)) {
51     if(!($2 ~ "skill")) continue;
52     if($2 in ignoreitem) continue;
53     }
54     equip = $2;
55     if(equip in plural) equip = sprintf("%ss",equip);
56     if(equip in newname) equip = newname[equip];
57     equiplist[i] = sprintf("%s,%s",equiplist[i],equip);
58     } while ( $1 != ("treasure" || "treasureone" || "list" ) )
59     }
60     }
61     }
62    
63     END {
64     close("trease");
65     # now print this stuff out in correct order!
66     for(i=0;i<pl;i++) {
67     printf("%s & ",capitalize(player[i]));
68     nr = split(equiplist[i], eq, ",");
69     if(nr==0) {
70     # hmm. This can happen if 2 or more character classes
71     # share the same treaure list. Lets find it.
72     for(j=0;j<pl;j++)
73     if(list[i]==list[j]) break;
74     nr = split(equiplist[j], eq, ",");
75     }
76     sub("skill_", "", eq[nr]);
77     sub("_", " ", eq[nr]);
78     printf("%s",capitalize(eq[nr--]));
79     do {
80     printf(", ");
81     sub("skill_", "", eq[nr]);
82     sub("_", " ", eq[nr]);
83     # printf("& %s\\\\\n",capitalize(eq[nr]));
84     printf("%s",capitalize(eq[nr]));
85     } while (--nr>1);
86     printf(" \\\\\n");
87     }
88     }
89    
90     function capitalize(str) {
91     return toupper(substr(str, 1, 1)) substr(str, 2);
92     }
93