|
@@ -10131,6 +10131,66 @@ ACMD_FUNC(resurrect) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+ACMD_FUNC(quest) {
|
|
|
+ uint8 i;
|
|
|
+ int quest_id = 0;
|
|
|
+ nullpo_retr(-1, sd);
|
|
|
+ memset(atcmd_output, '\0', sizeof(atcmd_output));
|
|
|
+
|
|
|
+ if (!message || !*message || sscanf(message, "%11d", &quest_id) < 1 || quest_id == 0) {
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1505), command); // Usage: %s <quest ID>
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ if (!quest_search(quest_id)) {
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1506), quest_id); // Quest %d not found in DB.
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ const char* type[] = { "setquest", "erasequest", "completequest", "checkquest" };
|
|
|
+ ARR_FIND( 0, ARRAYLENGTH(type), i, strcmpi(command+1, type[i]) == 0 );
|
|
|
+
|
|
|
+ switch(i) {
|
|
|
+ case 0:
|
|
|
+ if (quest_check(sd, quest_id, HAVEQUEST) >= 0) {
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1507), quest_id); // Character already has quest %d.
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ quest_add(sd, quest_id);
|
|
|
+ pc_show_questinfo(sd);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (quest_check(sd, quest_id, HAVEQUEST) < 0) {
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1508), quest_id); // Character doesn't have quest %d.
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ quest_delete(sd, quest_id);
|
|
|
+ pc_show_questinfo(sd);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ if (quest_check(sd, quest_id, HAVEQUEST) < 0)
|
|
|
+ quest_add(sd, quest_id);
|
|
|
+ if (quest_check(sd, quest_id, HAVEQUEST) < 2)
|
|
|
+ quest_update_status(sd, quest_id, Q_COMPLETE);
|
|
|
+ pc_show_questinfo(sd);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1509), quest_id); // Checkquest value for quest %d
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1510), quest_check(sd, quest_id, HAVEQUEST)); // HAVEQUEST : %d
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1511), quest_check(sd, quest_id, HUNTING)); // HUNTING : %d
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ sprintf(atcmd_output, msg_txt(sd,1512), quest_check(sd, quest_id, PLAYTIME)); // PLAYTIME : %d
|
|
|
+ clif_displaymessage(fd, atcmd_output);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
#include "../custom/atcommand.inc"
|
|
|
|
|
|
/**
|
|
@@ -10433,6 +10493,10 @@ void atcommand_basecommands(void) {
|
|
|
ACMD_DEFR(changedress, ATCMD_NOCONSOLE|ATCMD_NOAUTOTRADE),
|
|
|
ACMD_DEFR(camerainfo, ATCMD_NOCONSOLE|ATCMD_NOAUTOTRADE),
|
|
|
ACMD_DEFR(resurrect, ATCMD_NOCONSOLE),
|
|
|
+ ACMD_DEF2("setquest", quest),
|
|
|
+ ACMD_DEF2("erasequest", quest),
|
|
|
+ ACMD_DEF2("completequest", quest),
|
|
|
+ ACMD_DEF2("checkquest", quest),
|
|
|
};
|
|
|
AtCommandInfo* atcommand;
|
|
|
int i;
|