home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
PRE412.ZIP
/
ELRIC35.MOD
< prev
next >
Wrap
Text File
|
1990-06-13
|
20KB
|
620 lines
Welcome to...
Elrics mod #35
New restrictions on Message bases
Variable Gold per post per base
This mod is a kind of big one, yet it aint all that hard. What it does is
add some more stuff to subs.dat to allow you to have some extra restrictions
per base. To be exact, you may now include:
==> Maximum age for a base, for kiddie bases. Also allows you to do
something like an 18-22 only base.
==> Sex restrictions on a base, for male or female only bases
==> ANSI required for a base, for things like the ANSI art gallery
==> Gold, so different bases can earn different gold amounts
Of course, there is a problem with sticking this in SUBS.DAT, like it
should be. Wayne Bell for good reason won't distribute the source to the net,
and since it needs SUBS.DAT to post the messages, you would be in a world of
trouble if we changed that. So, there are several possible solutions:
==>Stick it in SUBS.DAT, but drop out of the network/linkwork.
==>Stick it in SUBS.DAT, and watch the net trash your drive.
==>Create a seperate little file for each sub, with 4 bytes in each one,
which of course wastes 2K of drive space each.
==>Make a new file, call it SUBS2.DAT, and store the extra info in there.
Then, read in the data in a complicated way involving multiple files,
arrays, and magic.
==>Make a new file, call it SUBS2.DAT. Store all the data in that one, and
let your BBS use this data file. Then, everytime you run Boardedit,
update SUBS.DAT with the info the net wants.
I chose the last alternative, because it was the only one that made sense.
So, without any further ado, allow me to procede with the mod.
==============================================================================
/** this step is indeed a form step, much like a form letter **/
1. From DOS, in your dir where you keep your source....
PKZIP SOURCE *.c *.h
If you already have a source zip file, then
PKZIP -f source *.c *.h
This way you have a copy of everything before you screw it up with a bad mod.
If you decide to take the mod out, it's as easy as
PKUNZIP -x source
and hit Y to overwrite any files you changed.
/** we now resume our regularly scheduled mod with step 2.... **/
==============================================================================
2. Load up vardec.h
Search down for the declaration for subboardrec. Mark that off (Ctrl-K B
at the beginning of the block, Ctrl-K K at the end.) Copy that block
(Ctrl-K C).
Now, take the first copy and re-name it oldsubboardrec. Take the second copy,
and add four variables to the unsigned chars. maxage, sex, ansi, and gold.
When you are done you should have a block that looks like this.
/* Old MESSAGE BASE INFORMATION (SUBS.DAT)*/
typedef struct {
char name[41], /* board name */
filename[9], /* board database filename */
key; /* board special key */
unsigned char readsl, /* sl required to read */
postsl, /* sl required to post */
anony, /* anonymous board? */
age; /* minimum age for sub */
unsigned short maxmsgs, /* max # of msgs */
ar, /* AR for sub-board */
storage_type, /* how messages are stored */
type; /* 4 digit board type */
} oldsubboardrec;
/* New MESSAGE BASE INFORMATION (SUBS2.DAT)*/
typedef struct {
char name[41], /* board name */
filename[9], /* board database filename */
key; /* board special key */
unsigned char readsl, /* sl required to read */
postsl, /* sl required to post */
anony, /* anonymous board? */
age, /* minimum age for sub */
maxage, /* maximum age */
sex, /* Male/Female restrictions */
ansi; /* ANSI required */
unsigned short maxmsgs, /* max # of msgs */
ar, /* AR for sub-board */
storage_type, /* how messages are stored */
type; /* 4 digit board type */
} subboardrec;
Save vardec.h
=============================================================================
3. Ok, now load up Sysopf.C There are several functions to modify here.
First, look at void modify_sub.
The first thing to add is the stuff to display these new options.
Right below where you add the new options, you will need to change the prompt
to reflect these changes. Heres what the first part of this function will
look like when you are done.
void modify_sub(int n)
{
subboardrec r;
/** stuff skipped over **/
print("J. Sub Type : ",s,"");
itoa(r.storage_type,s,10);
print("K. Storage typ: ",s,"");
/** add these lines **/
itoa(r.maxage,s,10);
print("L. Max Age : ",s,"");
switch (r.sex) {
case 0:strcpy(s,"Both"); break;
case 2:strcpy(s,"Male"); break;
case 1:strcpy(s,"Female"); break;
}
print("M. Sex : ",s,"");
print("N. ANSI : ",( r.ansi ? ("Required") : ("Not Required")),"");
itoa(r.gold,s,10);
print("O. Gold : ",s,"");
/** change the prompt and the onek statement to add the new letters **/
nl();
prt(2,"Which (A-O,Q) ? "); /** change **/
ch=onek("QABCDEFGHIJKLMNO"); /** change **/
switch(ch) {
case 'Q':done=1; break;
case 'A':
nl();
Now, you need to scan further down into the code to make these new options
do something. Look for Case 'K', then add these lines below that case.
Heres what you should have when you are done.
case 'K':
nl();
prt(2,"New Storage Type (0,1,2) ? ");
input(s,4);
i=atoi(s);
if ((s[0]) && (i>=0) && (i<=2))
r.storage_type=i;
break;
/** add new options on **/
case 'L':
nl();
prt(2,"New Max Age? (Enter 0 for none)");
input(s,3);
i=atoi(s);
if ((i>=0) && (i<128) && (s[0]))
r.maxage=i;
break;
case 'M':
nl();
prt(2,"New Sex Restriction (M:ale F:emale B:oth)? ");
ch2=onek("BFM");
switch (ch2) {
case 'B':r.sex=0; break;
case 'F':r.sex=1; break;
case 'M':r.sex=2; break;
}
break;
case 'N':
nl();
prt(2,"ANSI required? ");
if (yn())
r.ansi=1;
else
r.ansi=0;
break;
case 'O':
nl();
prt(2,"New Gold per Post? (Enter 0 for none, 10 Max)");
input(s,3);
i=atoi(s);
if ((i>=0) && (i<10) && (s[0]))
r.gold=i;
break;
/** end of new options **/
}
} while ((!done) && (!hangup));
subboards[n]=r;
if (!wfc)
changedsl();
}
OK. You are done with modify_sub.
===========================================================================
4. Still in sysopf.c, look down further for insert_sub. You will need to add
a little code to 0 out the new vars we just added. So, down in the middle
somewhere, add the 4 lines indicated
void insert_sub(int n)
{
subboardrec r;
/** skip down a few lines...**/
r.anony=0;
r.age=0;
/** add these in **/
r.maxage=0;
r.sex=0;
r.ansi=0;
r.gold=0;
/** end of mod**/
r.maxmsgs=50;
r.ar=0;
r.type=0;
=============================================================================
5. Still in Sysopf.c, look down a little further to void boardedit. The
first change here is to add in the dec for the old record structure. Just add
this line in like it is below...
void boardedit()
{
int i,i1,i2,done,f;
char s[81],s1[81],s2[81],ch;
oldsubboardrec oldsubboards[64]; /** add this line **/
if (!checkpw())
return;
Now, next look down a little further where it saves subs.dat. Change that line
to say SUBS2.DAT, and then add the rest of the indicated lines to save the
actual SUBS.DAT in the old format. This way, every time you run boardedit,
you save a fresh copy of subs.dat for the network to use.
sprintf(s,"%sSUBS2.dat",syscfg.datadir); /** change this line **/
f=open(s,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
write(f,(void *)&subboards[0], num_subs * sizeof(subboardrec));
close(f);
/** now make sure subs.dat is up to date for networking purposes **/
/** add these lines to copy the subs2 data over to the subs.dat array. **/
for (i=0;i<num_subs;i++) {
strcpy(oldsubboards[i].name,subboards[i].name); /* Now copy all data over */
strcpy(oldsubboards[i].filename,subboards[i].filename);
oldsubboards[i].key=subboards[i].key;
oldsubboards[i].readsl=subboards[i].readsl;
oldsubboards[i].anony=subboards[i].anony;
oldsubboards[i].age=subboards[i].age;
oldsubboards[i].maxmsgs=subboards[i].maxmsgs;
oldsubboards[i].ar=subboards[i].ar;
oldsubboards[i].storage_type=subboards[i].storage_type;
oldsubboards[i].type=subboards[i].type;
}
/** now add these to write this file out **/
sprintf(s,"%sSUBS.dat",syscfg.datadir);
f=open(s,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
write(f,(void *)&oldsubboards[0], num_subs * sizeof(oldsubboardrec));
close(f);
/** end of addition **/
}
==========================================================================
6. Now save Sysopf.c, and load up Utility.c. Scan down to void init, and
look for SUBS.DAT. You will need to change that to SUBS2.DAT, so the BBS
reads in the right file.
strcpy(s,syscfg.datadir);
strcat(s,"NAMES.LST");
i=open(s,O_RDWR | O_BINARY);
if (i<0) {
printf("%s NOT FOUND.\n",s);
end_bbs(noklevel);
}
read(i,(void *) (smallist), (sizeof(smalrec) * status.users));
close(i);
open_string_file();
strcpy(s,syscfg.datadir);
strcat(s,"SUBS2.DAT"); /** change this line **/
i=open(s,O_RDWR | O_BINARY);
if (i<0) {
printf("%s NOT FOUND.\n",s);
end_bbs(noklevel);
}
num_subs=(read(i,(void *) (&subboards), (64*sizeof(subboardrec))))/
sizeof(subboardrec);
==========================================================================
7. Still in Utility.c, scan down to changedsl. This routine is the one
that determines which bases a user has available. Since we have added new
restrictions, we need to add checks for these here.
void changedsl()
{
int i,i1,i2,i3,i4,ok,dp,ddp;
/** skip down a few lines...**/
for (i=0; i<num_subs; i++) {
ok=1;
s=subboards[i];
if (realsl<s.readsl)
ok=0;
if (thisuser.age<s.age)
ok=0;
/** add from here down **/
if ((s.maxage>0) && (thisuser.age>s.maxage))
ok=0;
if (((s.sex==2) && (thisuser.sex=='F')) ||
((s.sex==1) && (thisuser.sex=='M')))
ok=0;
if ((s.ansi) && (!okansi()))
ok=0;
/** end of addition **/
if ((s.ar!=0) && (((thisuser.ar) & (s.ar))==0))
ok=0;
/** extra mod. Add these two lines, and the #1 sysop will
always have access to every base on the BBS. If you want to
include the #2 or #8 or #187 user, then add lines for them too, just
changing the ==1 to ==2 or ==8 or ==187. **/
if (finduser(thisuser.name)==1)
ok=1;
=============================================================================
8. Now, load up BBSUTL1.C. Look down for list_users. We need to add some checks
here to see if people really do have access to the base.
void list_users()
{
/** skip a few lines **/
for (i=0; (i<status.users) && (!abort) && (!hangup); i++) {
read_user(smallist[i].number,&u);
ok=1;
if (u.sl<s.readsl)
ok=0;
if (u.age<s.age)
ok=0;
/** add from here down **/
if ((u.age>s.maxage) && (s.maxage>0))
ok=0;
if ((u.sex=='F') && (s.sex==2))
ok=0;
if ((u.sex=='M') && (s.sex==1))
ok=0;
if ((s.ansi) && !(u.sysstatus & sysstatus_ansi))
ok=0;
/** end of addition **/
if ((s.ar!=0) && ((u.ar & s.ar)==0))
ok=0;
if (ok) {
ansic(2);
=========================================================================
9. If you do not use a gold system, you can skip the next two steps.
Of course, even if you dont use a gold system, you can add these in.
Because, if you leave the gold set at 0, then this has no effect for the
user.
To make use of the variable gold, load up MSGBASE1.C, and make these
changes at the bottom of post.
sprintf(s,"+%s posted on %s",p.title,subboards[curlsub].name);
sysoplog(s);
sprintf(s,"Posted on %s",subboards[curlsub].name);
save_status();
pl(s);
/** add this to void post in MSGBASE1.C**/
if (subboards[curlsub].gold > 0) {
nl();
sprintf(s,"Lord Elric gives you %u gold pieces for that post",
subboards[curlsub].gold);
prt(3,s); nl();
thisuser.gold += (float) subboards[curlsub].gold;
sprintf(s,"You now have %d gold pieces.",(int) thisuser.gold);
pl(s);
}
nl();
/** end of addition **/
if ((subboards[curlsub].type) && (syscfg.systemnumber)) {
b=readfile(&(p.msg),subboards[curlsub].filename,&len1);
if (b==NULL)
return;
nh.tosys=0;
===========================================================================
10. Still doing that gold thing, we need to take away the gold if they
remove the post. Bloody lot of good it will do if we dont do this..they can
post, remove, post, remove, post, remove.....
sysoplog(s);
delete(i);
savebase();
nl();
pl("Message removed.");
/** add this to void remove_post in MSGBASE1.C**/
if (subboards[curlsub].gold > 0) {
nl();
sprintf(s,"Lord Elric takes back %u gold pieces for removing that post",
subboards[curlsub].gold);
prt(3,s); nl();
thisuser.gold -= (float) subboards[curlsub].gold;
}
/** end of addition **/
nl();
}
}
}
============================================================================
11. A bug in a previous version that was pointed out to me (THANKS once again
to Harb. He is a sysops dream....calls almost every board in town, almost
every day, posts quite a bit, almost never plays games, and he is the one
and only user who consistantly tries out everything he can think of when I say
"I got this new mod up that does this.....would everyone please check this
out and see if you find any bugs..."
Anyway, what this does is if the user changes his defaults, it resets his
access to the baords. This ONLY affects the ANSI only bases, but it was
the only flaw I could really find...
Load up BBS.C, and down in mainmenu add one line...
helpl=3;
reqchat();
break;
case 'D':
helpl=4;
defaults();
changedsl(); /** add this line **/
break;
case 'E':
send_email();
============================================================================
12. Still in BBS.C, if you are going to use the gold, add this to
indicate the amount of gold each base is worth in the listing
void sublist()
{
int i,abort;
char s[80],s2[80]; /** add the s2 **/
abort=0;
nl();
pla("Subs available: ",&abort);
nl();
i=0;
while ((i<64) && (usub[i].subnum!=-1)) { /** this 64 will be 32 if you **/
strcpy(s,usub[i].keys); /** not using the 64 base mod **/
s[2]=0;
if (s[1]==0)
s[1]=32;
strcat(s," - ");
if (syscfg.systemnumber)
if (subboards[usub[i].subnum].type)
strcat(s,"<LINK> ");
else
strcat(s," ");
sprintf(s2,"(%02d) ",subboards[usub[i].subnum].gold);/** add this line **/
strcat(s,s2); /** add this line **/
strcat(s,subboards[usub[i].subnum].name);
pla(s,&abort);
i++;
}
if (i==0)
pla("None.",&abort);
nl();
}
============================================================================
13. Now, for that gold thing, load up BBSUTL.C. Add this so when they view
their stats they can see the amount of gold they have.
void yourinfo()
{
char s[81];
outchr(12);
print("Your name : ",nam(&thisuser,usernum),"");
print("Your address : ",thisuser.street,""); /* from FROM mod */
print("From : ",thisuser.citystate,""); /* from FROM mod */
print("Zipcode : ",thisuser.zip,""); /* from FROM mod */
print("Phone number : ",thisuser.phone,"");
if (thisuser.waiting) {
itoa((int)thisuser.waiting,s,10);
print("Mail waiting : ",s,"");
}
itoa((int)thisuser.sl,s,10);
print("Sec Lev : ",s,"");
itoa((int)thisuser.dsl,s,10);
print("Transfer SecLev: ",s,"");
print("Last on : ",thisuser.laston,"");
itoa((int)thisuser.logons,s,10);
print("Times on : ",s,"");
itoa((int)thisuser.ontoday,s,10);
print("On today : ",s,"");
itoa((int)thisuser.msgpost,s,10);
print("Messages posted: ",s,"");
itoa((int)(thisuser.emailsent+thisuser.feedbacksent+thisuser.emailnet),s,10);
print("E-mail sent : ",s,"");
ltoa((long) ((thisuser.timeon+timer()-timeon)/60.0),s,10);
print("Time spent on : ",s," Minutes","");
sprintf(s,"Gold : %4.0f",thisuser.gold); /** add this line **/
pl(s); /** add this line **/
nl();
}
============================================================================
14. You are nearly finished. The only thing left to do is to recompile the
BBS.....Wait, did some sharp little sysop out there notice what I left out?
Thats right, you dont have a file called subs2.dat, and I gave you absolutely
no way to create one. Well, you may have noticed a little file included
with this mod called subcon.c. You need to compile this to an exe file, the
memory model really does not matter. Large, I suppose, since WWIV is. Anyway,
thats what I did, and it worked. It may or may not work in other models.
Anyway, then run this, such as
SUBCON \WWIV\DATA\SUBS.LST \WWIV\DATA\SUBS2.LST
^ ^ ^
:--File name : path and name : path and name
: of old file : of new file.
That should do it. For further ideas on what to do with gold, check out the
SALT (Sysops Against Little Twerps) mod by MrBill, or one of the other
gold mods. There are casinos, and ways to give gold, spend it on games, etc.
That is not part of my mod. I just have seen other people try to make gold
mods that gave differing amounts of gold for different bases, and I have
watched the bugs fly everywhere. Take for example, GoldSys. Does that really
work right yet?
Anyway, much credit should go to DartVader, sysop of Serendipity(?), who
asked me for a mod with the ANSI restriction, and to Deanna Troi, for creating
the Link Sisterhood sub, a female only sub, and a sysops nightmare. Search for
every female user on the BBS, and use another precious AR to only allow them
and only them on it, under threat of DeannaZip. This takes care of that
problem.
/** hey, it's the form info file **/
As usual, I take no responsibility for hard drive crashes, death in the
family, or end of the world as we know it resulting from this mod.
It's your fault if you didn't back up the files before you made the mod.
It's your fault if you don't back up your ENTIRE hard drive AT LEAST once
a month.
It works on my system with Turbo C 2.0, WWIV 4.1, V20/8088, 640K/640EMS.
If you use this, the only payment I ask is that you send me a note through
WWIVLink to 1@18251 saying you are using it...not too much to ask is it?
The Kingdom of Melnibone(LINK/NET)
812-877-3488 24 Hrs a day
3/12/2400/4800/9600/12,000/14,400 baud HST MNP5
Auto-validation of WWIV sysops on first call
Xmodem, Ymodem, DSZ Zmodem with retry, Ymodem-G
WWIV Link 1@18251
WWIV Net 1@8251