mirror of
https://github.com/tbamud/tbamud.git
synced 2026-02-28 14:31:44 +01:00
clang-format file added, quest.c and .h formatted
This commit is contained in:
55
.clang-format
Normal file
55
.clang-format
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AlwaysBreakTemplateDeclarations: Yes
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: true
|
||||||
|
AfterClass: true
|
||||||
|
AfterControlStatement: false
|
||||||
|
AfterEnum: true
|
||||||
|
AfterFunction: true
|
||||||
|
AfterNamespace: true
|
||||||
|
AfterStruct: true
|
||||||
|
AfterUnion: true
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: true
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: true
|
||||||
|
BeforeWhile: true
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BreakBeforeBinaryOperators: All
|
||||||
|
BreakConstructorInitializers: AfterColon
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
|
||||||
|
ColumnLimit: 120
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^<.*'
|
||||||
|
Priority: 1
|
||||||
|
- Regex: '^".*'
|
||||||
|
Priority: 2
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 3
|
||||||
|
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||||
|
IndentCaseBlocks: true
|
||||||
|
IndentWidth: 4
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
NamespaceIndentation: All
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesInAngles: false
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInParentheses: false
|
||||||
|
TabWidth: 4
|
||||||
|
...
|
||||||
124
src/quest.c
124
src/quest.c
@@ -70,7 +70,7 @@ qst_rnum real_quest(qst_vnum vnum)
|
|||||||
return (NOTHING);
|
return (NOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_complete(struct char_data *ch, qst_vnum vnum)
|
int is_complete(const struct char_data *ch, qst_vnum vnum)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -109,8 +109,6 @@ void destroy_quests(void)
|
|||||||
free(aquest_table);
|
free(aquest_table);
|
||||||
aquest_table = NULL;
|
aquest_table = NULL;
|
||||||
total_quests = 0;
|
total_quests = 0;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_quests(qst_vnum low, qst_vnum high)
|
int count_quests(qst_vnum low, qst_vnum high)
|
||||||
@@ -201,8 +199,7 @@ void parse_quest(FILE *quest_f, int nr)
|
|||||||
log("Format error in %s\n", line);
|
log("Format error in %s\n", line);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
switch(*line) {
|
if (*line == 'S') {
|
||||||
case 'S':
|
|
||||||
total_quests = ++i;
|
total_quests = ++i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -235,56 +232,54 @@ void assign_the_quests(void)
|
|||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
/* Quest Completion Functions */
|
/* Quest Completion Functions */
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
void set_quest(struct char_data *ch, qst_rnum rnum)
|
void set_quest(const struct char_data *ch, qst_rnum rnum)
|
||||||
{
|
{
|
||||||
GET_QUEST(ch) = QST_NUM(rnum);
|
GET_QUEST(ch) = QST_NUM(rnum);
|
||||||
GET_QUEST_TIME(ch) = QST_TIME(rnum);
|
GET_QUEST_TIME(ch) = QST_TIME(rnum);
|
||||||
GET_QUEST_COUNTER(ch) = QST_QUANTITY(rnum);
|
GET_QUEST_COUNTER(ch) = QST_QUANTITY(rnum);
|
||||||
SET_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
SET_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_quest(struct char_data *ch)
|
void clear_quest(const struct char_data *ch)
|
||||||
{
|
{
|
||||||
GET_QUEST(ch) = NOTHING;
|
GET_QUEST(ch) = NOTHING;
|
||||||
GET_QUEST_TIME(ch) = -1;
|
GET_QUEST_TIME(ch) = -1;
|
||||||
GET_QUEST_COUNTER(ch) = 0;
|
GET_QUEST_COUNTER(ch) = 0;
|
||||||
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
REMOVE_BIT_AR(PRF_FLAGS(ch), PRF_QUEST);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_completed_quest(struct char_data *ch, qst_vnum vnum)
|
void add_completed_quest(const struct char_data *ch, qst_vnum vnum)
|
||||||
{
|
{
|
||||||
qst_vnum *temp;
|
qst_vnum *temp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch) +1);
|
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch) +1);
|
||||||
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
||||||
temp[i] = ch->player_specials->saved.completed_quests[i];
|
temp[i] = GET_COMPLETED_QUEST(ch, i);
|
||||||
|
|
||||||
temp[GET_NUM_QUESTS(ch)] = vnum;
|
temp[GET_NUM_QUESTS(ch)] = vnum;
|
||||||
GET_NUM_QUESTS(ch)++;
|
GET_NUM_QUESTS(ch)++;
|
||||||
|
|
||||||
if (ch->player_specials->saved.completed_quests)
|
if (GET_COMPLETED_QUESTS(ch) != NULL)
|
||||||
free(ch->player_specials->saved.completed_quests);
|
free(GET_COMPLETED_QUESTS(ch));
|
||||||
ch->player_specials->saved.completed_quests = temp;
|
GET_COMPLETED_QUESTS(ch) = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_completed_quest(struct char_data *ch, qst_vnum vnum)
|
void remove_completed_quest(const struct char_data *ch, qst_vnum vnum)
|
||||||
{
|
{
|
||||||
qst_vnum *temp;
|
qst_vnum *temp;
|
||||||
int i, j = 0;
|
int i, j = 0;
|
||||||
|
|
||||||
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch));
|
CREATE(temp, qst_vnum, GET_NUM_QUESTS(ch));
|
||||||
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
for (i = 0; i < GET_NUM_QUESTS(ch); i++)
|
||||||
if (ch->player_specials->saved.completed_quests[i] != vnum)
|
if (GET_COMPLETED_QUEST(ch, i) != vnum)
|
||||||
temp[j++] = ch->player_specials->saved.completed_quests[i];
|
temp[j++] = GET_COMPLETED_QUEST(ch, i);
|
||||||
|
|
||||||
GET_NUM_QUESTS(ch)--;
|
GET_NUM_QUESTS(ch)--;
|
||||||
|
|
||||||
if (ch->player_specials->saved.completed_quests)
|
if (GET_COMPLETED_QUESTS(ch) != NULL)
|
||||||
free(ch->player_specials->saved.completed_quests);
|
free(GET_COMPLETED_QUESTS(ch));
|
||||||
ch->player_specials->saved.completed_quests = temp;
|
GET_COMPLETED_QUESTS(ch) = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void generic_complete_quest(struct char_data *ch)
|
void generic_complete_quest(struct char_data *ch)
|
||||||
@@ -363,8 +358,8 @@ void generic_complete_quest(struct char_data *ch)
|
|||||||
save_char(ch);
|
save_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
void autoquest_trigger_check(struct char_data *ch, const struct char_data *vict,
|
||||||
struct obj_data *object, int type)
|
const struct obj_data *object, int type)
|
||||||
{
|
{
|
||||||
struct char_data *i;
|
struct char_data *i;
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
@@ -402,7 +397,7 @@ void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
|||||||
if (ch == vict)
|
if (ch == vict)
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
||||||
if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
if (IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
||||||
if ((GET_MOB_VNUM(i) != QST_TARGET(rnum)) &&
|
if ((GET_MOB_VNUM(i) != QST_TARGET(rnum)) &&
|
||||||
!AFF_FLAGGED(i, AFF_CHARM))
|
!AFF_FLAGGED(i, AFF_CHARM))
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
@@ -417,7 +412,7 @@ void autoquest_trigger_check(struct char_data *ch, struct char_data *vict,
|
|||||||
case AQ_ROOM_CLEAR:
|
case AQ_ROOM_CLEAR:
|
||||||
if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) {
|
if (QST_TARGET(rnum) == world[IN_ROOM(ch)].number) {
|
||||||
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
for (i = world[IN_ROOM(ch)].people; i && found; i = i->next_in_room)
|
||||||
if (i && IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
if (IS_NPC(i) && !MOB_FLAGGED(i, MOB_NOTDEADYET))
|
||||||
found = FALSE;
|
found = FALSE;
|
||||||
if (found)
|
if (found)
|
||||||
generic_complete_quest(ch);
|
generic_complete_quest(ch);
|
||||||
@@ -486,9 +481,11 @@ static void quest_hist(struct char_data *ch)
|
|||||||
"Index Description Questmaster\r\n"
|
"Index Description Questmaster\r\n"
|
||||||
"----- ---------------------------------------------------- -----------\r\n");
|
"----- ---------------------------------------------------- -----------\r\n");
|
||||||
for (i = 0; i < GET_NUM_QUESTS(ch); i++) {
|
for (i = 0; i < GET_NUM_QUESTS(ch); i++) {
|
||||||
if ((rnum = real_quest(ch->player_specials->saved.completed_quests[i])) != NOTHING)
|
if ((rnum = real_quest(GET_COMPLETED_QUEST(ch, i))) != NOTHING)
|
||||||
send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n",
|
send_to_char(ch, "\tg%4d\tn) \tc%-52.52s\tn \ty%s\tn\r\n",
|
||||||
++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY) ? "Unknown" : GET_NAME(&mob_proto[(real_mobile(
|
++counter, QST_DESC(rnum), (real_mobile(QST_MASTER(rnum)) == NOBODY)
|
||||||
|
? "Unknown"
|
||||||
|
: GET_NAME(&mob_proto[(real_mobile(
|
||||||
QST_MASTER(rnum)))]));
|
QST_MASTER(rnum)))]));
|
||||||
else
|
else
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
@@ -510,10 +507,8 @@ static void quest_join(struct char_data *ch, struct char_data *qm, char argument
|
|||||||
else if (GET_QUEST(ch) != NOTHING)
|
else if (GET_QUEST(ch) != NOTHING)
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"%s But you are already part of a quest!", GET_NAME(ch));
|
"%s But you are already part of a quest!", GET_NAME(ch));
|
||||||
else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING)
|
else if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING
|
||||||
snprintf(buf, sizeof(buf),
|
|| (rnum = real_quest(vnum)) == NOTHING)
|
||||||
"%s I don't know of such a quest!", GET_NAME(ch));
|
|
||||||
else if ((rnum = real_quest(vnum)) == NOTHING)
|
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
"%s I don't know of such a quest!", GET_NAME(ch));
|
"%s I don't know of such a quest!", GET_NAME(ch));
|
||||||
else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum))
|
else if (GET_LEVEL(ch) < QST_MINLEVEL(rnum))
|
||||||
@@ -561,9 +556,8 @@ void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_IN
|
|||||||
qst_vnum vnum;
|
qst_vnum vnum;
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
|
|
||||||
if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING)
|
if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING
|
||||||
send_to_char(ch, "That is not a valid quest!\r\n");
|
|| (rnum = real_quest(vnum)) == NOTHING)
|
||||||
else if ((rnum = real_quest(vnum)) == NOTHING)
|
|
||||||
send_to_char(ch, "That is not a valid quest!\r\n");
|
send_to_char(ch, "That is not a valid quest!\r\n");
|
||||||
else if (QST_INFO(rnum)) {
|
else if (QST_INFO(rnum)) {
|
||||||
send_to_char(ch, "Complete Details on Quest %d \tc%s\tn:\r\n%s",
|
send_to_char(ch, "Complete Details on Quest %d \tc%s\tn:\r\n%s",
|
||||||
@@ -650,7 +644,7 @@ static void quest_show(struct char_data *ch, mob_vnum qm)
|
|||||||
send_to_char(ch, "There are no quests available here at the moment.\r\n");
|
send_to_char(ch, "There are no quests available here at the moment.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
static void quest_stat(struct char_data *ch, char argument[MAX_INPUT_LENGTH])
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum;
|
||||||
mob_rnum qmrnum;
|
mob_rnum qmrnum;
|
||||||
@@ -667,24 +661,24 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
case AQ_OBJ_FIND:
|
case AQ_OBJ_FIND:
|
||||||
case AQ_OBJ_RETURN:
|
case AQ_OBJ_RETURN:
|
||||||
snprintf(targetname, sizeof(targetname), "%s",
|
snprintf(targetname, sizeof(targetname), "%s",
|
||||||
real_object(QST_TARGET(rnum)) == NOTHING ?
|
real_object(QST_TARGET(rnum)) == NOTHING
|
||||||
"An unknown object" :
|
? "An unknown object"
|
||||||
obj_proto[real_object(QST_TARGET(rnum))].short_description);
|
: obj_proto[real_object(QST_TARGET(rnum))].short_description);
|
||||||
break;
|
break;
|
||||||
case AQ_ROOM_FIND:
|
case AQ_ROOM_FIND:
|
||||||
case AQ_ROOM_CLEAR:
|
case AQ_ROOM_CLEAR:
|
||||||
snprintf(targetname, sizeof(targetname), "%s",
|
snprintf(targetname, sizeof(targetname), "%s",
|
||||||
real_room(QST_TARGET(rnum)) == NOWHERE ?
|
real_room(QST_TARGET(rnum)) == NOWHERE
|
||||||
"An unknown room" :
|
? "An unknown room"
|
||||||
world[real_room(QST_TARGET(rnum))].name);
|
: world[real_room(QST_TARGET(rnum))].name);
|
||||||
break;
|
break;
|
||||||
case AQ_MOB_FIND:
|
case AQ_MOB_FIND:
|
||||||
case AQ_MOB_KILL:
|
case AQ_MOB_KILL:
|
||||||
case AQ_MOB_SAVE:
|
case AQ_MOB_SAVE:
|
||||||
snprintf(targetname, sizeof(targetname), "%s",
|
snprintf(targetname, sizeof(targetname), "%s",
|
||||||
real_mobile(QST_TARGET(rnum)) == NOBODY ?
|
real_mobile(QST_TARGET(rnum)) == NOBODY
|
||||||
"An unknown mobile" :
|
? "An unknown mobile"
|
||||||
GET_NAME(&mob_proto[real_mobile(QST_TARGET(rnum))]));
|
: GET_NAME(&mob_proto[real_mobile(QST_TARGET(rnum))]));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snprintf(targetname, sizeof(targetname), "Unknown");
|
snprintf(targetname, sizeof(targetname), "Unknown");
|
||||||
@@ -709,7 +703,8 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
QST_INFO(rnum), QST_DONE(rnum),
|
QST_INFO(rnum), QST_DONE(rnum),
|
||||||
(QST_QUIT(rnum) &&
|
(QST_QUIT(rnum) &&
|
||||||
(str_cmp(QST_QUIT(rnum), "undefined") != 0)
|
(str_cmp(QST_QUIT(rnum), "undefined") != 0)
|
||||||
? QST_QUIT(rnum) : "Nothing\r\n"),
|
? QST_QUIT(rnum)
|
||||||
|
: "Nothing\r\n"),
|
||||||
quest_types[QST_TYPE(rnum)],
|
quest_types[QST_TYPE(rnum)],
|
||||||
QST_TARGET(rnum) == NOBODY ? -1 : QST_TARGET(rnum),
|
QST_TARGET(rnum) == NOBODY ? -1 : QST_TARGET(rnum),
|
||||||
targetname,
|
targetname,
|
||||||
@@ -719,14 +714,17 @@ static void quest_stat(struct char_data *ch, char argument[MAX_STRING_LENGTH])
|
|||||||
if (QST_PREREQ(rnum) != NOTHING)
|
if (QST_PREREQ(rnum) != NOTHING)
|
||||||
send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n",
|
send_to_char(ch, "Preq : [\ty%5d\tn] \ty%s\tn\r\n",
|
||||||
QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum),
|
QST_PREREQ(rnum) == NOTHING ? -1 : QST_PREREQ(rnum),
|
||||||
QST_PREREQ(rnum) == NOTHING ? "" :
|
QST_PREREQ(rnum) == NOTHING
|
||||||
real_object(QST_PREREQ(rnum)) == NOTHING ? "an unknown object" :
|
? ""
|
||||||
obj_proto[real_object(QST_PREREQ(rnum))].short_description);
|
: real_object(QST_PREREQ(rnum)) == NOTHING
|
||||||
|
? "an unknown object"
|
||||||
|
: obj_proto[real_object(QST_PREREQ(rnum))].short_description);
|
||||||
if (QST_TYPE(rnum) == AQ_OBJ_RETURN)
|
if (QST_TYPE(rnum) == AQ_OBJ_RETURN)
|
||||||
send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n",
|
send_to_char(ch, "Mob : [\ty%5d\tn] \ty%s\tn\r\n",
|
||||||
QST_RETURNMOB(rnum),
|
QST_RETURNMOB(rnum),
|
||||||
real_mobile(QST_RETURNMOB(rnum)) == NOBODY ? "an unknown mob" :
|
real_mobile(QST_RETURNMOB(rnum)) == NOBODY
|
||||||
mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr);
|
? "an unknown mob"
|
||||||
|
: mob_proto[real_mobile(QST_RETURNMOB(rnum))].player.short_descr);
|
||||||
if (QST_TIME(rnum) != -1)
|
if (QST_TIME(rnum) != -1)
|
||||||
send_to_char(ch, "Limit : There is a time limit of %d turn%s to complete.\r\n",
|
send_to_char(ch, "Limit : There is a time limit of %d turn%s to complete.\r\n",
|
||||||
QST_TIME(rnum),
|
QST_TIME(rnum),
|
||||||
@@ -758,12 +756,8 @@ ACMD(do_quest)
|
|||||||
int tp;
|
int tp;
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
if (!*arg1)
|
if (!*arg1 || (tp = search_block(arg1, quest_cmd, FALSE)) == -1)
|
||||||
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ?
|
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? quest_mort_usage : quest_imm_usage);
|
||||||
quest_mort_usage : quest_imm_usage);
|
|
||||||
else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1))
|
|
||||||
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ?
|
|
||||||
quest_mort_usage : quest_imm_usage);
|
|
||||||
else {
|
else {
|
||||||
switch (tp) {
|
switch (tp) {
|
||||||
case SCMD_QUEST_LIST:
|
case SCMD_QUEST_LIST:
|
||||||
@@ -787,8 +781,7 @@ ACMD(do_quest)
|
|||||||
quest_stat(ch, arg2);
|
quest_stat(ch, arg2);
|
||||||
break;
|
break;
|
||||||
default: /* Whe should never get here, but... */
|
default: /* Whe should never get here, but... */
|
||||||
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ?
|
send_to_char(ch, "%s\r\n", GET_LEVEL(ch) < LVL_IMMORT ? quest_mort_usage : quest_imm_usage);
|
||||||
quest_mort_usage : quest_imm_usage);
|
|
||||||
break;
|
break;
|
||||||
} /* switch on subcmd number */
|
} /* switch on subcmd number */
|
||||||
}
|
}
|
||||||
@@ -796,25 +789,25 @@ ACMD(do_quest)
|
|||||||
|
|
||||||
SPECIAL(questmaster)
|
SPECIAL(questmaster)
|
||||||
{
|
{
|
||||||
qst_rnum rnum;
|
qst_rnum rnum = 0;
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
int tp;
|
int tp;
|
||||||
struct char_data *qm = (struct char_data *)me;
|
struct char_data *qm = (struct char_data *)me;
|
||||||
|
|
||||||
/* check that qm mob has quests assigned */
|
/* check that qm mob has quests assigned */
|
||||||
for (rnum = 0; (rnum < total_quests &&
|
while (rnum < total_quests && QST_MASTER(rnum) != GET_MOB_VNUM(qm))
|
||||||
QST_MASTER(rnum) != GET_MOB_VNUM(qm)) ; rnum ++);
|
rnum++;
|
||||||
if (rnum >= total_quests)
|
if (rnum >= total_quests)
|
||||||
return FALSE; /* No quests for this mob */
|
return FALSE; /* No quests for this mob */
|
||||||
else if (QST_FUNC(rnum) && (QST_FUNC(rnum) (ch, me, cmd, argument)))
|
if (QST_FUNC(rnum) && QST_FUNC(rnum)(ch, me, cmd, argument))
|
||||||
return TRUE; /* The secondary spec proc handled this command */
|
return TRUE; /* The secondary spec proc handled this command */
|
||||||
else if (CMD_IS("quest")) {
|
if (CMD_IS("quest")) {
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
if (!*arg1)
|
if (!*arg1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (((tp = search_block(arg1, quest_cmd, FALSE)) == -1))
|
if ((tp = search_block(arg1, quest_cmd, FALSE)) == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else {
|
|
||||||
switch (tp) {
|
switch (tp) {
|
||||||
case SCMD_QUEST_LIST:
|
case SCMD_QUEST_LIST:
|
||||||
if (!*arg2)
|
if (!*arg2)
|
||||||
@@ -829,8 +822,7 @@ SPECIAL(questmaster)
|
|||||||
return FALSE; /* fall through to the do_quest command processor */
|
return FALSE; /* fall through to the do_quest command processor */
|
||||||
} /* switch on subcmd number */
|
} /* switch on subcmd number */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return FALSE; /* not a questmaster command */
|
return FALSE; /* not a questmaster command */
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
19
src/quest.h
19
src/quest.h
@@ -34,15 +34,17 @@
|
|||||||
/* AQ Flags (much room for expansion) ********************************* */
|
/* AQ Flags (much room for expansion) ********************************* */
|
||||||
#define AQ_REPEATABLE (1 << 0) /* Quest can be repeated */
|
#define AQ_REPEATABLE (1 << 0) /* Quest can be repeated */
|
||||||
#define NUM_AQ_FLAGS 1
|
#define NUM_AQ_FLAGS 1
|
||||||
|
|
||||||
/* Main quest struct ************************************************** */
|
/* Main quest struct ************************************************** */
|
||||||
struct aq_data {
|
struct aq_data
|
||||||
|
{
|
||||||
qst_vnum vnum; /* Virtual nr of the quest */
|
qst_vnum vnum; /* Virtual nr of the quest */
|
||||||
char *name; /* For qlist and the sort */
|
char *name; /* For qlist and the sort */
|
||||||
char *desc; /* Description of the quest */
|
char *desc; /* Description of the quest */
|
||||||
char *info; /* Message displayed when accepted */
|
char *info; /* Message displayed when accepted */
|
||||||
char *done; /* Message displayed when completed */
|
char *done; /* Message displayed when completed */
|
||||||
char *quit; /* Message displayed when quit quest */
|
char *quit; /* Message displayed when quit quest */
|
||||||
long flags; /* Flags (repeatable, etc */
|
bitvector_t flags; /* Flags (repeatable, etc */
|
||||||
int type; /* Quest type */
|
int type; /* Quest type */
|
||||||
mob_vnum qm; /* questmaster offering quest */
|
mob_vnum qm; /* questmaster offering quest */
|
||||||
int target; /* Target value */
|
int target; /* Target value */
|
||||||
@@ -55,6 +57,7 @@ struct aq_data {
|
|||||||
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
|
qst_vnum next_quest; /* Link to next quest, NOTHING is end */
|
||||||
SPECIAL(*func); /* secondary spec_proc for the QM */
|
SPECIAL(*func); /* secondary spec_proc for the QM */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QST_NUM(i) (aquest_table[i].vnum)
|
#define QST_NUM(i) (aquest_table[i].vnum)
|
||||||
#define QST_NAME(i) (aquest_table[i].name)
|
#define QST_NAME(i) (aquest_table[i].name)
|
||||||
#define QST_DESC(i) (aquest_table[i].desc)
|
#define QST_DESC(i) (aquest_table[i].desc)
|
||||||
@@ -87,15 +90,15 @@ void assign_the_quests(void);
|
|||||||
void parse_quest(FILE *quest_f, int nr);
|
void parse_quest(FILE *quest_f, int nr);
|
||||||
int count_quests(qst_vnum low, qst_vnum high);
|
int count_quests(qst_vnum low, qst_vnum high);
|
||||||
void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax);
|
void list_quests(struct char_data *ch, zone_rnum zone, qst_vnum vmin, qst_vnum vmax);
|
||||||
void set_quest(struct char_data *ch, qst_rnum rnum);
|
void set_quest(const struct char_data *ch, qst_rnum rnum);
|
||||||
void clear_quest(struct char_data *ch);
|
void clear_quest(const struct char_data *ch);
|
||||||
void generic_complete_quest(struct char_data *ch);
|
void generic_complete_quest(struct char_data *ch);
|
||||||
void autoquest_trigger_check(struct char_data *ch, struct char_data *vict, struct obj_data *object, int type);
|
void autoquest_trigger_check(struct char_data *ch, const struct char_data *vict, const struct obj_data *object, int type);
|
||||||
qst_rnum real_quest(qst_vnum vnum);
|
qst_rnum real_quest(qst_vnum vnum);
|
||||||
int is_complete(struct char_data *ch, qst_vnum vnum);
|
int is_complete(const struct char_data *ch, qst_vnum vnum);
|
||||||
qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_rnum qm, int num);
|
qst_vnum find_quest_by_qmnum(struct char_data *ch, mob_rnum qm, int num);
|
||||||
void add_completed_quest(struct char_data *ch, qst_vnum vnum);
|
void add_completed_quest(const struct char_data *ch, qst_vnum vnum);
|
||||||
void remove_completed_quest(struct char_data *ch, qst_vnum vnum);
|
void remove_completed_quest(const struct char_data *ch, qst_vnum vnum);
|
||||||
void quest_timeout(struct char_data *ch);
|
void quest_timeout(struct char_data *ch);
|
||||||
void check_timed_quests(void);
|
void check_timed_quests(void);
|
||||||
SPECIAL(questmaster);
|
SPECIAL(questmaster);
|
||||||
|
|||||||
@@ -603,6 +603,10 @@ do \
|
|||||||
#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter))
|
#define GET_QUEST_COUNTER(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_counter))
|
||||||
/** Time remaining to complete the quest ch is currently on. */
|
/** Time remaining to complete the quest ch is currently on. */
|
||||||
#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time))
|
#define GET_QUEST_TIME(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.quest_time))
|
||||||
|
/** The completed quest at index i for this player */
|
||||||
|
#define GET_COMPLETED_QUEST(ch, i) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.completed_quests[(i)]))
|
||||||
|
/** The array of completed quests for ch */
|
||||||
|
#define GET_COMPLETED_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.completed_quests))
|
||||||
/** The number of quests completed by ch. */
|
/** The number of quests completed by ch. */
|
||||||
#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests))
|
#define GET_NUM_QUESTS(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.num_completed_quests))
|
||||||
/** The type of quest ch is currently participating in. */
|
/** The type of quest ch is currently participating in. */
|
||||||
|
|||||||
Reference in New Issue
Block a user