Welcome to the Builder Academy

Question Meta Store Code

More
27 Nov 2012 23:07 - 27 Nov 2012 23:13 #1080 by dfeigel71
Meta Store Code was created by dfeigel71
Here is some meta store code that I had from back in the circlemud era. I have done a little rework to it to make it work with tbamud, nothing major just minor changes so don't give me credit for the code as overall I just did some minor work on it.

One thing I have done to it is change the max stats to 255 as in the mud code I am working on, the stat cap is 255 instead of 18 or 25. So if you use this, you may want to adjust the stat cap to fit into your mud. Also, the store charges quest points. You can change this to whatever you see fit with ease.

The following changes will be need to be made if you wish to implement this on your mud.

ADD TO SPEC_PROC.H

SPECIAL(metastore);


ADD TO SPEC_ASSIGN.C WITH ALL THE OTHER ASSIGNROOM STUFF
ASSIGNROOM(10, metastore);

ALSO SEARCH FOR struct spec_func_data spec_func_list[] = {

add the following into that function:

{"Meta Store", metastore},


ADD THE FOLLOWING CHUNK OF CODE TO SPEC_PROCS.C AND CHANGE TO FIT YOUR MUD

SPECIAL(metastore)
{

int meta_type = 0;
long meta_quest = 0;
long meta_exp = 0;
long meta_gold = 0;

if (CMD_IS("buy")) {
meta_type = atoi(argument);
switch(meta_type) {

case 1:
case 2:
case 3:
meta_quest = 25;
meta_exp = 1000000;
break;

case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
meta_quest = 75;
meta_exp = 3000000;
break;

case 10:
meta_quest = 1;
break;

case 11:
meta_quest = 5;
break;

case 12:
meta_quest = 10;
break;

}

/* Gold and Exp validity check */

if ((GET_QUESTPOINTS(ch) < meta_quest)) {
send_to_char(ch, "The Metaphysician says, \'You don't have enough quest points!!\'\r\n");
return (TRUE); }

if ((GET_EXP(ch) < meta_exp)) {
send_to_char(ch, "The Metaphysician says, \'You don't have enough experience points.\'\r\n");
return (TRUE); }

if ((GET_GOLD(ch) < meta_gold)) {
send_to_char(ch, "The Metaphysician says, \'You don't have enough money!!\'\r\n");
return (TRUE); }

/* Boost Stats */

switch(meta_type) {

case 1:
GET_MAX_HIT(ch) += rand_number(20, 40);
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "Your maximum hitpoints increase!\r\n");
return 1;
break;

case 2:
GET_MAX_POWER(ch) += rand_number(30, 50);
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You your mana raise!\r\n");
return 1;
break;

case 3:
GET_MAX_MOVE(ch) += rand_number(20, 40);
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You feel more endurance ability!\r\n");
return 1;
break;

case 4:
if (GET_STR(ch) < 255) {
GET_STR(ch) += 1;
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You feel stronger!\r\n");
return 1; }
else {
send_to_char(ch, "You are as naturally strong as you can be.\r\n");
return 1; }
break;

case 5:
if (GET_INT(ch) < 255) {
GET_INT(ch) += 1;
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You feel smarter!\r\n");
return 1; }
else {
send_to_char(ch, "Sorry, you can understand no more.\r\n");
return 1; }
break;

case 6:
if (GET_WIS(ch) < 255) {
GET_WIS(ch) += 1;
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You feel wiser!\r\n");
return 1; }
else {
send_to_char(ch, "Sorry, but I cannot make you any more wise.\r\n");
return 1; }
break;

case 7:
if (GET_DEX(ch) < 255) {
GET_DEX(ch) += 1;
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You feel faster!\r\n");
return 1; }
else {
send_to_char(ch, "Sorry, but you are already as agile as can be.\r\n");
return 1; }
break;

case 8:
if (GET_CON(ch) < 255) {
GET_CON(ch) += 1;
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You feel suddenly more sturdy.\r\n");
return 1; }
else {
send_to_char(ch, "Sorry, you are as hardy an individual as can be.\r\n");
return 1; }
break;

case 9:
if (GET_CHA(ch) < 255) {
GET_CHA(ch) += 1;
GET_QUESTPOINTS(ch) -= meta_quest;
GET_EXP(ch) -= meta_exp;
send_to_char(ch, "You social engineering skills increase!\r\n");
return 1; }
else {
send_to_char(ch, "Sorry, your charisma stuns me already.\r\n");
return 1; }
break;

case 10:
GET_GOLD(ch) += 10000;
GET_QUESTPOINTS(ch) -= 1;
send_to_char(ch, "You receive 10,000 gold for 1 quest points.\r\n");
return 1;
break;

case 11:
GET_GOLD(ch) += 50000;
GET_QUESTPOINTS(ch) -= 5;
send_to_char(ch, "You receive 50,000 gold for 5 quest points.\r\n");
return 1;
break;

case 12:
GET_GOLD(ch) += 100000;
GET_QUESTPOINTS(ch) -= 10;
send_to_char(ch, "You receive 100,000 gold for 10 quest points.\r\n");
return 1;
break;

}
send_to_char(ch, "The Metaphysician says, 'What would like to buy?\r\n");
send_to_char(ch, "____________________________________________ \r\n");
send_to_char(ch, "# Stat Raised: Exp: Quest Points: \r\n");
send_to_char(ch, "____________________________________________ \r\n");
send_to_char(ch, "1 health 1,000,000 25 \r\n");
send_to_char(ch, "2 mana 1,000,000 25 \r\n");
send_to_char(ch, "3 movement 1,000,000 25 \r\n");
send_to_char(ch, "
\r\n");
send_to_char(ch, "4 str (max: 255) 3,000,000 75 \r\n");
send_to_char(ch, "5 int (max: 255) 3,000,000 75 \r\n");
send_to_char(ch, "6 wis (max: 255) 3,000,000 75 \r\n");
send_to_char(ch, "7 dex (max: 255) 3,000,000 75 \r\n");
send_to_char(ch, "8 con (max: 255) 3,000,000 75 \r\n");
send_to_char(ch, "9 cha (max: 255) 3,000,000 75 \r\n");
send_to_char(ch, "_________________________________________ \r\n");
send_to_char(ch, "Currency Exchange: \r\n");
send_to_char(ch, "_________________________________________ \r\n");
send_to_char(ch, "10 10,000 Gold for 1 Quest Points \r\n");
send_to_char(ch, "11 50,000 Gold for 5 Quest Points \r\n");
send_to_char(ch, "12 100,000 Gold for 10 Quest Points \r\n");
return 1; }
return 0;
}



I hope someone enjoys it and finds a good use for it. If you decide to improve on it, please let me know, as I am always looking to see how others improve on existing ideas. As my coding skill improves, I hope to contribute some fresh code of my own so look for it in the future.


Sincerely,

Dustin
Last edit: 27 Nov 2012 23:13 by dfeigel71.

Please Log in or Create an account to join the conversation.

More
23 Apr 2013 16:04 #1992 by JTP
Replied by JTP on topic Meta Store Code
Nice code

Just one HUGE problem, after buying better stats, performing save gives you back your old stats ;)

How can i fix that ?

Please Log in or Create an account to join the conversation.

More
23 Apr 2013 20:25 #1994 by thomas
Replied by thomas on topic Meta Store Code
switch to

ch->real_abils.str += 1;
affect_total();

instead of

GET_STR(ch) += 1;

Please Log in or Create an account to join the conversation.

More
23 Apr 2013 20:40 #1995 by JTP
Replied by JTP on topic Meta Store Code
affect_total(vict);
or
affect_total(ch);

And do i need to alter the buy hit, mana, move with affect total aswell ??

Please Log in or Create an account to join the conversation.

Time to create page: 0.180 seconds