Jump to content

Item2.set_attr in source


Recommended Posts

item.get_attr(i):

int item_get_attr(lua_State* L){
	LPITEM item = CQuestManager::instance().GetCurrentItem();
	if (!lua_isnumber(L, 1)){
		lua_pushnumber(L,0);
	}
	int index = (int)lua_tonumber(L, 1);
	if (index <0 || index > 6){
		lua_pushnumber(L,0);
	}
	const TPlayerItemAttribute& values = item->GetAttribute(iAttrIndex);
	lua_pushnumber(L, values.bType);
	lua_pushnumber(L, values.sType);
	return 1;
}
Link to comment
Share on other sites

  • Premium

iMer's libgame item2.get_attr() & item2.set_attr()

int tItem2::get_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!item){
        return 0;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        return 0;
    }
    TPlayerItemAttribute attr=item->GetAttribute(attr_index);
    lua::PushNumber(L,attr.bType);
    lua::PushNumber(L,attr.sValue);
    return 2;
}
int tItem2::set_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!lua::IsNumber(L,2)||!lua::IsNumber(L,3)||!item){
        lua::PushBoolean(L,0);
        return 1;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        lua::PushBoolean(L,0);
        return 1;
    }
    item->SetForceAttribute(attr_index,lua::ToNumber(L,2),lua::ToNumber(L,3));
    lua::PushBoolean(L,1);
    return 1;
}
  • Love 2
Link to comment
Share on other sites

  • 3 years later...
  • Premium
On 21/08/2014 at 10:13 PM, Denis said:

item.get_attr(i):


int item_get_attr(lua_State* L){
	LPITEM item = CQuestManager::instance().GetCurrentItem();
	if (!lua_isnumber(L, 1)){
		lua_pushnumber(L,0);
	}
	int index = (int)lua_tonumber(L, 1);
	if (index <0 || index > 6){
		lua_pushnumber(L,0);
	}
	const TPlayerItemAttribute& values = item->GetAttribute(iAttrIndex);
	lua_pushnumber(L, values.bType);
	lua_pushnumber(L, values.sType);
	return 1;
}

 

On 21/08/2014 at 10:41 PM, Zonni said:

iMer's libgame item2.get_attr() & item2.set_attr()

 


int tItem2::get_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!item){
        return 0;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        return 0;
    }
    TPlayerItemAttribute attr=item->GetAttribute(attr_index);
    lua::PushNumber(L,attr.bType);
    lua::PushNumber(L,attr.sValue);
    return 2;
}
int tItem2::set_attr(lua_State* L){
    CItem* item = CQuestManager::instance()->GetCurrentItem();
    if (!lua::IsNumber(L,1)||!lua::IsNumber(L,2)||!lua::IsNumber(L,3)||!item){
        lua::PushBoolean(L,0);
        return 1;
    }
    int attr_index = lua::ToNumber(L,1);
    if (attr_index <0 || attr_index > 6){
        lua::PushBoolean(L,0);
        return 1;
    }
    item->SetForceAttribute(attr_index,lua::ToNumber(L,2),lua::ToNumber(L,3));
    lua::PushBoolean(L,1);
    return 1;
}

 

 

Where we add this? 

if pc.get_sex() == true and npc.get_sex() == false then
	npc.purge()
end

 

Link to comment
Share on other sites

  • 8 months later...

Aveline has posted a topic which covers this, please check the following post: 

 

for brain_cells in xrange(brain):
  if brain_cells == 0:
    print("0x3703c7 Fatal error occurred. Please replace the brain.")
    break
  if brain_cells == "damaged":
    print("0x3703c7 Error occurred. Please repair damaged brain_cells")
    break
  
  print("brain_cells are at 100% capacity.")

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.