diff options
author | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-06 16:46:03 +0000 |
---|---|---|
committer | epoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2011-12-06 16:46:03 +0000 |
commit | b9d77010fc9474d3db72778508ea35f5b311be58 (patch) | |
tree | 84810951b944d57205c27ccf2d0ac43a9201d6b0 /src/map/npc.c | |
parent | 0e361a16b060d6a49d8832d5bc5d3bf88dd71486 (diff) | |
download | hercules-b9d77010fc9474d3db72778508ea35f5b311be58.tar.gz hercules-b9d77010fc9474d3db72778508ea35f5b311be58.tar.bz2 hercules-b9d77010fc9474d3db72778508ea35f5b311be58.tar.xz hercules-b9d77010fc9474d3db72778508ea35f5b311be58.zip |
- 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
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 29 |
1 files changed, 28 insertions, 1 deletions
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 |