Postado Junho 10, 2014 11 anos aqui tá a lista completa: int32_t LuaScriptInterface::luaGetItemAttribute(lua_State *L) //by Kratos { //getItemAttr(uid, val) std::string attr = popString(L); uint32_t uid = popNumber(L); ScriptEnviroment* env = getScriptEnv(); Item* item = env->getItemByUID(uid); if(!item) { reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND)); lua_pushboolean(L, false); return 1; } ///////////////////////////////////// string: if(attr == "name") { lua_pushstring(L, item->getName().c_str()); return 1; } if(attr == "pluralname") { lua_pushstring(L, item->getPluralName().c_str()); return 1; } if(attr == "specialdescr") { lua_pushstring(L, item->getSpecialDescription().c_str()); return 1; } if(attr == "text") { lua_pushstring(L, item->getText().c_str()); return 1; } if(attr == "writer") { lua_pushstring(L, item->getWriter().c_str()); return 1; } ///////////////////////////////////// int: if(attr == "itemid") { lua_pushnumber(L, item->getID()); return 1; } if(attr == "aid") { lua_pushnumber(L, item->getActionId()); return 1; } if(attr == "uid") { lua_pushnumber(L, item->getUniqueId()); return 1; } if(attr == "charges") { lua_pushnumber(L, item->getCharges()); return 1; } if(attr == "fluidtype") { lua_pushnumber(L, item->getFluidType()); return 1; } if(attr == "duration") { lua_pushnumber(L, item->getDuration()); return 1; } if(attr == "dduration") { lua_pushnumber(L, item->getDefaultDuration()); return 1; } if(attr == "throw_range") { lua_pushnumber(L, item->getThrowRange()); return 1; } if(attr == "shoot_range") { lua_pushnumber(L, item->getShootRange()); return 1; } if(attr == "atk") { lua_pushnumber(L, item->getAttack()); return 1; } if(attr == "arm") { lua_pushnumber(L, item->getArmor()); return 1; } if(attr == "def") { lua_pushnumber(L, item->getDefense()); return 1; } if(attr == "slot_position") { if(item->getSlotPosition() & SLOTP_NECKLACE) lua_pushnumber(L,1); if(item->getSlotPosition() & SLOTP_HEAD) lua_pushnumber(L,2); if(item->getSlotPosition() & SLOTP_BACKPACK) lua_pushnumber(L,3); if(item->getSlotPosition() & SLOTP_LEFT) lua_pushnumber(L,4); if(item->getSlotPosition() & SLOTP_ARMOR) lua_pushnumber(L,5); if(item->getSlotPosition() & SLOTP_RIGHT) lua_pushnumber(L,6); if(item->getSlotPosition() & SLOTP_RING) lua_pushnumber(L,7); if(item->getSlotPosition() & SLOTP_LEGS) lua_pushnumber(L,8); if(item->getSlotPosition() & SLOTP_AMMO) lua_pushnumber(L,9); if(item->getSlotPosition() & SLOTP_FEET) lua_pushnumber(L,10); return 1; } if(attr == "hitchance") { lua_pushnumber(L, item->getHitChance()); return 1; } if(attr == "maxwritelen") { lua_pushnumber(L, item->getMaxWriteLength()); return 1; } if(attr == "count") { lua_pushnumber(L, item->getItemCount()); return 1; } ///////////////////////////////////////////// boolean: if(attr == "ispushable") { lua_pushboolean(L, item->isPushable()); return 1; } if(attr == "isreadable") { lua_pushboolean(L, item->isReadable()); return 1; } if(attr == "iscanwritetext") { lua_pushboolean(L, item->canWriteText()); return 1; } if(attr == "isblocking") { lua_pushboolean(L, item->isBlocking()); return 1; } if(attr == "isstackable") { lua_pushboolean(L, item->isStackable()); return 1; } if(attr == "isrune") { lua_pushboolean(L, item->isRune()); return 1; } if(attr == "isfluidcont") { lua_pushboolean(L, item->isFluidContainer()); return 1; } if(attr == "isalwaysontop") { lua_pushboolean(L, item->isAlwaysOnTop()); return 1; } if(attr == "isgroundtile") { lua_pushboolean(L, item->isGroundTile()); return 1; } if(attr == "issplash") { lua_pushboolean(L, item->isSplash()); return 1; } if(attr == "ismagicfield") { lua_pushboolean(L, item->isMagicField()); return 1; } if(attr == "isnotmoveable") { lua_pushboolean(L, item->isNotMoveable()); return 1; } if(attr == "ispickupable") { lua_pushboolean(L, item->isPickupable()); return 1; } if(attr == "isweapon") { lua_pushboolean(L, item->isWeapon()); return 1; } if(attr == "isrotateable") { lua_pushboolean(L, item->isRoteable()); return 1; } if(attr == "isdoor") { lua_pushboolean(L, item->isDoor()); return 1; } if(attr == "isbed") { lua_pushboolean(L, item->isBed()); return 1; } if(attr == "iskey") { lua_pushboolean(L, item->isKey()); return 1; } std::cout << "[LuaScriptInterface::luaGetItemAttribute]: invalid item attribute." << std::endl; } int32_t LuaScriptInterface::luaSetItemAttribute(lua_State *L) //by Kratos { //setItemAttr(uid, "attr", val) uint32_t intval = popNumber(L); std::string attr = popString(L); ScriptEnviroment* env = getScriptEnv(); Item* item = env->getItemByUID(popNumber(L)); if(!item) { reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND)); lua_pushboolean(L, false); return 1; } //////////////////////////////////// int: if(attr == "aid") { item->setActionId(intval); return 1; } if(attr == "uid") { item->setUniqueId(intval); return 1; } if(attr == "fluidtype") { item->setFluidType(intval); return 1; } if(attr == "duration") { item->setDuration(intval); return 1; } if(attr == "dduration") { item->setDefaultDuration(); return 1; } if(attr == "itemcount") { item->setItemCount(intval); return 1; } std::cout << "[LuaScriptInterface::luaSetItemAttribute]: invalid item attribute." << std::endl; return 1; } Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Junho 10, 2014 11 anos Autor Eu devo ta fazendo alguma coisa errada, eu tentei: doItemSetAttribute(itemEx.uid, 'arm', 10) Mas não deu resultado. Estou fazendo algo de errado?
Postado Junho 10, 2014 11 anos isso varia de versão pra versão... tenta 'armor', tenta colocar entre aspas "arm" e tenta usar sem aspas: arm. Dps tenta dnv usando "armor" e armor. Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá! "Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda (obg ao @Beeny por fazer essa linda sign <3)
Postado Junho 10, 2014 11 anos Autor Éh, deu certo. Eu tentei : doItemSetAttribute(itemEx.uid, 'armor', 10) E funcionou. Mas o que eu realmente queria era algo que desse HP. Algo como maxhitpoints ou maxhealthpoints. Tentei e não deu certo. É uma pena, mas valeu pela ajuda. REP+
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.