summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorFreeyorp <Freeyorp101@NOSPAM@hotmail.com>2009-07-12 20:58:50 +1200
committerJared Adams <jaxad0127@gmail.com>2009-07-15 22:02:00 -0600
commit7463b3e82a1480d8adeb9c39c9d592c1975d81b4 (patch)
tree5ee457e5543cfb3b624449fa1f8c7d961ba6ef1b /src/map/script.c
parent4673fd3ca06010e74f8223486b0f34e58c7b0a7e (diff)
downloadtmwa-7463b3e82a1480d8adeb9c39c9d592c1975d81b4.tar.gz
tmwa-7463b3e82a1480d8adeb9c39c9d592c1975d81b4.tar.bz2
tmwa-7463b3e82a1480d8adeb9c39c9d592c1975d81b4.tar.xz
tmwa-7463b3e82a1480d8adeb9c39c9d592c1975d81b4.zip
Add a function that unequips a particular type of equipment from a player
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 218c3f3..40fcd62 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -285,6 +285,7 @@ int buildin_isin(struct script_state *st); // [Jaxad0127]
int buildin_shop(struct script_state *st); // [MadCamel]
int buildin_isdead(struct script_state *st); // [Jaxad0127]
int buildin_fakenpcname(struct script_state *st); //[Kage]
+int buildin_unequip_by_id(struct script_state *st); // [Freeyorp]
void push_val(struct script_stack *stack,int type,int val);
int run_func(struct script_state *st);
@@ -490,7 +491,9 @@ struct {
{buildin_isin,"isin","siiii"},
{buildin_shop,"shop","s"},
{buildin_isdead,"isdead","i"},
- {buildin_fakenpcname,"fakenpcname","ssi"}, //End Additions
+ {buildin_fakenpcname,"fakenpcname","ssi"},
+ {buildin_unequip_by_id,"unequipbyid","i"}, // [Freeyorp]
+ // End Additions
{NULL,NULL,NULL},
};
int buildin_message(struct script_state *st); // [MouseJstr]
@@ -5666,6 +5669,27 @@ int buildin_nude(struct script_state *st)
}
/*==========================================
+ * UnequipById [Freeyorp]
+ *------------------------------------------
+ */
+
+int buildin_unequip_by_id(struct script_state *st)
+{
+ struct map_session_data *sd=script_rid2sd(st);
+ if(sd==NULL)
+ return 0;
+
+ int slot_id = conv_num(st,& (st->stack->stack_data[st->start+2]));
+
+ if(slot_id>=0 && slot_id<11 && sd->equip_index[slot_id] >= 0)
+ pc_unequipitem(sd,sd->equip_index[slot_id], slot_id);
+
+ pc_calcstatus(sd, 0);
+
+ return 0;
+}
+
+/*==========================================
* gmcommand [MouseJstr]
*
* suggested on the forums...