• 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 0.X Check runes

jestem pro

That is the question
Joined
Apr 20, 2013
Messages
650
Solutions
14
Reaction score
87
Hello, I wanna check, in an upgrade system, does the destination item is "rune".

But this function doesnt work for me:

Lua:
if isItemRune(itemEx.itemid) then
// next code

I don't have any idea.

Or I check the specific rune and it doesnt work too:

Lua:
if getItemNameById(itemEx.itemid) == 2260 then
 
is
Code:
getItemInfo(itemEx.itemid).type == ITEM_TYPE_RUNE

or now add in your lib/functions.lua
Code:
function isItemRune(itemid)
return (getItemInfo(itemid).type == ITEM_TYPE_RUNE)
end
and use isItemRune now xd
 
is
Code:
getItemInfo(itemEx.itemid).type == ITEM_TYPE_RUNE

or now add in your lib/functions.lua
Code:
function isItemRune(itemid)
return (getItemInfo(itemid).type == ITEM_TYPE_RUNE)
end
and use isItemRune now xd
doesnt work my friend.

its 0.4 version
 
Here is the possible properties to check for with getItemInfo.
C++:
int32_t LuaInterface::luaGetItemInfo(lua_State* L)
{
    //getItemInfo(itemid)
    const ItemType* item;
    if(!(item = Item::items.getElement(popNumber(L))))
    {
        lua_pushboolean(L, false);
        return 1;
    }

    lua_newtable(L);
    setFieldBool(L, "stopTime", item->stopTime);
    setFieldBool(L, "showCount", item->showCount);
    setFieldBool(L, "stackable", item->stackable);
    setFieldBool(L, "showDuration", item->showDuration);
    setFieldBool(L, "showCharges", item->showCharges);
    setFieldBool(L, "showAttributes", item->showAttributes);
    setFieldBool(L, "distRead", item->allowDistRead);
    setFieldBool(L, "readable", item->canReadText);
    setFieldBool(L, "writable", item->canWriteText);
    setFieldBool(L, "forceSerialize", item->forceSerialize);
    setFieldBool(L, "vertical", item->isVertical);
    setFieldBool(L, "horizontal", item->isHorizontal);
    setFieldBool(L, "hangable", item->isHangable);
    setFieldBool(L, "usable", item->useable);
    setFieldBool(L, "movable", item->moveable);
    setFieldBool(L, "pickupable", item->pickupable);
    setFieldBool(L, "rotable", item->rotable);
    setFieldBool(L, "replacable", item->replaceable);
    setFieldBool(L, "hasHeight", item->hasHeight);
    setFieldBool(L, "blockSolid", item->blockSolid);
    setFieldBool(L, "blockPickupable", item->blockPickupable);
    setFieldBool(L, "blockProjectile", item->blockProjectile);
    setFieldBool(L, "blockPathing", item->blockPathFind);
    setFieldBool(L, "allowPickupable", item->allowPickupable);
    setFieldBool(L, "alwaysOnTop", item->alwaysOnTop);

    createTable(L, "floorChange");
    for(int32_t i = CHANGE_FIRST; i <= CHANGE_LAST; ++i)
    {
        lua_pushnumber(L, i);
        lua_pushboolean(L, item->floorChange[i - 1]);
        pushTable(L);
    }

    pushTable(L);
    setField(L, "magicEffect", (int32_t)item->magicEffect);
    setField(L, "fluidSource", (int32_t)item->fluidSource);
    setField(L, "weaponType", (int32_t)item->weaponType);
    setField(L, "bedPartnerDirection", (int32_t)item->bedPartnerDir);
    setField(L, "ammoAction", (int32_t)item->ammoAction);
    setField(L, "combatType", (int32_t)item->combatType);
    setField(L, "corpseType", (int32_t)item->corpseType);
    setField(L, "shootType", (int32_t)item->shootType);
    setField(L, "ammoType", (int32_t)item->ammoType);

    createTable(L, "transformUseTo");
    setField(L, "female", item->transformUseTo[PLAYERSEX_FEMALE]);
    setField(L, "male", item->transformUseTo[PLAYERSEX_MALE]);

    pushTable(L);
    setField(L, "transformToFree", item->transformToFree);
    setField(L, "transformEquipTo", item->transformEquipTo);
    setField(L, "transformDeEquipTo", item->transformDeEquipTo);
    setField(L, "clientId", item->clientId);
    setField(L, "maxItems", item->maxItems);
    setField(L, "slotPosition", item->slotPosition);
    setField(L, "wieldPosition", item->wieldPosition);
    setField(L, "speed", item->speed);
    setField(L, "maxTextLength", item->maxTextLen);
    setField(L, "writeOnceItemId", item->writeOnceItemId);
    setField(L, "attack", item->attack);
    setField(L, "extraAttack", item->extraAttack);
    setField(L, "defense", item->defense);
    setField(L, "extraDefense", item->extraDefense);
    setField(L, "armor", item->armor);
    setField(L, "breakChance", item->breakChance);
    setField(L, "hitChance", item->hitChance);
    setField(L, "maxHitChance", item->maxHitChance);
    setField(L, "runeLevel", item->runeLevel);
    setField(L, "runeMagicLevel", item->runeMagLevel);
    setField(L, "lightLevel", item->lightLevel);
    setField(L, "lightColor", item->lightColor);
    setField(L, "decayTo", item->decayTo);
    setField(L, "rotateTo", item->rotateTo);
    setField(L, "alwaysOnTopOrder", item->alwaysOnTopOrder);
    setField(L, "shootRange", item->shootRange);
    setField(L, "charges", item->charges);
    setField(L, "decayTime", item->decayTime);
    setField(L, "attackSpeed", item->attackSpeed);
    setField(L, "wieldInfo", item->wieldInfo);
    setField(L, "minRequiredLevel", item->minReqLevel);
    setField(L, "minRequiredMagicLevel", item->minReqMagicLevel);
    setField(L, "worth", item->worth);
    setField(L, "levelDoor", item->levelDoor);
    setField(L, "name", item->name.c_str());
    setField(L, "plural", item->pluralName.c_str());
    setField(L, "article", item->article.c_str());
    setField(L, "description", item->description.c_str());
    setField(L, "runeSpellName", item->runeSpellName.c_str());
    setField(L, "vocationString", item->vocationString.c_str());

    createTable(L, "abilities");
    setFieldBool(L, "manaShield", item->abilities.manaShield);
    setFieldBool(L, "invisible", item->abilities.invisible);
    setFieldBool(L, "regeneration", item->abilities.regeneration);
    setFieldBool(L, "preventLoss", item->abilities.preventLoss);
    setFieldBool(L, "preventDrop", item->abilities.preventDrop);
    setField(L, "elementType", (int32_t)item->abilities.elementType);
    setField(L, "elementDamage", item->abilities.elementDamage);
    setField(L, "speed", item->abilities.speed);
    setField(L, "healthGain", item->abilities.healthGain);
    setField(L, "healthTicks", item->abilities.healthTicks);
    setField(L, "manaGain", item->abilities.manaGain);
    setField(L, "manaTicks", item->abilities.manaTicks);
    setField(L, "conditionSuppressions", item->abilities.conditionSuppressions);

    //TODO: absorb, increment, reflect, skills, skillsPercent, stats, statsPercent

    pushTable(L);
    setField(L, "group", (int32_t)item->group);
    setField(L, "type", (int32_t)item->type);
    setFieldFloat(L, "weight", item->weight);
    return 1;
}
 
Back
Top