diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-28 19:22:13 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-08-28 19:22:13 +0000 |
commit | d70d0a66866d8c41cf6a8c9df266c0d7ea29c3dc (patch) | |
tree | 07bf231018571a695d5836094836057a0387d736 /src/map/npc.c | |
parent | 5b2bc3e1c6914d9cce55ddf483ee61e956e09829 (diff) | |
download | hercules-d70d0a66866d8c41cf6a8c9df266c0d7ea29c3dc.tar.gz hercules-d70d0a66866d8c41cf6a8c9df266c0d7ea29c3dc.tar.bz2 hercules-d70d0a66866d8c41cf6a8c9df266c0d7ea29c3dc.tar.xz hercules-d70d0a66866d8c41cf6a8c9df266c0d7ea29c3dc.zip |
- The memory leak reports will now print out in the logs also the revision they belong to.
- Cleaned up the scriptable npc-shop code, it should be crash-proof now.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8525 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index cd6e0b997..5ff34647c 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1164,6 +1164,24 @@ int npc_buysellsel(struct map_session_data *sd,int id,int type) return 0;
}
+//npc_buylist for script-controlled shops.
+static int npc_buylist_sub(
+ struct map_session_data *sd,int n,
+ unsigned short *item_list, struct npc_data *nd)
+{
+ unsigned char npc_ev[51];
+ int i;
+ int regkey = add_str("@bought_nameid");
+ int regkey2 = add_str("@bought_quantity");
+ sprintf(npc_ev, "%s::OnBuyItem", nd->exname);
+ for(i=0;i<n;i++){
+ pc_setreg(sd,regkey+(i<<24),(int)item_list[i*2+1]);
+ pc_setreg(sd,regkey2+(i<<24),(int)item_list[i*2]);
+ }
+ npc_event(sd, npc_ev, 0);
+ return 0;
+}
+
/*==========================================
*
*------------------------------------------
@@ -1180,6 +1198,9 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) if ((nd = npc_checknear(sd,map_id2bl(sd->npc_shopid))) == NULL)
return 3;
+ if (nd->master_nd) //Script-based shops.
+ return npc_buylist_sub(sd,n,item_list,nd->master_nd);
+
if (nd->bl.subtype!=SHOP)
return 3;
|