From 26aad11908074a6ee2c55ed98570ebb136dc395c Mon Sep 17 00:00:00 2001 From: aleos89 Date: Tue, 18 Mar 2014 15:30:22 -0400 Subject: [PATCH] Fixed the Item Shop and Point Shop not displaying their shop message when "callshop" is used. (bugreport:8710) --- src/map/npc.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/src/map/npc.c b/src/map/npc.c index b626e38d27..d6f9f6622d 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1218,25 +1218,10 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd) switch(nd->subtype) { case SHOP: + case ITEMSHOP: + case POINTSHOP: clif_npcbuysell(sd,nd->bl.id); break; - case ITEMSHOP: - { - char output[CHAT_SIZE_MAX]; - struct item_data *id = itemdb_exists(nd->u.shop.itemshop_nameid); - memset(output,'\0',sizeof(output)); - sprintf(output,msg_txt(sd,714),id->jname,id->nameid); // Item Shop List: %s (%d) - clif_broadcast(&sd->bl,output,strlen(output) + 1,0x10,SELF); - clif_npcbuysell(sd,nd->bl.id); - } break; - case POINTSHOP: - { - char output[CHAT_SIZE_MAX]; - memset(output,'\0',sizeof(output)); - sprintf(output,msg_txt(sd,715),nd->u.shop.pointshop_str); // Point Shop List: '%s' - clif_broadcast(&sd->bl,output,strlen(output) + 1,0x10,SELF); - clif_npcbuysell(sd,nd->bl.id); - } break; case CASHSHOP: clif_cashshop_show(sd,nd); break; @@ -1311,11 +1296,29 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type) } if (nd->sc.option & OPTION_INVISIBLE) // can't buy if npc is not visible (hack?) return 1; - if( nd->class_ < 0 && !sd->state.callshop ) - {// not called through a script and is not a visible NPC so an invalid call + if( nd->class_ < 0 && !sd->state.callshop ) {// not called through a script and is not a visible NPC so an invalid call return 1; } + if (nd->subtype == ITEMSHOP) { + char output[CHAT_SIZE_MAX]; + struct item_data *id = itemdb_exists(nd->u.shop.itemshop_nameid); + + memset(output,'\0',sizeof(output)); + + if (id) { + sprintf(output,msg_txt(sd,714),id->jname,id->nameid); // Item Shop List: %s (%d) + clif_broadcast(&sd->bl,output,strlen(output) + 1,0x10,SELF); + } + } else if (nd->subtype == POINTSHOP) { + char output[CHAT_SIZE_MAX]; + + memset(output,'\0',sizeof(output)); + + sprintf(output,msg_txt(sd,715),nd->u.shop.pointshop_str); // Point Shop List: '%s' + clif_broadcast(&sd->bl,output,strlen(output) + 1,0x10,SELF); + } + // reset the callshop state for future calls sd->state.callshop = 0; sd->npc_shopid = id;