Skip to content

Commit

Permalink
fix: remove weight (already checking max container items)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and dudantas committed Aug 31, 2023
1 parent 9011074 commit 54bd453
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
12 changes: 1 addition & 11 deletions data/events/scripts/player.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
CONTAINER_WEIGHT_CHECK = true -- true = enable / false = disable
CONTAINER_WEIGHT_MAX = 1000000 -- 1000000 = 10k = 10000.00 oz

local storeItemID = {
-- registered item ids here are not tradable with players
-- these items can be set to moveable at items.xml
Expand Down Expand Up @@ -244,20 +241,13 @@ function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder,
return false
end

-- No move if item count > 20 items
-- No move if tile item count > 20 items
local tile = Tile(toPosition)
if tile and tile:getItemCount() > 20 then
self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end

-- No move parcel very heavy
if CONTAINER_WEIGHT_CHECK and ItemType(item:getId()):isContainer()
and item:getWeight() > CONTAINER_WEIGHT_MAX then
self:sendCancelMessage("Your cannot move this item too heavy.")
return false
end

-- Players cannot throw items on teleports
if blockTeleportTrashing and toPosition.x ~= CONTAINER_POSITION then
local thing = Tile(toPosition):getItemByType(ITEM_TYPE_TELEPORT)
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/eventcallbacks/player/on_rotate_item.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local callback = EventCallback()

function callback.playerOnRotateItem(player, item, position)
if item:getActionId() == 100 then
if item:getActionId() == IMMOVABLE_ACTION_ID then
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return false
end
Expand Down
2 changes: 1 addition & 1 deletion src/items/containers/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ std::deque<Item*> Container::getStoreInboxFilteredItems() const {

phmap::flat_hash_set<StoreInboxCategory_t> Container::getStoreInboxValidCategories() const {
phmap::flat_hash_set<StoreInboxCategory_t> validCategories;
for (const auto& item : itemlist) {
for (const auto &item : itemlist) {
auto attribute = item->getCustomAttribute("unWrapId");
uint16_t unWrapId = attribute ? static_cast<uint16_t>(attribute->getInteger()) : 0;
if (unWrapId != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4312,7 +4312,7 @@ void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool h
if (category.has_value()) {
bool toSendCategory = false;
// Check if category exist in the deque
for (const auto& tempCategory : categories) {
for (const auto &tempCategory : categories) {
if (tempCategory == category.value()) {
toSendCategory = true;
g_logger().debug("found category {}", toSendCategory);
Expand Down

0 comments on commit 54bd453

Please sign in to comment.