summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c29
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