/*used the do_buy and do_list functions, * just modified them to work with quest stuff, * and also removed the unnessecary stuff * like the pets info. This makes for * resetable objects, instead of hardcoding like * some quest code does. * Belial - Millennium, ns2.vic.com 9000 * Belial - Deadly Temptations lr2.com 6000 * Belial - -E- * Stinkfist - Last Rites lr2.com 9000 * any suggestions, or any help....email me at * chancedj@peaknet.net */ /* add these to the declarations section in the top of the quest.c file. */ void quest_buy args( (CHAR_DATA *ch, CHAR_DATA *qm, char *argument) ); void quest_list args( (CHAR_DATA *ch, CHAR_DATA *qm, char *argument) ); /* add this to do_quest, after the questmaster is found. * qm = the questmaster mob. If there is already a list * section in the quest code, remove it and replace it with this. */ if( !str_prefix( arg, "list" ) ) { quest_list(ch,qm,argument); return; } if( !str_prefix( arg, "buy" ) ) { quest_buy(ch,qm,argument); return; } /* in db.c find and change the following ( - remove, + add )*/ - if ( LastMob->pIndexData->pShop ) /* Shop-keeper? */ + if ( LastMob->pIndexData->pShop + || LastMob->spec_fun == spec_lookup( "spec_questmaster" ) ) /* Shop-keeper? */ /* change the ch->questpoints to whatever you use * ie ch->quest_tokens, ch->pcdata->tokens, etc etc. * also may want to make it so you cant give an object to * the questmaster, then it goes into the listing and messes with * everyone. */ /* QUICK NOTE!!!! This shows it being used with vassagos quest code * if you are using any other persons, then change the following code bits * to whatever you use to identify the questmaster! */ ->spec_fun == spec_lookup( "spec_questmaster" ) /* the rest is added whereever the do_quest is located :) */ void quest_buy( CHAR_DATA *ch, CHAR_DATA *qm, char *argument ) { char buf[MAX_STRING_LENGTH]; int cost; OBJ_DATA *obj, *t_obj; char arg[MAX_INPUT_LENGTH]; char trash[MAX_INPUT_LENGTH]; int number, count = 1; /* get rid of buy in argument */ argument = one_argument(argument,trash); number = mult_argument(argument,arg); obj = get_obj_keeper( ch,qm, arg ); if (obj == NULL) { send_to_char( "Buy what?\n\r", ch ); return; } cost = obj->cost; if (number < 1) { act("$n tells you 'Get real!",qm,NULL,ch,TO_VICT); return; } if ( cost < 0 || !can_see_obj( ch, obj ) ) { act( "$n tells you 'I don't sell that -- try 'list''.", qm, NULL, ch, TO_VICT ); ch->reply = qm; return; } if ( (ch->questpoints) < cost * number ) { if (number > 1) act("$n tells you 'You can't afford to buy that many.", qm,obj,ch,TO_VICT); else act( "$n tells you 'You can't afford to buy $p'.", qm, obj, ch, TO_VICT ); ch->reply = qm; return; } if ( ch->level < obj->level ) { act( "$n tells you 'You can't use $p yet'.", qm, obj, ch, TO_VICT ); ch->reply = qm; return; } if (ch->carry_number + number * get_obj_number(obj) > can_carry_n(ch)) { send_to_char( "You can't carry that many items.\n\r", ch ); return; } if ( ch->carry_weight + number * get_obj_weight(obj) > can_carry_w(ch)) { send_to_char( "You can't carry that much weight.\n\r", ch ); return; } if (number > 1) { sprintf(buf,"$n buys $p[%d].",number); act(buf,ch,obj,NULL,TO_ROOM); sprintf(buf,"You buy $p[%d] for %d questpoints.",number,cost * number); act(buf,ch,obj,NULL,TO_CHAR); } else { act( "$n buys $p.", ch, obj, NULL, TO_ROOM ); sprintf(buf,"You buy $p for %d questpoints.",cost); act( buf, ch, obj, NULL, TO_CHAR ); } ch->questpoints -= (cost * number); for (count = 0; count < number; count++) { t_obj = create_object( obj->pIndexData, obj->level ); if (t_obj->timer > 0 && !IS_OBJ_STAT(t_obj,ITEM_HAD_TIMER)) t_obj->timer = 0; REMOVE_BIT(t_obj->extra_flags,ITEM_HAD_TIMER); obj_to_char( t_obj, ch ); t_obj->cost = 0; } } void quest_list( CHAR_DATA *ch, CHAR_DATA *qm, char *argument ) { char buf[MAX_STRING_LENGTH]; OBJ_DATA *obj; int cost; bool found; found = FALSE; for ( obj = qm->carrying; obj; obj = obj->next_content ) { if ( obj->wear_loc == WEAR_NONE && can_see_obj( ch, obj ) && (cost = obj->cost ) > 0 ) { if ( !found ) { found = TRUE; send_to_char( "{c[{CLv Token Qty{c] Item{x\n\r", ch ); } if (IS_OBJ_STAT(obj,ITEM_INVENTORY)) { sprintf(buf,"{c[{C%2d %5d -- {c] %s{x\n\r",obj->level,cost,obj->short_descr); send_to_char( buf, ch ); } } } if ( !found ) send_to_char( "No items available at this time.\n\r", ch ); else { sprintf(buf, "\n\r$n tells you '{wYou have {B%d {wquestpoints to spend.{x'", ch->questpoints); act(buf,qm,NULL,ch,TO_VICT); } return; }