- 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://svn.code.sf.net/p/rathena/svn/trunk@15017 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
9796c781f6
commit
a7d65b3d13
@ -5678,8 +5678,9 @@ is bought or sold by a player.
|
|||||||
In the OnBuyItem, two arrays are set (@bought_nameid and @bought_quantity), which
|
In the OnBuyItem, two arrays are set (@bought_nameid and @bought_quantity), which
|
||||||
hold information about the name id (item id) sold and the amount sold of it. Same
|
hold information about the name id (item id) sold and the amount sold of it. Same
|
||||||
goes for the OnSellItem label, only the variables are named different
|
goes for the OnSellItem label, only the variables are named different
|
||||||
(@sold_nameid and @sold_quantity). An example on a shop comes with eAthena, and
|
(@sold_nameid, @sold_quantity, @sold_refine, @sold_attribute, @sold_identify,
|
||||||
can be found in the doc/sample/npc_dynamic_shop.txt file.
|
@sold_card1, @sold_card2, @sold_card3, @sold_card4). An example on a shop comes
|
||||||
|
with eAthena, and can be found in the doc/sample/npc_dynamic_shop.txt file.
|
||||||
|
|
||||||
This example shows how to use the labels and their set variables to create a dynamic shop.
|
This example shows how to use the labels and their set variables to create a dynamic shop.
|
||||||
|
|
||||||
|
@ -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)
|
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];
|
char npc_ev[EVENT_NAME_LENGTH];
|
||||||
int i, idx;
|
char card_slot[NAME_LENGTH];
|
||||||
|
int i, j, idx;
|
||||||
int key_nameid = 0;
|
int key_nameid = 0;
|
||||||
int key_amount = 0;
|
int key_amount = 0;
|
||||||
|
int key_refine = 0;
|
||||||
|
int key_attribute = 0;
|
||||||
|
int key_identify = 0;
|
||||||
|
int key_card = 0;
|
||||||
|
|
||||||
// discard old contents
|
// discard old contents
|
||||||
script_cleararray_pc(sd, "@sold_nameid", (void*)0);
|
script_cleararray_pc(sd, "@sold_nameid", (void*)0);
|
||||||
script_cleararray_pc(sd, "@sold_quantity", (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
|
// save list of to be sold items
|
||||||
for( i = 0; i < n; i++ )
|
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_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);
|
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
|
// invoke event
|
||||||
|
Loading…
x
Reference in New Issue
Block a user