Two main questions how to properly declare linkshell in last line of your code kjLotus?
Also how do I properly put in my linkshell name?
I used teotwawki's guide but used kjLotus' code in the part for lua_baseentity.cpp for lines 169-213.
My code as is in the section is this
Code: Select all
inline int32 CLuaBaseEntity::AddLinkpearl(lua_State* L)
{
    DSP_DEBUG_BREAK_IF(m_PBaseEntity->objtype == TYPE_NPC);
    const int8* linkshellName = lua_tostring(L, 1);
    const int8* Query = "SELECT name FROM linkshells WHERE name='%s'";
    int32 ret = Sql_Query(SqlHandle, Query, linkshellName);
    if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0 && Sql_NextRow(SqlHandle) == SQL_SUCCESS)
    {
        CCharEntity* PChar = (CCharEntity*)m_PBaseEntity;
        std::string qStr = ("UPDATE char_inventory SET signature='");
        qStr += linkshellName;
        qStr += "' WHERE charid = " + std::to_string(PChar->id);
        qStr += " AND itemId = 515 AND signature = ''";
        Sql_Query(SqlHandle, qStr.c_str());
        Query = "SELECT linkshellid,color FROM linkshells WHERE name='%s'";
        ret = Sql_Query(SqlHandle, Query, linkshellName);
        if (ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0 && Sql_NextRow(SqlHandle) == SQL_SUCCESS)
        {
            CItem* PItem = itemutils::GetItem(515);
            // Update item with name & color //
            int8 EncodedString[16];
            EncodeStringLinkshell((int8*)linkshellName, EncodedString);
            PItem->setSignature(EncodedString);
            ((CItemLinkshell*)PItem)->SetLSID(Sql_GetUIntData(SqlHandle, 0));
            ((CItemLinkshell*)PItem)->SetLSColor(Sql_GetIntData(SqlHandle, 1));
            uint8 invSlotID = charutils::AddItem(PChar, LOC_INVENTORY, PItem);
            // auto-equip it //
            if (invSlotID != ERROR_SLOTID)
            {
                PItem->setSubType(ITEM_LOCKED);
                PChar->equip[SLOT_LINK1] = invSlotID;
                PChar->equipLoc[SLOT_LINK1] = LOC_INVENTORY;
                linkshell::AddOnlineMember(PChar, (CItemLinkshell*)PItem);
            }
        }
    }
    return 1;
}Code: Select all
src/map/lua/lua_baseentity.cpp:207:17: error: ‘linkshell’ has not been declared
                 linkshell::AddOnlineMember(PChar, (CItemLinkshell*)PItem);
Code: Select all
const int8* linkshellName = lua_tostring(L, 1);Any help would be greatly appreciated.
Thanks
Kosmos