From 48f6d35d2c293a17a863bb540e686b1c780b9005 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 8 Apr 2015 01:31:19 +0300 Subject: Add to item_db.conf item attributes for equip/unequip effects. New attributes: UnequipEffect - send this effect to client if unequip item was success UnequipFailEffect - send this effect to client if unequip item was fail For equip events used same attributes like for use. --- src/map/pc.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index 79a3cac..504d5c6 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -242,3 +242,40 @@ int epc_useitem_post(int retVal, struct map_session_data *sd, int *nPtr) clif->specialeffect(&sd->bl, effect, AREA); return retVal; } + +static void equippost_effect(struct map_session_data *const sd, const int n, const bool retVal, const bool equip) +{ + if (!sd) + return; + + if (n < 0 || n >= MAX_INVENTORY) + return; + + struct ItemdExt *data = itemd_get(sd->inventory_data[n]); + if (!data) + return; + + int effect; + if (equip) + effect = retVal ? data->useEffect : data->useFailEffect; + else + effect = retVal ? data->unequipEffect : data->unequipFailEffect; + + if (effect != -1) + clif->specialeffect(&sd->bl, effect, AREA); + return; +} + +int epc_equipitem_post(int retVal, struct map_session_data *sd, + int *nPtr, int *data __attribute__ ((unused))) +{ + equippost_effect(sd, *nPtr, retVal, true); + return retVal; +} + +int epc_unequipitem_post(int retVal, struct map_session_data *sd, + int *nPtr, int *data __attribute__ ((unused))) +{ + equippost_effect(sd, *nPtr, retVal, false); + return retVal; +} -- cgit v1.2.3-70-g09d2