• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to change maximum stack from 100 to 255

kosmik1

New Member
Joined
Jun 7, 2010
Messages
29
Reaction score
2
I dont know what i need to change in source to can have 255 items in stack not 100.
Thx for help and sry for bad english.
 
Last edited:
I make this:
container.cpp

Code:
        if(item->isStackable())
[LIST=1]
        {
            uint32_t n = 0;
            if(index != INDEX_WHEREEVER)
            {
                const Thing* destThing = __getThing(index);
                const Item* destItem = NULL;
                if(destThing)
                    destItem = destThing->getItem();
   
                if(destItem && destItem->getID() == item->getID())
                    n = 255 - destItem->getItemCount();//
            }
   
            maxQueryCount = freeSlots * 255 + n; //
            if(maxQueryCount < count)
                return RET_CONTAINERNOTENOUGHROOM;
        }

game.cpp
Code:
            if(toItem && toItem->getID() == item->getID())
            {
                n = std::min((uint32_t)255 - toItem->getItemCount(), m);//
                toCylinder->__updateThing(toItem, toItem->getID(), toItem->getItemCount() + n);
                updateItem = toItem;
            }

Code:
            if(item->isStackable() && toItem && toItem->getID() == item->getID())
            {
                uint32_t n = std::min((uint32_t)255 - toItem->getItemCount(), m);//
                toCylinder->__updateThing(toItem, toItem->getID(), toItem->getItemCount() + n);
                if(m - n > 0)
                {
                    if(m - n != item->getItemCount())
                        moveItem = Item::CreateItem(item->getID(), m - n);
                }

Code:
                do
                {
                    Item* remaindItem = Item::CreateItem(it->second, std::min(255, tmp));//
                    if(internalAddItem(NULL, cylinder, remaindItem, INDEX_WHEREEVER, flags) != RET_NOERROR)
                        internalAddItem(NULL, cylinder->getTile(), remaindItem, INDEX_WHEREEVER, FLAG_NOLIMIT);
   
                    tmp -= std::min(255, tmp);//
                }
                while(tmp > 0);


luascript.cpp
Code:
        const ItemType& it = Item::items[newId];
        if(it.stackable && count > 255)//
            count = 255;

Code:
        while(itemCount > 0)
        {
            int32_t stackCount = std::min(255, subType);//
            Item* newItem = Item::CreateItem(itemId, stackCount);
            if(!newItem)
            {
                errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
                lua_pushboolean(L, false);
                return 1;
            }

Code:
        const ItemType& it = Item::items[itemId];
        int32_t itemCount = 1, subType = 1;
        if(it.hasSubType())
        {
            if(it.stackable)
                itemCount = (int32_t)std::ceil((float)count / 255);//
   
            subType = count;
        }

Code:
        ScriptEnviroment* env = getEnv();
        const ItemType& it = Item::items[(uint32_t)popNumber(L)];
        if(it.stackable && count > 255)//
            count = 255;

Code:
        while(itemCount > 0)
        {
            int32_t stackCount = std::min(255, subType);//
            Item* newItem = Item::CreateItem(itemId, stackCount);
            if(!newItem)
            {
                errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
                lua_pushboolean(L, false);
                return 1;
            }


player.cpp
Code:
    ReturnValue Player::__queryMaxCount(int32_t index, const Thing* thing, uint32_t count, uint32_t& maxQueryCount,
        uint32_t flags) const
    {
        const Item* item = thing->getItem();
        if(!item)
        {
            maxQueryCount = 0;
            return RET_NOTPOSSIBLE;
        }
   
        const Thing* destThing = __getThing(index);
        const Item* destItem = NULL;
        if(destThing)
            destItem = destThing->getItem();
   
        if(destItem)
        {
            if(destItem->isStackable() && item->getID() == destItem->getID())
                maxQueryCount = 255 - destItem->getItemCount();//
            else
                maxQueryCount = 0;
        }
        else
        {
            if(item->isStackable())
                maxQueryCount = 255;//
            else
                maxQueryCount = 1;
   
            return RET_NOERROR;
        }
   
        if(maxQueryCount < count)
            return RET_NOTENOUGHROOM;
   
        return RET_NOERROR;
    }

And when i have more than 100 in stack i cant move it from bp. Only witch + ctrl and can throw to ground. But cant separated
 
Back
Top