newquest.c
demise/src/newquest.c · 9.1 KB
From the archive dodbackup-final.tar.gz
Download the archive « Back to the archive contents
/*************************
* New Quest Code *
* Coded by Corim *
* aka *
* Gunnar Trulsrud *
* *
* based on *
* the normal quest code *
*************************/
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
void
do_qrequest (CHAR_DATA * ch, char *argument)
{
char arg[MIL];
char arg2[MIL];
CHAR_DATA *qmaster;
OBJ_INDEX_DATA *pObjIndex;
OBJ_INDEX_DATA *pObjIndex2;
OBJ_DATA *obj;
OBJ_DATA *obj2;
char buf[MIL];
bool world;
argument = one_argument (argument, arg);
argument = one_argument (argument, arg2);
if (IS_NPC (ch))
return;
if (arg[0] == '\0')
{
stc ("Who do you wish to request a quest from.\n\r", ch);
return;
}
if ((qmaster = get_char_room (ch, arg)) == NULL)
{
stc ("They arent here.\n\r", ch);
return;
}
if (!IS_NPC (qmaster))
{
stc ("They are not a quest master.\n\r", ch);
return;
}
if (qmaster->pIndexData->vnum == 28)
{
if ((pObjIndex = get_obj_index (OBJ_VNUM_QUESTCARD)) == NULL)
{
send_to_char ("Missing object, please inform Corim.\n\r", ch);
return;
}
if ((pObjIndex2 = get_obj_index (28)) == NULL)
{
send_to_char ("Missing object, please inform Corim.\n\r", ch);
return;
}
obj2 = create_object (pObjIndex2, 0);
obj_to_room (obj2, get_room_index (number_range (25, 49)));
SET_BIT (obj2->weapflags, WEAPON_WRAITHQUEST);
obj = create_object (pObjIndex, 0);
obj_to_char (obj, ch);
obj->value[0] = 28;
obj->value[1] = -1;
obj->value[2] = -1;
obj->value[3] = -1;
if (obj->questmaker != NULL)
free_string (obj->questmaker);
obj->questmaker = str_dup (qmaster->short_descr);
if (obj->questowner != NULL)
free_string (obj->questowner);
obj->questowner = str_dup (ch->name);
free_string (obj->creator);
sprintf (buf, "%s", ch->name);
obj->creator = str_dup (buf);
act ("$p fades into existance in $N hands.", ch, obj, qmaster, TO_CHAR);
act ("$p fades into existance in $N's hands.", ch, obj, qmaster,
TO_ROOM);
act ("$N hands $p to you.", ch, obj, qmaster, TO_CHAR);
act ("$N hands $p to $n hands.", ch, obj, qmaster, TO_ROOM);
do_say (qmaster, "Find that object, then come back here!");
return;
}
if (qmaster->spec_fun == spec_lookup ("spec_assassin") && IS_ASSASSIN (ch))
{
qreq_assassin (ch, qmaster);
return;
}
if (qmaster->spec_fun != spec_lookup ("spec_questmaster"))
{
stc ("They are not a quest master.\n\r", ch);
return;
}
if (IS_SET (ch->evenmore, EM_QUESTOR))
{
do_say (qmaster,
"I have already given you an assignment, now get going before I Smite you!");
waiting (ch, 9);
return;
}
if (!HAS_CREDIT (ch))
{
do_say (qmaster,
"You dont have any credit, I can't give you any assignments.");
waiting (ch, 9);
return;
}
if (ch->countdown > 0 && !IS_IMMORTAL (ch))
{
if (ch->countdown > 120)
{
do_say (qmaster,
"I dont have any need of your services right now come back later.");
waiting (ch, 9);
return;
}
else
{
do_say (qmaster,
"Hmm yes I could need some help, if I could just remember where I put that list.");
do_say (qmaster, "Come back in a couple of minutes.");
waiting (ch, 9);
return;
}
}
if (arg2[0] == '\0')
{
do_say (qmaster,
"Hmm what kind of list do you want though? An EASY list, I dont pay as much for these quests");
do_say (qmaster,
"Or would you like a HARD list, these list have a higher reward.");
waiting (ch, 9);
return;
}
else if (!str_cmp (arg2, "easy"))
{
do_say (qmaster,
"You want an easy list do you, nobody wants to do an honest piece of work anymore.");
check_social (qmaster, "grumble", "");
world = FALSE;
}
else if (!str_cmp (arg2, "hard"))
{
do_say (qmaster,
"Ah, a hard list, now where did I put those, hardly anyone asks for them anymore.");
world = TRUE;
}
else
{
do_say (qmaster,
"Hmm what kind of list do you want though? An EASY list, I dont pay as much for these quests");
do_say (qmaster,
"Or would you like a HARD list, these list have a higher reward.");
waiting (ch, 9);
return;
}
if ((pObjIndex = get_obj_index (OBJ_VNUM_QUESTCARD)) == NULL)
{
send_to_char ("Missing object, please inform Corim.\n\r", ch);
return;
}
obj = create_object (pObjIndex, 0);
obj_to_char (obj, ch);
quest_object (ch, obj, world);
if (!world)
obj->level = number_range (1, 5);
else
obj->level = number_range (9, 12);
act ("$p fades into existance in $N hands.", ch, obj, qmaster, TO_CHAR);
act ("$p fades into existance in $N's hands.", ch, obj, qmaster, TO_ROOM);
if (obj->questmaker != NULL)
free_string (obj->questmaker);
obj->questmaker = str_dup (qmaster->short_descr);
if (obj->questowner != NULL)
free_string (obj->questowner);
obj->questowner = str_dup (ch->name);
free_string (obj->creator);
sprintf (buf, "%s", ch->name);
obj->creator = str_dup (buf);
act ("$N scribles a few lines on $p.", ch, obj, qmaster, TO_CHAR);
act ("$N scribles a few lines on $p.", ch, obj, qmaster, TO_ROOM);
act ("$N hands you $p.", ch, obj, qmaster, TO_CHAR);
act ("$N hands $p to $n.", ch, obj, qmaster, TO_ROOM);
SET_BIT (ch->evenmore, EM_QUESTOR);
if (ch->countdown > 0)
ch->countdown = 0;
do_say (qmaster,
"Find these items that I need for my shop, and I will reward you handsomely.");
if (!IS_COR (ch, COR_FIRSTQUEST))
{
do_say (qmaster, "To see what is on the list READ it.");
do_say (qmaster,
"When you find them just TOUCH them to this scroll and they will be transported to me.");
do_say (qmaster,
"If you find all the items just come back her and DELIVER the list to me for your reward.");
SET_BIT (ch->corbits, COR_FIRSTQUEST);
}
waiting (ch, 9);
return;
}
void
do_touch (CHAR_DATA * ch, char *argument)
{
char buf[MSL];
char list[MSL];
char object[MSL];
char arg1[MIL];
char arg2[MIL];
OBJ_DATA *qobj;
OBJ_DATA *obj;
OBJ_INDEX_DATA *pObjIndex;
int count = 0;
int count2 = 0;
argument = one_argument (argument, arg1);
argument = one_argument (argument, arg2);
if (arg1[0] == '\0')
{
send_to_char ("Syntax: Touch <list> <object>\n\r", ch);
return;
}
if ((qobj = get_obj_carry (ch, arg1)) == NULL)
{
send_to_char ("You are not carrying that object.\n\r", ch);
return;
}
else if (qobj->item_type != ITEM_QUESTCARD)
{
send_to_char ("That is not a Item List.\n\r", ch);
return;
}
if (arg2[0] == '\0')
{
stc ("Touch what Item to the List?\n\r", ch);
return;
}
if ((obj = get_obj_carry (ch, arg2)) == NULL)
{
send_to_char ("You are not carrying that object.\n\r", ch);
return;
}
if (str_cmp (qobj->creator, ch->name))
{
send_to_char ("This list is not attuned to you.\n\r", ch);
return;
}
sprintf (list, arg1);
sprintf (object, arg2);
sprintf (buf, "%s %s", list, object);
do_complete (ch, buf);
return;
}
void
do_qcancel (CHAR_DATA * ch, char *argument)
{
CHAR_DATA *qmaster;
OBJ_INDEX_DATA *pObjIndex;
OBJ_DATA *obj;
ROOM_INDEX_DATA *location;
char buf[MIL];
if (IS_NPC (ch))
return;
for (qmaster = ch->in_room->people; qmaster != NULL;
qmaster = qmaster->next_in_room)
{
if (!IS_NPC (qmaster))
continue;
if (qmaster->spec_fun == spec_lookup ("spec_questmaster"))
break;
}
if (qmaster == NULL
|| qmaster->spec_fun != spec_lookup ("spec_questmaster"))
{
stc
("The Old Wizard is not here, you need to actually go to the Wizard to cancel the quest.\n\r",
ch);;
return;
}
if (!IS_SET (ch->evenmore, EM_QUESTOR))
{
do_say (qmaster, "I have not given you a quest.");
do_say (qmaster,
"Stop wasting my time or you will spend the next century or so as a toad");
waiting (ch, 9);
return;
}
for (obj = object_list; obj != NULL; obj = obj->next)
{
if (obj->item_type != ITEM_QUESTCARD)
continue;
if (str_cmp (obj->creator, ch->name))
continue;
extract_obj (obj);
}
REMOVE_BIT (ch->evenmore, EM_QUESTOR);
do_say (qmaster, "Ahh, another failure, I had high hopes for you to.");
do_say (qmaster, "Get out of my sight vermin, I have no use for failures!");
act
("$N dismisses you with a wave of $S hand, then your vision starts to blur.\n\rWhen the fog clears you are in a totally different place.",
ch, NULL, qmaster, TO_CHAR);
act ("$N dismisses $n with a wave of $S hand, and $n starts fading away.",
ch, NULL, qmaster, TO_NOTVICT);
if ((location = get_room_index (ROOM_VNUM_TEMPLE)) != NULL)
{
char_from_room (ch);
char_to_room (ch, location);
}
do_look (ch, "");
act ("$n fades into view, wonder where $e came from?", ch, NULL, NULL,
TO_ROOM);
ch->countdown = number_range (420, 600);
return;
}