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

C++ Slot, OPCODE EXTEND

Ascuas Funkeln

Rakkedo Game
Joined
Apr 14, 2013
Messages
549
Solutions
33
Reaction score
309
Location
Poland
GitHub
AscuasFunkeln
Hello guys, i have little or huge problem :D
Im already near finish to add new slots, but i cant solve this problem.
Already change Client side and server side.
This files already is edited in server side.
fbc68747020f8484e1af1e2eabdcb46b.jpeg

I add new slot, loops etc. Just everything what i find about it on otland and find in sources.
And look its near work, but one problem ->
f264ffb8f360dc024f972ec7f54cf484.jpeg

Its look like server have this slot, but dont answer to client "its it" and client just "vanish" the item if i put it into slot.
As i said if i put item into slot its vanish. Fk have no idea with this opcodes errors/links etc. What to do?
PLS HELP XD

items.h
Code:
#define ITEMS 11500
#define SLOTP_WHEREEVER 0xFFFFFFFF
#define SLOTP_HEAD 1 << 0
#define    SLOTP_NECKLACE 1 << 1
#define    SLOTP_BACKPACK 1 << 2
#define    SLOTP_ARMOR 1 << 3
#define    SLOTP_RIGHT 1 << 4
#define    SLOTP_LEFT 1 << 5
#define    SLOTP_LEGS 1 << 6
#define    SLOTP_FEET 1 << 7
#define    SLOTP_RING 1 << 8
#define    SLOTP_AMMO 1 << 9
#define    SLOTP_DEPOT 1 << 11
#define    SLOTP_TWO_HAND 1 << 12
#define    SLOTP_CAPE 1 << 14
#define SLOTP_HAND SLOTP_LEFT | SLOTP_RIGHT

items.cpp
Code:
                    else if(tmpStrValue == "ring")

                    {
                        it.slotPosition |= SLOTP_RING;
                        it.wieldPosition = SLOT_RING;
                    }
                    else if(tmpStrValue == "cape")
                    {
                        it.slotPosition |= SLOTP_CAPE;
                        it.wieldPosition = SLOT_CAPE;
                    }
                    else if(tmpStrValue == "ammo")
                        it.wieldPosition = SLOT_AMMO;
                    else if(tmpStrValue == "hand")
                        it.wieldPosition = SLOT_HAND;

iologindata.cpp
Code:
    ItemBlockList itemList;

    for(int32_t slotId = 1; slotId < 13; ++slotId)
    {
        if(Item* item = player->inventory[slotId])
            itemList.push_back(itemBlock(slotId, item));
    }

        loadItems(itemMap, result);
        for(ItemMap::reverse_iterator rit = itemMap.rbegin(); rit != itemMap.rend(); ++rit)
        {
            Item* item = rit->second.first;
            int32_t pid = rit->second.second;
            if(pid > 0 && pid < 13)
                player->__internalAddThing(pid, item);
[B]

movements.cpp
Code:
                else if(tmpStrValue == "ring")
                    slot = SLOTP_RING;
                else if(tmpStrValue == "cape")
                    slot = SLOTP_CAPE;

        case SLOT_RING:
            slotp = SLOTP_RING;
            break;
        case SLOT_CAPE:
            slotp = SLOTP_CAPE;
            break;

player.cpp
Code:
        (item->getSlotPosition() & SLOTP_RING) || (item->getSlotPosition() & SLOTP_CAPE))

        case SLOT_CAPE:
            if(item->getSlotPosition() & SLOTP_CAPE)
                ret = RET_NOERROR;
            break;

    setWriteItem(NULL);
    for(int32_t i = 0; i < 13; i++)
    {
        if(inventory[i])

void Player::__addThing(Creature* actor, int32_t index, Thing* thing)
{
    if(index < 0 || index > 13)
    {
#ifdef __DEBUG_MOVESYS__
        std::cout << "Failure: [Player::__addThing], " << "player: " << getName() << ", index: " << index << ", index < 0 || index > 13" << std::endl;
        DEBUG_REPORT


void Player::__replaceThing(uint32_t index, Thing* thing)
{
    if(index < 0 || index > 13)
    {
#ifdef __DEBUG_MOVESYS__
        std::cout << "Failure: [Player::__replaceThing], " << "player: " << getName() << ", index: " << index << ", index < 0 || index > 13" << std::endl;
        DEBUG_REPORT

    if(index > 0 && index < 13)
    {
        if(inventory[index])
        {
#ifdef __DEBUG_MOVESYS__
            std::cout << "Warning: [Player::__internalAddThing], player: " << getName() << ", items[index] is not empty." << std::endl;
            //DEBUG_REPORT

    transferContainer.setParent(NULL);
    for(int32_t i = 0; i < 13; i++)
    {
        inventory[i] = NULL;
        inventoryAbilities[i] = false;

creature.h
Code:
    SLOT_HAND = 12,
    SLOT_CAPE = 13,
    SLOT_LAST = SLOT_CAPE,

player.h
Code:
        bool inventoryAbilities[13];
        Item* inventory[13];

enums.h

Code:
    CONDITIONID_AMMO,
    CONDITIONID_CAPE,
    CONDITIONID_OUTFIT




TSF 0.3.6 V8.2
 
Last edited:
I still trying to fix that and nothing. I see other people got additional lines in protocalgame and luascript, but in 0.3.6 is not exist (registerEnum and sendInventory) :|
Im thinking its fk not possible to add new slots to 0.3.6 - 8.6 distro or i still missing something...

Any ideas?
 
Back
Top