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

[Suggestion] Items and proper UID system

oen432

Legendary OT User
Joined
Oct 3, 2014
Messages
1,909
Solutions
55
Reaction score
2,137
Location
Poland
GitHub
Oen44
Anyone else thinks that with OTC being more and more popular, we should start working on a real Item Unique Identification, like in any other multiplayer game?

Why? Simple, client has no way to identify one item from another if they are the same type (like two Fire Axes, where one has bonus stats like imbuements or custom attributes).
How? This is simple too, integer that increments every time it's assigned to a newly created item.

Now we can ask server for an item based on a number.
 
Last edited:
Yeah, like this? :p

Currently, I think you can pass Item(...):Id() to OTC using extendedopcodes to be able to distinguish two fire swords from each other.
Where id is the temporarily/incremental runtime item reference by TFS. (not the itemtype id like fire sword).
 
Last edited:
Yeah, like this? :p
Well, almost. Yours is too advanced, saving isn't necessary.

game.h
C++:
uint32_t lastItemId = 0;
uint32_t nextItemUID() {
    return ++lastItemId;
}

item.h
C++:
uint32_t realUId = 0;

void setRealUID(uint32_t uid) {
    realUId = uid;
}

uint32_t getRealUID() const {
    return realUId;
}

item.cpp
C++:
Item* Item::CreateItem(const uint16_t type, uint16_t count /*= 0*/)
{
    /* ... */
    if (it.id != 0) {
        /* ... */
        if (it.pickupable)
        {
            newItem->setRealUID(g_game.nextItemUID());
        }

        newItem->incrementReferenceCounter();
    }

    return newItem;
}

New methods to get item by UID, set item UID and it worked well. Used it with Tooltip and Upgrade System, every item is unique and I'm able to update it's data on the client using UID.
 
Back
Top