summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoraK-FDF <horak-fdf@web.de>2024-07-29 09:45:48 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-08-30 21:05:24 +0200
commit587fc350d7ab825c2cb82bdb216694893d3a2413 (patch)
tree5aec893468bfdd032d8943aa80576a6376d63f65
parenta1caa53ab1ee0cf41d8bbc41c88d8eb84207ee7f (diff)
downloadtmwa-587fc350d7ab825c2cb82bdb216694893d3a2413.tar.gz
tmwa-587fc350d7ab825c2cb82bdb216694893d3a2413.tar.bz2
tmwa-587fc350d7ab825c2cb82bdb216694893d3a2413.tar.xz
tmwa-587fc350d7ab825c2cb82bdb216694893d3a2413.zip
GM restricted item handling
-rw-r--r--src/map/clif.cpp6
-rw-r--r--src/map/npc.cpp3
-rw-r--r--src/map/storage.cpp3
3 files changed, 8 insertions, 4 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index a5bb2ba..6381c09 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -4620,7 +4620,8 @@ RecvResult clif_parse_DropItem(Session *s, dumb_ptr<map_session_data> sd)
OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[fixed.ioff2.unshift()])
{
- if (bool(sdidn->mode & ItemMode::NO_DROP))
+ GmLevel gmlvl = pc_isGM(sd);
+ if (bool(sdidn->mode & ItemMode::NO_DROP) && gmlvl.get_all_bits() < 60)
{
clif_displaymessage(sd->sess, "This item can't be dropped."_s);
return rv;
@@ -4909,7 +4910,8 @@ RecvResult clif_parse_TradeAddItem(Session *s, dumb_ptr<map_session_data> sd)
if (fixed.zeny_or_ioff2.ok())
OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[fixed.zeny_or_ioff2.unshift()])
{
- if (bool(sdidn->mode & ItemMode::NO_TRADE))
+ GmLevel gmlvl = pc_isGM(sd);
+ if (bool(sdidn->mode & ItemMode::NO_TRADE) && gmlvl.get_all_bits() < 60)
{
clif_displaymessage(sd->sess, "This item can't be traded."_s);
return rv;
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index a6d3dda..0a7bfc2 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -1006,7 +1006,8 @@ int npc_selllist(dumb_ptr<map_session_data> sd,
OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[item_list[i].ioff2.unshift()])
{
- if (bool(sdidn->mode & ItemMode::NO_SELL_TO_NPC))
+ GmLevel gmlvl = pc_isGM(sd);
+ if (bool(sdidn->mode & ItemMode::NO_SELL_TO_NPC) && gmlvl.get_all_bits() < 60)
{
//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.
diff --git a/src/map/storage.cpp b/src/map/storage.cpp
index cab3f0f..dc1fe62 100644
--- a/src/map/storage.cpp
+++ b/src/map/storage.cpp
@@ -188,7 +188,8 @@ int storage_storageadd(dumb_ptr<map_session_data> sd, IOff0 index, int amount)
OMATCH_BEGIN_SOME (sdidn, sd->inventory_data[index])
{
- if (bool(sdidn->mode & ItemMode::NO_STORAGE))
+ GmLevel gmlvl = pc_isGM(sd);
+ if (bool(sdidn->mode & ItemMode::NO_STORAGE) && gmlvl.get_all_bits() < 60)
{
clif_displaymessage(sd->sess, "This item can't be stored."_s);
return 0;