summaryrefslogtreecommitdiff
path: root/src/map/npc.cpp
diff options
context:
space:
mode:
authorHoraK-FDF <horak-fdf@web.de>2024-06-06 19:36:23 +0000
committerLed Mitz <smoothshifter@tuta.io>2024-06-06 19:36:23 +0000
commit04c17a55c5b83e1b8ef1dc336fd8e023ba1e10ad (patch)
tree684a3f499b16bc44940eff429314ec54077f75ff /src/map/npc.cpp
parent1841311e6302ff88e53446744e571bed703d2087 (diff)
downloadtmwa-04c17a55c5b83e1b8ef1dc336fd8e023ba1e10ad.tar.gz
tmwa-04c17a55c5b83e1b8ef1dc336fd8e023ba1e10ad.tar.bz2
tmwa-04c17a55c5b83e1b8ef1dc336fd8e023ba1e10ad.tar.xz
tmwa-04c17a55c5b83e1b8ef1dc336fd8e023ba1e10ad.zip
KeepAfterUse + DontUseAmmo
**** Approved-by: Free Yorp <thefreeyorp+git@gmail.com> Approved-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl> Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl>
Diffstat (limited to 'src/map/npc.cpp')
-rw-r--r--src/map/npc.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 7d3e62b..a6d3dda 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -1003,12 +1003,18 @@ int npc_selllist(dumb_ptr<map_session_data> sd,
if (!nameid ||
sd->status.inventory[item_list[i].ioff2.unshift()].amount < item_list[i].count)
return 1;
- if (bool(itemdb_search(nameid)->mode & ItemMode::NO_SELL_TO_NPC))
+
+ OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[item_list[i].ioff2.unshift()])
{
- //clif_displaymessage(sd->sess, "This item can't be sold to an NPC."_s);
- // M+ already outputs "Unable to sell unsellable item." on return value 3.
- return 3;
+ if (bool(sdidn->mode & ItemMode::NO_SELL_TO_NPC))
+ {
+ //clif_displaymessage(sd->sess, "This item can't be sold to an NPC."_s);
+ // M+ already outputs "Unable to sell unsellable item." on return value 3.
+ return 3;
+ }
}
+ OMATCH_END ();
+
if (sd->trade_partner)
return 2; // cant sell while trading
z += static_cast<double>(itemdb_value_sell(nameid)) * item_list[i].count;