diff options
author | Dennis Friis <peavey@placid.dk> | 2008-05-08 11:02:20 +0000 |
---|---|---|
committer | Dennis Friis <peavey@placid.dk> | 2008-05-08 11:02:20 +0000 |
commit | 1a9b53b8f1890c004e2660e8f82ad3ac705a8fb9 (patch) | |
tree | 2055177b65dd819da00c25ef878764245ce1a06f | |
parent | cf58d1b9db1be0f2e72a9a34deb535c5fa6d9cdf (diff) | |
download | tmwa-1a9b53b8f1890c004e2660e8f82ad3ac705a8fb9.tar.gz tmwa-1a9b53b8f1890c004e2660e8f82ad3ac705a8fb9.tar.bz2 tmwa-1a9b53b8f1890c004e2660e8f82ad3ac705a8fb9.tar.xz tmwa-1a9b53b8f1890c004e2660e8f82ad3ac705a8fb9.zip |
When buying from NPC do not stack unstackable items. It might seem like a better place to fix it in pc_additem, but this method should be allowed to or breakage may occur.
-rw-r--r-- | src/map/npc.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 7175504..84f0695 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -990,14 +990,28 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) return 4; // cant buy while trading pc_payzeny(sd,(int)z); + for(i=0;i<n;i++) { - struct item item_tmp; + struct item_data *item_data; + if ((item_data = itemdb_exists(item_list[i*2+1])) != NULL) + { + int amount = item_list[i*2], flag; + struct item item_tmp; + memset(&item_tmp,0,sizeof(item_tmp)); - memset(&item_tmp,0,sizeof(item_tmp)); - item_tmp.nameid = item_list[i*2+1]; - item_tmp.identify = 1; // npc”Ì”„ƒAƒCƒeƒ€‚ÍŠÓ’èÏ‚Ý + item_tmp.nameid = item_data->nameid; + item_tmp.identify = 1; // npc”Ì”„ƒAƒCƒeƒ€‚ÍŠÓ’èÏ‚Ý - pc_additem(sd,&item_tmp,item_list[i*2]); + if (amount > 1 && (item_data->type == 4 || item_data->type == 5 || item_data->type == 7 || item_data->type == 8)) + { + for (j=0; j<amount; j++) { + pc_additem(sd,&item_tmp,1); + } + } + else { + pc_additem(sd,&item_tmp,amount); + } + } } //¤lŒoŒ±’l |