diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/init.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 76 | ||||
-rw-r--r-- | src/map/pc.h | 4 |
3 files changed, 82 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c index 204b0a3..7cf8b4e 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -85,6 +85,8 @@ HPExport void plugin_init (void) addPacket(0x7530, 22, map_parse_version, hpClif_Parse); addHookPre("pc->readparam", epc_readparam_pre); addHookPre("pc->setregistry", epc_setregistry); + addHookPre("pc->equipitem_pos", epc_equipitem_pos); + addHookPre("pc->unequipitem_pos", epc_unequipitem_pos); addHookPre("npc->checknear", enpc_checknear); addHookPre("clif->quest_send_list", eclif_quest_send_list); addHookPre("clif->quest_add", eclif_quest_add); diff --git a/src/map/pc.c b/src/map/pc.c index b07f187..e958751 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -10,6 +10,8 @@ #include "../../../common/mmo.h" #include "../../../common/socket.h" #include "../../../common/strlib.h" +#include "../../../map/itemdb.h" +#include "../../../map/pc.h" #include "map/pc.h" #include "map/session.h" @@ -43,3 +45,77 @@ int epc_setregistry(struct map_session_data *sd, int64 *reg, int *val) return 0; } + +#define equipPos(mask, field, lookf) \ + if (pos & mask) \ + { \ + hookStop(); \ + if (id) \ + sd->status.field = id->look; \ + else \ + sd->status.field = 0; \ + clif->changelook(&sd->bl, lookf, sd->status.field); \ + } + +#define equipPos2(mask, lookf) \ + if (pos & mask) \ + { \ + hookStop(); \ + if (id) \ + clif->changelook(&sd->bl, lookf, id->look); \ + else \ + clif->changelook(&sd->bl, lookf, 0); \ + } + +void epc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int *posPtr) +{ + int pos = *posPtr; + + equipPos(EQP_HEAD_LOW, head_bottom, LOOK_HEAD_BOTTOM); + equipPos(EQP_HEAD_TOP, head_top, LOOK_HEAD_TOP); + equipPos(EQP_HEAD_MID, head_mid, LOOK_HEAD_MID); + equipPos(EQP_GARMENT, robe, LOOK_ROBE); + //skip EQP_ARMOR + equipPos2(EQP_SHOES, LOOK_SHOES); + equipPos2(EQP_COSTUME_HEAD_TOP, 13); + equipPos2(EQP_COSTUME_HEAD_MID, 14); + equipPos2(EQP_COSTUME_HEAD_LOW, 15); + equipPos2(EQP_COSTUME_GARMENT, 16); + //skipping SHADOW slots +} + +#undef equipPos +#undef equipPos2 + +#define unequipPos(mask, field, lookf) \ + if (pos & mask) \ + { \ + hookStop(); \ + sd->status.field = 0; \ + clif->changelook(&sd->bl, lookf, sd->status.field); \ + } + +#define unequipPos2(mask, lookf) \ + if (pos & mask) \ + { \ + hookStop(); \ + clif->changelook(&sd->bl, lookf, 0); \ + } + +void epc_unequipitem_pos(struct map_session_data *sd, int *nPtr, int *posPtr) +{ + int pos = *posPtr; + int n = *nPtr; + + unequipPos(EQP_HEAD_LOW, head_bottom, LOOK_HEAD_BOTTOM); + unequipPos(EQP_HEAD_TOP, head_top, LOOK_HEAD_TOP); + unequipPos(EQP_HEAD_MID, head_mid, LOOK_HEAD_MID); + unequipPos(EQP_GARMENT, robe, LOOK_ROBE); + //skip EQP_ARMOR + unequipPos2(EQP_SHOES, LOOK_SHOES); + unequipPos2(EQP_COSTUME_HEAD_TOP, 13); + unequipPos2(EQP_COSTUME_HEAD_MID, 14); + unequipPos2(EQP_COSTUME_HEAD_LOW, 15); + unequipPos2(EQP_COSTUME_GARMENT, 16); + //skipping SHADOW slots +} diff --git a/src/map/pc.h b/src/map/pc.h index 2f07c92..104e8d5 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -13,4 +13,8 @@ int epc_readparam_pre(struct map_session_data* sd, int *type); int epc_setregistry(struct map_session_data *sd, int64 *reg, int *val); +void epc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int *posPtr); + +void epc_unequipitem_pos(struct map_session_data *sd, int *nPtr, int *posPtr); + #endif // EVOL_MAP_PC |