summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKirieZ <guilherme_kiriez@hotmail.com>2016-07-16 12:41:42 -0300
committerhemagx <ibrahem.h.basyone@gmail.com>2016-09-10 19:52:10 +0200
commitdab13fae79a10b6dc325519ef4fd6878029e7ed5 (patch)
tree3ff7f50deaa78de8933a040de3a049907cf10615 /src
parentd426042f7a77e699657a3f495307d2c1d766dc75 (diff)
downloadhercules-dab13fae79a10b6dc325519ef4fd6878029e7ed5.tar.gz
hercules-dab13fae79a10b6dc325519ef4fd6878029e7ed5.tar.bz2
hercules-dab13fae79a10b6dc325519ef4fd6878029e7ed5.tar.xz
hercules-dab13fae79a10b6dc325519ef4fd6878029e7ed5.zip
Adds official behavior when selling to NPCs. Fixes issue #1214
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c8
1 files changed, 7 insertions, 1 deletions
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);