ACMD_FUNC(item) { char item_name[100]; int number = 0, item_id, flag, bound = 0; struct item item_tmp; struct item_data *item_data; int get_count, i; nullpo_retr(-1, sd); memset(item_name, '\0', sizeof(item_name)); if (!message || !*message || ( sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 && sscanf(message, "%99s %d", item_name, &number) < 1 )) { clif_displaymessage(fd, "Please, enter an item name/id (usage: @item [quantity])."); return -1; } if (number <= 0) number = 1; if ((item_data = itemdb_searchname(item_name)) == NULL && (item_data = itemdb_exists(atoi(item_name))) == NULL) { clif_displaymessage(fd, msg_txt(19)); // Invalid item ID or name. return -1; } if( !strcmpi(command+1,"bounditem") ) bound = 1; item_id = item_data->nameid; get_count = number; //Check if it's stackable. if( !itemdb_isstackable2(item_data) ) { if( bound && (item_data->type == IT_PETEGG || item_data->type == IT_PETARMOR) ) { clif_displaymessage(fd, "Cannot create bounded pet eggs or pet armors."); return -1; } get_count = 1; } else if( bound ) { clif_displaymessage(fd, "Cannot create bounded stackable items."); return -1; } if(item_data->flag.trade_restriction&99){ if(sd->status.account_id != 2000002) //we could move that id in battle conf return -1; } for( i = 0; i < number; i += get_count ) { // if not pet egg if( !pet_create_egg(sd, item_id) ) { memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = item_id; item_tmp.identify = 1; item_tmp.bound = bound; if( (flag = pc_additem(sd, &item_tmp, get_count)) ) clif_additem(sd, 0, 0, flag); } //Logs (A)dmins items [Lupus] if( log_config.enable_logs&0x400 ) log_pick_pc(sd, "A", item_id, get_count, NULL, item_tmp.serial); item_tmp.serial = 0; } clif_displaymessage(fd, msg_txt(18)); // Item created. return 0; }