summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorTaylor Locke <kisuka@kisuka.com>2014-10-19 03:50:50 +0200
committerHaru <haru@dotalux.com>2014-10-24 00:59:20 +0200
commitfe9e666743bbd0b4ef9d782ce2fc43cc2a081753 (patch)
treec2ca671cbf6a7099c8af96692e1a69900e8de482 /src/map
parente1e5bd338fe507d23ac72c964efa5c7009c30bba (diff)
downloadhercules-fe9e666743bbd0b4ef9d782ce2fc43cc2a081753.tar.gz
hercules-fe9e666743bbd0b4ef9d782ce2fc43cc2a081753.tar.bz2
hercules-fe9e666743bbd0b4ef9d782ce2fc43cc2a081753.tar.xz
hercules-fe9e666743bbd0b4ef9d782ce2fc43cc2a081753.zip
Re-commit of 4ac673941714032ada6d26fb60936ec510bbe496 (part 1)
Some Quality of Life Changes - getbrokencount command added to get amount of broken equipment. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map')
-rw-r--r--src/map/script.c24
1 files changed, 24 insertions, 0 deletions
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"),