/** * Wrapper and actualiser to add an item copy. Does not return. * * @param MEMBER The member performing the action * @param string The name of the item * @param integer The cost of the item copy * @param BINARY Whether the item is finite. */ function add_item_wrap_copy($member_id, $name, $cost, $not_infinite) { if ($not_infinite != 1) { $not_infinite = 0; } if (!($cost > 0)) { $cost = 0; } // Get $realm,$x,$y from $member_id list($realm, $x, $y) = get_loc_details($member_id); if (!has_specific_permission($member_id, 'administer_ocworld') && $GLOBALS['SITE_DB']->query_value('w_realms', 'owner', array('id' => $realm)) != $member_id && $GLOBALS['SITE_DB']->query_value('w_realms', 'r_private', array('id' => $realm)) == 1) { ocw_refresh_with_message(do_lang_tempcode('W_NO_EDIT_ACCESS_PRIVATE_REALM'), 'warn'); } if (!has_specific_permission($member_id, 'administer_ocworld') && $GLOBALS['SITE_DB']->query_value('w_itemdef', 'owner', array('name' => $name)) != $member_id && $GLOBALS['SITE_DB']->query_value('w_itemdef', 'replicateable', array('name' => $name)) == 0) { ocw_refresh_with_message(do_lang_tempcode('ACCESS_DENIED__I_ERROR', $GLOBALS['FORUM_DRIVER']->get_username(get_member())), 'warn'); } // Make sure that they aren't in the brig and adding a bribable! $bribable = $GLOBALS['SITE_DB']->query_value('w_itemdef', 'bribable', array('name' => $name)); if ($x == 0 && $y == 2 && $bribable == 1) { ocw_refresh_with_message(do_lang_tempcode('W_NICE_TRY'), 'warn'); } // Charge them if (!has_specific_permission($member_id, 'administer_ocworld')) { $price = get_price('mud_item_copy'); if (available_points($member_id) < $price) { ocw_refresh_with_message(do_lang_tempcode('W_EXPENSIVE', integer_format($price)), 'warn'); } require_code('points2'); charge_member($member_id, $price, do_lang('W_MADE_OCWORLD', $name)); } add_item_to_room($realm, $x, $y, $name, $not_infinite, $cost, $member_id); ocw_refresh_with_message(do_lang_tempcode('W_MADE_ITEM_COPY_AT', escape_html($name))); }
/** * The actualiser for a member to drop an item in the room they are in. * * @param MEMBER The member dropping the item * @param string The name of the item */ function drop($member_id, $item_name) { // Is the item held by the user if (!item_held($member_id, $item_name)) { ocw_refresh_with_message(do_lang_tempcode('ACCESS_DENIED__I_ERROR', $GLOBALS['FORUM_DRIVER']->get_username(get_member())), 'warn'); } // Load $realm, $x and $y for $member_id list($realm, $x, $y) = get_loc_details($member_id); add_item_to_room($realm, $x, $y, $item_name, 1, 0, $member_id); remove_item_person($member_id, $item_name); }