Hi guys,
Could someone help me convert this command to the latest version of rathena?
Index: src/map/script.c
/* ===============================================================
* +-> [Carlos H]
* -> getstorageitem(<item_id>,<quant>{,"<name>"});
--------------------------------------------------------------- */
BUILDIN_FUNC(getstorageitem){
TBL_PC * sd = ((script_hasdata(st,4)) ? map_nick2sd(script_getstr(st,4)):script_rid2sd(st));
struct script_data* data;
struct item_data * item_data;
struct item item_tmp;
int nameid = 0, amount = script_getnum(st,3),x = 0;
data = script_getdata(st,2);
get_val(st,data);
if( data_isstring(data) ){
const char * nameitem = conv_str(st,data);
if( (item_data = itemdb_searchname(nameitem)) != NULL )
nameid = item_data->nameid;
}else if( (item_data = itemdb_exists(conv_num(st,data))) != NULL )
nameid = item_data->nameid;
if( nameid && sd ){
sd->state.storage_flag = 1;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = nameid;
item_tmp.identify = 1;
if( !itemdb_isstackable2(item_data) && amount )
for( ; x < amount; x++ )
storage_additem(sd,&item_tmp,amount);
else
storage_additem(sd,&item_tmp,amount);
storage_storageclose(sd);
script_pushint(st,amount);
}else
script_pushint(st,0);
return 0;
}
Index: src/map/storage.c
int storage_additem(struct map_session_data* sd, struct item* item_data, int amount)
Index: src/map/storage.h
int storage_additem(struct map_session_data* sd, struct item* item_data, int amount);
Sorry my bad English.
Thank you.