-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrgdata.c
More file actions
229 lines (212 loc) · 5.29 KB
/
rgdata.c
File metadata and controls
229 lines (212 loc) · 5.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
* Super-Rogue
* Copyright (C) 1984 Robert D. Kindelberger
* All rights reserved.
*
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include "global.c"
main(argc,argv)
char **argv;
int argc;
{
char *ptr;
int i, j, k;
struct magic_item *mi;
struct init_weps *wp;
struct init_armor *ar;
struct monster *mo;
FILE *fo;
/*
* write to desired output file
*/
if (argc > 1) {
fo = fopen(argv[1], "w");
if (fo == NULL) {
printf("%s: %s not writable\n",argv[0],argv[1]);
exit(1);
}
}
else
fo = stdout;
/*
* print total chances for armor, weapons, food, scrolls, etc
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t ITEM GENERAL INFO\n\n\n");
fprintf(fo,"NAME\t\tCHANCE\t\tWEIGHT\n\n");
for (mi = &things[0]; mi < &things[NUMTHINGS]; mi++) {
fprintf(fo,"%s\t\t",mi->mi_name);
i = mi->mi_prob / 10;
j = mi->mi_prob % 10;
fprintf(fo,"%2d.%1d %%\t\t",i,j);
i = mi->mi_wght / 10;
j = mi->mi_wght % 10;
if (i == 0 && j == 0)
fprintf(fo,"%3s\n","*");
else
fprintf(fo,"%3d.%1d lbs\n",i,j);
}
fprintf(fo,"\n\n\n\n\n\n\nNOTES - * means that weight depends on which one of that item type\n");
fprintf(fo," - All items weigh 20%% more when cursed\n");
/*
* print stuff about potions
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t\t POTION INFO\n\n\n");
fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
for (mi = &p_magic[0]; mi < &p_magic[MAXPOTIONS]; mi++) {
fprintf(fo,"%s\t",mi->mi_name);
k = strlen(mi->mi_name);
if (k < 8)
ptr = "\t\t\t";
else if (k >= 16)
ptr = "\t";
else
ptr = "\t\t";
fprintf(fo,"%s", ptr);
i = mi->mi_prob / 10;
j = mi->mi_prob % 10;
fprintf(fo,"%2d.%1d %%\t\t",i,j);
fprintf(fo,"%3d\n",mi->mi_worth);
}
fprintf(fo,"\n\n\n\n\nNOTE - All potions weigh 0.5 lbs\n");
/*
* print stuff about scrolls
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t\t SCROLL INFO\n\n\n");
fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
for (mi = &s_magic[0]; mi < &s_magic[MAXSCROLLS]; mi++) {
fprintf(fo,"%s\t",mi->mi_name);
k = strlen(mi->mi_name);
if (k < 8)
ptr = "\t\t\t";
else if (k >= 16)
ptr = "\t";
else
ptr = "\t\t";
fprintf(fo,"%s", ptr);
i = mi->mi_prob / 10;
j = mi->mi_prob % 10;
fprintf(fo,"%2d.%1d %%\t\t",i,j);
fprintf(fo,"%3d\n",mi->mi_worth);
}
fprintf(fo,"\n\n\n\n\nNOTE - All scrolls weigh 3.0 lbs\n");
/*
* print stuff about rings
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t\t RING INFO\n\n\n");
fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
for (mi = &r_magic[0]; mi < &r_magic[MAXRINGS]; mi++) {
fprintf(fo,"%s\t",mi->mi_name);
k = strlen(mi->mi_name);
if (k < 8)
ptr = "\t\t\t";
else if (k >= 16)
ptr = "\t";
else
ptr = "\t\t";
fprintf(fo,"%s", ptr);
i = mi->mi_prob / 10;
j = mi->mi_prob % 10;
fprintf(fo,"%2d.%1d %%\t\t",i,j);
fprintf(fo,"%3d\n",mi->mi_worth);
}
fprintf(fo,"\n\n\n\n\nNOTE - All rings weigh 0.5 lbs\n");
/*
* print stuff about sticks
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t\t STAFF/WAND INFO\n\n\n");
fprintf(fo,"NAME\t\t\t\tCHANCE\t\tWORTH\n\n");
for (mi = &ws_magic[0]; mi < &ws_magic[MAXSTICKS]; mi++) {
fprintf(fo,"%s\t",mi->mi_name);
k = strlen(mi->mi_name);
if (k < 8)
ptr = "\t\t\t";
else if (k >= 16)
ptr = "\t";
else
ptr = "\t\t";
fprintf(fo,"%s", ptr);
i = mi->mi_prob / 10;
j = mi->mi_prob % 10;
fprintf(fo,"%2d.%1d %%\t\t",i,j);
fprintf(fo,"%3d\n",mi->mi_worth);
}
fprintf(fo,"\n\n\n\n\nNOTES - All wands weigh 6.0 lbs\n");
fprintf(fo," - All staffs weigh 10.0 lbs\n");
fprintf(fo," - Wands contain from 4 to 8 charges\n");
fprintf(fo," - Staffs contain from 5 to 12 charges\n");
fprintf(fo," - Sticks of light have an additional 7 to 15 charges\n");
/*
* print armor info
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t\t\t\tARMOR INFO\n\n\n");
fprintf(fo,"NAME\t\t\t\tAC\tCHANCE\t\tWORTH\t\tWEIGHT\n\n");
for (ar = &armors[0]; ar < &armors[MAXARMORS]; ar++) {
fprintf(fo,"%s\t",ar->a_name);
k = strlen(ar->a_name);
if (k < 8)
ptr = "\t\t\t";
else if (k >= 16)
ptr = "\t";
else
ptr = "\t\t";
fprintf(fo,"%s", ptr);
fprintf(fo,"%2d\t",ar->a_class);
fprintf(fo,"%2d %%\t\t",ar->a_prob);
fprintf(fo,"%3d\t\t",ar->a_worth);
fprintf(fo,"%2d lbs\n",ar->a_wght / 10);
}
fprintf(fo,"\n\n\n\n\nNOTE - All armor becomes 50%% lighter when blessed\n");
/*
* print stuff about weapons
*/
fprintf(fo,"\n\n\n\n\n\n");
fprintf(fo,"\t\t\t\t\tWEAPON INFO\n\n\n");
fprintf(fo,
"NAME\t\t\tHIT DAMAGE\tHURL DAMAGE\tWORTH\t\tWEIGHT\n\n");
for (wp = &weaps[0]; wp < &weaps[MAXWEAPONS]; wp++) {
fprintf(fo,"%s\t",wp->w_name);
k = strlen(wp->w_name);
if (k < 8)
ptr = "\t\t";
else if (k >= 16)
ptr = "";
else
ptr = "\t";
fprintf(fo,"%s", ptr);
ptr = wp->w_dam;
i = *ptr - '0';
j = 0;
ptr += 2;
while (*ptr != NULL) {
j = j * 10 + (*ptr - '0');
++ptr;
}
j *= i;
fprintf(fo," %d to %d\t",i,j);
ptr = wp->w_hrl;
i = *ptr - '0';
j = 0;
ptr += 2;
while (*ptr != NULL) {
j = j * 10 + (*ptr - '0');
++ptr;
}
j *= i;
fprintf(fo," %d to %d\t",i,j);
fprintf(fo,"%4d\t\t",wp->w_worth);
i = wp->w_wght / 10;
j = wp->w_wght % 10;
fprintf(fo,"%2d.%1d lbs\n",i,j);
}
fprintf(fo,"\n\n\n\n\nNOTE - All weapons become 50%% lighter when blessed\n");
/*
* print stuff about the monsters
*/
}