Figured I would share a small piece of code since I have been asking
lots of questions, etc. lately.
I dont know if you all feel the same way as I do, but I got tired of adding
to the level_exp table array after 150 or so levels........ So I wrote a
little
thing to shorten the job.
<SNIP>
int level_exp(int chclass, int level)
{
int modifier, exp;
if (level > LVL_IMPL || level < 0) {
log("SYSERR: Requesting exp for invalid level %d!", level);
return 0;
}
switch(chclass)
{
case CLASS_MAGIC_USER:
modifier = 2;
break;
case CLASS_CLERIC:
modifier = 5;
break;
case CLASS_THIEF:
modifier = 3;
break;
case CLASS_WARRIOR:
modifier = 4;
default:
log("SYSERR: Unknown class in level chart.");
modifier = 0;
}
if (level < 5) {
exp = (level - 1) * modifier * 1000;
} else {
exp = (level - 1) * modifier * 3000;
}
return exp;
}
</SNIP>
Yes, it is sloppy, yes it probably has bugs, but hey, you didnt have to do
it!
Enjoy
-----------------------------------------------------------------------
Mark W. Vanness Jr.
Artifact Newsletter - Project Coordinator
TrekWars Administration - Project Coordinator
-----------------------------------------------------------------------
Artifact - http://artifact-vpx.hypermart.net
TrekWars MUD - telnet://funcity.org:9321
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST