lua/wrappers/game/lua_store.cpp
/**
	 * Attempts to buy the item from the store using the purse from the buyer character.
	 *
	 * @param am.character buyer The character buying the item.
	 * @param am.item item The item to buy.
	 * @param number [1.0] value_factor A multiplier that affects the cost of the item.
	 * @returns am.return_code Return codes for the purchase:
	 * <table class='return_codes'>
	 *  <tr><td>success</td><td>The item was bought.</td></tr>
	 *  <tr><td>nil_parameter</td><td>The buyer or item was nil.</td></tr>
	 *  <tr><td>no_store_owner</td><td>Cannot buy the item with no store owner.</td></tr>
	 *  <tr><td>no_inventories</td><td>Could not find the item in the store because there are no inventories.</td></tr>
	 *  <tr><td>item_not_in_inventory</td><td>Could not find the item in the store inventories.</td></tr>
	 *  <tr><td>not_enough_coin</td><td>Buyer does not have enough coin to buy the item.</td></tr>
	 * </table>
	 */
Attempts to buy the item from the store using the purse from the buyer character.
@param am.character buyer The character buying the item.
Attempts to buy the item from the store using the purse from the buyer character . @param am . character buyer The character buying the item .
int Store_buy(lua_State *lua)
	{
		Store *store = castUData<Store>(lua, 1);
		if (store)
		{
			Character *obj = castUData<Character>(lua, 2);
			Item *item = castUData<Item>(lua, 3);
			if (obj && item)
			{
				float factor = 1.0f;
				if (lua_isnum(lua, 4))
				{
					factor = lua_tonumber(lua, 4);
				}
				lua_pushinteger(lua, store->buyItem(obj, item, factor));
				return 1;
			}
			return LuaState::expectedArgs(lua, "buy", "am.character buyer, am.item item, number [1.0] value_factor");
		}
		return LuaState::expectedContext(lua, "buy", "am.store");
	}
int Store_buy ( lua_State * lua ) { Store * store = castUData < Store > ( lua , 1 ) ; if ( store ) { Character * obj = castUData < Character > ( lua , 2 ) ; Item * item = castUData < Item > ( lua , 3 ) ; if ( obj && item ) { float factor = 1.0f ; if ( lua_isnum ( lua , 4 ) ) { factor = lua_tonumber ( lua , 4 ) ; } lua_pushinteger ( lua , store -> buyItem ( obj , item , factor ) ) ; return 1 ; } return LuaState :: expectedArgs ( lua , " " , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Attempts to buy the item from the store using the purse from the buyer character.
Attempts to buy the item from the store using the purse from the buyer character .