From b9d77010fc9474d3db72778508ea35f5b311be58 Mon Sep 17 00:00:00 2001 From: epoque11 Date: Tue, 6 Dec 2011 16:46:03 +0000 Subject: - Added support for additional item information when OnSellItem is called - Added information is refine, attribute, identify flag and the item cards git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15017 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/npc.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/map/npc.c') diff --git a/src/map/npc.c b/src/map/npc.c index 1762bc73b..5869c6daa 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1424,14 +1424,28 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list) static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* item_list, struct npc_data* nd) { char npc_ev[EVENT_NAME_LENGTH]; - int i, idx; + char card_slot[NAME_LENGTH]; + int i, j, idx; int key_nameid = 0; int key_amount = 0; + int key_refine = 0; + int key_attribute = 0; + int key_identify = 0; + int key_card = 0; // discard old contents script_cleararray_pc(sd, "@sold_nameid", (void*)0); script_cleararray_pc(sd, "@sold_quantity", (void*)0); + script_cleararray_pc(sd, "@sold_refine", (void*)0); + script_cleararray_pc(sd, "@sold_attribute", (void*)0); + script_cleararray_pc(sd, "@sold_identify", (void*)0); + for( j = 0; MAX_SLOTS > j; j++ ) + {// clear each of the card slot entries + sprintf_s(card_slot, sizeof(card_slot), "@sold_card%d", j + 1); + script_cleararray_pc(sd, card_slot, (void*)0); + } + // save list of to be sold items for( i = 0; i < n; i++ ) { @@ -1439,6 +1453,19 @@ static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* script_setarray_pc(sd, "@sold_nameid", i, (void*)(intptr_t)sd->status.inventory[idx].nameid, &key_nameid); script_setarray_pc(sd, "@sold_quantity", i, (void*)(intptr_t)item_list[i*2+1], &key_amount); + + if( itemdb_isequip(sd->status.inventory[idx].nameid) ) + {// process equipment based information into the arrays + script_setarray_pc(sd, "@sold_refine", i, (void*)(intptr_t)sd->status.inventory[idx].refine, &key_refine); + script_setarray_pc(sd, "@sold_attribute", i, (void*)(intptr_t)sd->status.inventory[idx].attribute, &key_attribute); + script_setarray_pc(sd, "@sold_identify", i, (void*)(intptr_t)sd->status.inventory[idx].identify, &key_identify); + + for( j = 0; MAX_SLOTS > j; j++ ) + {// store each of the cards from the equipment in the array + sprintf_s(card_slot, sizeof(card_slot), "@sold_card%d", j + 1); + script_setarray_pc(sd, card_slot, i, (void*)(intptr_t)sd->status.inventory[idx].card[j], &key_card); + } + } } // invoke event -- cgit v1.2.3-60-g2f50