summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Locke <kisuka@kisuka.com>2014-10-18 01:22:28 -0700
committerTaylor Locke <kisuka@kisuka.com>2014-10-18 01:32:57 -0700
commit4ac673941714032ada6d26fb60936ec510bbe496 (patch)
tree21e0aa8b626640428d7554a30762b8392be0ef1e
parentcc8dfc2f45d0c5405cc628393e846e94e1e7a812 (diff)
downloadhercules-4ac673941714032ada6d26fb60936ec510bbe496.tar.gz
hercules-4ac673941714032ada6d26fb60936ec510bbe496.tar.bz2
hercules-4ac673941714032ada6d26fb60936ec510bbe496.tar.xz
hercules-4ac673941714032ada6d26fb60936ec510bbe496.zip
Some Quality of Life Changes
checkquest deprecated; Use questprogress instead for a more logical quest log checking command. getbrokencount command added to get amount of broken equipment. setdragon and setmadogear deprecated; use setriding instead. setriding now handles all combat mounts.
-rw-r--r--db/const.txt7
-rw-r--r--doc/script_commands.txt79
-rw-r--r--src/map/pc.c44
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/script.c107
5 files changed, 220 insertions, 19 deletions
diff --git a/db/const.txt b/db/const.txt
index a53866b7c..06fa8a3db 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -3362,3 +3362,10 @@ SCFLAG_FIXEDTICK 0x02
SCFLAG_LOADED 0x04
SCFLAG_FIXEDRATE 0x08
SCFLAG_NOICON 0x10
+
+// Dragon Colors
+DRAGON_GREEN 1
+DRAGON_BROWN 2
+DRAGON_GRAY 3
+DRAGON_BLUE 4
+DRAGON_RED 5 \ No newline at end of file
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 0af9644dd..7efcc77ad 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -2788,6 +2788,13 @@ such item is found.
---------------------------------------
+*getbrokencount()
+
+This function will return the total amount of broken equipment on the
+invoking character.
+
+---------------------------------------
+
*getequipisequiped(<equipment slot>)
This functions will return 1 if there is an equipment placed on the
@@ -3816,22 +3823,47 @@ falcon and 0 if they don't.
*checkriding()
If <flag> is 0 this command will remove the mount from the character.
-Otherwise it gives the invoking character a PecoPeco (if they are a Knight
-series class), a GrandPeco (if they are a Crusader series class), or
-a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
-this will not work at all if they aren't of a class which can ride.
-Note: the character needs to have the skill KN_RIDING to gain a mount.
+
+Otherwise it gives the invoking character a combat mount specific to their
+class.
+
+ - PecoPeco (Knight series class)
+
+ - GrandPeco (Crusader series class)
+
+ - Dragon (Rune Knight)
+ The color of the dragon can be passed through the flag value using
+ either values 1 ~ 5 or the following constants:
+ DRAGON_GREEN
+ DRAGON_BROWN
+ DRAGON_GRAY
+ DRAGON_BLUE
+ DRAGON_RED
+
+ - Gryphon (Royal Guard)
+
+ - Warg (Ranger)
+
+ - Mado Gear (Mechanic)
+
+Unlike 'setfalcon' and 'setcart' this will not work at all if they aren't of a
+class which can ride a mount.
+
+Note: The character needs to have the specific skill for their mount.
The accompanying function will return 1 if the invoking character is
-riding a bird and 0 if they aren't.
+on a mount and 0 if they aren't.
- if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
+ if (checkriding())
+ mes "Leave your mount outside! No riding mounts on the floor here!";
---------------------------------------
*setdragon {<color>};
*checkdragon()
+[ DEPRECATED - Please use setriding]
+
The 'setdragon' function toggles mounting a dragon for the invoking
character. It will return 1 if successful, 0 otherwise.
@@ -3853,6 +3885,8 @@ riding a dragon and 0 if they aren't.
*setmadogear {<flag>};
*checkmadogear()
+[ DEPRECATED - Please use setriding]
+
If <flag> is 0 this command will remove the mount from the character.
Otherwise it gives the invoking character a Mado (if they are a Mechanic).
@@ -8284,17 +8318,23 @@ If *questinfo is set, and the same ID is specified here, the icon will be cleare
---------------------------------------
-*completequest <ID>;
+*completequest <ID>{,<ID2>};
Change the state for the given quest <ID> to "complete" and remove from
the users quest log.
+If a second quest id of greater value is specified, all quests between the two
+will be completed.
+
---------------------------------------
-*erasequest <ID>;
+*erasequest <ID>{,<ID2>};
Remove the quest of the given <ID> from the user's quest log.
+If a second quest id of greater value is specified, all quests between the two
+will be erased.
+
---------------------------------------
*changequest <ID>,<ID2>;
@@ -8306,6 +8346,8 @@ Add quest of the <ID2> to the the quest log, and the state is "active".
*checkquest(<ID>{,PLAYTIME|HUNTING})
+DEPRECATED - use questprogress instead.
+
If no additional argument supplied, return the state of the quest:
-1 = Quest not started (not in quest log)
0 = Quest has been given, but the state is "inactive"
@@ -8329,6 +8371,25 @@ If parameter "HUNTING" is supplied:
---------------------------------------
+*questprogress(<ID>{,PLAYTIME|HUNTING})
+
+If no additional argument supplied, return the state of the quest:
+ 0 = Quest not started (not in quest log)
+ 1 = Quest has been given
+ 2 = Quest completed
+
+If parameter "PLAYTIME" is supplied:
+ 0 = Quest not started (not in quest log)
+ 1 = The time limit has not yet been reached
+ 2 = The time limit has been reached
+
+If parameter "HUNTING" is supplied:
+ 0 = Quest not started (not in quest log)
+ 1 = Player hasn't killed all of the target monsters
+ 2 = Player has killed all of the target monsters
+
+---------------------------------------
+
*showevent <icon>{,<mark color>}
Show an emotion on top of a NPC, and optionally,
diff --git a/src/map/pc.c b/src/map/pc.c
index 697a24507..71860340d 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -8163,11 +8163,47 @@ int pc_setfalcon(TBL_PC* sd, int flag)
*------------------------------------------*/
int pc_setriding(TBL_PC* sd, int flag)
{
- if( flag ){
- if( pc->checkskill(sd,KN_RIDING) > 0 ) // add peco
- pc->setoption(sd, sd->sc.option|OPTION_RIDING);
- } else if( pc_isriding(sd) ){
+ if( flag )
+ {
+ // Rune Knight (Dragon)
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT ) {
+ if( pc->checkskill(sd, RK_DRAGONTRAINING) )
+ pc->setoption(sd, sd->sc.option|flag);
+ }
+ // Ranger (Warg)
+ else if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER ) {
+ if( pc->checkskill(sd, RA_WUGRIDER) )
+ pc->setoption(sd,sd->sc.option|OPTION_WUGRIDER);
+ }
+ // Mechanic (Mado Gear)
+ else if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
+ if( pc->checkskill(sd, NC_MADOLICENCE) )
+ pc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ }
+ // Knight / Crusader (Peco Peco)
+ else {
+ if( pc->checkskill(sd, KN_RIDING) )
+ pc->setoption(sd, sd->sc.option|OPTION_RIDING);
+ }
+ }
+ else if( pc_isriding(sd) )
+ {
+ // Rune Knight (Dragon)
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT ) {
+ pc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ }
+ // Ranger (Warg)
+ else if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER ) {
+ pc->setoption(sd,sd->sc.option&~OPTION_WUGRIDER);
+ }
+ // Mechanic (Mado Gear)
+ else if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
+ pc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ }
+ // Knight / Crusaders (Peco Peco)
+ else {
pc->setoption(sd, sd->sc.option&~OPTION_RIDING);
+ }
}
return 0;
diff --git a/src/map/pc.h b/src/map/pc.h
index c36704b4f..6159a8f26 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -589,7 +589,7 @@ struct map_session_data {
#endif
#define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON )
-#define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING )
+#define pc_isriding(sd) ( (sd)->sc.option&(OPTION_RIDING|OPTION_DRAGON|OPTION_WUGRIDER|OPTION_MADOGEAR) )
#define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE )
#define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle->bc->natural_heal_weight_rate )
#define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 )
diff --git a/src/map/script.c b/src/map/script.c
index e70c2e10a..77b60ddd2 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7658,6 +7658,29 @@ BUILDIN(getbrokenid)
}
/*==========================================
+ * getbrokencount
+ *------------------------------------------*/
+BUILDIN(getbrokencount)
+{
+ int i, counter = 0;
+ TBL_PC *sd;
+
+ sd = script->rid2sd(st);
+
+ if( sd == NULL )
+ return true;
+
+ for(i = 0; i < MAX_INVENTORY; i++) {
+ if(sd->status.inventory[i].attribute)
+ counter++;
+ }
+
+ script_pushint(st, counter);
+
+ return true;
+}
+
+/*==========================================
* repair [Valaris]
*------------------------------------------*/
BUILDIN(repair)
@@ -8658,7 +8681,7 @@ BUILDIN(checkriding)
if( sd == NULL )
return true;// no player attached, report source
- if( pc_isriding(sd) || pc_isridingwug(sd) || pc_isridingdragon(sd) )
+ if( pc_isriding(sd) )
script_pushint(st, 1);
else
script_pushint(st, 0);
@@ -8677,11 +8700,17 @@ BUILDIN(setriding)
TBL_PC* sd;
sd = script->rid2sd(st);
+
if( sd == NULL )
return true;// no player attached, report source
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
+
+ // Color variants for Rune Knight dragon mounts.
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT )
+ flag = (flag == 1 ? OPTION_DRAGON1 : flag == 2 ? OPTION_DRAGON2 : flag == 3 ? OPTION_DRAGON3 : flag == 4 ? OPTION_DRAGON4 : flag == 5 ? OPTION_DRAGON5 : 0);
+
pc->setriding(sd, flag);
return true;
@@ -16281,21 +16310,57 @@ BUILDIN(setquest) {
BUILDIN(erasequest) {
struct map_session_data *sd = script->rid2sd(st);
+ int quest_id;
if( sd == NULL )
return false;
- quest->delete(sd, script_getnum(st, 2));
+ if(script_hasdata(st, 3))
+ {
+ if(script_getnum(st, 3) < script_getnum(st, 2))
+ {
+ ShowError("buildin_erasequest: The second quest id must be greater than the id of the first.\n");
+ return false;
+ }
+
+ for(quest_id = script_getnum(st, 2); quest_id < script_getnum(st, 3); quest_id++)
+ {
+ quest->delete(sd, quest_id);
+ }
+ }
+ else
+ {
+ quest->delete(sd, script_getnum(st, 2));
+ }
+
return true;
}
BUILDIN(completequest) {
struct map_session_data *sd = script->rid2sd(st);
+ int quest_id;
if( sd == NULL )
return false;
- quest->update_status(sd, script_getnum(st, 2), Q_COMPLETE);
+ if(script_hasdata(st, 3))
+ {
+ if(script_getnum(st, 3) < script_getnum(st, 2))
+ {
+ ShowError("buildin_completequest: The second quest id must be greater than the id of the first.\n");
+ return false;
+ }
+
+ for(quest_id = script_getnum(st, 2); quest_id < script_getnum(st, 3); quest_id++)
+ {
+ quest->update_status(sd, quest_id, Q_COMPLETE);
+ }
+ }
+ else
+ {
+ quest->update_status(sd, script_getnum(st, 2), Q_COMPLETE);
+ }
+
return true;
}
@@ -16309,6 +16374,8 @@ BUILDIN(changequest) {
return true;
}
+// Deprecated
+// Please use questprogress instead.
BUILDIN(checkquest) {
struct map_session_data *sd = script->rid2sd(st);
enum quest_check_type type = HAVEQUEST;
@@ -16324,6 +16391,33 @@ BUILDIN(checkquest) {
return true;
}
+BUILDIN(questprogress) {
+ struct map_session_data *sd = script->rid2sd(st);
+ enum quest_check_type type = HAVEQUEST;
+ int quest_progress = 0;
+
+ if( sd == NULL )
+ return false;
+
+ if( script_hasdata(st, 3) )
+ type = (enum quest_check_type)script_getnum(st, 3);
+
+ quest_progress = quest->check(sd, script_getnum(st, 2), type);
+
+ // "Fix" returned quest state value to make more sense.
+ // 0 = Not Started, 1 = In Progress, 2 = Completed.
+ if(quest_progress == -1)
+ quest_progress = 0;
+ else if(quest_progress == 0 || quest_progress == 1)
+ quest_progress = 1;
+ else
+ quest_progress = 2;
+
+ script_pushint(st, quest_progress);
+
+ return true;
+}
+
BUILDIN(showevent) {
TBL_PC *sd = script->rid2sd(st);
struct npc_data *nd = map->id2nd(st->oid);
@@ -17304,6 +17398,7 @@ BUILDIN(setmounting) {
}
return true;
}
+
/**
* Retrieves quantity of arguments provided to callfunc/callsub.
* getargcount() -> amount of arguments received in a function
@@ -18844,6 +18939,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getequipid,"i"),
BUILDIN_DEF(getequipname,"i"),
BUILDIN_DEF(getbrokenid,"i"), // [Valaris]
+ BUILDIN_DEF(getbrokencount,""),
BUILDIN_DEF(repair,"i"), // [Valaris]
BUILDIN_DEF(repairall,""),
BUILDIN_DEF(getequipisequiped,"i"),
@@ -19241,9 +19337,10 @@ void script_parse_builtin(void) {
//Quest Log System [Inkfish]
BUILDIN_DEF(questinfo, "ii??"),
BUILDIN_DEF(setquest, "i"),
- BUILDIN_DEF(erasequest, "i"),
- BUILDIN_DEF(completequest, "i"),
+ BUILDIN_DEF(erasequest, "i?"),
+ BUILDIN_DEF(completequest, "i?"),
BUILDIN_DEF(checkquest, "i?"),
+ BUILDIN_DEF(questprogress, "i?"),
BUILDIN_DEF(changequest, "ii"),
BUILDIN_DEF(showevent, "i?"),