• 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!

Limit Slots C++ TFS 1.4.2 / Otcv8

alejandro762

Well-Known Member
Joined
Sep 6, 2021
Messages
225
Reaction score
64
I started to see if there is possible to add many slots on client and TFS.

Got working all slots till number 15, above on Slot number 16, i see on visual says:

C++ enum SlotPositionBits::SLOTP_SLOT16 = 65536U

I see on OTC: &position: {x=65535, y=16, z=0}


Is there the 65536, the same as 65535 , so the cap is 15 slots on client side ?
There is a possibility to go higher?

Client returns: Cannot dress this object here

Since cannot equip any item on slot16, slot17, slot18...

Slot add with this script: TFS 1.X+ - Help new inventory slot TFS 1.3 and OTClient (https://otland.net/threads/help-new-inventory-slot-tfs-1-3-and-otclient.264537/)
12, 13, 14, 15 works perfect, above 15 won't work TFS 1.4 using otcv8
 
Last edited:
To add prints onEquip and deEquip, while giving "You cannot dress this object here" i changed the RETURNVALUE to NOERROR, in order to equip everything, everywhere and check:
Lua:
ReturnValue MoveEvent::fireEquip(Player* player, Item* item, slots_t slot, bool isCheck)
{
    if (scripted) {
        if (!equipFunction || equipFunction(this, player, item, slot, isCheck) == RETURNVALUE_NOERROR) {
            if (executeEquip(player, item, slot, isCheck)) {
                return RETURNVALUE_NOERROR;
            }
            return RETURNVALUE_NOERROR;
        }
        return equipFunction(this, player, item, slot, isCheck);
    } else {
        return equipFunction(this, player, item, slot, isCheck);
    }
}
Code:
if ((slotPosition & SLOTP_HEAD) || (slotPosition & SLOTP_NECKLACE) ||
            (slotPosition & SLOTP_BACKPACK) || (slotPosition & SLOTP_ARMOR) ||
            (slotPosition & SLOTP_LEGS) || (slotPosition & SLOTP_FEET) ||
            (slotPosition & SLOTP_RING) || (slotPosition & SLOTP_CONTAINER) ||
            (slotPosition & SLOTP_RING2) || (slotPosition & SLOTP_ELEVATOR) ||
            (slotPosition & SLOTP_WINGS) || (slotPosition & SLOTP_OBLI)) {
        ret = RETURNVALUE_NOERROR;
    } else if (slotPosition & SLOTP_TWO_HAND) {
        ret = RETURNVALUE_PUTTHISOBJECTINBOTHHANDS;
    } else if ((slotPosition & SLOTP_RIGHT) || (slotPosition & SLOTP_LEFT)) {
        if (!g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
            ret = RETURNVALUE_CANNOTBEDRESSED;
        } else {
            ret = RETURNVALUE_PUTTHISOBJECTINYOURHAND;
        }
    }
Code:
<item id="26647" article="a" name="Obliverator">
    <attribute key="slotType" value="obli" />
    <attribute key="weight" value="1500" />
    </item>
<movevent event="Equip" itemid="26647" slot="obli" function="onEquipItem" script="onequip.lua"/>
    <movevent event="DeEquip" itemid="26647" slot="obli" function="onDeEquipItem" script="deequip.lua"/>

Prints:
Code:
function onEquip(player, item, slot, isCheck)
    if isCheck then
        return true
    end
    print("Equipping item in slot:", slot)
    return true
end
function onDeEquip(player, item, slot)
    print("De-equipping item from slot:", slot)
return true
end

Returns:
Equipping item in slot: 16
De-equipping item from slot: 16

Redo Changes back to original RETURNVALUE:
Seems the slot 16 is correct, but for some reason the CONST_SLOT_OBLI is returning RETURNVALUE_CANNOTBEDRESSED directly
 
Seems the slot 16 Is detected as "classic slot": ( But 17 .... 26 ) As i tried before also are detected as classic slot

Lua:
Cannot dress item classic in slot: 48
Cannot dress item classic in slot: 48
Cannot dress item classic in slot: 48
Cannot dress item classic in slot: 48
Cannot dress item classic in slot: 48
Cannot dress item classic in slot: 48


Code:
if ((slotPosition & SLOTP_HEAD) || (slotPosition & SLOTP_NECKLACE) ||      
(slotPosition & SLOTP_BACKPACK) || (slotPosition & SLOTP_ARMOR) ||
            (slotPosition & SLOTP_LEGS) || (slotPosition & SLOTP_FEET) ||
            (slotPosition & SLOTP_RING) || (slotPosition & SLOTP_CONTAINER) ||
            (slotPosition & SLOTP_RING2) || (slotPosition & SLOTP_ELEVATOR) ||
            (slotPosition & SLOTP_WINGS) || (slotPosition & SLOTP_OBLI))
{
        ret = RETURNVALUE_CANNOTBEDRESSED;
        std::cout << "Cannot dress item in slot: " << slotPosition << std::endl;
    } else if (slotPosition & SLOTP_TWO_HAND) {
        ret = RETURNVALUE_PUTTHISOBJECTINBOTHHANDS;
    } else if ((slotPosition & SLOTP_RIGHT) || (slotPosition & SLOTP_LEFT)) {
        if (!g_config.getBoolean(ConfigManager::CLASSIC_EQUIPMENT_SLOTS)) {
            ret = RETURNVALUE_CANNOTBEDRESSED;

            std::cout << "Cannot dress item classic in slot: " << slotPosition << std::endl;
        } else {
            ret = RETURNVALUE_PUTTHISOBJECTINYOURHAND;
        }
    }

Code:
enum slots_t : uint8_t {
    CONST_SLOT_WHEREEVER = 0,
    CONST_SLOT_HEAD = 1,
    CONST_SLOT_NECKLACE = 2,
    CONST_SLOT_BACKPACK = 3,
    CONST_SLOT_ARMOR = 4,
    CONST_SLOT_RIGHT = 5,
    CONST_SLOT_LEFT = 6,
    CONST_SLOT_LEGS = 7,
    CONST_SLOT_FEET = 8,
    CONST_SLOT_RING = 9,
    CONST_SLOT_AMMO = 10,
    CONST_SLOT_STORE_INBOX = 11,
    CONST_SLOT_CONTAINER = 12,
    CONST_SLOT_RING2 = 13,
    CONST_SLOT_ELEVATOR = 14,
    CONST_SLOT_WINGS = 15,
    CONST_SLOT_OBLI = 16,
    CONST_SLOT_FIRST = CONST_SLOT_HEAD,
    CONST_SLOT_LAST = CONST_SLOT_OBLI,
};

if i add "classic slots" to true on config it allows to add it on Hand.


So strange
 
So i started all directly from new server 1.4: GitHub - otland/forgottenserver at 1.4 (https://github.com/otland/forgottenserver/tree/1.4)

And new client otcv8 from otacademy repository.

You can add 15 slots, on slot 16 are detected as classic slot and you cannot equip any item, seems weird.
Post automatically merged:

Item detected as Classic Slot.. Output of console: Cannot equip Classic Slot item: 48 , tried add an if statment with slotPosition and returnvalue no error, but doesn't work.


cannotbedressed.gif
 
Last edited:
Back
Top