summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/script_commands.txt7
-rw-r--r--src/map/script.c24
2 files changed, 31 insertions, 0 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index d0acbf1c8..65caf5837 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
diff --git a/src/map/script.c b/src/map/script.c
index 32444b7b6..1b6e10930 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)
@@ -18844,6 +18867,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"),