Ir para conteúdo

Featured Replies

Postado

gostaria de saber que alguém sabe fazer alguma função que da para adicionar ml em itens , tem que alterar essa parte do código da source .

agradeço deis de já!

int32_t LuaInterface::luaDoItemSetAttribute(lua_State* L)
{
	//doItemSetAttribute(uid, key, value)
	boost::any value;
	if(lua_isnumber(L, -1))
	{
		double tmp = popFloatNumber(L);
		if(std::floor(tmp) < tmp)
			value = tmp;
		else
			value = (int32_t)tmp;
	}
	else if(lua_isboolean(L, -1))
		value = popBoolean(L);
	else if(lua_isstring(L, -1))
		value = popString(L);
	else
	{
		lua_pop(L, 1);
		errorEx("Invalid data type");

		lua_pushboolean(L, false);
		return 1;
	}

	std::string key = popString(L);
	ScriptEnviroment* env = getEnv();

	Item* item = env->getItemByUID(popNumber(L));
	if(!item)
	{
		errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
		lua_pushboolean(L, false);
		return 1;
	}

	if(value.type() == typeid(int32_t))
	{
		if(key == "uid")
		{
			int32_t tmp = boost::any_cast<int32_t>(value);
			if(tmp < 1000 || tmp > 0xFFFF)
			{
				errorEx("Value for protected key \"uid\" must be in range of 1000 to 65535");
				lua_pushboolean(L, false);
				return 1;
			}

			item->setUniqueId(tmp);
		}
		else if(key == "aid")
			item->setActionId(boost::any_cast<int32_t>(value));
		else
			item->setAttribute(key.c_str(), boost::any_cast<int32_t>(value));
	}
	else
		item->setAttribute(key.c_str(), value);

	lua_pushboolean(L, true);
	return 1;
}

up

Editado por loreal (veja o histórico de edições)

I like

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo