From dab13fae79a10b6dc325519ef4fd6878029e7ed5 Mon Sep 17 00:00:00 2001 From: KirieZ Date: Sat, 16 Jul 2016 12:41:42 -0300 Subject: Adds official behavior when selling to NPCs. Fixes issue #1214 --- src/map/npc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/map/npc.c b/src/map/npc.c index 945a84957..4f74ea5a5 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2173,6 +2173,9 @@ int npc_selllist(struct map_session_data *sd, struct itemlist *item_list) z = 0; + if (sd->status.zeny >= MAX_ZENY && nd->master_nd == NULL) + return 1; + // verify the sell list for (i = 0; i < VECTOR_LENGTH(*item_list); i++) { struct itemlist_entry *entry = &VECTOR_INDEX(*item_list, i); @@ -2222,7 +2225,10 @@ int npc_selllist(struct map_session_data *sd, struct itemlist *item_list) pc->delitem(sd, idx, entry->amount, 0, DELITEM_SOLD, LOG_TYPE_NPC); } - if( z > MAX_ZENY ) + if (z + sd->status.zeny > MAX_ZENY && nd->master_nd == NULL) + return 1; + + if (z > MAX_ZENY) z = MAX_ZENY; pc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL); -- cgit v1.2.3-60-g2f50