ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/doc/playbook/gods-extract
Revision: 1.2
Committed: Thu Sep 7 21:43:15 2006 UTC (17 years, 8 months ago) by pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Moved documents to doc/historic

File Contents

# Content
1
2 # parse the crossfire -m8 output
3
4 BEGIN {
5 crosscmd = crosscmd " 2>&1";
6 god = 0;
7 while (crosscmd | getline buff == 1) {
8 if(buff ~ /GOD/) { god++; gift[god] =0; name[god] = get_entry(buff,2," "); }
9 if(!god) continue;
10 if(buff ~ /enemy:/) enemy[god] = get_entry(buff,2," ");
11 if(buff ~ /aligned/) aligned[god] = get_entry(buff,2," ");
12 if(buff ~ /enemy_race/) erace[god] = get_entry(buff,2," ");
13 if(buff ~ /servant/) servant[god] = get_entry(get_entry(get_entry(buff,2,": "),1,")"),2"(");
14 if(buff ~ /Attacks:/) atype[god] = get_entry(get_entry(buff,2,": "),1,")");
15 if(buff ~ /Immune:/) immune[god] = get_entry(get_entry(buff,2,": "),1,")");
16 if(buff ~ /Prot:/) prot[god] = get_entry(get_entry(buff,2,": "),1,")");
17 if(buff ~ /Vuln:/) vuln[god] = get_entry(get_entry(buff,2,": "),1,")");
18 if(buff ~ /Attuned:/) attuned[god] = get_entry(get_entry(buff,2,": "),1,")");
19 if(buff ~ /Repelled:/) repelled[god] = get_entry(get_entry(buff,2,": "),1,")");
20 if(buff ~ /Denied:/) denied[god] = get_entry(get_entry(buff,2,": "),1,")");
21 if(buff ~ /Desc:/) desc[god] = get_entry(get_entry(buff,2,": "),1,",");
22 if(buff ~ /Priest/ || gift[god]) {
23 if(!buff) continue;
24 special[god,gift[god]++] = buff;
25 }
26 # printf(" %s \n", buff);
27 }
28 close(crosscmd);
29 for(i=1;i<=god;i++) {
30 printf("\{\\bf %s \} & %s \\\\\\hline", name[i], capitalize(desc[i]));
31 if(enemy[i]) printf("\nEnemy cult: & %s \\\\ ", enemy[i]);
32 # if(servant[i]) printf("Servant: & %s \\\\ \n ", servant[i]);
33 if(aligned[i]) prt_var("Aligned race(s): ",aligned[i],",",3);
34 if(erace[i]) prt_var("Enemy race(s): ",erace[i],",",3);
35 if(atype[i]) prt_var("Attacktype(s): ",atype[i],",",3);
36 if(immune[i]) prt_var("Immunity: ",immune[i],",",3);
37 if(prot[i]) prt_var("Protected: ",prot[i],",",3);
38 if(vuln[i]) prt_var("Vulnerable: ",vuln[i],",",3);
39 if(attuned[i]) prt_var("Attuned: ",attuned[i],",",3);
40 if(repelled[i]) prt_var("Repelled: ",repelled[i],",",3);
41 if(denied[i]) prt_var("Denied: ",denied[i],",",3);
42 for(j=1;j<gift[i];j++) {
43 if(j==1) printf("Added gifts/limits: & \\\\\n");
44 printf("& %s \\\\\n",special[i,j]);
45 }
46 if(i!=god) printf(" \\hline \n \\sngc\{ \} \\\\ \n \\sngc\{ \} \\\\ \\hline \n");
47 else printf(" \\hline \n");
48 }
49 }
50
51 function prt_var (hstr,vstr,sep,len) {
52 printf("%s & ",hstr); prtlong(vstr,sep,len);
53 }
54
55
56 function get_entry (str,start,sep) {
57 nr = split(str, var, sep);
58 for(k=start;k<=nr;k++) {
59 if(var[k]==" ") continue;
60 break;
61 }
62 while(var[k] ~ /_/ ) { sub("_", " ", var[k]); }
63 return var[k];
64 }
65
66 function prtlong (str,sep,max) {
67 nr = split(str, var, sep);
68 printf("\n");
69 for(l=1;l<=nr;l++) {
70 if(var[l] == "(null)") var[l] = "None";
71 if(l==nr) printf("%s \\\\",capitalize(var[l]));
72 else printf("%s,",capitalize(var[l]));
73 if(l!=1 && l!=nr && (l % max)==0) printf("\\\\ \n & ");
74 }
75 }
76
77 function capitalize(str) {
78 return toupper(substr(str, 1, 1)) substr(str, 2);
79 }
80