/inherit/item.c(1) /inherit/item.c(1) DDEESSCCRRIIPPTTIIOONN //iinnhheerriitt//iitteemm..cc is the base object for all items. `Item' is any non-living object that player can carry or interact with. Excluding players, monsters and rooms, most object fall into this category. IINNHHEERRIITTEEDD /inherit/item.c inherits //iinnhheerriitt//bbaassee..cc VVAARRIIAABBLLEESS _i_n_t _x_d_i_m_, _y_d_i_m_, _z_d_i_m These variables describe the physical size of an object. For the sake of simplicity these variables define the smallest bbooxx the item can fit in. The order of these (width, height, depth) is not impor­ tant. _i_n_t _w_e_i_g_h_t Weight defines the weight of an item in ggrraammss.. Objects without weight cannot be created. _s_t_r_i_n_g _s_m_e_l_l_, _s_t_r_i_n_g _t_a_s_t_e_, _s_t_r_i_n_g _l_i_s_t_e_n Instead of items being just visual, smell, taste and possible sounds can be defined into them to make them more unique. These aren't mandatory but it's recommended to include them in your items. _i_n_t _h_p_, _i_n_t _m_a_x_h_p These define the condition of an item. Every time the item is damaged, hitpoints are reduced and when they reach zero the item is useless and beyond repair. _i_n_t _n_o___g_e_t If no_get is 1, the item cannot be taken or moved by players. 0 is the default. _i_n_t _l_i_g_h_t `light' describes the amount of light item emits. It can vary from -2 to +2. -2 and +2 are magical lights while -1 to +1 are mundane. One should use set_light() function for defining this variable. _m_a_p_p_i_n_g _m_a_t_e_r_i_a_l_s This defines the materials the item is created MAJIK INHERITABLES 1 /inherit/item.c(1) /inherit/item.c(1) from. This variable shouldn't be accessed directly, but through the set_material() function described below. Every item should have a material. _m_a_p_p_i_n_g _p_r_o_p_e_r_t_i_e_s This defines the special properties of an item, for example stat bonuses when held. This should be also accessed through set_property() function. FFUUNNCCTTIIOONNSS _i_n_t _g_e_t_(_o_b_j_e_c_t _t_a_r_g_e_t_) get() is meant for moving items. It checks whether the item can be moved and updates light levels accordingly. _i_n_t _q_u_e_r_y___v_a_l_u_e_(_) query_value() tries to approximate the value of an item from weight and material of an item. _v_o_i_d _w_e_a_r_(_) Every time when item is worn, the wear() function is called. Normally this isn't defined, but you may create special effects (emotes, ...) with this function. _v_o_i_d _u_n_w_e_a_r_(_) unwear() is called when player removes an item. It behaves exactly like wear(). _m_i_x_e_d _s_e_t___m_a_t_e_r_i_a_l_(_s_t_r_i_n_g _m_a_t_e_r_i_a_l _| _m_a_p_p_i_n_g _m_a_t_e_r_i_a_l_s_) One must define the material for each object. The set_material() works in two ways. First, you can just give the name of the material, and the item will be made from that material only. TTHHOOBB-->>sseett__mmaatteerriiaall((""wwoooodd""));; Second, you can give mapping as an argument when you want your item to be consisted from several materials. TTHHOOBB-->>sseett__mmaatteerriiaall(( (([[ wwoooodd :: 9900,, iirroonn :: 1100 ]])) ));; would set item to be 90% wood and 10% iron. MAJIK INHERITABLES 2 /inherit/item.c(1) /inherit/item.c(1) _s_t_r_i_n_g _q_u_e_r_y___c_o_n_d_(_) query_cond() returns the verbal approximation from the condition of an item. The condition string is dependent on the per cent of hitpoints left. _s_t_r_i_n_g _q_u_e_r_y___w_e_i_g_h_t_s_t_r_(_) query_weightstr() returns the verbal approximation for the weight of an item. _i_n_t _q_u_e_r_y___l_o_n_g_e_s_t___d_i_m_(_) This function returns the longest dimension of an object, for example the length of a sword. _i_n_t _q_u_e_r_y___v_o_l_u_m_e_(_) query_volume() returns approximation of total vol­ ume needed by an item to be stored in a container. _s_t_r_i_n_g _i_d_e_n_t_i_f_y_(_) identify() returns special and detailed information about item, including exact weight and approxima­ tion of item's properties and materials. _i_n_t _s_e_t___l_i_g_h_t_(_i_n_t _l_i_g_h_t_l_e_v_e_l_) set_light() defines the light level of an object (see variable `light' above). MAJIK INHERITABLES 3