Originally posted by [b]AnnieRuru[/b]
responsible topic
[url="http://rathena.org/board/topic/73574-callshop-script/"]http://rathena.org/b...allshop-script/[/url]
[codebox]prontera,159,172,5 script market#2 100,{
if ( countitem(1201) == 0 ) {
getitem2 1201, 1,1,0,0, 4001,4002,4003,0;
getitem2 1201, 1,1,0,0, 4001,4002,4003,4004;
}
callshop "market2#hidden", 2;
end;
OnSellItem:
.@size = getarraysize( @sold_nameid );
for ( .@i = 0; .@i < .@size; .@i++ ) {
dispbottom callfunc( "getitemname2", @sold_nameid[.@i], @sold_identify[.@i], @sold_refine[.@i], @sold_attribute[.@i], @sold_card1[.@i], @sold_card2[.@i], @sold_card3[.@i], @sold_card4[.@i]);
dispbottom @sold_nameid[.@i] +" "+ @sold_identify[.@i] +" "+ @sold_refine[.@i] +" "+ @sold_attribute[.@i] +" "+ @sold_card1[.@i] +" "+ @sold_card2[.@i] +" "+ @sold_card3[.@i] +" "+ @sold_card4[.@i];
}
end;
OnInit:
npcshopattach "market2#hidden";
end;
}
- shop market2#hidden -1,512:10,513:20,514:30,515:40,516:50
[/codebox]
tested with this script on latest rathena 16857
and ... ahem... my [url=http://www.eathena.ws/board/index.php?showtopic=244678]getitemname2 function[/url]
when I sell the that custom Knife that I provided with this script
1st knife return 1201 1 0 0 0 0 0 0
2nd knife return 1201 1 0 0 4004 0 0 0
it seems card1 ~ card3 value is discard and overwrite with card4 value on the card1 slot
[url="http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=4858"]http://www.eathena.w...er&showbug=4858[/url]
when I make a reference to this topic
[codebox]Index: npc.c
===================================================================
--- npc.c (revision 16857)
+++ npc.c (working copy)
@@ -1561,14 +1561,16 @@
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 card_slot[NAME_LENGTH];
- int i, j, idx;
+ int i, 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;
+ int key_card1 = 0;
+ int key_card2 = 0;
+ int key_card3 = 0;
+ int key_card4 = 0;
// discard old contents
script_cleararray_pc(sd, "@sold_nameid", (void*)0);
@@ -1576,12 +1578,10 @@
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
- snprintf(card_slot, sizeof(card_slot), "@sold_card%d", j + 1);
- script_cleararray_pc(sd, card_slot, (void*)0);
- }
+ script_cleararray_pc(sd, "@sold_card1", (void*)0);
+ script_cleararray_pc(sd, "@sold_card2", (void*)0);
+ script_cleararray_pc(sd, "@sold_card3", (void*)0);
+ script_cleararray_pc(sd, "@sold_card4", (void*)0);
// save list of to be sold items
for( i = 0; i < n; i++ )
@@ -1596,12 +1596,11 @@
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
- snprintf(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);
- }
+ script_setarray_pc(sd, "@sold_sold", i, (void*)(intptr_t)sd->status.inventory[idx].identify, &key_identify);
+ script_setarray_pc(sd, "@sold_card1", i, (void*)(intptr)sd->status.inventory[idx].card[0], &key_card1);
+ script_setarray_pc(sd, "@sold_card2", i, (void*)(intptr)sd->status.inventory[idx].card[1], &key_card2);
+ script_setarray_pc(sd, "@sold_card3", i, (void*)(intptr)sd->status.inventory[idx].card[2], &key_card3);
+ script_setarray_pc(sd, "@sold_card4", i, (void*)(intptr)sd->status.inventory[idx].card[3], &key_card4);
}
}
[/codebox]somehow this code fix the bug

and I feel this kind of modification looks noob
I also fail to detect why the official code doesn't work
I'm still noob in source modification anyways
maybe you core developers can find out why current rathena code doesn't work, while this noob coding works