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

TFS 1.X+ TFS 1.3 / New items.otmb + dat/spr problem

Itutorial

Excellent OT User
Joined
Dec 23, 2014
Messages
2,307
Solutions
68
Reaction score
982
The client keeps causing the server to trash when I try to log in. I have checked that I am using all the correct versions. There is no error before the server crashes.

Running the server with VS debugger just says: Access Violation at 0x0000000

I have a ground tile and 2 outfits for male and female in the dat/spr. My character has the correct looktype, ect. So none of that should cause a crash.

Also no modifications to otclient or TFS sources.
 
Last edited:
Solution
Okay so I found the problem.

Code:
void Player::internalAddThing(uint32_t index, Thing* thing)
{
    
    if (!thing) { // This check is required sometimes.
        return;
    }
    
    Item* item = thing->getItem();
    if (!item) {
        return;
    }

    //index == 0 means we should equip this item at the most appropiate slot (no action required here)
    if (index > CONST_SLOT_WHEREEVER && index <= CONST_SLOT_LAST) {
        if (inventory[index]) {
            return;
        }

        inventory[index] = item;
        item->setParent(this);
    }
}
Try adding empty spaces up to 500? in items, outfits and effects in tibia.dat and make .otb out of it. I've had similar problem when I was doing new spr/dat/otb and it helped.
 
From what the debug is saying:

The database is being checked for any items to load onto the player.

It is crashing when trying to check if it is an item.

There are no items in my database and I removed the firstitems.lua coding in creaturescripts... Does anyone know anything that was added in sources possibly that gives new players (or players that just died) an item when they log in? I feel that may be the problem.


Code:
void Player::internalAddThing(uint32_t index, Thing* thing)
{
    Item* item = thing->getItem();    <------- THIS IS CAUSING THE PROBLEM
    if (!item) {
        return;
    }

    //index == 0 means we should equip this item at the most appropiate slot (no action required here)
    if (index > CONST_SLOT_WHEREEVER && index <= CONST_SLOT_LAST) {
        if (inventory[index]) {
            return;
        }

        inventory[index] = item;
        item->setParent(this);
    }
}


Is it possible this is not a good enough check?

Code:
//load inventory items
    ItemMap itemMap;

    query.str(std::string());
    query << "SELECT `pid`, `sid`, `itemtype`, `count`, `attributes` FROM `player_items` WHERE `player_id` = " << player->getGUID() << " ORDER BY `sid` DESC";
    if ((result = db.storeQuery(query.str()))) {   <---- I think this isn't handling the situation correctly.
 
Last edited:
Okay so I found the problem.

Code:
void Player::internalAddThing(uint32_t index, Thing* thing)
{
    
    if (!thing) { // This check is required sometimes.
        return;
    }
    
    Item* item = thing->getItem();
    if (!item) {
        return;
    }

    //index == 0 means we should equip this item at the most appropiate slot (no action required here)
    if (index > CONST_SLOT_WHEREEVER && index <= CONST_SLOT_LAST) {
        if (inventory[index]) {
            return;
        }

        inventory[index] = item;
        item->setParent(this);
    }
}
 
Solution
Back
Top