This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ackfuss.c
255 lines (231 loc) · 8.51 KB
/
ackfuss.c
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
/*
* Copyright Matt Goff (Kline) 2009
* If you use my code, please give credit where it is due.
* Support provided at www.ackmud.net
*/
#include "h/areaconvert.h"
#include "h/extern.h"
void write_ackfuss( ofstream &file, int type )
{
write_ackfuss_area(file, type);
write_ackfuss_room(file, type);
write_ackfuss_npc(file, type);
write_ackfuss_obj(file, type);
write_ackfuss_shop(file, type);
write_ackfuss_reset(file, type);
file << "#$" << endl; /* the end */
return;
}
void write_ackfuss_area( ofstream &file, int type )
{
char delim = '~';
int i = 0;
file << "#AREA" << endl;
file << "Revision " << area.revision << endl;
file << "CanRead " << area.can_read << delim << endl;
file << "CanWrite " << area.can_write << delim << endl;
file << "Flags ";
for ( i = 0; i < MAX_BITSET; i++ )
if ( area.bitset_flags_out.test(i) )
file << i << " ";
file << "EOL" << endl;
file << "Keyword " << area.keyword << delim << endl;
file << "LevLabel " << area.level_label << delim << endl;
file << "LevRange " << area.min_level << " " << area.max_level << endl;
file << "Name " << area.name << delim << endl;
file << "Owner " << area.owner << delim << endl;
file << "ResetMsg " << area.reset_msg << delim << endl;
file << "ResetRate " << area.reset_rate << endl;
file << "VnumRange " << area.min_vnum << " " << area.max_vnum << endl;
file << "End" << endl;
return;
}
void write_ackfuss_room( ofstream &file, int type )
{
char delim = '~';
list<room_data *>::iterator rt;
list<extra_data *>::iterator et;
room_data *room;
extra_data *extra;
int i = 0, x = 0;
for ( rt = room_list.begin(); rt != room_list.end(); rt++ )
{
room = *rt;
file << "#ROOM" << endl;
file << "Vnum " << room->vnum << endl;
file << "Desc " << room->description << delim << endl;
file << "Flags ";
for ( i = 0; i < MAX_BITSET; i++ )
if ( room->bitset_flags_out.test(i) )
file << i << " ";
file << "EOL" << endl;
file << "Name " << room->name << delim << endl;
file << "Sect " << room->sector << endl;
file << "End" << endl;
for ( i = 0; i < MAX_EXIT; i++ )
{
if ( room->exit[i] )
{
file << "#DOOR" << endl;
file << "Dir " << i << endl; /* Must be first for sanity checks --Kline */
file << "Desc " << room->exit[i]->description << delim << endl;
file << "Flags ";
for ( x = 0; x < MAX_BITSET; x++ )
if ( room->exit[i]->bitset_flags_out.test(x) )
file << x << " ";
file << "EOL" << endl;
file << "Key " << room->exit[i]->key << endl;
file << "Keyword " << room->exit[i]->keyword << delim << endl;
file << "Vnum " << room->exit[i]->vnum << endl;
file << "End" << endl;
}
}
for ( et = room->extra_list.begin(); et != room->extra_list.end(); et++ )
{
extra = *et;
file << "#REXTRA" << endl;
file << "Desc " << extra->description << delim << endl;
file << "Keyword " << extra->keyword << delim << endl;
file << "End" << endl;
}
}
return;
}
void write_ackfuss_npc( ofstream &file, int type )
{
char delim = '~';
list<npc_data *>::iterator nt;
npc_data *npc;
int i = 0;
for ( nt = npc_list.begin(); nt != npc_list.end(); nt++ )
{
npc = *nt;
file << "#MOBILE" << endl;
file << "Vnum " << npc->vnum << endl;
file << "AcMod " << npc->ac_mod << endl;
file << "Act ";
for ( i = 0; i < MAX_BITSET; i++ )
if ( npc->bitset_act_flags_out.test(i) )
file << i << " ";
file << "EOL" << endl;
file << "Affected " << 0 << endl;
file << "Alignment " << npc->alignment << endl;
file << "Cast " << npc->cast << endl;
file << "Clan " << npc->clan << endl;
file << "Class " << npc->pclass << endl;
file << "Def " << npc->def << endl;
file << "Desc " << npc->description << delim << endl;
file << "DrMod " << npc->dr_mod << endl;
file << "HrMod " << npc->hr_mod << endl;
file << "Level " << npc->level << endl;
file << "LongDesc " << npc->long_descr << delim << endl;
file << "PlrName " << npc->player_name << delim << endl;
file << "Position " << npc->position << endl;
file << "Race " << npc->race << endl;
file << "RaceMods " << npc->race_mod << endl;
file << "Resist " << npc->resist << endl;
file << "Sex " << npc->sex << endl;
file << "ShortDesc " << npc->short_descr << delim << endl;
file << "Skills " << npc->skills << endl;
file << "SMagic " << npc->strong_magic << endl;
file << "Suscept " << npc->suscept << endl;
file << "WMagic " << npc->weak_magic << endl;
file << "End" << endl;
}
return;
}
void write_ackfuss_obj( ofstream &file, int type )
{
char delim = '~';
list<obj_data *>::iterator ot;
list<affect_data *>::iterator at;
list<extra_data *>::iterator et;
obj_data *obj;
affect_data *aff;
extra_data *extra;
int i = 0;
for ( ot = obj_list.begin(); ot != obj_list.end(); ot++ )
{
obj = *ot;
file << "#OBJECT" << endl;
file << "Vnum " << obj->vnum << endl;
file << "ExtraFlags ";
for ( i = 0; i < MAX_BITSET; i++ )
if ( obj->bitset_extra_flags_out.test(i) )
file << i << " ";
file << "EOL" << endl;
file << "ItemApply " << obj->int_item_apply_out << endl;
file << "Level " << obj->level << endl;
file << "LongDesc " << obj->long_descr << delim << endl;
file << "Name " << obj->name << delim << endl;
file << "ShortDesc " << obj->short_descr << delim << endl;
file << "Type " << obj->type << endl;
file << "Values ";
for ( i = 0; i < MAX_OBJ_VALUE; i++ )
file << obj->value[i] << " ";
file << endl;
file << "WearFlags ";
for ( i = 0; i < MAX_BITSET; i++ )
if ( obj->bitset_wear_flags_out.test(i) )
file << i << " ";
file << "EOL" << endl;
file << "Weight " << obj->weight << endl;
file << "End" << endl;
for ( at = obj->apply_list.begin(); at != obj->apply_list.end(); at++ )
{
aff = *at;
file << "#OAFFECT" << endl;
file << "Location " << aff->int_location_out << endl;
file << "Modifier " << aff->modifier << endl;
file << "End" << endl;
}
for ( et = obj->extra_list.begin(); et != obj->extra_list.end(); et++ )
{
extra = *et;
file << "#OEXTRA" << endl;
file << "Desc " << extra->description << delim << endl;
file << "Keyword " << extra->keyword << delim << endl;
file << "End" << endl;
}
}
return;
}
void write_ackfuss_shop( ofstream &file, int type )
{
list<shop_data *>::iterator st;
shop_data *shop;
int i = 0;
for ( st = shop_list.begin(); st != shop_list.end(); st++ )
{
shop = *st;
file << "#SHOP" << endl;
file << "Keeper " << shop->keeper << endl;
file << "BuyType ";
for ( i = 0; i < MAX_TRADE; i++ )
file << shop->buy_type[i] << " ";
file << endl;
file << "HourClose " << shop->hour_close << endl;
file << "HourOpen " << shop->hour_open << endl;
file << "ProfBuy " << shop->prof_buy << endl;
file << "ProfSell " << shop->prof_sell << endl;
file << "End" << endl;
}
return;
}
void write_ackfuss_reset( ofstream &file, int type )
{
list<reset_data *>::iterator rt;
reset_data *reset;
file << "#RESETS" << endl;
for ( rt = reset_list.begin(); rt != reset_list.end(); rt++ )
{
reset = *rt;
file << reset->command << " " << reset->arg1 << " " << reset->arg2 << " ";
if ( reset->command[0] == 'G' || reset->command[0] == 'R' )
file << reset->notes << endl;
else
file << reset->arg3 << " " << reset->notes << endl;
}
file << "S" << endl;
return;
}