Updated Player checkItemManipulation method.
This commit is contained in:
parent
0d5785b2aa
commit
5fd42cce29
@ -4095,26 +4095,26 @@ public class Player extends Playable
|
|||||||
{
|
{
|
||||||
if (World.getInstance().findObject(objectId) == null)
|
if (World.getInstance().findObject(objectId) == null)
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item not available in World");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item not available in World.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Item item = getInventory().getItemByObjectId(objectId);
|
final Item item = getInventory().getItemByObjectId(objectId);
|
||||||
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item he is not owner of");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item he is not owner of.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((count < 0) || ((count > 1) && !item.isStackable()))
|
if ((count < 0) || ((count > 1) && !item.isStackable()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item with invalid count: " + count);
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item with invalid count: " + count);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > item.getCount())
|
if (count > item.getCount())
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " more items than he owns");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " more items than he owns.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4129,9 +4129,9 @@ public class Player extends Playable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cannot drop/trade wear-items
|
||||||
if (item.isWear())
|
if (item.isWear())
|
||||||
{
|
{
|
||||||
// cannot drop/trade wear-items
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12614,18 +12614,19 @@ public class Player extends Playable
|
|||||||
final Item item = getInventory().getItemByItemId(itemId);
|
final Item item = getInventory().getItemByItemId(itemId);
|
||||||
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item he is not owner of");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item he is not owner of");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((getActiveEnchantItem() != null) && (getActiveEnchantItem().getItemId() == itemId))
|
|
||||||
{
|
|
||||||
LOGGER.warning(getObjectId() + ":player tried to " + action + " an enchant scroll he was using");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((getActiveEnchantItem() != null) && (getActiveEnchantItem().getItemId() == itemId))
|
||||||
|
{
|
||||||
|
LOGGER.warning(getObjectId() + ":player " + this + " tried to " + action + " an enchant scroll he was using");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cannot drop/trade wear-items
|
||||||
if (item.isWear())
|
if (item.isWear())
|
||||||
{
|
{
|
||||||
// cannot drop/trade wear-items
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12643,7 +12644,7 @@ public class Player extends Playable
|
|||||||
final Item item = getInventory().getItemByObjectId(objectId);
|
final Item item = getInventory().getItemByObjectId(objectId);
|
||||||
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item he is not owner of");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item he is not owner of");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12658,9 +12659,9 @@ public class Player extends Playable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cannot drop/trade wear-items
|
||||||
if (item.isWear())
|
if (item.isWear())
|
||||||
{
|
{
|
||||||
// cannot drop/trade wear-items
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4171,26 +4171,26 @@ public class Player extends Playable
|
|||||||
{
|
{
|
||||||
if (World.getInstance().findObject(objectId) == null)
|
if (World.getInstance().findObject(objectId) == null)
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item not available in World");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item not available in World.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Item item = getInventory().getItemByObjectId(objectId);
|
final Item item = getInventory().getItemByObjectId(objectId);
|
||||||
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item he is not owner of");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item he is not owner of.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((count < 0) || ((count > 1) && !item.isStackable()))
|
if ((count < 0) || ((count > 1) && !item.isStackable()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item with invalid count: " + count);
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item with invalid count: " + count);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > item.getCount())
|
if (count > item.getCount())
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " more items than he owns");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " more items than he owns.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4205,9 +4205,15 @@ public class Player extends Playable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We cannot put a Weapon with Augmention in WH while casting (Possible Exploit)
|
||||||
|
if (item.isAugmented() && (isCastingNow()))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cannot drop/trade wear-items
|
||||||
if (item.isWear())
|
if (item.isWear())
|
||||||
{
|
{
|
||||||
// cannot drop/trade wear-items
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12919,24 +12925,25 @@ public class Player extends Playable
|
|||||||
final Item item = getInventory().getItemByItemId(itemId);
|
final Item item = getInventory().getItemByItemId(itemId);
|
||||||
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item he is not owner of");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item he is not owner of");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((getActiveEnchantItem() != null) && (getActiveEnchantItem().getItemId() == itemId))
|
if ((getActiveEnchantItem() != null) && (getActiveEnchantItem().getItemId() == itemId))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ":player tried to " + action + " an enchant scroll he was using");
|
LOGGER.warning(getObjectId() + ":player " + this + " tried to " + action + " an enchant scroll he was using");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// can not trade a cursed weapon
|
||||||
if (CursedWeaponsManager.getInstance().isCursed(itemId))
|
if (CursedWeaponsManager.getInstance().isCursed(itemId))
|
||||||
{
|
{
|
||||||
// can not trade a cursed weapon
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cannot drop/trade wear-items
|
||||||
if (item.isWear())
|
if (item.isWear())
|
||||||
{
|
{
|
||||||
// cannot drop/trade wear-items
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12954,7 +12961,7 @@ public class Player extends Playable
|
|||||||
final Item item = getInventory().getItemByObjectId(objectId);
|
final Item item = getInventory().getItemByObjectId(objectId);
|
||||||
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
if ((item == null) || (item.getOwnerId() != getObjectId()))
|
||||||
{
|
{
|
||||||
LOGGER.warning(getObjectId() + ": player tried to " + action + " item he is not owner of");
|
LOGGER.warning(getObjectId() + ": player " + this + " tried to " + action + " item he is not owner of");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12969,15 +12976,15 @@ public class Player extends Playable
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// can not trade a cursed weapon
|
||||||
if (CursedWeaponsManager.getInstance().isCursed(item.getItemId()))
|
if (CursedWeaponsManager.getInstance().isCursed(item.getItemId()))
|
||||||
{
|
{
|
||||||
// can not trade a cursed weapon
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cannot drop/trade wear-items
|
||||||
if (item.isWear())
|
if (item.isWear())
|
||||||
{
|
{
|
||||||
// cannot drop/trade wear-items
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user